5.2. Find all polynomials $P(x, y)$ in two variables, such that

$$
P(a, b) \cdot P(c, d)=P(a c+b d, a d+b c)
$$

for all real numbers $a, b, c, d$.

(former Yugoslavia)
5.2. First we note that

$$
\begin{aligned}
P(t x, t y) & =P(t, 0) P(x, y) \\
P(t s, 0) & =P(t, 0) P(s, 0)
\end{aligned}
$$

Define $p(x)=P(x, 0)=a_{k} x^{k}+\cdots+a_{0}$. From (2) one gets easily (comparing coefficients on both sides) that either $p(x)=0$, or $p(x)=1$, or $p(x)=x^{k}$ with $k \geq 1$, for all $x$.

Therefore, either $P(x, y)=0$, or $P(x, y)=1$, or

$$
P(t x, t y)=t^{k} P(x, y)
$$

Consider $(3)$ :

$$
\begin{aligned}
P(x, y) P(1,1) & =P(x+y, x+y)=(x+y)^{k} P(1,1) \\
P(x, y) P(1,-1) & =P(x-y, x-y)=(x-y)^{k} P(1,-1)
\end{aligned}
$$

Now we have three cases:

a) If $P(1,1) \neq 0$, then $P(x, y)=(x+y)^{k}$, which is easily verified to satisfy the condition of the problem.

b) If $P(1,-1) \neq 0$, then $P(x, y)=(x-y)^{k}$, which also satisfyes the condition in the problem.

c) Assume that $P(1,1)=P(1,-1)=0$. Keeping $y$ fixed, and dividing $P(x, y)$ by $x^{2}-y^{2}$ we obtain

$$
P(x, y)=\left(x^{2}-y^{2}\right) Q(x, y)+x R(y)+S(y)
$$

for all $x, y \in \mathbf{R}$. Substituting $(x, y)=(t, t)$ and $(x, y)=(t,-t)$ and using (3) we obtain

$$
\begin{aligned}
t R(t)+S(t) & =0 \\
-t R(t)+S(t) & =0
\end{aligned}
$$

from which we obtain $R(t)=S(t)=0$ for all $t$. Therefore

$$
P(x, y)=\left(x^{2}-y^{2}\right) Q(x, y)
$$

in this case.

The polynomial $Q$ also satisfies the condition in the problem like $P$, and its degree is equal to $k-2$. So, we can again repeat the whole procedure with three possible cases for $Q$, instead of $P$. After finitely many steps we arrive to

$$
P(x, y)=(x+y)^{m}(x-y)^{n}
$$

where $m, n \geq 0$ are integers. Therefore all solutions of the problem are constants 0,1 and polynomials given by (4).

REMARK Let us state the problem analogous to the preceding one: Find all polynomials $P(x, y, z)$ in three variables, such that

$$
P(a, b, c) \cdot P(x, y, z)=P(a x+b z+c y, a y+b x+c z, a z+b y+c x)
$$

for all real numbers $a, b, c, x, y, z$. It can be shown that all solutions are either constants 0 and 1 , or

$$
P(x, y, z)=(x+y+z)^{m}\left(x^{2}+y^{2}+z^{2}-x y-y z-z x\right)^{n} \text {, }
$$

where $m, n \geq 0$ are integers. Try to prove this!