TITLE: Computing the Jordan Form of a Matrix
QUESTION [12 upvotes]: I apologize if this has already been answered, but I've seen multiple examples of how to compute Jordan Canonical Forms of a matrix, and I still don't really get it. Could someone help me out with this?
What I know for certain is that I must start off by finding my eigenvalues, and corresponding eigenvectors. OR, (how it was taught in class from my understanding), I can simply plug in the eigenvalues into my original matrix and find the rank. I have no clue what to do from there though... I also know that my Jordan Normal Forms should look like these:
$$\begin{pmatrix}
\lambda_1 & 0 & 0\\
0 & \lambda_2 & 0\\
0 & 0 & \lambda_3\\
\end{pmatrix}$$
or 
$$\begin{pmatrix}
\lambda_1 & 1 & 0\\
0 & \lambda_1 & 0\\
0 & 0 & \lambda_2\\
\end{pmatrix}$$
And if we switch 1 and 2, then the 1 will be on the other side of the top. Lastly, 
$$\begin{pmatrix}
\lambda & 1 & 0\\
0 & \lambda & 1\\
0 & 0 & \lambda\\
\end{pmatrix}$$
I've seen from many sources that if given a matrix J (specifically 3x3) that is our Jordan normal form, and we have our matrix A, then there is some P such that $PAP^{-1}=J$.
Here's an example matrix if I could possibly get an explanation on how this works through an example:
$$\begin{pmatrix}
-7 & 8 & 2\\
-4 & 5 & 1\\
-23 & 21 & 7\\
\end{pmatrix}$$

I don't know how to fill the information in the middle. For instance, what do I do after I find the rank of my matrix or what do I do once I find my rank? Sorry if I made mistakes, very tired, and please try to make this as coherent as possible, because I'm so confused. This is an Advanced Linear Algebra course. Any help is greatly appreciated!

REPLY [4 votes]: If you are not interested in computing $P$, then the Jordan form can be computed by using this: 

The number of Jordan blocks with diagonal entry as $\lambda$ is the geometric multiplicity of $\lambda$. 
The number of Jordan blocks of order $k$ with diagonal entry $\lambda$ is given by $rank(A-\lambda I)^{k-1}-2\, rank(A-\lambda I)^k + rank(A-\lambda I)^{k+1}.$ 

Here, the geometric multiplicities of $\lambda =1,2$ are each $1.$ And $1$ has algebraic multiplicity $1$ where as of $2$ the algebraic multiplicity is $2.$ So, using the condition (1) only, we see that there is a Jordan block of order $1$ with $\lambda=1$ and one Jordan block with $\lambda=2.$. So, the Jordan form is as computed above. (of course, upto a permutation of the Jordan blocks.)