<s>[INST] How to solve $\sin(x) = \pm a$ for $a \not = 0$? I was solving the below equation: $\left|\sqrt{2\sin^2x  + 18 \cos^2x} - \sqrt{2\cos^2x  + 18 \sin^2x} \right| = 1$ for $x \in [0, 2\pi]$.
My attempt:
$$\begin{align}&\left|\sqrt{2\sin^2x  + 18 \cos^2x} - \sqrt{2\cos^2x  + 18 \sin^2x} \right| = 1\\\implies& \left|\sqrt{2\sin^2x  + 2 \cos^2x + 16\cos^2x} - \sqrt{2\cos^2x  + 2 \sin^2x + 16\sin^2x} \right| = 1
\\\implies& \left|\sqrt{2(\sin^2x  + \cos^2x) + 16\cos^2x} - \sqrt{2(\cos^2x  +  \sin^2x) + 16\sin^2x} \right| = 1
\\\implies& \left|\sqrt{2+ 16\cos^2x} - \sqrt{2 + 16\sin^2x} \right| = 1\end{align}$$
Squaring both sides,
$$\begin{align}\implies& (2+ 16\cos^2x) + (2 + 16\sin^2x) - 2\sqrt{(2+ 16\cos^2x) (2 + 16\sin^2x)} = 1
\\\implies& 4 + 16(\sin^2x + \cos^2x) - 2\sqrt{2\cdot 2 \cdot (1+ 8\cos^2x) (1+ 8\sin^2x)} = 1
\\\implies &20 - 4\sqrt{1+8\cos^2x + 8\sin^2x + 8^2 \sin^2x \cos^2x } = 1
\\\implies &19 = 4\sqrt{1+8(\cos^2x + \sin^2x) + 16 \cdot (2\sin x \cos x)^2 }
\\\implies &\frac{19}{4} = \sqrt{9 + 16 \cdot (2\sin x \cos x)^2 }
\\\implies &\frac{19}{4} = \sqrt{9 + 16 \sin^2(2x) }\end{align}$$
Again squaring both sides,
$$\begin{align}\implies& \frac{361}{16} = 9 + 16 \sin^2(2x)
\\\implies& \frac{361}{16} - 9 =  16 \sin^2(2x)
\\\implies &\frac{361 - 144}{16} =  16 \sin^2(2x)
\\\implies& \frac{217}{256} =  \sin^2(2x)
\\\implies& \pm\frac{\sqrt{217}}{16} =  \sin(2x)\end{align}$$

Now I'm not getting any way to solve this equation. Although the question states to find only the solutions in the interval $[0, 2\pi]$, can we find the general form for all the solutions in $\mathbb{R}$ i.e. for all real numbers?
Desmos shows that there are $8$ solutions over the interval $[0, 2\pi]$.
 [/INST] Use abbreviation $s = \sin x$ and $1-s^2 = \cos^2x$:
$$\begin{align}
1 
&= \left|\sqrt{2\sin^2x + 18 \cos^2x} - \sqrt{2\cos^2x + 18 \sin^2x} \right|  \\
&= \Big |\sqrt{2s^2+18(1-s^2)} - \sqrt{2(1-s^2) + 18 s^2} \Big| \\
&= \Big |\sqrt{18-16s^2} - \sqrt{2+16s^2} \Big| \\
&= \Big (\sqrt{18-16s^2} - \sqrt{2+16s^2} \Big)^2 \tag 1\\
&= 20 -2\sqrt{(18-16s^2)(2+16s^2)} \\
\end{align}$$
where $(1)$ squared the whole equation. Then isolate the square-root and square again to get rid of the root:
$$\begin{align}
4\cdot(18-16 s^2)\cdot(2+16s^2) &= 19^2 \tag 2\\
\end{align}$$
The absolute value on the left side can be dropped in $(2)$ assuming $|s^2|\leqslant1$, i.e. $x$ is real and the factors on the left side are positive.  What remains is quadratic in $s^2$ which has 4 solutions:
$$s=\pm\frac14\sqrt{8\pm\frac{\sqrt{39}}2} \tag 3$$
Now it's clear that when $x$ is a solution, then
$-x$ and $\pi/2-x$ and $x\pm\pi$ are also solutions.  This is because the original equation does not change under respective transformations.
So let $x_0$ be the smallest, non-negative solution, i.e.
$$x_0\approx 0.5849127361226382 \approx \arcsin(0.5521266272786072)$$
then all solutions are
$$\pm x_0+\frac\pi2 \Bbb Z\tag 4$$

*

*The 4 solutions that are in $[-\pi/2, \pi/2)$ are, in ascending order:
$-\pi/2+x_0, -x_0, x_0, \pi/2-x_0$.


*The 4 solutons that are in $[0, \pi)$: $x_0, \pi/2-x_0, \pi/2+x_0, \pi-x_0$.


*The 8 solutons that are in $[0, 2\pi)$: $x_0, \pi/2-x_0, \pi/2+x_0, \pi-x_0, \pi+x_0, 3\pi/2-x_0, 3\pi/2+x_0, 2\pi-x_0$.
As $(3)$ is constructible with straightedge and compass, so are the angles $x$ that are solutions.
</s>