# Alternative of finding theta when sin $\theta$ and cos $\theta$ are given

For example, we're given a problem in which sin $\theta = \sqrt3/2$ and cos $\theta = -1/2$. To find out the angle $\theta$, I look at the unit circle and I get the answer. However, I was just curious whether there's an alternative to this, any idea? Because when I tried using cos(-$\theta$) = cos$\theta$, I get the wrong value of $\theta$ as we've been provided with the value of sin $\theta$ as well...

$$\sin\theta=\frac{\sqrt3}2=\sin\frac\pi3\implies\theta=n\pi+(-1)^n\frac\pi3$$ where $n$ is any integer
Set $n=2s+1,$(odd) $=2s$(even) one by one
Again, $$\cos\theta=-\frac12=-\cos\frac\pi3=\cos\left(\pi-\frac\pi3\right)$$ $$\implies\theta=2m\pi\pm\left(\pi-\frac\pi3\right)$$ where $m$ is any integer
Observe that the intersection of the above two solutions is $$\theta=2r\pi+\frac{2\pi}3$$ where $r$ is any integer
The given data determine $\theta$ up to an additive multiple of $2\pi$. When $\cos\theta\ne-1$ the principal value $\theta\in\ ]{-\pi},\pi[\$ can be found using the formula $$\tan{\theta\over2}={\sin\theta\over 1+\cos\theta}\ ,$$ which leads to $$\theta=2\arctan{\sin\theta\over 1+\cos\theta}\ .$$ In your example we get $$\theta=2\arctan{{\sqrt{3}\over2}\over 1-{1\over2}}=2\arctan\sqrt{3}={2\pi\over3}\ .$$