What is the maximum possible value of $P A+P B+P C+P D$ if $P$ is a point on the unit square $A B C D$?
First, we prove a lemma.

Lemma. Let $0 \leq a \leq 1$ and $b$ be real numbers, and let

$$
f(x, y)=\sqrt{x^{2}+y^{2}}+\sqrt{(1-x)^{2}+y^{2}}
$$

Then $f(a, b) \leq f(0, b)$, and equality holds if and only if $a=0$ or $a=1$ or $b=0$.

On our website, we provided a geometric statement equivalent to the lemma and its geometric proof. Now, we will show how to achieve the goal through calculations. The statement can be rearranged as follows:

$$
\sqrt{1+b^{2}}-\sqrt{(1-a)^{2}+b^{2}} \geq \sqrt{a^{2}+b^{2}}-|b|
$$

According to our assumption about $a$, both sides are non-negative, so squaring is an equivalent transformation. After performing the operations, we get:

$$
\begin{gathered}
1+b^{2}+1-2 a+a^{2}+b^{2}-2 \sqrt{1+b^{2}} \sqrt{(1-a)^{2}+b^{2}} \geq \\
\geq a^{2}+b^{2}+b^{2}-2|b| \sqrt{a^{2}+b^{2}}
\end{gathered}
$$

After simplifications and introducing the notation $c=1-a$ (clearly $0 \leq c \leq 1$), rearranging (1) gives:

$$
c+|b| \sqrt{(1-c)^{2}+b^{2}} \geq \sqrt{1+b^{2}} \sqrt{c^{2}+b^{2}}
$$

Again, both sides are non-negative, so we can square again:

$$
c^{2}+b^{2}(1-c)^{2}+b^{4}+2|b| c \sqrt{(1-c)^{2}+b^{2}} \geq c^{2}+b^{2}+b^{2} c^{2}+b^{4}
$$

After simplifications and rearranging, we get $2|b| c \sqrt{(1-c)^{2}+b^{2}} \geq 2 b^{2} c$. Since $2|b| c \geq 0$, there are two cases: if $2|b| c=0$, then $b=0$ or $a=1$ and equality holds. Otherwise, $2|b| c>0$ and we can divide by it:

$$
\sqrt{(1-c)^{2}+b^{2}} \geq|b|
$$

Again, both sides are non-negative, and after another squaring, we get the obvious inequality $(1-c)^{2} \geq 0$. Equality holds when $a=0$. Since we performed only equivalent transformations, we have proved the original statement, and thus the lemma.

Let us choose the coordinate system such that the vertices of the unit square are $A(0,0), B(1,0), C(1,1)$, and $D(0,1)$; and let $P(x, y)$, where $0 \leq x, y \leq 1$. Then

$$
\begin{gathered}
P A+P B+P C+P D= \\
=\sqrt{x^{2}+y^{2}}+\sqrt{(1-x)^{2}+y^{2}}+\sqrt{(1-x)^{2}+(1-y)^{2}}+\sqrt{x^{2}+(1-y)^{2}}= \\
=f(x, y)+f(x, 1-y)
\end{gathered}
$$

Applying the lemma and using that $0 \leq y \leq 1$, we get

$$
\begin{gathered}
f(x, y)+f(x, 1-y) \leq f(0, y)+f(0,1-y)= \\
=\sqrt{y^{2}}+\sqrt{1+y^{2}}+\sqrt{(1-y)^{2}}+\sqrt{1+(1-y)^{2}}= \\
=y+1-y+f(y, 1)=1+f(y, 1)
\end{gathered}
$$

Again, by the lemma, $f(y, 1) \leq f(0,1)=1+\sqrt{2}$, from which it follows that $P A+P B+P C+P D \leq 2+\sqrt{2}$. Equality holds if and only if equality holds in all our estimates, which is easy to see that this happens if and only if $P$ is one of the vertices of the unit square.

Márton Borbényi (Kaposvár, Táncsics Mihály Gymnasium, 12th grade)

Remark. We sketch a second possible solution, which uses some basic knowledge about functions of two variables. Let us introduce the function $g(P)=P A+P B+P C+P D$. It is known that in a triangle, the median is at most as long as the arithmetic mean of the sides enclosing the median. From this elementary geometric fact, it immediately follows that if $F$ is the midpoint of the segment $P Q$, then $g(F) \leq(g(P)+g(Q)) / 2$, and equality holds only if $P=Q$. Since the function $g$ is continuous, we have shown that $g$ is strictly convex. Using the convexity, it is not too difficult to show that the maximum is at the vertices, it is enough to think that every other point of $A B C D$ is an interior point of a segment whose endpoints are also points of $A B C D$.[^0]


[^0]:    ${ }^{1}$ https://www.komal.hu/feladat?a=feladat\&f=B4878\&l=hu.