# minimal polynomial irreducible polynomial in $F[t]$ if the only $T$-invariant subspaces are $0$ and $V$

This is my first post so excuse me for lack of proper formatting.

I tried to prove it by contradiction thus assuming the minimal polynomial is reducible, the primary decomposition theorem gives us a proper invariant subspace contradicting the given assumption.

So I reduced the problem to the case where minimal is $$g(t)^m$$ where $$g(t)$$ is irreducible. I showed that image of $$g(t)$$ is contained in $$\ker(g^m-1 (T))$$ but im stuck here and dont know how to proceed or if that even helps.

Suppose the minimal polynomial factors as $$p(t)q(t)$$. We then have $$p(T)(q(T)(x))=0$$ for all $$x$$ in the overall space $$V$$, so the image of $$q(T)$$ is contained in the kernel of $$p(T)$$.
Now, consider the space $$X=\{x: p(T)(x)=0\}$$, the kernel of $$p(T)$$. This kernel is an invariant subspace; $$0=T(p(T)(x))=p(T)(Tx)$$.
If $$X$$ is all of $$V$$, then $$p(T)$$ is identically zero. This means that the minimal polynomial $$pq$$ of $$T$$ must divide $$p$$, and thus $$q$$ is a constant.
If $$X=\{0\}$$, then since the image of $$q(T)$$ is contained in $$X$$, $$q(T)$$ is identically zero. This means that the minimal polynomial $$pq$$ of $$T$$ must divide $$q$$, and thus $$p$$ is a constant.
By hypothesis, those are the only two options. If $$0$$ and $$V$$ are the only invariant subspaces, any factorization of the minimal polynomial must be trivial with one of the factors constant, and the minimal polynomial is therefore irreducible.