Maximum of $2x_1x_2+2x_2x_3+2x_3x_4$ Calculate max of $$g(x)=2x_1x_2+2x_2x_3+2x_3x_4$$ if $x_1^2+x_2^2+x_3^2+x_4^2=1$.
I do not know how to attack this problem, so a help on the way would be great.
 A: The matrix $$A=\pmatrix{0&1&0&0\cr1&0&1&0\cr0&1&0&1\cr0&0&1&0\cr}$$ represents $g$, in the sense that if $x$ is the column vector $(x_1,x_2,x_3,x_4)$, then $g(x)=x^tAx$. The maximum value of $g(x)$ on $x$ of length 1 is the maximum eigenvalue of $A$. 
This is explained at length at http://rutherglen.science.mq.edu.au/math133s213/notes/Quadratic%20forms2013.pdf
A: Establish the Lagrange multiplier $L$ that given by:
\begin{equation}
L=(2x_1x_2+2x_2x_3+2x_3x_4)+\lambda(x_1^2+x_2^2+x_3^2+x_4^2-1)
\end{equation}
For the sake of simplicity, variables of $L$ have been ignored. Calculate the extreme conditions:
\begin{equation}
\frac{\partial L}{\partial x_1}=2\lambda x_1+2x_2=0\\
\frac{\partial L}{\partial x_2}=2\lambda x_2+2(x_1+x_3)=0\\
\frac{\partial L}{\partial x_3}=2\lambda x_3+2(x_2+x_4)=0\\
\frac{\partial L}{\partial x_4}=2\lambda x_4+2x_3=0\\
\frac{\partial L}{\partial \lambda}=x_1^2+x_2^2+x_3^2+x_4^2-1=0
\end{equation}
The solution is:
\begin{equation}
x_1=\pm\frac{1+\sqrt{5}}{2}\sqrt{\frac{5-\sqrt{5}}{20}}\\
x_2=\pm\sqrt{\frac{5-\sqrt{5}}{20}}\\
x_3=\mp\sqrt{\frac{5-\sqrt{5}}{20}}\\
x_4=\mp\frac{1+\sqrt{5}}{2}\sqrt{\frac{5-\sqrt{5}}{20}}\\
\end{equation}
Note that there are four solutions but only these two are maximum.
