Maximizing the sum of two numbers, the sum of whose squares is constant 
How could we prove that if the sum of the squares of two numbers is a constant, then the sum of the numbers would have its maximum value  when the numbers are equal?

This result is also true for more than two numbers. I tested the results by taking various values and brute-force-ish approach. However I am interested to know a formal proof of the same. 
This is probably an mild extention to this problem. I encountered this result while searching for a easy solution for the same.

My answer in your other question still applies... and in any number of variables.
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}$.
