Let $A = (a_{ij})$ be a symmetric matrix. Find the maximum and minimum of
$$F: {\mathbb{R}}^n \to {\mathbb{R}}: f(x) = \sum_{i, j = 1}^{n}a_{ij}x_{i}x_{j}$$
on the sphere
$$S = \left\{ x \in \mathbb{R}; \sum_{i=0}^{n}{x_i}^2 = 1 \right\}$$
I have been trying to apply Lagrange multiplier to solve it, so far I have
\begin{eqnarray*}
\mathcal{L}(x, y, \lambda) = f(x) + \lambda g(x) = \sum_{i,j=1}^{n}a_{ij}x_{i}x_{j} + \lambda(\sum_{i=1}^{n}{x_i}^2 - 1)
\end{eqnarray*}
\begin{eqnarray*}
= \nabla_{x,y,\lambda}\mathcal{L}(x,y,\lambda) =(\frac{\partial L}{\partial x_1}, \frac{\partial L}{\partial x_2},...,\frac{\partial L}{\partial x_n})
\end{eqnarray*}
\begin{eqnarray*}
= (\sum_{j=1}^{n}a_{1j}x_{j}-2 \lambda x_1, \sum_{j=1}^{n}a_{2j}x_{j}-2 \lambda x_2, ... , \sum_{j=1}^{n}a_{nj}x_{j}-2 \lambda x_n)
\end{eqnarray*}
then for all i
\begin{eqnarray*}
\sum_{j=1}^{n}a_{ij}x_{j}-2 \lambda x_i
\end{eqnarray*}
Thus the stationary point $(x_1, x_2,..., x_n)$ is the solution of the system of the linear equations. Also the Hessian is
\begin{bmatrix}
a_{11}-2\lambda & a_{12} & \dots &a_{1n}\\
a_{21} & a_{22} -2\lambda & \dots & \vdots \\
\vdots & \ddots & & \\
a_{n1} & \dots & & a_{nn}-2\lambda
\end{bmatrix}
but this approach is not leading any further.
On wikipedia in example one there is a problem with constraint of a two dimensional sphere, my approach is to expend it to the n dimensianl space to solve the general case, now I'm not sure if this will work. And I also reffered to this post, but the function in my task is in quadratic form, so it's not being too helpful.
It's a homework question but right now I'm getting really stuck, any hint would be appreciated.