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?
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.