Solution 1:

Take the function $f$ defined as $f(x,y)=x+y$, and take the functions $g_1,g_2$ which are both piecewise linear functions that interpolate the following points:

  • For $g_1$, the points are: $g_1(-1)=0, g_1(0)=3, g_1(1)=0$. Outside $[-1,1]$, the value of $g_1$ is $0$.
  • For $g_2$, the points are: $g_2(-1)=0, g_2(0)=1, g_2(1)=0, g_2(9)=0,g_2(10)=2,g_2(11)=0$. Outside of $[-1,11]$, the value of $g_2$ is $0$.

Clearly, $f(g_1(x), g_2(x))$ has a maximum at $x=0$, since the expression has a value of $4$ at $x=0$, and is smaller everywhere else.


However, if we define $F(x)=f(g_1(x-100), g_2(x))$, then

  1. $F(0)=f(g_1(100), g_2(0))=g_1(100)+g_2(0)=1$
  2. $F(10)=f(g_1(-90), g_2(10))=g_1(-90)+g_2(10)=2$

which means that $F$ does not have a maximum at $x=0$, because $F(10)>F(0)$.