I'm currently working for my linear algebra exam and I'm really confused about the trigonalisation algorithm. For example, If I have this matrix : $$A= \begin{pmatrix} 1 & 2 & 1 \\ 0 & 3 & 1 \\ 8 & 0 & 5 \end{pmatrix} $$ I would like to find a basis, in which $A$ is upper triangular. The characteristic polynomial of this matrix is : $X_A(t)=-(t-1)^2(t-7)$. Then we have $E_1(A)=\ker(A-I_3)$ and $E_2(A)=\ker(A-7I_3)$ the two eigenspaces.
A basis for $A_1$ is $B_1=(1,1,-2)^t$ and for $A_2$ is $B_2=(1,1,4)^t$, this implies that $A$ is not diagonalizable, but we can triangularize this matrix. My question is, how can I find the third vector $B_3$ of the basis ? Can I just take an arbitary vector and check if it forms a basis ? For example $B_3=(1,4,-4)$, then $(B_1,B_2,B_3)$ is a basis of $R^3$. We have $f(B_3)=4B_2+B_3$ . Then, the matrix $A$ in this basis is : $$A= \begin{pmatrix} 7 & 0 & 0 \\ 0 & 1 & 4 \\ 0 & 0 & 1 \end{pmatrix} $$ With the corresponding base change matrix : $$P= \begin{pmatrix} 1 & 1 & 1 \\ 1 & 1 & 4 \\ 4 & -2 & -4 \end{pmatrix} $$ Is that correct the way I choose $B_3$ ? Any help would be appreciate :)