Maximum value of $\sqrt{1-\sqrt{a_1}} + \sqrt{1-\sqrt{a_2}} + \cdots + \sqrt{1-\sqrt{a_n}}$ for $a_i \in [0,1], a_1+a_2+ \cdots +a_n = 2$

inequality

Given $n \ge 3$ real numbers $a_1, a_2, \cdots, a_n \in [0,1]$ such that $a_1 + a_2+ \cdots +a_n =2$, find the maximum value of:
$$P =\sqrt{1-\sqrt{a_1}} + \sqrt{1-\sqrt{a_2}} + \cdots + \sqrt{1-\sqrt{a_n}}.$$

So far my only guess is that the equality occurs when there are $n-x$ numbers equal to $0$ and $x$ numbers equal to $\dfrac{2}{x}$, then we have:
$$P \le n-x + x \sqrt{1-\sqrt{\frac{2}{x}}} = n-x + \sqrt{x^2-x\sqrt{2x}}$$
The function above reaches maximum at $x=3$, so we have:
$$P \le n-3 + \sqrt{9 -3\sqrt{6}} $$
And I didn't know how to proceed any further.

Best Answer

A brute force method: $f(x)=\sqrt{1-\sqrt x}$, then, $f'(x)=-\frac{1}{4\sqrt{x}\sqrt{1-\sqrt{x}}}$, $f''(x)=\frac{2-3\sqrt x}{16\sqrt{(1-\sqrt x)x}^3}$. Therefore, the function $f(x)$ is convex for $x<4/9$ and concave for $x>4/9$. So, we can make $f(x_1)+f(x_2)$ (WLOG $x_1\le x_2$) larger we do the adjustment:

(a) If $0\le x_1\le x_2\le 4/9$, $f(x_1)+f(x_2)\le f(x_1-\delta)+f(x_2+\delta)$ for all $\delta\in[0,\min(4/9-x_2,x_1)]$.

(a) If $4/9\le x_1\le x_2\le 1$, $f(x_1)+f(x_2)\le f(x_1+\delta)+f(x_2-\delta)$ for all $\delta\in[0,\frac{x_2-x_1}2]$.

Therefore, $\sum_{i}f(x_i)$ reach maximum when it can't be adjusted by the method above. Specifically:

(a) all the $x\ge 4/9$'s are equal.

(b) all the other $x\le 4/9$ are hitting the boundary (that is, being $0$ or one single value.)

So, we have $0=x_1=\dots=x_k\le x_{k+1}<4/9\le x_{k+2}=\dots=x_n$.

Since all $x_i\le 1$, we have $2\le n-k\le 4$. We have three cases:

Case 1: $n-k=2$. So, we have $0=x_1=\dots=x_{n-3}\le x_{n-2}<4/9\le x_{n-1}=x_n$. Let $x_n=x$, and we have $x_n\ge 7/9$. Therefore, we have

\begin{align}&\sum_i f(x_i)=n-3+\sqrt{1-\sqrt{x_{n-2}}}+\sqrt{1-\sqrt{x_{n-1}}}+\sqrt{1-\sqrt{x_{n}}}\\ \le &n-3+1+2\sqrt{1-\sqrt{7/9}}\le n-3+1.236\dots\end{align}

Notice that $n-3+\sqrt{9-3\sqrt{6}}=n-3+1.285\dots$, so this case is smaller.

Case 2: $n-k=3$. So, we have $0=x_1=\dots=x_{n-4}\le x_{n-3}<4/9\le x_{n-2}= x_{n-1}=x_n$. Let $x_n=x$, and we have $14/27\le x_n\le 2/3$. Therefore, we have

\begin{align}&\sum_i f(x_i)=n-4+\sqrt{1-\sqrt{2-3x}}+3\sqrt{1-\sqrt{x}}\end{align}

Let $g(x)=\sqrt{1-\sqrt{2-3x}}+3\sqrt{1-\sqrt{x}}$. Therefore, $g'(x)=\frac{3}{4}(\frac 1{\sqrt{2-3x}\sqrt{1-\sqrt{2-3x}}}-\frac 1{\sqrt{1-x}\sqrt{1-\sqrt{x}}})$ Notice that $\sqrt{x}\sqrt{1-\sqrt{x}}$ is an increasing function in $[0,1]$. Also, $2-3x\le x$ since $14/27\le x_n\le 2/3$. Therefore, we have ${\sqrt{2-3x}\sqrt{1-\sqrt{2-3x}}}\le {\sqrt{1-x}\sqrt{1-\sqrt{x}}}$, and thus $\frac 1{\sqrt{2-3x}\sqrt{1-\sqrt{2-3x}}}-\frac 1{\sqrt{1-x}\sqrt{1-\sqrt{x}}}\ge 0$, $g'(x)\ge 0$. Therefore, in this case, $x=2/3$ get the maximum value, which is your proposed solution \begin{align}&\sum_i f(x_i)=n-4+\sqrt{1-\sqrt{2-3\times 2/3}}+3\sqrt{1-\sqrt{2/3}}=n-3+\sqrt{9-6\sqrt 3}\end{align}

Case 3: $n-k=4$. So, we have $0=x_1=\dots=x_{n-5}\le x_{n-4}<4/9\le x_{n-3}=\dots =x_n$. Let $x_n=x$, and we have $4/9\le x_n\le 1/2$. Therefore, we have

\begin{align}&\sum_i f(x_i)=n-5+\sqrt{1-\sqrt{2-4x}}+4\sqrt{1-\sqrt{x}}\end{align}

Let $g(x)=\sqrt{1-\sqrt{2-4x}}+4\sqrt{1-\sqrt{x}}$. Therefore, $g'(x)=\frac 1{\sqrt{2-4x}\sqrt{1-\sqrt{2-4x}}}-\frac 1{\sqrt{1-x}\sqrt{1-\sqrt{x}}}$. Similar to the previous case, $g'(x)\ge 0$, and we take $x=1/2$. Therefore, we have

\begin{align}&\sum_i f(x_i)=n-5+1+4\sqrt{1-\sqrt{1/2}}=n-3+1.164...\end{align} which is also smaller.

Therefore, the maximum value is $n-3+\sqrt{9-3\sqrt 6}$

Related Question