Let $e$ and $f$ be elements of an associative algebra $A$. We say $e$ and $f$ are associated if there exist elements $x, y \in A$ such that: $$e = xy, f = yx.$$
My teacher said it is an easy exercise to show that the following is true: $$Ae \cong Af,$$ as left $A-$modules.
I have started by defining the map: $$ae \mapsto af.$$ The problem I have is showing that this map is injective as a module homomorphism, and in showing that the map is a surjective module homomorphism, I have not use the fact that the idempotents are associated, so I think that it is necessary here.
Any help is appreciated.
First remark: in general it is false that $Ae\simeq Af$ if $e=xy$ and $f=yx$. Take for example $A$ to be the ring of $2\times 2$ matrices, then $$x=\begin{pmatrix} 0 & 1\\ 0 & 0\end{pmatrix},y=\begin{pmatrix} 0 & 0\\ 0 & 1\end{pmatrix}.$$ This gives $e=xy=x\not=0$ and $f=yx=0$.
However, in your title you wrote "idempotents" so I presume that you wanted $e$ and $f$ to satisfy $e^2=e$, $f^2=f$.
Second remark: even in this case, the map that you defined is not necessarily well-defined. Take for example $A$ as before and $$x=\begin{pmatrix} 0 & 1\\ 0 & 0\end{pmatrix},y=\begin{pmatrix} 0 & 0\\ 1 & 0\end{pmatrix}.$$ This gives $e=xy=\begin{pmatrix} 1 & 0\\ 0 & 0\end{pmatrix}$ and $f=yx=\begin{pmatrix} 0 & 0\\ 0 & 1\end{pmatrix}$. And the two matrices do not have the same kernel.
Now, let us come to the proof of the fact hat $Ae\simeq Af$ if $e=xy$, $f=yx$, AND if $e^2=e$, $f^2=f$. Note that $e=xyxy=xfy$ and $f=yxyx=yex$. We define two maps
$$\begin{array}{rccc} \psi \colon& Ae&\to& Af\\ &ae &\mapsto & axf \end{array}$$ $$\begin{array}{rccc} \phi \colon& Af&\to& Ae\\ &af &\mapsto & aye \end{array}$$
If $a,a'\in A$ are such that $ae=a'e$, then $0=(a-a')e=(a-a')xy$, which implies that $0=(a-a')xyx=(a-a')xf$, so $axf=a'xf$. Hence, $\psi$ is well-defined. The same argument gives you that $\phi$ is well defined, and you can also compute that both maps are inverse from each other, and homomorphisms of $A$-modules.
For instance, $\phi(\psi(ae))=\phi(axf)=axye=ae^2=ae$.