# Find the maximum and minimum under following constraint

Find the maximum and minimum of $$f(\textbf{x}) = x_1 + x_2 + \cdots + x_n$$ under the constraint $$\|\textbf{x}\|=1$$.

My attempt:

For local optima, $$Df(x) = \lambda Dg(x)$$, where $$g(x) = \|\textbf{x}\|^2-1$$, so $$[1,1,\dots,1] = \lambda [x_1 , x_2 , \dots , x_n]$$. Note that $$\lambda \neq 0$$, so what we have is that $$x_1 = x_2 = \cdots = x_n = \frac{1}{\lambda}$$ and putting it on constraint we have that $$\lambda = \sqrt{n}$$.

Now $$f(x) = \sqrt{n}$$ but I am not sure whether it is maximum and minimum. There seems to be only one value satisfying the lagrangian. Another point is that we know that both global minimum and global maximum exist and shouldn't there be at least two different values of $$\lambda$$?

What Lagrange multipliers theorem gives you is some necessary condition on $$x$$ to have a constrained local extremum at $$x$$. When you want to find a global maximum/minimum (say of a continuous function over a compact set), it basically allows you to automatically rule out a large amount of candidate solutions.
In the case of $$f$$, we have that if $$x$$ is a local extremum of $$f$$ on $$S^{n-1}$$, then $$x$$ must satisfy $$x_1=\ldots=x_n$$. Plugging this into the $$\{\lVert x\rVert=1\}$$ constraint leads to $$x_i^2=1/n$$, ie. $$x_i=1/\sqrt{n}$$ for all $$i$$ or $$x_i=-1/\sqrt{n}$$ for all $$i$$. Note that there are 2 local extrema (not 1). The first case corresponds to the global maximum and the second one to the global minimum.