Proving a function to be a difference I am concerned with a function $f:\mathbb{R}\times\mathbb{R}\rightarrow \mathbb{R}$ such that
$$f(f(x_1,x_2),f(x_3,x_2))=f(x_1,x_3)$$
for any $x_1,x_2,x_3\in \mathbb{R}$, and
$$f(x,0)=x$$
$$f(x,x)=0$$
for any $x\in\mathbb{R}$.
For example, such a function is $f(x_1,x_2)=x_1-x_2$. To what extent is it possible to reduce $f$ to the latter form?
 A: Carrying on from @AWashburn’s post:
$$f(x_1,x_2)=ax_1+bx_2+c\ \implies \\ a^2x_1+(ab+b^2)x_2+abx_3+(a+b+1)c\ =\ ax_1+bx_3+c$$
Comparing coefficients gives
$$\begin{array}{rcl} a^2 &=& a \\ ab+b^2 &=& 0 \\ ab &=& b \\ (a+b+1)c &=& c \end{array}$$
The first equation gives $a=0$ or $a=1$; the second gives $b=0$ or $a+b=0$ $\implies$ $b=-a=0\ \text{or}\ -\!1$. We have the following:


*

*If $b=0$ then $(a+b+1)c=(a+1)c=c$ $\implies$ $a=1,c=0$ or $a=0,c=\ \text{any value}$. Hence $f(x_1,x_2)=x_1$ or $f(x_1,x_2)=c$ (constant).

*If $b=-1$ then $(a+b+1)c=ac=c$ $\implies$ $a=c=0$ (impossible since $ab=b\ne0$) or $a=1,c=\ \text{any value}$. Hence $f(x_1,x_2)=x_1-x_2+c$.
Hence, if $f$ is linear, the only possibilities are $$\boxed{f(x_1,x_2)=c}$$ or $$\boxed{f(x_1,x_2)=x_1}$$ or $$\boxed{f(x_1,x_2)=x_1-x_2+c}$$
Of course if $f$ is not linear there may be other solutions. Since this question is tagged as “linear-transformations” it is presumed that a linear solution is required.
A: Another solution is
$$
f(x_1, x_2) = x_1
$$
then
$$
f(f(x_1, x_2), f(x_3, x_2)) = f(x_1, x_3)
$$
A: It seems to me that there are a lot of functions that fulfill that requirement (if you don't include the assumption that they are linear) like $f(x_1,x_2) = \frac{x_1}{x_2}$.
If you assume it is linear then you can just plug in $f(x_1,x_2) = ax_1 + bx_2 + c$ and you get
$a^2x_1 +(ab+b^2)x_2 + abx_3 + (a+b+1)c = ax_1 + bx_3 + c$
From here you can see that there are many different choices for $a$,$b$,and $c$ that will give you the type of linear function you want.
