<s>[INST] Solving the following trigonometric equation: $\sin x + \cos x = \frac{1}{3} $ I have to solve the following equation:
$$\sin x + \cos x = \dfrac{1}{3} $$
I use the following substitution:
$$\sin^2 x + \cos^2 x = 1  \longrightarrow \sin x = \sqrt{1-\cos^2 x}$$
And by operating, I obtain:
$$ \sqrt{(1-\cos^2 x)} = \dfrac{1}{3}-\cos x$$
$$ 1 - \cos^2 x = \dfrac{1}{9} + \cos^2 x - \dfrac{2}{3}\cos x$$
$$ -2\cos^2 x + 2/3\cos x +\dfrac{8}{9}=0$$
$$ \boxed{\cos^2 x -\dfrac{1}{3}\cos x -\dfrac{4}{9} = 0}$$
Can I just substitute $\cos x$ by $z$ and solve as if it was a simple second degree equation and then obtain $x$ by taking the inverse cosine? I have tried to do this but I cannot get the right result. If I do this, I obtain the following results:
$$ z_1 = -0.520517 \longrightarrow  x_1 = 121.4º\\
z_2= 0.8538509 \longrightarrow x_2 = 31.37º$$
I obtain $x$ from $z$ by taking the inverse cosine.
The correct result should be around 329º which corresponds to 4.165 rad. My question is if what I am doing is wrong because I have tried multiple times and I obtain the same result (or in the worst case, I have done the same mistake multiple times).
 [/INST] we have after squaring $$\sin(x)^2+\cos(x)^2+\sin(2x)=\frac{1}{9}$$ or $$\sin(2x)=-\frac{8}{9}$$
the answer is $$c_1\in \mathbb{Z}\land \left(x=2 \pi  c_1+2 \tan ^{-1}\left(\frac{1}{10}
   \left(9-\sqrt{161}\right)\right)\lor x=2 \pi  c_1+2 \tan
   ^{-1}\left(\frac{1}{10} \left(9+\sqrt{161}\right)\right)\right)$$
</s>