TITLE: A "wrong" counterexample to splitting lemma in linear algebra
QUESTION [5 upvotes]: I have a "wrong" counterexample to the following statement in linear algebra but I don't see why it's wrong: let $T:V\to W$ be a linear map between vector spaces. Then, $V$ is the direct sum of $\textrm{im}(T)$ and $\ker(T)$.
Let $V$ be the space of polynomials over a field with degree less than or equal to n, and let $T \colon V \to V$ be the differential operator. Then $\textrm{im}(T)$ is the space of polynomials with degree less than or equal to $n-1$, and $\ker(T)$ is the base field. Their direct sum is a proper subspace of $V$.

REPLY [4 votes]: The statement of the theorem should be the following: let $T \colon V \to V$ be a linear transformation such that $\textrm{ker}(T) \cap \textrm{im}(T) = 0$, then
$$
V = \textrm{ker}(T) \oplus \textrm{im}(T).
$$
As mentioned in the comments above, this theorem does not directly apply to the given linear transformation $T \colon V \to V$, because the subspaces $\textrm{ker}(T)$ and $\textrm{im}(T)$ intersect nontrivially (their intersection is the constants). 
However, it is true that $V$ is isomorphic to $U \oplus W$ as vector spaces, where $U \simeq \textrm{ker}(T)$ and $W = \textrm{im}(T)$. The isomorphism is not equality, in the sense that $V$ is not the direct sum of the subspaces $\textrm{ker}(T) \subset V$ and $\textrm{im}(T)$.

REPLY [2 votes]: I think everyone else is reading your question backwards. You believe that a statement about direct sums is true, but you've written down what you know to be a counterexample to it. You want to know what is wrong with your counterexample.
However, the counterexample is correct, because the statement is wrong. First, as was pointed out in the comments, the statement $V$ is the direct sum of $\text{im}(T)$ and $\ker(T)$ doesn't even make sense unless $V = W$.  
But even for this, as your counterexample shows, the statement is not true.
What is true is the following: $V$ is the direct sum of $\ker(T)$ and a subspace $V'$ which is mapped isomorphically to $\text{Im}(T)$ via $T$, i.e. $T|_V'$ is an isomorphism to $\text{Im}(T)$.