I'm doing an exercice about Jordan matrix, and I have to write the Jordan matrix of : $$A =\begin{pmatrix} 3 & 0 & 1& 0&0 &0 &0\\ 0 & 3 & 0& 1& 0&0 &0\\ 0 & 0 & 3& 0& 1& 0&0\\ 0 & 0 & 0& 5& 0& 1&0\\ 0 & 0 & 0& 0& 5& 0&1\\ 0 & 0 & 0& 0& 0& 5&0\\ 0 & 0 & 0& 0& 0& 0&5\\ \end{pmatrix}$$ We have the following characteristic polynomial: $(\lambda -3)^3(\lambda -5)^4$ that means eigenvalues are : 3 and 5 and have respectively algebraic multiplicity 3 and 4. I find that the Jordan blocks for 5 is : $$J_5 =\begin{pmatrix} 5& 1& 0&0\\ 0& 5& 0&0\\ 0& 0& 5&1\\ 0& 0& 0&5\\ \end{pmatrix}$$ with no problem,
But now I want to determine the Jordan block of 3, so for that I found the geometric multiplicity which is : $dim(ker(A-3I_7)) = 2$ so we have two possibilities :
$J_3 =\begin{pmatrix} 3 & 1 & 0\\ 0 & 3 & 0\\ 0 & 0 & 3 \\ \end{pmatrix}$ or $J_3 =\begin{pmatrix} 3 & 0 & 0\\ 0 & 3 & 1\\ 0 & 0 & 3 \\ \end{pmatrix}$
S0 my question is how to know which one is correct? Thank you
Whenever you have block upper triangular matrix $\begin{bmatrix} T_1 & T_{12}\\ 0 & T_2 \end{bmatrix}$, where $\lambda(T_1)\cap\lambda(T_2)=\emptyset$, you can get rid off $T_{12}$ by similarity transformation. It is called Block Diagonal Decomposition.
You can check using the following algorithm:
For your example:
Output will be $A =\begin{bmatrix} 3 & 0 & 1& 0&0 &0 &0\\ 0 & 3 & 0& 0& 0&0 &0\\ 0 & 0 & 3& 0& 0& 0&0\\ 0 & 0 & 0& 5& 0& 1&0\\ 0 & 0 & 0& 0& 5& 0&1\\ 0 & 0 & 0& 0& 0& 5&0\\ 0 & 0 & 0& 0& 0& 0&5\\ \end{bmatrix}$
Now you have two separate blocks to deal with. And remember that Jordan Canonical Form is not unique, however it is unique up to permutation of Jordan blocks, thus both of your two possibilities are correct.