Computing the Jordan Form of a Matrix 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!

 A: 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.)      
A: Step 1: find eigenvalues. $\chi_A(\lambda) = \det(A-\lambda I) = -\lambda^3+5\lambda^2-8\lambda+4 = -(\lambda-1)(\lambda-2)^2$. We are lucky, all eigenvalues are real.
Step 2: for each eigenvalue $\lambda_\imath$, find rank of $A-\lambda_\imath I$ (or, rather, nullity, $\dim(\ker(A-\lambda_\imath I))$) and kernel itself. For $\lambda=1$:
$$A-\lambda I = \pmatrix{-8 && 8 && 2 \\ -4 && 4 && 1 \\ -23 && 21 && 6}, \ker(A-\lambda I) = L(\pmatrix{3 \\ 1 \\ 8})$$
($L(v_1, v_2, ..., v_n)$ denotes the linear hull of vectors, the set of all their linear combinations.) Algebraic multiplicity of the root is 1, geometric multiplicity is 1, we're done here. For $\lambda=2$:
$$A-\lambda I = \pmatrix{-9 && 8 && 2 \\ -4 && 3 && 1 \\ -23 && 21 && 5}, \ker(A-\lambda I) = L(\pmatrix{2 \\ 1 \\ 5})$$
Algebraic multiplicity of the root is 2, geometric multiplicity is 1. We're unlucky, now we have to solve
$$(A-\lambda I)v=\pmatrix{2 \\ 1 \\ 5} \sim v  = \pmatrix{0 \\ 0 \\ 1}$$
Step 3: our matrix in basis $(\pmatrix{3 \\ 1 \\ 8},\pmatrix{2 \\ 1 \\ 5},\pmatrix{0 \\ 0 \\ 1})$ has form $J_A = \pmatrix{1 && 0 && 0 \\ 0 && 2 && 1 \\ 0 && 0  && 2}$. Matrix $P$ corresponding to this basis change is $\pmatrix{3 && 2 && 0 \\ 1 && 1 && 0 \\ 8 && 5 && 1}$, i.e. $P^{-1}AP=J_A$.
Note: If you have a root of algebraic multiplicity 3, but there's only one eigenvector $v_1$, then you seek $v_2:(A−λI)v_2=v_1$ and then $v_3:(A−λI)v_3=v_2$ (note the index!). But when the nullity of $A−λI$ is greater than 1 (and less than algebraic multiplicity), things get a bit tricky. You have to find maximal $k : (A−λI)^k≠0$, then find vector(s) $v_k:(A−λI)^k v_k=0,\,(A−λI)^{k−1}v_k≠0$ (chain generators) and then proceed $v_{k−1}=(A−λI)v_k,v_{k−2}=(A−λI)v_{k−1},...$ up to an eigenvector $v_1$ (see "Jordan chains").
