<s>[INST] Finding the maximum of $ \sqrt{x + 27} + \sqrt{13 - x} + \sqrt{x}$ for $0\le x \le 13$ using the Cauchy-Schwarz inequality gives two different answers I am trying to find the maximum of the expression $$\sqrt{x+27} + \sqrt{13-x} + \sqrt{x} \qquad \text{for } 0 \le x \le 13.$$
Clearly using Cauchy is the way to go here, so I tried $$((x + 27) + 2(13-x) + x)(1 + 0.5 + 1) = (x + 27 + 26 - 2x + x)\frac 52 = \frac{265}{2} \ge (\sqrt{x+27} + \sqrt{13-x} + \sqrt{x})^2.$$
But then, we also have that $$\left( 1 + \frac{1}{3} + \frac{1}{2} \right) ((x + 27) + 3(13 - x) + 2x) = 121 \ge (\sqrt{x + 27} + \sqrt{13 - x} + \sqrt{x})^2.$$
Clearly, these are two different values. What gives? How could I “guess” the correct combination of scalars that lead to the correct answer? (as the first attempt is incorrect).
 [/INST] How to "guess":
The form is making something nice, so I try to guess something to make $x+27,13-x,x$ are all squares, and indeed $x=9$, son the previous three numbers are $6^2,2^2,3^2$. So, this can have
$$(\sqrt{x+27} + \sqrt{13-x} + \sqrt{x})^2\le(6+2+3)(\frac{x+27}6+\frac{13-x}2+\frac{x}3)=121$$
So we can get $\sqrt{x+27} + \sqrt{13-x} + \sqrt{x}\le 11$, equality taken if $x=3$
The correct values will be yielded when the equality of Cauchy-Schwartz holds.
How to really calculate:
I am going to try this for Cauchy-Schwartz:
$$(\frac 1u+1+\frac 1{1-u})(u(x+27)+(13-x)+(1-u)x)\ge(\sqrt{x+27} + \sqrt{13-x} + \sqrt{x})^2$$
This holds if
$$(x+27)u^2=13-x=x(1-u)^2$$
Solving for $x$ we have
$$x=\frac{13}{1+(1-u)^2}$$
Using $1+\frac{27}{x}=\frac{x+27}{x}=\frac{(1-u)^2}{u^2}$ we have
$$1+27(\frac{1+(1-u)^2}{13})=\frac{(1-u)^2}{u^2}$$
Clearing the denominators, we have
$$27u^4-54u^3+54u^2+26u-13=0$$
Factoring (in fact, try the rational roots first) gives
$$(3u-1)(9u^3-15u^2+13u+13)=0$$
And the latter $9u^3-15u^2+13u+13$ has no positive real roots. So, you can set $u=1/3$ and yield the same result.
By the way, both Cauchy-Schwartz and the derivative will give you the following inequality:
$$\frac{1}{\sqrt x}+\frac{1}{\sqrt{27+x}}=\frac{1}{\sqrt{13-x}}$$
This is equivalent to
$$\frac{1}{x^2}+\frac{1}{{(27+x)^2}}+\frac{1}{{(13-x)^2}}=\frac{1}{x{(27+x)}}+\frac{1}{(13-x)x}+\frac{1}{(27+x)(13-x)}$$
And you can solve this equation, but I don't want to present it here.
</s>