A function \(f: \mathbb{R}^{2} \rightarrow \mathbb{R}\) is called Olympic if it
has the following property: given \(n \geq 3\) distinct points \(A_{1}, A_{2},
\ldots, A_{n} \in \mathbb{R}^{2}\), if \(f\left(A_{1}\right)=\)
\(f\left(A_{2}\right)=\cdots=f\left(A_{n}\right)\), then the points \(A_{1},
A_{2}, \ldots, A_{n}\) are the vertices of a convex polygon. Let \(P \in
\mathbb{C}[X]\) be a nonconstant polynomial. Prove that the function \(f:
\mathbb{R}^{2} \rightarrow \mathbb{R}\) defined by \(f(x, y)=|P(x+i y)|\) is
Olympic if and only if all the roots of \(P\) are equal.