A wrong proof that the kernel and image are always complementary Let $E$ be a vector space, $f\colon E\rightarrow E$ an endomorphism. Let $A=\ker(f)\oplus \operatorname{im}(f)$; that is $$A=\{x\in E\;|\; \text{there exists a unique}\; (a,b)\in \ker(f)\times\operatorname{im}(f), x=a+b\}.$$ I have a proof that $A=E$ which clearly need not be true, but i don't see what went wrong in my proof. thanks for your help!
Proof $A$ is obviously a subspace of $E$. Moreover  $$\dim(A)=\dim(\ker(f)\oplus \operatorname{im}(f))=\dim(\ker(f)+\dim(\operatorname{im}(f))$$ hence by the rank nullity theorem $$\dim(A)=\dim(E)$$ hence $$A=E.$$

The direct sum of two subspaces of $E$ is an abstract vector space that has a canonical map to $E$, but that map can fail to be injective, and it will precisely when the two subspaces have non-zero intersection. So your mistake is in assuming that the direct sum is a subspace of $E$.
More precisely, if $W_1,W_2$ are subspaces of $E$, then there is $W_1+W_2$, the sum of the two subspaces, which is by definition the subset of $E$ consisting of all sums $w_1+w_2$ with $w_1\in W_1$ and $w_2\in W_2$. This is a subspace of $E$. Then there is the direct sum, $W_1\oplus W_2$, which is, by definition, the set $W_1\times W_2$ with scalar multiplication done component-wise. There is a linear map $W_1\oplus W_2\rightarrow E$ given by $(w_1,w_2)\mapsto w_1+w_2$, so the image is $W_1+W_2\subseteq E$, but there could be a kernel. Namely, if $w$ is a non-zero element of $W_1\cap W_2$, then $(w,-w)\in W_1\oplus W_2$ is non-zero and maps to $w-w=0$. Conversely, if $(w_1,w_2)\mapsto 0$, then $w_1=-w_2\in W_1\cap W_2$. So the induced surjective linear map $W_1\oplus W_2\rightarrow W_1+W_2$ will be an isomorphism if and only if $W_1\cap W_2=\{0\}$.
