My teacher gave me this functional equation as an excercise $$f(x+f(y))=x+f(f(y))\,\, \forall\,\, x,y \in \mathbb{R}$$ If $f(2)=8$, calculate $f(2005)$
So my solution was
For every $y$, let $f(y)=c$ and $f(f(y))=d$ (just for simplicity)
Then $$f(x+c)=x+d$$ Replacing $x=k-c\,\forall k\in \mathbb{R}$
Then $$\begin{align*}f(k)&=k-c+d\\f(2)&=2-c+d=8\\d-c&=6\\f(x)&=x+6\\f(2005)&=2011\end{align*}$$ But I was doubting there was a flaw in my reasoning, and after showing my teacher my solution I doubted it even more(He was not so sure about it). After some thought I came up with a more formal proof that would be $$\begin{align*}f(x+f(y))&=x+f(f(y))\\f(n+x+f(y))&=n+x+f(f(y))\\f(n+x+f(y))-f(x+f(y))&=n\end{align*}$$ Setting $x=2-f(y)$, $n=2003$
$$\begin{align*}f(2003+2)-f(2)=2003\\f(2005)=2011\end{align*}$$ The question is: was there something wrong about the first proof?
Your approach is fine.
Another approach: I want to simplify the equations to get rid of $f$s where possible, so I've got to make the argument equal to $2$. So immediately substitute $y = 2$ to get \[f(x + f(2)) = x + f(f(2)),\] and use $f(2) = 8$ to get \[f(x + 8) = x + f(8),\] and substitute $z = x + 8$ to get \[f(z) = z - 8 + f(8)\]
Now I can compute $f$ of anything in terms of $f(8)$. But that's no good because I don't know what $f(8)$ is. However, I can compute $f(2)$ in terms of $f(8)$, and I already know $f(2)$, so maybe that will help! \[f(2) = -6 + f(8)\]
In other words $f(8) = f(2) + 6$, so $f(8) = 14$, so $f(x) = x + 6$.