Find all functions $f(f(f(...(f(x_1,x_2),x_3),...),x_{2016}))=x_1+x_2+...+x_{2016}$

Considering the outer most iteration (the one with $x_{2016}$), we obviously have $f(x,y) = g(x)+y$ for some function $g$, so:

$\begin{align*}x_1+x_2+\ldots+x_{2015}+x_{2016}&= f(f(f(\ldots f(x_1,x_2),\ldots,x_{2016}) \\ &= g(g(\ldots g(x_1)+x_2 \ldots )+x_{2015})+x_{2016} \\ \implies x_1+x_2+\ldots +x_{2015}\qquad \quad\,&=g(g(\ldots g(x_1)+x_2 \ldots )+x_{2015}) \end{align*}$

Setting $x_1 = \dots = x_{2014} =0$ and $c:=g(\ldots g(x_1)+x_2 \ldots ) = g(\ldots g(0)+0 \ldots )$ we get

$y = g(c+y)\;\forall y$

We subsitute $y$ with $t-c$ and get

$t-c = g(t)\;\forall t \qquad (*)$

Pluggin this equation back in the original results in

$\begin{align*}x_1+x_2+\ldots+x_{2016} &= f(f(f(\ldots f(x_1,x_2),\ldots,x_{2016}) \\ &\overset{(*)}{=} (x_1-c)+(x_2-c)+\ldots+(x_{2015}-c)+x_{2016} \\ &= x_1+x_2+\ldots +x_{2016} - 2015c\end{align*}$

Therefore $c=0$ and so $g(t) = t$. And this implies $f(x,y)=x+y \;\forall x,y$.


So lets assume $f$ is a real function an

$$f(f(f(\ldots f(f(x_1,x_2),x_3)\ldots),x_{2016})= x_1+x_2+\ldots + x_{2016} \tag{1}$$

We now apply

$$f(.,x_{2017}) \tag{2}$$

on the LHS and RHS of $(1)$ and we get

$$f( f(f(f(\ldots f(f(x_1,x_2),x_3)\ldots),x_{2016}) ,x_{2017}) = f(x_1+x_2+\ldots + x_{2016},x_{2017}) \tag{3}$$

If we change the variable names in $(1)$ , $x_{i}$ by $x_{i+1}$, we get

$$f(f(f(\ldots f(f(x_2,x_3),x_4)\ldots),x_{2017})= x_2+x_3+\ldots + x_{2017} \tag{4}$$

In $(4)$ now we substitute $x_2$ by $f(x_1,x_2)$ and get

$$f(f(f(\ldots f(f( f(x_1,x_2) ,x_3),x_4)\ldots),x_{2017})= f(x_1,x_2) +x_3+\ldots + x_{2017} \tag{5}$$

The LHS of $(3)$ and $(5)$ are the same. So the RHS of $(3)$ and $(5)$ must be equal and we get

$$f(x_1+x_2+\ldots + x_{2016},x_{2017}) = f(x_1,x_2) +x_3+\ldots + x_{2017} \tag{6}$$

Here we set $x_1=0$, $x_2=0$, ..., $x_{2015}=0$ and get

$$f(x_{2016},x_{2017})=f(0,0)+x_{2016}+x_{2017} \tag{7}$$

We can use $(7)$ to evaluate the nested function expression of the LHS of $(1)$. You can start with the outer or with the inner expression. Finally you will get

$$f( f(f(f(\ldots f(f(x_1,x_2),x_3)\ldots),x_{2016}) ,x_{2017})= 2015 f(0,0)+x_1+x_2+x_3+\cdots+x_{2016} \tag{8}$$

The RHS of $(1)$ and $(8)$ are equal, so ist must be

$$2015f(0,0)=0 \tag{9}$$

From $(9)$ and $(7)$ we see that

$$f(x,y)=x+y \tag{10}$$

as expected.