Thanks Byron this is a smart approach and perhaps the best one for my other question too :-)
–
VelvetThunderAug 23 '11 at 19:43

@Fool Glad to help. This problem just cried out for the CS inequality. You have to be careful, though. Other symmetric problems will not have symmetric solutions, as seen in the very interesting article pointed out by Bill Dubuque.
–
Byron SchmulandAug 23 '11 at 19:47

This is a special case of the "Purkiss Principle". See the following excellent exposition by Wm. Waterhouse Do Symmetric Problems Have Symmetric Solutions? I recall thinking that this was one of the most beautiful Monthly articles that I ever read as an undergraduate. Apparently others felt similarly since it won a prestigious Lester R. Ford award for expository excellence.

Let $x$ and $y$ be the two numbers. The condition "the sum of the squares is a constant" means that there is a fixed number $c$ such that $x^2+y^2=c$. That means that if you know one of the two numbers, say, $x$, then you can figure out the absolute value of the other one: $y^2 = c-x^2$, so $|y|=\sqrt{c-x^2}$.

Now, since you want to find the maximum of the sum, then you can restrict yourself to the positive values of $x$ and $y$ (the condition on the sum of squares doesn't restrict the sign). So we may assume $x\geq 0$, $y\geq 0$, and $y=\sqrt{c-x^2}$. And now you want to find the maximum of $x+y = x+\sqrt{c-x^2}$.

Thus, this reduces to finding the maximum value of $S(x) = x+\sqrt{c-x^2}$ on the interval $[0,\sqrt{c}]$.

By the Extreme Value Theorem, the maximum will be achieved either at an endpoint or at a critical point of $S(x)$. At $0$ we get $S(0) = \sqrt{c}$; at $\sqrt{c}$ we get $S(\sqrt{c}) = \sqrt{c}$. As for critical points,
$$S'(x) = 1 - \frac{x}{\sqrt{c-x^2}}.$$
The critical points are $x=\sqrt{c}$ (where $S'(x)$ is not defined), and the point where $x=\sqrt{c-x^2}$, or $2x^2=c$; hence $x^2=\frac{c}{2}$ (which means $y^2=\frac{c}{2}$ as well). At $x=\sqrt{\frac{c}{2}}$, $S(x) = 2\sqrt{\frac{c}{2}} = \sqrt{2c}$. This is clearly the maximum.

You can use the method of Lagrange multipliers to maximize/minimize $f(a_1,\ldots,a_n)=a_1+\cdots+a_n$ given $g(a_1,\ldots,a_n)=a_1^2+\cdots+a_n^2=k$, where $k$ is a constant. We need the gradient of $f$ to be a multiple of the gradient of $g$, i.e.,
$$1=\lambda 2a_1,\quad 1=\lambda 2a_2,\ \ldots \quad 1=\lambda 2a_n,$$
where $\lambda$ is some real number. Hence:
$$\lambda = \frac{1}{2a_1}=\frac{1}{2a_2}=\cdots=\frac{1}{2a_n}$$
and we must have $a_1=\cdots=a_n=a$. This yields $g(a,\ldots,a)=na^2=k$, so that $a_1=\cdots=a_n=a=\sqrt{k/n}$ or $a_1=\cdots=a_n=-\sqrt{k/n}$. We clearly have a maximum at $a_1=\cdots=a_n=\sqrt{k/n}$ and the maximum value of $f$ is $n\sqrt{k/n}$.

As was already mentioned in my answer to this other post of yours (but maybe you skipped it), there is an algebraic proof. Let us start with two numbers $a$ and $b$ and use the relation
$$
(a+b)^2=2(a^2+b^2)-(a-b)^2.
$$
This implies that the square of the sum is at most twice the sum of the squares and also that, if one fixes the sum of the squares, the sum $a+b$ achieves this maximum value if and only if $(a-b)^2$ is zero, that is, if and only if $a=b$.

The argument can be adapted to $n$ numbers, using the relation
$$
(a_1+\cdots+a_n)^2=n(a_1^2+\cdots+a_n^2)-\sum\limits_{i\ne j}(a_i-a_j)^2.
$$
The conclusion is the same: the square of the sum is at most $n$ times the sum of the squares and, if one fixes the sum of the squares, the sum $a_1+\cdots+a_n$ achieves this maximum value if and only if the sum of the $(a_i-a_j)^2$ is zero, that is, if and only if $a_i=a_j$ for every $i\ne j$.

We have (x+y)=c where x indicates a square, y a square, and c a constant. Now take max(x, y).

Case 1: If max(x, y)=x, then rewrite y as (x*(y/x)) (just one time). So, the sum of the squares (x+y) becomes (x+(x*(y/x)))=(x*(1+(1*(y/x))))=(x*(1+(y/x))). Since x>=y by hypothesis, and y and x both equal positive integers, (y/x) belongs to (0, 1]. So, (1+(y/x)) belongs to (1, 2]. For (x*z) with z belonging (1, 2], and x a positive integer, (x*z) has greatest value when z=2, so (x*(1+(y/x))) has greatest value when (1+(y/x))=2, which implies x=y.