# Ask a question about an example in a course note on optimization problem with equality constraint

I have two difficulties on understanding the solution to an example in a course I took this semester on optimization. This example is given to illustrate the usage of Lagrange multiplier method (please see Example 1 in the image below:

{\Large ?}\;\left\{\begin{align*}(x_1-x_2)(x_2-x_3)(x_3-x_1)&=0\\x_1^2+x_2^2+x_3^2&=4\\x_1+x_2+x_3&=1\end{align*}\right. One solution is $$x_1=x_2,\;x_3=1-2x_1,\;2x_1^2+(1-2x_1)^2=4 \\ \left(\dfrac13+\dfrac{\sqrt{22}}6,\;\dfrac13+\dfrac{\sqrt{22}}6,\;\dfrac13-\dfrac{\sqrt{22}}3\right) \\ \left(\dfrac13-\dfrac{\sqrt{22}}6,\;\dfrac13-\dfrac{\sqrt{22}}6,\;\dfrac13+\dfrac{\sqrt{22}}3\right)$$ and permutations of these.

$\underline{\text{Example 2}:}$

$$\begin{array}{ll}\text{minimize}&ax\\\text{subject to}&x_1x_2+x_1x_3+x_2x_3=0\\&x_1^2+x_2^2+x_3^2=1\end{array}$$ Necessary conditions for optimality: \eqalign{&{\Large\Rightarrow}\;\;\;\left\{\begin{array}{l}a_1+\lambda_1(x_2+x_3)+2\lambda_2x_1=0\\a_2+\lambda_1(x_3+x_1)+2\lambda_2x_2=0\\a_3+\lambda_1(x_1+x_2)+2\lambda_2x_3=0\\x_1x_2+x_1x_3+x_2x_3=0\\x_1^2+x_2^2+_3^2=1\end{array}\right.\\ &{\Large\Rightarrow}\;\;\;\left|\begin{matrix}a_1 & x_2+x_3 & x_1 \\ a_2 & x_3+x_1 & x_2 \\ a_3 & x_1+x_2 & x_3\end{matrix}\right|=0\\ &{\Large\Rightarrow}\;\;\;\underbrace{(x_1+x_2+x_3)}_{\neq0}\left|\begin{matrix}a_1 & 1 & x_1 \\ a_2 & 1 & x_2 \\ a_3 & 1 & x_3\end{matrix}\right|=0.}

I marked my question with a red "?" in the image. I can not understand how these two steps comes out. Could you please help me?

I also have the same difficulty for the second example, I hope, after I solve the first example with your help, I can understand the second one myself. But if I still fail to understand it, I'll post it and ask for help here. Sorry for my dullness in math and thank you for any help.

$$3x_1^2+2\lambda_1x_1+\lambda_2=0\\3x_2^2+2\lambda_1x_2+\lambda_2=0\\3x_3^2+2\lambda_1x_3+\lambda_2=0\\$$
$$\begin{pmatrix}3x_1^2&2x_1&1\\3x_2^2&2x_2&1\\3x_3^2&2x_3&1\\\end{pmatrix}\begin{pmatrix}1\\\lambda_1\\\lambda_2\end{pmatrix}=\begin{pmatrix}0\\0\\0\end{pmatrix}$$
Now, it follows that the $3\times 3$ matrix has a nontrivial kernel, so it cannot be invertible. Thus its determinant is $0$. If you calculate its determinant, you'll find it is $6(x_1-x_2)(x_2-x_3)(x_1-x_3)$.