If $f:A\rightarrow A$ is an $R$-module homomorphism such that $ff=f$, show that $$A=\ker f\oplus{\rm im}~f$$
Here is a part of what I made as a proof.
Let $a\in A$. $f(a)\in{\rm im}~f$, $f(a)\in A$ since $f$ is from $A$ to $A$, $a-f(a) \in A$ since $A$ is a module.
Consider $f(a-f(a))$. Since $f$ is a module homomorphism, $$f(a-f(a))=f(a)-ff(a)=f(a)-f(a)=0,$$ therefore $a-f(a)\in\ker f$. We have $a-f(a)\in\ker f$ and $f(a)\in{\rm im}~f$. $$(a-f(a))+f(a)=a-f(a)+f(a)=a$$ So $a\in A$ can be written as the sum of an element in $\ker f$ and an element in ${\rm im}~f$ and since $\ker f$ and ${\rm im}~f$ are submodules of $A$, we have $$A=\ker f+{\rm im}~f.$$
I was also able to show that the intersection of $\ker f$ and ${\rm im}~f$ is $\{0\}$.
I showed this proof to one of my senior and he said that what I actually did in my proof was show that $A$ is the Internal Direct Sum of $\ker f$ and ${\rm im}~f$.
Looking back at the problem, what is asked is to prove that $A$ is the External Direct Sum of $\ker f$ and ${\rm im}~f$.
I got the internal and external direct sum wrong but I understand them now. Now how would I go on proving the problem?
Here are some of my questions/ideas:
Since I'm trying to prove that $A$ is an external direct sum may I assume that $A=X\oplus Y$ where $X$ and $Y$ are modules? Then try to prove that that $\ker f=X$ and ${\rm im}~f=Y$? Also, if $A$ is the external direct product of $\ker f$ and ${\rm im}~f$ then that means that an element in $A$ is of the form $(x,y)$ where $x\in\ker f$ and $y\in{\rm im}~f$ right? Does that mean that I have to define $f$ in $X$ and $Y$?
Is it possible to salvage my proof above? When does the internal direct sum equal to the external direct sum? I know that it is always the case that the two are isomorphic. If I remember correctly in groups it is possible for the internal direct product and the external direct product to be equal.
I hope you guys could clarify some things to me and point me in the right direction. Thank you!
Summary
The internal direct sum is a relationship between submodules of a module that mirrors the external direct product. These two notions, in a sense, subsume each other.
Details
The (external) direct sum of two modules joins them into a single module while keeping copies of the original two modules which don't overlap.
So for example, if $A$ and $B$ are modules, then $A\oplus B$ is $A\times B$ with the usual module structure. Notice this module has two submodules $\bar{A}=A\times\{0\}$ and $\bar{B}=\{0\}\times B$ isomorphic to $A$ and $B$ respectively. Notice also that $\bar{A}+\bar{B}=A\times B$ and $\bar{A}\cap \bar{B}=\{0\}\times\{0\}$.
"Internal direct sums" are kind of like the inverse of that problem. Given a module $M$, are there submodules $A,B$ which only meet at $0$ and $A+B=M$? In this way, external direct sums can be though of as a type of product, and finding internal direct sums is just "factoring" with that product.
How they are interrelated
The external direct sum $A\oplus B$ of $A$ and $B$ is an internal direct sum of $\bar{A}$ and $\bar{B}$. In that sense, external direct sums are internal direct sums.
In the other direction, if $N$ and $N'$ are submodules of a module $M$ such that $N+N'=M$ and $N\cap N'=\{0\}$, then you can prove that $N\times N'$ with the direct sum module structure is isomorphic to $M$ via the mapping $(n,n')\mapsto n+n'$. Notice how the mapping lines up the submodule $N\times\{0\}\subseteq N\times N'$ with $N\subseteq M$ and likewise for $N'$. In this sense, internal direct sums as external direct sums.
I don't mean to say they are identical ideas, because they are obviously not. What I mean to say is that an internal direct sum is just a reflection of an external direct sum interpreted inside a module.
Your situation
Really, I think your proof is fine, and I'm not sure your teacher is actually looking for you to distinguish it as an external direct sum. But if you want to, you can: just form the external direct sum of the modules $\ker(f)$ and ${\rm im}(f)$, and map $A$ into this direct sum by sending $a\mapsto (a-f(a),f(a))\in\ker(f)\times{\rm im}(f)$, explaining that this is an isomorphism.