Let T : V → V be a linear transformation and suppose that for some v ∈ V , $T^k(v) = 0$ but $T^{k−1}(v) \neq 0$. Prove that the set $B = ${${T^{k−1}(v), . . . , T(v), v}$} is linearly independent, and its span U is T-invariant. Find the matrix of T restricted to U relative to the basis B.
I figured out set B is linearly independent.
Suppose $$av+a_1T(v)+a_2T^2(v)+...+a_{k-1}T^{k-1}(v)=0$$ If it is not linearly independent, $a_0=a_1=a_2=...=0$
and using $T^k(v)$=0 to get $T(v)=bT(v)+b_1T^2(v)...+b_{k-2}T^{k-1}(v)$ $\in$w
But how to find the matrix of T restricted to U and what does relative to the basis B mean?
Let $$a_0v+a_1T(v)+\cdots+a_{k-1} T^{k-1}(v) =0\hspace{1cm}(1)$$ Then $$a_0T(v)+a_1T^2(v)+\cdots+a_{k-2} T^{k-1}(v) =0$$ which implies $$a_0T^2(v)+a_1T^3(v)+\cdots+a_{k-3} T^{k-1}(v) =0$$ Proceeding this way in $k$ steps, we get $$a_0T^{k-1}(v)=0$$ This shows $a_0=0$.
Substituting this in $(1)$, we get $$a_1T(v)+\cdots+a_{k-1} T^{k-1}(v) =0$$
Repeating the argument as before, we get $$a_0=a_1=\cdots=a_{k-1}=0$$
This proves B is linearly independent.
Let $U=\rm{span}\ B$ and $w \in U$. Then there exists scalars $b_0,b_1,\cdots,b_{k-1}$ such that $$w=b_0v+b_1T(v)+\cdots+b_{k-1}T^{k-1}(v)$$ Therefore,$$T(w)=b_0T(v)+b_1T^2(v)+\cdots+b_{k-2}T^{k-1}(v)$$ Thus, $T(w) \in U$. This shows that $U$ is $T-$invariant.
I'll let you find the matrix yourself now.