$f(xf(y)-f(x))=2f(x)+xy$ This is my problem "Find $f:\mathbb{R}\to \mathbb{R}$ s.t. $f(xf(y)-f(x))=2f(x)+xy$ ". I'm not so good at functional equation so all I did until now is subtituting $x,y$ by $1,0$ and I couldn't even calculate a value.
One other approach is that I find 1 solution $f=-x+1$. So I let $g=f+x-1$ and try to prove $g=0$, but subtituting that into the equation make it a mess. Help me please.
 A: This is a really tough problem, I like it very much! I tried to make it clear where I used what, but nevertheless its a bit messy. Feel free to ask if something is unclear!
Let $f$ be a solution of the equation and let $P(x,y)$ e the assertion $f(xf(y)-f(x))=2f(x)+xy$
Then
$$
P(1,y):\qquad f(f(y)-f(1))=2f(1)+y\implies f\text{ surjective}
$$
Thus let $a,b\in\mathbb{R}$ be such that $f(a)=0$ and $f(b)=1$.
$$
P(a,b):\qquad 0=f(af(b)-f(a))=ab
$$
Therefore either $a=0$ or $b=0$.
Case 1 : $a=0$
$$
P(1,1):\qquad 0=2f(1)+1\implies f(1)=-\frac12
$$
Thus if we reconsider $P(1,y)$ we obtain $f(f(y)+1/2)=y-1$. Hence
$$
P(1,f(y)+1/2):\qquad f(y-1/2)=f(f(f(y)+1/2)+1/2)=f(y)+1/2-1=f(y)-1/2
$$
and with $y=f(x)+1/2$ in the above equation:
$$
f(f(x))=f(f(x)+1/2)-1/2=x-3/2
$$
But thus $0=f(f(0))=-3/2$, contradiction.
Case 2 : $b=0$
Then again $P(1,1)$ gives $f(0)=1$. Therefore if we reconsider $P(1,y)$ we get $f(f(y))=y\tag{1}\label{1}$ and thus $f$ is bijective. Now
$$
P(x,0):\qquad f(x-f(x))=2f(x)\tag{2}\label{2}
$$
$$
P(f(x),0):\qquad f(f(x)-x)=2x\\\stackrel{f()}\implies f(x)-x\stackrel{\eqref{1}}=f(f(f(x)-x))=f(2x)\tag{3}\label{3}
$$
$$
P(f(x),1):\qquad f(-x)\stackrel{\eqref{1}}=f(-f(f(x)))\stackrel{P(f(x),1)}=2f(f(x))+f(x)\stackrel{\eqref{1}}=2x+f(x)\tag{4}\label{4}
$$
Now $f(-1)\stackrel{\eqref{4}}=2+f(1)=2$  and thus $f(2)=f(f(-1))\stackrel{\eqref{1}}=-1$. Finally we take 
$$
P(x,2):f(-x-f(x))=2f(x)+2x
$$
But $f(-x-f(x))\stackrel{\eqref{4}}=2(x+f(x))+f(x+f(x))$ and thus the above equation simplifies to $f(x+f(x))=0$. But $f$ is injective and we know already that $f(1)=0$, so
$$
x+f(x)=1\implies f(x)=1-x\qquad\forall x\in\mathbb{R}
$$
Substituting this back into the original equation we see that this is indeed a solution.
A: Fact 1: $f$ has a root. To see this, take $x \not = 0$ and $y = \frac{-2f(x)}{x}$. 
Fact 2: If $f(c) = 0$, then $c = \pm\sqrt{f(0)}$. To see this, set $x=y=c$.
Fact 3: $f(0) = \pm 1$. To see this, let $c$ be a root and set $x=c, y=0$. Then, $f(cf(0)) = 0 \implies cf(0)=\pm\sqrt{f(0)}$ but $c = \pm\sqrt{f(0)}$.
Fact 4: $f(0) = 1$. If $f(0) = -1$, then $x=y=0$ gives $f(1) = -2$. Then $x=1,y=0$ gives $f(-1-(-2))=2(-2) = -4$, a contradiction.
Fact 5: $f(-1) = 2$ and $f(1) = 0$. The first equality follows from $x=0,y=0$. The second then comes from Fact 1, Fact 2, and $f(-1)\not = 0$.
Fact 6: $f(f(x)) = x$ for all $x \in \mathbb{R}$. This follows from setting $x=1$.
Fact 7: $f(-a) = 2a+f(a)$ for all $a \in \mathbb{R}$. This follows from $x=f(a),y=1$ and noting Fact 6 implies $f$ is surjective.
Fact 8: $f(-x-f(x)) = 2x+2f(x)$. This follows from $y=2$.
Fact 9: $f(-x-f(x)) = 2x+2f(x)+f(x+f(x))$. This follows from letting $a = x+f(x)$ in Fact 7.
Fact 10: $f(x) = -x+1$. This follows from Facts 8,9 , Fact 6 showing $f$ is injective, and Fact 5, which gives $f(1) = 0$.
A: Let's investigate first the affine solutions $x\mapsto ax+b$. The equation rewrites as
$$a(axy+bx-ax-b)+b=2ax+2b+xy\iff (a^2-1)xy+a(b-a-2)x-b(a+1)=0$$
Identifying the coefficients of the terms of the two sides of this polynomial equations we get that $x\mapsto -x+1$ is the only affine solution to the problem.
More painful but with the same method we prove that the only polynomial (power series solution) is $x\mapsto -x+1$
That's all I have for the moment
A: $$P(x,y) \implies f(xf(y)−f(x))=2f(x)+xy$$
$$P(1,y) \implies f(f(y)-f(1))=2f(1)+y \implies \text{Surjectivity}$$
Because $2f(1)+y$ can attain any real value. Then there exists a real number $a$ such that $f(a)=0$
$$P(a,a) \implies a=\pm \sqrt{f(0)}$$
$$f(xf(1)-f(x))=2f(x)+x$$
and there exists a real number $c$ such that $f(c)=1$
$$P(x,c) \implies f(x-f(x))=2f(x)+xc \tag{1}$$
Let $b \ne a \implies f(b) \ne 0$ be a real number,
$$P(x/f(b),b) \implies f(x-f(x))=2f(x)+xb/f(b) \tag{2}$$
Combining $(1)$ with $(2)$, we get
$$f(b)=b/c, \ \ \ \forall \ b \ne a, \ c \ne 0$$
Substituting that in the original equation, we get
$$xy/c^2-x/c^2=2x/c+xy$$
which implies that no such $c \ne 0$ exists 
$$\implies c=0 \implies f(0)=1 \implies a= \pm 1$$
Case 1: $a=1 \ \ (f(1)=0)$
$$P(1,y) \implies f(f(y))=y \tag{3}$$
$$P(x,1) \implies f(-f(x))=2f(x)+x $$
$$\overset{(3)}{\implies} f(-x)=2x+f(x) \tag{4}$$
$$\overset{x=1}{\implies} f(-1)=2$$
$$P(-1,x) \implies f(-f(x)-2)=4-x \overset{(3)}{\implies} f(-x-2)=4-f(x) \overset{(4)}{\implies} f(x-2)=4-2x-f(x)$$
So, by strong induction, we have for all integers $k$, 
$$f(k)=1-k$$
and to prove it we put $x=k+1$ in $f(x-2)=4-2x-f(x)$ getting
$$f(k-1)=2-2k-f(k+1) \iff f(k+1)=2-f(k-1)-2k=2-(1-(k-1))-2k=-k$$
So, it's proven. Now, let $k$ be a positive integer,
$$P(x,k) \implies f(x-xk-f(x))=2f(x)+xk$$
$$P(x,0) \implies f(x-f(x))=2f(x)$$
So, we combine the above two equations to get
$$f((x-f(x))-xk)=f(x-f(x))+xk$$
Due to the surjectivity, $x-f(x)$ can attain any real value, and so does $xk$, so we set $x-f(x)=u$ and $-xk=v$ getting
$$f(u+v)=f(u)-v \tag{5}$$
$$\implies f(xf(y)-f(x))=f(xf(y))+f(x) \overset{(3), P(x,y)}{\implies} f(xf(y))=f(x)+xy$$
$$ \overset{(3), y=f(y)}{\implies} f(xy)=f(x)+xf(y)$$
$$\overset{x \mapsto x+1}{\implies}f(xy+y)=f(x+1)+xf(y)+f(y)\overset{(5)}{\implies} f(xy)-y=f(x)-1+xf(y)+f(y)$$
$$\overset{x=1}{\implies} f(y)-y=f(1)-1+f(y)+f(y) \iff f(y)=1-y \ \ \ \Box.$$
Case 2: $a=-1$
$$P(-1,x) \implies f(-f(x))=-x$$
$$P(x,-1) \implies f(-f(x))=2f(x)-x$$
So $f(x)=0$ which doesn't work in the original equation.
