find the Jordan basis of a matrix I'm trying to find the Jordan basis of the matrix $$A =\begin{bmatrix} 8 & 1 & 2 \\ -3 & 4 & -2\\ -3 & -1 & 3\end{bmatrix}$$ I've got the characteristic equation to be $CA(x) = (5-x)^3$ and hence the eigenvalue to be $5$. I started by finding $v_1$ such that $(A-5I)v_1=0$ and chose $v_1 = \begin{bmatrix} 1 \\ -3 \\ 0\end{bmatrix}$. I then tried to find a $v_2$ such that $(A-5I)^2v_2 = 0$ but $(A-5I)^2$ is the zero matrix so can $v_2$ be any vector in $\mathbb{R}^3$?
More generally, when trying to find a Jordan basis for a matrix $A$, what do you do when $(A-\lambda I)^i=0$ for some $i$? Also what do you do when there is no solution to $(A-\lambda I)^iv_i = 0$ for a particular $i$?

The eigenspace $E_5$ has dimension $2$ (so the Jordan form of the matrix will have $2$ Jordan blocks) since 
$$A-5I=\begin{bmatrix}
3&1&2\\-3&-1&-2\\-3&-1&-2\end{bmatrix}
$$
and it is defined by the single equation $\;3x+y+2z=0$. 
You should attack the problem backwards: begin with choosing a vector $v_3=(x,y,z)$, 
 in $\ker(A-5I)^2\smallsetminus E_5=\mathbf R^3\smallsetminus E_5$, i.e. such that
$$3x+y+2z\ne 0,\enspace \text{say }\enspace v_3=(1,0,-1),$$
and set $\;(A-5I)v_3=v_2=(1,-1,-1)$ ; $v_2$ belongs to the eigenspace $E_5$. 
Last  you have to complete $v_2$ with another vector $v_1$ in the eigenspace which is linearly independent from $v_2$. The vector you've found – $v_1=(1,-3,0)$ is fine. In the basis $\mathcal B=(v_1,v_2,v_3)$ the matrix of $A$ becomes by construction:
$$J=\begin{bmatrix}
5&0&0\\0&5&1\\0&0&5\end{bmatrix}. $$
