Maximize quadratic function over unit sphere In lecture, we proved that, given a symmetric matrix $A$, the
$$\max_{\|x\|_2 = 1} x^T A x$$
is the largest eigenvalue $\lambda_{\max}$ of matrix $A$: we diagonalize the matrix $A$ and show that for every unit vector x the inequality $x^T A x \leq \lambda_{\max}$ holds. I understand every part of the computation.
What I do not understand is why it suffices to consider unit vectors for $x$? If the inequality is true for every $x$ in the unit sphere and we find one for which the inequality is an equality, then of course we have found a maximum. But in the unit sphere do not only lie the unit vectors.
 A: Let us consider a Lagrangian function of the following form
\begin{equation}
\mathcal{L}(\vec{x},\lambda) = -\vec{x}^{\intercal}A\vec{x} + \lambda(\vec{x}^2 - 1).
\end{equation}
The first derivatives of the Lagrange function are
\begin{equation}
\frac{\partial\mathcal{L}}{\partial\vec{x}} = -2A\vec{x} + 2\lambda\vec{x} = 0,\\
\frac{\partial\mathcal{L}}{\partial\lambda} = \vec{x}^2 - 1 = 0.
\end{equation}
So,
\begin{equation}
A\vec{x} = \lambda\vec{x},\\
\vec{x}^2 = 1.
\end{equation}
It is seen from the last equation that the Lagrangian multiplier is an eigenvalue of the matrix $A$. At a stationary point, the Lagrange function can be rewritten as follows
\begin{equation}
\mathcal{L} = -\lambda\vec{x}^2,\\
\vec{x}^2 = 1.
\end{equation}
The last equation shows that the Lagrange function has the minimum value at $\lambda = \lambda_{\rm max}$. The min value of this function is equal to $-\lambda_{\rm max}$ only if $\vec{x}^2 = 1$. So the max value of the $\vec{x}^{\intercal}A\vec{x}$ is equal to $\lambda_{\rm max}$ only if $\vec{x}^2=1$. For $\vec{x}^2\neq1$, the value of the $\vec{x}^{\intercal}A\vec{x}$ at the maximum will be different.
