3. Find all values of $\alpha$ for which the sum of the squares of the roots of the equation

$$
x^{2}+(\sin \alpha-1) x-\frac{1}{2} \cos ^{2} \alpha=0
$$

is the greatest. What is that sum?
Solution. From Vieta's formulas, it follows that

\[
\begin{aligned}
x_{1}^{2}+x_{2}^{2} & =\left(x_{1}+x_{2}\right)^{2}-2 x_{1} x_{2} \\
& =[-(\sin \alpha-1)]^{2}-2\left(-\frac{1}{2} \cos ^{2} \alpha\right) \\
& =\sin ^{2} \alpha-2 \sin \alpha+1+\cos ^{2} \alpha \\
& =2-2 \sin \alpha=2(1-\sin \alpha)
\end{aligned}
\]

Thus, $x_{1}^{2}+x_{2}^{2}$ has its maximum value for $\sin \alpha=-1$ and that sum is $2(1+1)=4$.