# A Functional Equation from the 2012 IMO

Here's Problem 4 from the 2012 IMO:

Find all functions $f:\mathbb Z\to\mathbb Z$ such that, for all integers $a$, $b$, $c$ with $a+b+c=0$ the following equality holds:

$f^{2}(a)+f^{2}(b)+f^{2}(c)=2f(a)f(b)+2f(b)f(c)+2f(c)f(a).$

Here $\mathbb Z$ is the set of all integers.

### Solution

The problem is reasonably standard. Setting first $a = b = c = 0$, we get

$3f^{2}(0)=6f^{2}(0),$

implying $f(0)=0$.

Next, let say $c=0$, so that $b=-a$: $f^{2}(a)+f^{2}(-a)=2f(a)f(-a)$. In other words,

$(f(a) - f(-a))^{2}=0$,

so that $f(a)=f(-a)$, making $f$ an even function. Using that and setting $a=b=1$ and $c=-2$ gives

$2f^{2}(1) + f^{2}(2)=4f(2)f(1) + 2f^{2}(1)$,

which is equivalent to

$f(2)(f(2)-4f(1))=0$.

Thus one of the two: either $f(2)=0$ or $f(2)=4f(1)$. We'll have to consider the two cases separately.

Note that we can safely assume that $f(1)\ne 0$, for $f(0)=0$ would imply that $f$ is identically $0$, which is an obvious solution. To see that, take successively $a=b=1$, $c=2$ which gives $f(2)=0$, and then $a=1$, $b=2$, $c=3$, to obtain $f(3)=0$, and so on.

### Case 1: $f(2)=0$

Clearly also $f(4)=0$ and $f(6)=0$, and so on. More generally, $f(2n)=0$, for all $n\in \mathbb Z$. This gives a good reason to suspect that this is an indication that $f$ is periodic. Let's check:

$f^{2}(a+2)+f^{2}(a)+f^{2}(2)=2f(a+2)f(a)+2f(a)f(2)+2f(a+2)f(2)$.

But, since $f(2)=0$, this reduces to

$f^{2}(a+2)+f^{2}(a)=2f(a+2)f(a)$ or $(f(a+2)-f(a))^{2}=0$,

Telling us that $f$ is periodic, with period $2$. This means that $f(2n)=0$ and $f(2n+1)=k=\mbox{const}$, for all $n\in \mathbb Z$.

### Case 2: $f(2)=4f(1)$

Let's see what comes next:

$f^{2}(3)+f^{2}(2)+f^{2}(1)=2f(3)f(2)+2(f(2)f(1)+2f(1)f(3)$.

This simplifies to

$f^{2}(3)-10f(3)f(1)+9f^{2}(1)=0$.

This quadratic equation yields two solutions: $f(3)=9f(1)$ or $f(3)=f(1)$. Again, we are forced to consider two cases separately:

### Case 2.1: $f(3)=9f(1)$

We'll prove by induction that, for all $n\in \mathbb Z$, $f(n)=n^{2}f(1)$. We already saw that this is true for $n=1,2,3$. Assuming this is true for $n=m$,

$f^{2}(m+1)+f^{2}(m)+f^{2}(1)=2f(m+1)f(m)+2f(m)f(1)+2f(1)f(m+1)$.

By the inductive assumption, this reduces to

\begin{align} f^{2}(m+1)+(m^{4}+1)f^{2}(1) &= 2f(m+1)m^{2}f(1)+2m^{2}f^{2}(1)+2f(1)f(m+1)\\ &=2m^{2}f^{2}(1)+2f(m+1)f(1)(m^{2}+1). \end{align}

And, in turn, to

$f^{2}(m+1)-2(m^{2}+1)f(m+1)f(1)+(m^{2}-1)^{2}f^{2}(1) = 0.$

Strangely enough, solving this quadratic equation leads to $f(m+1)=(m\pm 1)^{2}f(1)$.

### Case 2.1.1: $f(m+1)=(m+1)^{2}f(1)$

The "$+$" sign confirms the expected result. It is easily checked that $f(n)=n^{2}f(1)$ serves a solution to the given equation.

### Case 2.1.2: $f(m+1)=(m-1)^{2}f(1)$

This case turns up rather surprisingly. We started with the sequence $f(1)$, $f(2)=2^{2}f(1)$, $f(3)=3^{2}f(1)$, but along the way there emerged a possibility that for some $m$ $f(m+1)=(m-1)^{2}f(1)$. Assuming this to be the case, let $k\gt 2$ be the least such number. Then in particular,

\begin{align} f(k-1)&=(k-1)^{2}f(1) \\ f(k+1)&=(k-1)^{2}f(1) \end{align}

Substituting this into

$f^{2}(k-1)+f^{2}(k+1)+f^{2}(2)=2f(k-1)f(k+1)+2f(k+1)f(2)+2f(2)f(k-1)$

and dropping the common factor $f^{2}(1)$, gives

$(k-1)^{4} + (k-1)^{4} + 4^{2} = 2(k-1)^{2}(k-1)^{2} + 2\cdot 4\cdot (k-1)^{2} + 2\cdot 4\cdot (k-1)^{2},$

which simplifies to

$1 = (k-1)^{2}.$

This equation has two solutions: $k=0$ and $k=2$, neither of which fits the Case 2.1 requirement $k\gt 2$. Thus this pass does not lead to a solution of the problem.

### Case 2.2: $f(3)=f(1)$

Let's find $f(4)$ in this case:

$f^{2}(4)+f^{2}(3)+f^{2}(1)=2f(4)f(3)+2f(3)f(1)+2f(1)f(4)$,

or,

$f^{2}(4)+2f^{2}(1)=2f(4)f(1)+2f^{2}(1)+2f(1)f(4)$,

which is the same as

$f(4)(f(4)-4f(1))=0$,

so that either $f(4)=0$ or $f(4)=4f(1)$. Two cases again:

### Case 2.2.1: $f(4)=0$

Repeating Case 1, we see that $f$ is periodic with period $4$. The values $f(1),f(2),f(3),f(4)$ are $f(1), 4f(1), f(1), 0$, respectively, and these are repeated.

### Case 2.2.2: $f(4)=4f(1)$

Since also $f(2)=4f(1)$, $f(4)=f(2)$. But then,

$f^{2}(4)+f^{2}(2)+f^{2}(2)=2f(4)f(2)+2f(2)f(2)+2f(2)f(4)$

simplifies to

$3f^{2}(2)=6f(2)f(2)$

implying $f(2)=0$, which is Case 1.

Summing up, there are three kinds of solutions:

1. $f(2n)=0$, $f(2n+1)=C,$
2. $f(n)=n^{2}C,$
3. $f(4n+1)=f(4n+3)=C$, $f(4n+2)=4C$, $f(4n)=0$,

where $C$ is an arbitrary (integer) constant, $n\in \mathbb Z$.