Find the maximum of a real function of $2016$ variables Find the maximum of the function $$f(\bar x)=\sqrt{x_1^2+2x_2^2+......2016x_{2016}^2}$$ $\bar x=(x_1,x_2,....x_{2016}) \in \mathbb{R}^{2016}$ 
where the domain of $f$ is $$\bar x=(x_1,x_2,....x_{2016}) \in \mathbb{R}^{2016} :\sum_{n=1}^{2016}x_n^2=1.$$ 
$f^2(\bar x)={x_1^2+2x_2^2+......2016x_{2016}^2}=\sum_{n=1}^{2016}nx_n^2$ 
I don't know how to use condition $||\bar x||=1$.
 A: Just for fun, I have tried to use Cauchy-Schwarz (many times!)
Note that it is sufficient to maximise $f(x)^{2}$. Let $u = (x_{1}, x_{2}, \ldots, x_{2016})$ and $v = (x_{1}, 2x_{2}, \ldots, 2016x_{2016})$. Then by the Cauchy-Schwarz inequality, we have
  \begin{align}
  |u \cdot v| & \leq \left\|u\right\|\left\|v\right\| \\
  \sum_{n=1}^{2016} nx_{n}^{2} & \leq\left(\sum_{n=1}^{2016}n^{2}x_{n}^{2}\right)^\frac{1}{2}\left(\sum_{n=1}^{2016}x_{n}^{2}\right)^\frac{1}{2} \\
& = \left(\sum_{n=1}^{2016}n^{2}x_{n}^{2}\right)^\frac{1}{2}
  \end{align}
We could apply C-S again to $(n^{2}x_{n})(x_{n})$ to get
  $$ \left(\sum_{n=1}^{2016}n^{2}x_{n}^{2}\right)^\frac{1}{2} \leq \left(\sum_{n=1}^{2016}n^{4}x_{n}^{2}\right)^\frac{1}{4} $$
Eventually, after $k$ applications, we get
  $$ \sum_{n=1}^{2016} nx_{n}^{2} \leq \left(\sum_{n=1}^{2016} n^{2^{k}}x_{n}^{2}\right)^{\frac{1}{2^{k}}}$$
Due to the condition on $\sum x_{n}^{2}$ we have $x_{n}\leq 1$ for each $n$, so setting $x_{n}=1$ gives us
  $$ \left(\sum_{n=1}^{2016} n^{2^{k}}x_{n}^{2}\right)^{\frac{1}{2^{k}}} \leq \left(\sum_{n=1}^{2016} n^{2^{k}}\right)^{\frac{1}{2^{k}}} $$
Swapping every $n$ for $2016$ should get us a larger quantity still:
  $$\left(\sum_{n=1}^{2016} n^{2^{k}}\right)^{\frac{1}{2^{k}}} \leq \left(\sum_{n=1}^{2016} 2016^{2^{k}}\right)^{\frac{1}{2^{k}}} = 2016^{\frac{2^{k}+1}{2^{k}}}$$
The limit of the latter as $k\rightarrow\infty$ is $2016$, hence $f(x)^{2}\leq 2016$ On the other hand, the equality condition from C-S leads us to choose $\lambda u = v$ for some $\lambda$, which clearly can only be the case when all but one $x_{n}$ is $0$. Thus we try $u = (0,\ldots,0,1)$ and find $f(u)^{2} = 2016$. So the maximum of $f$ is $\sqrt{2016}$
A: You can work step by step.
First of all, the function obviuously reaches its max at the same $\vec x$ as the function $g_1(x)=f(x)^2$, so you can skip the square root.
Now you have $$g_1(x)=x_1^2 + 2x_2^2+\dots + 2016x^2_{2016} = \\=||x|| + x_2^2+2x_3^2+\dots + 2015x_{2016}^2\\=1 + x_2^2+2x_3^2+\dots + 2015x_{2016}^2$$
Now, notice that $g_1$ reaches its maximum on the same point as $$h_1(x)=x_2^2+2x_3^2+\dots + 2015x_{2016}^2$$
so you can safely say that $x_1=0$.
Now, you can use the same trick to define $g_2$ and notice that $x_2=0$.

Or, another way. Once you have $g_1$, you can see that if $x_i\neq 0$ for any $i<2016$, you can always strictly increase the value of $g_1$ by setting $\bar x_i=0$ and $\bar x_{2016}=\sqrt{x_{2016}^2 - x_i^2}$.
This proves that $x_i=0$ for all $i<2016$.
A: On a more serious note, $$f(x) \leq \sqrt{\sum 2016 x_{n}^{2}}=\sqrt{2016\sum  x_{n}^{2}} = \sqrt{2016}$$ while $f((0,\ldots,0,1))=\sqrt{2016}$ which is therefore the maximum.
