Let $x, y, z$ be real numbers in $[0,1]$. Find the greatest value that the expression

$$
x^{2} y+y^{2} z+z^{2} x-x^{2} z-z^{2} y-y^{2} x
$$

can take.
(Solved by Théodore Fougereux and Daniel Cortild)

We start by noting the following identity:

$$
P(x, y, z)=(z-y)(y-x)(x-z)
$$

Moreover, the maximum is clearly positive since we have $P(0,0,0)=0$. Therefore, we must have 1 or 3 positive factors.

If all three factors are positive, we have $z \geq y \geq x \geq z$, which implies $x=y=z$, giving a maximum of 0.

We can deduce that the maximum will be achieved when there is only one positive factor. We can assume this factor is $z-y$. We then have:

$$
\begin{aligned}
& z-y \geq 0 \\
& y-x<0 \\
& x-z<0
\end{aligned}
$$

Thus,

$$
P(x, y, z)=(z-y)(y-x)(x-z)=(z-y)(x-y)(z-x)
$$

Now, all factors are positive, so we can use the AM-GM inequality by setting $a=x-y$ and $b=z-x$:

$$
P(x, y, z)=(a+b) a b \leq(a+b)\left(\frac{a+b}{2}\right)^{2}=\frac{(a+b)^{3}}{4} \leq \frac{1}{4}
$$

since $a+b=z-y \leq 1$ by hypothesis.

We verify that this bound is achieved, for example, at $x=1, y=\frac{1}{2}$, and $z=0$.