<s>[INST] How can I find the dimension of an eigenspace? I have the following square matrix 
$$ A = \begin{bmatrix} 2 & 0 & 0 \\ 6 & -1 & 0 \\ 1 & 3 &-1 \end{bmatrix} $$
I found the eigenvalues:


*

*$2$ with algebraic and geometric multiplicity $1$ and eigenvector $(1,2,7/3)$. 

*$-1$ with algebraic multiplicity $2$ and geometric multiplicity $1$; one eigenvector is $(0,0,1)$.
Thus, matrix  $A$ is not diagonizable. My questions are:


*

*How can I find the Jordan normal form? 

*How I can find the dimension of the eigenspace of eigenvalue $-1$? 

*In Sagemath, how can I find the dimension of the eigenspace of eigenvalue $-1$?
 [/INST] Most  Jordan Normal Form questions, in integers, intended to be done by hand, can be settled with the minimal polynomial. The characteristic polynomial is $\lambda^3 - 3 \lambda - 2 = (\lambda -2)(\lambda + 1)^2.$ the minimal polynomial is the same, which you can confirm by checking that $A^2 - A - 2 I \neq 0.$ Each linear factor of the characteristic polynomial must appear in the minimal polynomial, which exponent at least one, so the quadratic shown is the only possible alternative as minimal. 
Next,
$$
A+I =
\left(
\begin{array}{rrr}
3 & 0 & 0 \\
6 & 0 & 0 \\
1 & 3 & 0
\end{array}
\right)
$$
with genuine eigenvector $t(0,0,1)^T$ with convenient multiplier $t$ if desired.
$$
(A+I)^2 =
\left(
\begin{array}{rrr}
9 & 0 & 0 \\
18 & 0 & 0 \\
21 & 0 & 0
\end{array}
\right)
$$
The description I like is that we now take $w$ with $(A+I)w \neq 0$ and $(A+I)^2 w = 0.$ I choose
 $$
w =
\left(
\begin{array}{r}
0 \\
1 \\
0 
\end{array}
\right)
$$
This $w$ will be the right hand column of $P$ in $P^{-1}A P = J.$ The middle column is $$ v = (A+I)w, $$
so that $v \neq 0$ but $(A+I)v = (A+I)^2 w = 0$ and $v$ is a genuine eigenvector. You already had the $2$ eigenvector, I take a multiple to give integers. i like integers.
$$
P =
\left(
\begin{array}{rrr}
3 & 0 & 0 \\
6 & 0 & 1 \\
7 & 3 & 0
\end{array}
\right)
$$
with 
$$
P^{-1} =
\frac{1}{9}
\left(
\begin{array}{rrr}
3 & 0 & 0 \\
-7 & 0 & 3 \\
-18 & 9 & 0
\end{array}
\right)
$$
leading to
$$
\frac{1}{9}
\left(
\begin{array}{rrr}
3 & 0 & 0 \\
-7 & 0 & 3 \\
-18 & 9 & 0
\end{array}
\right)
\left(
\begin{array}{rrr}
2 & 0 & 0 \\
6 & -1 & 0 \\
1 & 3 & -1
\end{array}
\right)
\left(
\begin{array}{rrr}
3 & 0 & 0 \\
6 & 0 & 1 \\
7 & 3 & 0
\end{array}
\right) =
\left(
\begin{array}{rrr}
2 & 0 & 0 \\
0 & -1 & 1 \\
0 & 0 & -1
\end{array}
\right)
$$
It is the reverse direction $PJP^{-1} = A$ that allows us to evaluate functions of $A$ such as $e^{At},$
$$
\frac{1}{9}
\left(
\begin{array}{rrr}
3 & 0 & 0 \\
6 & 0 & 1 \\
7 & 3 & 0
\end{array}
\right) 
\left(
\begin{array}{rrr}
2 & 0 & 0 \\
0 & -1 & 1 \\
0 & 0 & -1
\end{array}
\right)
\left(
\begin{array}{rrr}
3 & 0 & 0 \\
-7 & 0 & 3 \\
-18 & 9 & 0
\end{array}
\right) =
\left(
\begin{array}{rrr}
2 & 0 & 0 \\
6 & -1 & 0 \\
1 & 3 & -1
\end{array}
\right)
$$
</s>