# $3^{\mathrm{RD}}$ European MathematiCal CuP $6^{\text {th }}$ December 2014-14 $4^{\text {th }}$ December 2014
Junior Category ## Problems and Solutions Problem 1. Which of the following claims are true, and which of them are false? If a fact is true you should prove it, if it isn't, find a counterexample. a) Let $a, b, c$ be real numbers such that $a^{2013}+b^{2013}+c^{2013}=0$. Then $a^{2014}+b^{2014}+c^{2014}=0$. b) Let $a, b, c$ be real numbers such that $a^{2014}+b^{2014}+c^{2014}=0$. Then $a^{2015}+b^{2015}+c^{2015}=0$. c) Let $a, b, c$ be real numbers such that $a^{2013}+b^{2013}+c^{2013}=0$ and $a^{2015}+b^{2015}+c^{2015}=0$. Then $a^{2014}+b^{2014}+c^{2014}=0$ (Matko Ljulj) Solution. Firstly, we know that for every real number $x, x^{2} \geqslant 0$ holds. The key idea in this problem is to realize that the expression $a^{2014}+b^{2014}+c^{2014}$ is a sum of squares (which are nonnegative numbers). Thus $a^{2014}+b^{2014}+c^{2014}=0 \Longleftrightarrow a=b=c=0$. a) NO: It is sufficient to find three real numbers whose sum equals 0 , and then take their $2013^{\text {th }}$ roots. For example: $a=\sqrt[2013]{1}, b=\sqrt[2013]{2}, c=\sqrt[2013]{-3}$ b) YES: From the key idea we conclude $a=b=c=0$, and then we conclude $a^{2015}+b^{2015}+c^{2015}=0+0+0=0$. c) NO: Again we have to find a counterexample, for instance $a=1, b=0, c=-1$. Problem 2. In each vertex of a regular $n$-gon $A_{1} A_{2} \ldots A_{n}$ there is a unique pawn. In each step it is allowed: 1. to move all pawns one step in the clockwise direction or 2. to swap the pawns at vertices $A_{1}$ and $A_{2}$. Prove that by a finite series of such steps it is possible to swap the pawns at vertices: a) $A_{i}$ and $A_{i+1}$ for any $1 \leqslant iy^{n+1} $$ Another proof: Inequality is equivalent to $$ \left(\frac{x}{y}\right)^{n}>y $$ The fact follows from the fact that the expression on the left hand side is increasing and it is unbounded, while the right hand side is fixed. Fact 6: For all prime numbers $p$ we have $f(p) \leqslant p$. Proof: Let $p_{1}, p_{2}, \ldots, p_{n}, \ldots$ be the increasing sequence $2,3,5,7, \ldots$ of all prime numbers. Let's take arbitrary prime number $p_{n}$. From the Fact 3 we have that $f\left(p_{n}\right)$ is also a prime. Let's take positive integer $n_{0}$ as the integer from the Fact 5, for positive integers $y=p_{n}n$ ) is not in the set $\{1,2, \ldots, N\}$. Let us now observe all positive integers which are $\alpha^{\text {th }}$ power of a prime and they are in the set $\{f(1), f(2), \ldots, f(N)\}$. According to Fact 4, we have that $f(n)$ is $\alpha^{\text {th }}$ power of a prime if and only if $n$ is $\alpha^{\text {th }}$ power of a prime. From that and from previous paragraph we conclude that only such numbers are $f\left(p_{1}^{\alpha}\right), \ldots, f\left(p_{n}^{\alpha}\right)$. Now we have $\left\{p_{1}^{\alpha}, \ldots, p_{n}^{\alpha}\right\}=\left\{f\left(p_{1}^{\alpha}\right), \ldots, f\left(p_{n}^{\alpha}\right)\right\}$. Thus $f\left(p_{n}^{\alpha}\right) \in\left\{p_{1}^{\alpha}, \ldots, p_{n}^{\alpha}\right\}$, so $f\left(p_{n}^{\alpha}\right)=p_{i}^{\alpha}$ for some $1 \leqslant i \leqslant n$, which implies $f\left(p_{n}\right)^{\alpha}=p_{i}^{\alpha}$, for some $1 \leqslant i \leqslant n \Longrightarrow f\left(p_{n}\right)=p_{i} \leqslant p_{n}$, which completes the proof. Fact 7: For every positive integer we have $f(n)=n$. Proof: From Fact 3 we have that $f(p)$ if and only if $p$ is prime. Let $p_{1}, p_{2}, \ldots, p_{n}, \ldots$ be the increasing sequence $2,3,5,7, \ldots$ of all prime numbers. From Fact 6 we have $f\left(p_{1}\right) \leqslant p_{1} \Longrightarrow f(2)=2$. For $n \geqslant 2$, inductively and from injectivity of $f$ we have $f\left(p_{n}\right)>p_{n-1}$ and from Fact 6 we have $f\left(p_{n}\right) \leqslant p_{n}$, thus is must be $f\left(p_{n}\right)=p_{n}$, for all positive integers $n$. Now for arbitrary positive integer $n$ from Fact 4 we have $$ f(n)=f\left(p_{1}\right)^{a_{1}} f\left(p_{2}\right)^{a_{2}} \ldots f\left(p_{k}\right)^{a_{k}}=p_{1}^{a_{1}} p_{2}^{a_{2}} \ldots p_{k}^{a_{k}}=n $$ which completes our proof. Remark: We can prove Fact 6 differently (without using Fact 5). We observe numbers $1 \cdot 2 \ldots \cdot n$ and $f(1) \cdot f(2) \ldots \cdot f(n)$, and their unique factorizations. They coincide for infinitely many positive integers $n$. For fixed primes $p, q$, if we take sufficiently great $n$, we can use well-known formula for $\nu_{p}(n!)$ to prove that $\nu_{p}(n!)>\nu_{q}(n!)$ for all $q>p$ (here positive integer $n$ depends on $p, q$ ). ## $3^{\mathrm{Rd}}$ European Mathematical CuP $6^{\text {th }}$ December 2014-14 th December 2014
Senior Category ## Problems and Solutions Problem 1. Prove that there are infinitely many positive integers which can't be expressed as $a^{d(a)}+b^{d(b)}$ where $a$ and $b$ are positive integers. For positive integer a expression $d(a)$ denotes the number of positive divisors of $a$. (Borna Vukorepa) Solution. We will show that $a^{d(a)}$ is a square of an integer for every positive integer $a$. If $a$ is a square of an integer, any its power is also a square of an integer. If $a$ is not a perfect square, number of it's positive divisors is even. We can prove this by pairing divisiors of $a$ as $d$ and $\frac{a}{d}$. A divisor $d$ won't be paired with itself because that would imply $a=d^{2}$. This proves that $d(a)$ is even and hence $a^{d(a)}$ is a perfect square for every positive integer $a$. The expression in the problem is hence a sum of two squares. Every number of the form $4 t+3$ can't be written as a sum of two squares because 0 and 1 are the only quadratic residues modulo 4 , so it is impossible for a sum of two squares to give remainder 3 modulo 4 . Problem 2. Jeck and Lisa are playing a game on an $m \times n$ board, with $m, n>2$. Lisa starts by putting a knight onto the board. Then in turn Jeck and Lisa put a new piece onto the board according to the following rules: 1. Jeck puts a queen on an empty square that is two squares horizontally and one square vertically, or alternatively one square horizontally and two squares vertically, away from Lisa's last knight. 2. Lisa puts a knight on an empty square that is on the same, row, column or diagonal as Jeck's last queen. The one who is unable to put a piece on the board loses the game. For which pairs $(m, n)$ does Lisa have a winning strategy? (Stijn Cambie) Solution. We shall show that Lisa has a winning strategy if and only if $m$ and $n$ are both odd. Lisa's winning strategy Suppose the game is played on an $m \times n$ board with $m$ and $n$ both odd. Then Lisa puts her first knight in a corner and partitions the remaining squares of the board into 'dominoes'. In each turn Jeck has to put a queen in one of these dominoes and Lisa puts a knight on the other square of the domino. As the board is finite, Jeck can't keep finding new dominoes and so Lisa will win. Jeck's winning strategy Suppose the game is played on an $m \times n$ board with $m$ or $n$ even. We shall show that Jeck is able to partition the board into pairs of squares that are two squares horizontally and one square vertically, or alternatively one square horizontally and two squares vertically, away from each other. In each turn Lisa has to put a knight in one of these and Jeck puts a queen on the other square of the pair. As the board is finite, Lisa can't keep finding new pairs and so Jeck will win. Now we prove that Jeck can make the required partition. Case 1. Suppose $4 \mid m$ or $4 \mid n$. We know that any $k \times 4 l$ board $(k \geq 2)$ can be divided into $2 \times 4$ and $3 \times 4$ boards (firstly divide $k \times 4 l$ board in $l$ boards of dimensions $k \times 4$; after that every $k \times 4$ board divide in $\frac{k}{2}$ boards of dimensions $2 \times 4$, or in $\frac{k-3}{2}$ boards of dimensions $2 \times 4$ and one $3 \times 4$ board, dependently on parity of $k$ ). The following diagrams show that every $2 \times 4$ and every $3 \times 4$ board allows a required partition. ![](https://cdn.mathpix.com/cropped/2024_06_05_6daddc1b45bd681a5838g-05.jpg?height=100&width=214&top_left_y=2577&top_left_x=675) | 1 | 2 | 3 | 4 | | :--- | :--- | :--- | :--- | | 3 | 5 | 1 | 6 | | 2 | 6 | 4 | 5 | Case 2. Suppose $m, n \equiv 1,2(\bmod 4)$. Any $(5+4 k) \times(6+4 l)$ board can be divided into a $5 \times 6$ board, a $4 k \times 6$ board, a $5 \times 4 l$ board and a $4 k \times 4 l$ board. The following diagram shows that a $5 \times 6$ board allows a required partition. | 1 | 2 | 14 | 13 | 12 | 11 | | :---: | :---: | :---: | :---: | :---: | :---: | | 3 | 4 | 12 | 11 | 14 | 15 | | 2 | 1 | 13 | 15 | 7 | 8 | | 4 | 3 | 5 | 6 | 9 | 10 | | 5 | 6 | 9 | 10 | 8 | 7 | According to case 1 a $4 k \times 6$ board, a $5 \times 4 l$ board and a $4 k \times 4 l$ board also allow a partition. Case 3. Suppose $m, n \equiv 2,3(\bmod 4)$. Any $(3+4 k) \times(6+4 l)$ board can be divided into a $3 \times 6$ board, a $4 k \times 6$ board, a $3 \times 4 l$ board and a $4 k \times 4 l$ board. The following diagram shows that a $3 \times 6$ board allows a required partition. | 1 | 2 | 3 | 4 | 7 | 8 | | :--- | :--- | :--- | :--- | :--- | :--- | | 3 | 4 | 1 | 6 | 9 | 5 | | 2 | 6 | 9 | 5 | 8 | 7 | According to case 1 a $4 k \times 6$ board, a $3 \times 4 l$ board and a $4 k \times 4 l$ board also allow a partition. Case 4. Suppose $m, n \equiv 2(\bmod 4)$. Any $(6+4 k) \times(6+4 l)$ board can be divided into a $6 \times 6$ board, a $4 k \times 6$ board, a $6 \times 4 l$ board and a $4 k \times 4 l$ board. The $6 \times 6$ board can be partitioned in two $3 \times 6$ boards, which were already solved. According to case 1 a $4 k \times 6$ board, a $6 \times 4 l$ board and a $4 k \times 4 l$ board also allow a partition. Problem 3. Let $A B C D$ be a cyclic quadrilateral with the intersection of internal angle bisectors of $\angle A B C$ and $\angle A D C$ lying on the diagonal $A C$. Let $M$ be the midpoint of $A C$. The line parallel to $B C$ that passes through $D$ intersects the line $B M$ in $E$ and the circumcircle of $A B C D$ at $F$ where $F \neq D$. Prove that $B C E F$ is a parallelogram. (Steve Dinh) Solution. We prove the problem in reverse as this is much more natural in this problem. ![](https://cdn.mathpix.com/cropped/2024_06_05_6daddc1b45bd681a5838g-06.jpg?height=797&width=968&top_left_y=1423&top_left_x=544) We note that if $B C E F$ is a parallelogram then its diagonals are bisecting each other so the point $G \equiv B E \cap C F$ should be the midpoint of $C F$. If $G$ is the midpoint of $C F$ then $\triangle G B C$ and $\triangle G E F$ are congruent as $C G=G F$ and $F E \| B C$ gives $\angle G E F=\angle G B C$ and $\angle G F E=\angle G C B$. Hence this implies $B G=G E$ and in particular $B C E F$ is a paralelogram as its diagonals bisect each other. Hence $G$ being midpoint of $C F$ is equivalent to our problem. As $M$ is the midpoint of $A C$ by the midline theorem applied to triangle $A C F$ we have $G$ is the midpoint of $C G$ if and only if $M G \| A F$. Hence we only need to prove $B M \| A F$. Now we further notice that, using $F D \| B C$, this is equivalent to $\angle A F D=\angle M B C$. We further see that $\angle A F D=\angle A B D$ as they are angles over the same chord. So our claim is equivalent to $\angle A B D=$ $\angle M B C$. We add that here depending on the relative position of $F$ on the circles we might have $\pi-\angle A F D=\angle M B C$ but then $\pi-\angle A F D=\angle A B D$ so the final conclusion still holds. We know that $\angle B D A=\angle B C M$ as they are angles over the same chord. Now this gives us that our claim is equivalent to the claim $\triangle B C M \sim \triangle B D A$. The same angle equality shows that this is equivalent to $\frac{B C}{C M}=\frac{A D}{B D}$. Using the fact $M$ is the midpoint of $A C$ we have $C M=\frac{A C}{2}$ so our claim is equivalent to $2 A D \cdot B C=B D \cdot A C$. We further have by the angle bisector theorem applied to $\triangle A B C$ and $\triangle C D A$ : $$ \frac{A B}{B C}=\frac{A I}{C I}=\frac{A D}{C D} $$ So using this our claim is equivalent to $A B \cdot C D+A D \cdot B C=B D \cdot A C$ which we can recognise to be the Ptolomeys theorem for cyclic quadrilaterals. Problem 4. Find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ such that for all $x, y \in \mathbb{R}$ the following holds: $$ f\left(x^{2}\right)+f\left(2 y^{2}\right)=(f(x+y)+f(y))(f(x-y)+f(y)) $$ (Matija Bucić) Solution. Let $P(x, y)$ be the assertion $f\left(x^{2}\right)+f\left(2 y^{2}\right)=(f(x+y)+f(y))(f(x-y)+f(y))$. $P(0, x)$ gives us $$ f(0)+f\left(2 x^{2}\right)=2 f(x)(f(x)+f(-x)) $$ and $P(0,-x)$ gives us $$ f(0)+f\left(2 x^{2}\right)=2 f(-x)(f(x)+f(-x)) $$ By combining (1) and (2) we get $$ f(x)^{2}=f(-x)^{2} $$ $P(0,0)$ gives us $2 f(0)=4 f(0)^{2}$, thus we have two cases: 1. $f(0)=\frac{1}{2}$. $P(x, 0)$ gives us $$ f\left(x^{2}\right)=\left(f(x)+\frac{1}{2}\right)^{2}-\frac{1}{2} $$ while $P(-x, 0)$ gives us $$ f\left(x^{2}\right)=\left(f(-x)+\frac{1}{2}\right)^{2}-\frac{1}{2} $$ Combining (4) and (5) and using (3) we get $$ f(x)=f(-x) $$ The assertion $P\left(x^{2}, x^{2}\right)$ can be written as $$ f\left(x^{4}\right)+f\left(2 x^{4}\right)=\left(f\left(2 x^{2}\right)+f\left(x^{2}\right)\right)\left(\frac{1}{2}+f\left(x^{2}\right)\right) $$ For an arbitrary $x \in \mathbb{R}$, let us denote $a=f(x)$. Using (4) we get: $$ \begin{aligned} & f\left(x^{2}\right)=\left(a+\frac{1}{2}\right)^{2}-\frac{1}{2} \\ & f\left(x^{4}\right)=\left(f\left(x^{2}\right)+\frac{1}{2}\right)^{2}-\frac{1}{2}=\left(a+\frac{1}{2}\right)^{4}-\frac{1}{2} \end{aligned} $$ Using (1) and (6) we get: $$ \begin{aligned} & f\left(2 x^{2}\right)=4 f(x)^{2}-\frac{1}{2}=4 a^{2}-\frac{1}{2} \\ & f\left(2 x^{4}\right)=4 f\left(x^{2}\right)^{2}-\frac{1}{2}=4\left(\left(a+\frac{1}{2}\right)^{2}-\frac{1}{2}\right)^{2}-\frac{1}{2} \end{aligned} $$ Plugging the last 4 equations in (7) we get: $$ \left(a+\frac{1}{2}\right)^{4}+4\left(\left(a+\frac{1}{2}\right)^{2}-\frac{1}{2}\right)^{2}-1=\left(4 a^{2}-1+\left(a+\frac{1}{2}\right)^{2}\right)\left(a+\frac{1}{2}\right)^{2} $$ which is equivalent to $$ \left(a+\frac{1}{2}\right)^{2}(4 a-2)=0 $$ Therefore $a= \pm \frac{1}{2}$ and $f(x)= \pm \frac{1}{2}$. Now if we use (6) in (1) we get $$ f(0)+f\left(2 x^{2}\right)=4(f(x))^{2}=1 $$ so $f\left(2 x^{2}\right)=\frac{1}{2}$ for every $x$, now using (6) we conclude $f(x)=\frac{1}{2}$ for all $x$ which is easily checked to be a solution. 2. $f(0)=0$. We immediately see using $P(x, 0)$ that $$ f\left(x^{2}\right)=f(x)^{2} $$ By comparing $P(x, y)$ and $P(x,-y)$ and using (3) we get: $$ (f(y)-f(-y))(f(x+y)+f(x-y))=0 $$ If there exists $c \in \mathbb{R}$ such that $f(c) \neq f(-c)$ we have for all $x$ $$ f(x+c)=-f(x-c) $$ Plugging in $x+c$ in $x$ here gives us: $$ f(x+2 c)=-f(x) $$ Specially, $f(2 c)=0$. Now, $P(2 c-y, y)$ : $$ \begin{aligned} f\left((2 c-y)^{2}\right)+f\left(2 y^{2}\right) & =(f(2 c)+f(y))(f(2 c-2 y)+f(y)) \\ (-f(-y))^{2}+f\left(2 y^{2}\right) & =f(y) f(2 c-2 y)+f(y)^{2} \\ f\left(2 y^{2}\right) & =f(y) f(2 c-2 y)=-f(y) f(-2 y) \end{aligned} $$ Let $S(x)$ denote the statement $(x \neq 0) \wedge(f(x)=f(-x) \neq 0)$. If there is no $d \in \mathbb{R}$ such that $S(d)$ then $f(x)=-f(-x)$ for all $x \in \mathbb{R}$. $P(0, x)$ gives us $$ f\left(2 x^{2}\right)=2 f(x)(f(x)+f(-x))=0 $$ which gives us another solution $f(x)=0$. Now, let us assume that there exists $d \in \mathbb{R}$ such that $S(d)$ holds. Obviously, $S(-d)$ holds, as well. $P(0, d)$ gives us $$ f\left(2 d^{2}\right)=4 f(d)^{2} $$ and (10) gives us $$ \begin{aligned} f\left(2 d^{2}\right) & =-f(d) f(-2 d) \\ f(-2 d) & =-4 f(d) \\ f(2 d) & =-4 f(-d)=-4 f(d)=f(-2 d) \end{aligned} $$ Therefore, $S(2 d)$ also holds. Inductively, we deduce that $S\left(2^{n} d\right)$ holds for every $n \in \mathbb{N}$. Also, $f\left(2^{n} d\right)=(-4)^{n} f(d)$, which means that $f$ is unbounded. $P(x, c)$, using the fact $f\left(x^{2}\right)=f(x)^{2}$ : $$ f(x)^{2}+f\left(2 c^{2}\right)=f(x+c) f(x-c)+f(c)(f(x+c)+f(x-c))+f(c)^{2} $$ and since $f(x+c)=-f(x-c)$ and $f\left(2 c^{2}\right)=0$ (this follows from $P(0, c)$ ) we have $$ f(x)^{2}+f(x+c)^{2}=f(c)^{2} $$ which implies that $f$ is bounded and that is contradiction. Therefore, there is no $c \in \mathbb{R}$ such that $f(c)=-f(c)$ and therefore $$ f(x)=f(-x), \quad \text { for all } x \in \mathbb{R} $$ $P(0, x)$ : $$ f\left(2 x^{2}\right)=4 f(x)^{2}=4 f\left(x^{2}\right) $$ Therefore, using (11) $$ f(2 x)=4 f(x), \quad \text { for all } x \in \mathbb{R} $$ $P(x, y)$ can now be written as follows: $$ f(x)^{2}+3 f(y)^{2}=f(y)(f(x+y)+f(x-y))+f(x+y) f(x-y) $$ and similarly, $P(y, x)$ can be written as $$ f(y)^{2}+3 f(x)^{2}=f(x)(f(x+y)+f(x-y))+f(x+y) f(x-y) $$ subtracting the previous two equalities $$ (f(x)-f(y))(2 f(x)+2 f(y)-f(x+y)-f(x-y))=0 . $$ Assume that for some $x, y \in \mathbb{R} f(x)=f(y)=a$. Let $f(x+y)=b$ and $f(x-y)=c$. Now we have: $$ 4 a^{2}=b c+a b+a c $$ $P(x+y, x-y)$ $$ f(x+y)^{2}+4 f(x-y)^{2}=(f(2 x)+f(x-y))(f(2 y)+f(x-y)) $$ i.e. $$ b^{2}+4 c^{2}=(4 a+c)^{2} $$ If we plug in $x \rightarrow x+y, y \rightarrow x-y$ in (13) we get $$ (f(x+y)-f(x-y))(2 f(x+y)+2 f(x-y)-f(2 x)-f(2 y))=0 $$ i.e. $$ (b-c)(2 b+2 c-8 a)=0 $$ If $b=c(15)$ gives us $$ \begin{aligned} 5 b^{2} & =(4 a+b)^{2} \\ b^{2} & =4 a^{2}+2 a b \end{aligned} $$ while (14) gives us $$ 4 a^{2}=b^{2}+2 a b $$ Thus, $a b=0$ and $a=b=c=0$ which implies $2 a+2 a-b-c=0$. On the other hand, if $b \neq c$ we also have $2 a+2 a-b-c=0$ Therefore, $f(x)=f(y)$ implies $2 f(x)+2 f(y)=f(x+y)+f(x-y)$ while $f(x) \neq f(y)$, using (13) also implies $2 f(x)+2 f(y)=f(x+y)+f(x-y)$. Therefore, for all $x, y$ : $$ 2 f(x)+2 f(y)=f(x+y)+f(x-y) $$ Now we have: $$ \begin{aligned} f(x)^{2}+3 f(y)^{2} & =f(x+y) f(x-y)+f(y)(f(x+y)+f(x-y)) \\ & =f(x+y) f(x-y)+f(y)(2 f(x)+2 f(y)) \\ (f(x)-f(y))^{2} & =f(x+y) f(x-y) \end{aligned} $$ Combining (16) i (17) gives us $$ (f(x+y)-f(x)-f(y))^{2}=4 f(x) f(y) $$ Let $g: \mathbb{R} \rightarrow \mathbb{R}_{0}^{+}$be the function such that $f(x)=g(x)^{2}$. Equations (8), (11) and (12) imply that $g\left(x^{2}\right)=g(x)^{2}$, $g(-x)=g(x)$ and $g(2 x)=2 g(x)$, respectively Equation (16) can be written as $$ f(x+y)-f(x)-f(y)=-(f(x-y)-f(x)-f(y)) $$ If $f(x+y)-f(x)-f(y) \geqslant 0$, from (18) we conclude that $g(x+y)=g(x)+g(y)$. Otherwise, $f(x-y)-f(x)-f(y) \geqslant 0$ and equation (18) can be rewritten as $$ (f(x-y)-f(x)-f(y))^{2}=4 f(x) f(y) $$ From the last equation we can conclude that $g(x-y)=g(x)+g(y)$ Therefore $$ g(x+y)=g(x)+g(y) \quad \text { or } \quad g(x-y)=g(x)+g(y) $$ and thus one of the following two equations hold: $$ g\left(x^{2}+y^{2}\right)+2 g(x y)=g\left(x^{2}+y^{2}+2 x y\right)=g(x+y)^{2} $$ or $$ g\left(x^{2}+y^{2}\right)+2 g(x y)=g\left(x^{2}+y^{2}-2 x y\right)=g(x-y)^{2} $$ From (18) we conclude: $$ g(x+y)=g(x)+g(y) \quad \text { or } \quad g(x+y)=|g(x)-g(y)| $$ By putting $-y$ instead of $y$ in (22) and using $g(-y)=g(y)$ we get: $$ g(x-y)=g(x)+g(y) \quad \text { or } \quad g(x-y)=|g(x)-g(y)| $$ Equations (22) and (23) imply that each of $g(x-y)^{2}$ and $g(x+y)^{2}$ can be written as either $(g(x)+g(y))^{2}$ or $(g(x)-g(y))^{2}$. Thus, no matter whether (20) or (21) holds, one of the following equations must hold: $$ g\left(x^{2}+y^{2}\right)+2 g(x y)=(g(x)+g(y))^{2} $$ $$ g\left(x^{2}+y^{2}\right)+2 g(x y)=(g(x)-g(y))^{2} $$ Without loss of generality we may assume that $g(x) \geqslant g(y)$. If $g\left(x^{2}+y^{2}\right)=g(x)^{2}+g(y)^{2}$ then equations (24) i (25) imply that $g(x y)=g(x) g(y)$ or $g(x y)=-g(x) g(y)$ and because $g$ is non-negative we conclude that $g(x y)=g(x) g(y)$. Otherwise, $g\left(x^{2}+y^{2}\right)=\left|g\left(x^{2}\right)-g\left(y^{2}\right)\right|=g(x)^{2}-g(y)^{2}$ and we have $$ g(x)^{2}+g(y)^{2} \pm 2 g(x) g(y)=g(x)^{2}-g(y)^{2}+2 g(x y) $$ and $$ g(y)^{2} \pm g(x) g(y)=g(x y) $$ However, since $g(x) \geqslant g(y)$ and $g(x y) \geqslant 0$ we get $$ g(y)^{2}+g(x) g(y)=g(x y) $$ Therefore, we conclude that $$ g(x y)=g(y)^{2}+g(x) g(y) \quad(\text { for } g(y) \leqslant g(x)) \quad \text { or } \quad g(x y)=g(x) g(y) $$ Thus, $$ g(x y) \geqslant g(x) g(y) $$ If for some $a, b$ it holds that $g\left(a^{2}+b^{2}\right) \neq g(a)^{2}+g(b)^{2}$ we may assume that $g(a)>g(b)$ and we have $g\left(a^{2}+b^{2}\right)=$ $g(a)^{2}-g(b)^{2}$, and $$ g(a b)=g(b)^{2}+g(a) g(b) $$ Let us denote $a^{\prime}=2 a$ and $b^{\prime}=\frac{1}{2} b$. We have $g\left(a^{\prime}\right)=2 g(a)$ and $g\left(b^{\prime}\right)=\frac{1}{2} g(b)$. Therefore, $g\left(a^{\prime}\right)>g(a)>g(b)>g\left(b^{\prime}\right)$. Note that $g\left(a^{\prime} b^{\prime}\right)=g(a b)$ and $g\left(a^{\prime}\right) g\left(b^{\prime}\right)=g(a) g(b)$. From (26) we conclude that either $g\left(a^{\prime} b^{\prime}\right)=g\left(a^{\prime}\right) g\left(b^{\prime}\right)$ or $g\left(a^{\prime} b^{\prime}\right)=g\left(b^{\prime}\right)^{2}+g\left(a^{\prime}\right) g\left(b^{\prime}\right)$. Each of these two cases is only possible when $g(b)=0$. However, this implies that $g\left(a^{2}+b^{2}\right)=g\left(a^{2}\right)-g\left(b^{2}\right)=g\left(a^{2}\right)+g\left(b^{2}\right)$ which is a contradiction. Therefore, there are no $a, b$ such that $g\left(a^{2}+b^{2}\right) \neq g(a)^{2}+g(b)^{2}$ and for all $x, y \geqslant 0 g(x+y)=g(x)+g(y)$ which, together with the fact that $g$ is non-negative, means that $g$ satisfies a Cauchy functional equation whose only solution is $g(x)=g(1) x$. Since $g(1)=g(1)^{2}$ we get that $g(1)=1$ and $f(x)=x^{2}$ for all $x$. Therefore there are 3 solutions which are given by - $f(x)=0 \quad \forall x \in \mathbb{R}$, - $f(x)=\frac{1}{2} \forall x \in \mathbb{R}$ and - $f(x)=x^{2} \forall x \in \mathbb{R}$.