Find all $\theta$ such that sin$\theta$ and cos$\theta$ are both rational number. 
Find all $\theta$ such that sin$\theta$ and cos$\theta$ are both rational number.

I thought this question might have been asked by someone else, but I couldn't find any.
Currently I'm studying Pythagorean triple, so naturally I put $X$=cos$\theta$ and $Y$=sin$\theta$, then
$$X^2 +Y^2 =1: X,~Y \in \Bbb{Q}$$
By using graph or from the graphical proof of Pythagorean triple, one can show that 
$$X=\frac{a^2-b^2}{a^2+b^2},~Y=\frac{2ab}{a^2+b^2}$$
where $(a, b)=1$. But then, we have to find $\theta$ which makes $X$ and $Y$ in that form. So I got stuck. I've thought of using the inverse trigonometric function, but we still have two equations then. So I was wondering if there is any simpler way to express $\theta$ which satisfies the given condition. I'm even more confused because I don't have the answer!
Thanks.
 A: We get a slightly more convenient form if we use a different parametrisation of the unit circle (minus the point $-1$), namely
$$f \colon t \mapsto \frac{1 + it}{1 - it} = \frac{1-t^2}{1+t^2} + i\frac{2t}{1+t^2}$$
for $t \in \mathbb{R}$. This corresponds to writing your $X$ and $Y$ in terms of $\frac{b}{a}$ instead of using the two parameters $a$ and $b$. So it's not really a different parametrisation.
Then $f(t)$ is a rational point on the unit circle if and only if $t$ is rational. Clearly, if $t$ is rational then both $\frac{1-t^2}{1+t^2}$ and $\frac{2t}{1+t^2}$ are rational since $\mathbb{Q}$ is a field. And if $\frac{1-t^2}{1+t^2} = q$ is rational, then $-1 < q \leqslant 1$, and we find that $t^2 = \frac{1-q}{1+q}$ is rational. Then, if also $\frac{2t}{1+t^2} = r$ is rational, it follows that
$$t = \frac{1+t^2}{2}\cdot r = \frac{r}{1+q}$$
is rational.
On the other hand, for $\lvert \theta\rvert < \pi$ we have
$$f\biggl(\tan \frac{\theta}{2}\biggr) = \frac{1 + i\tan \frac{\theta}{2}}{1 - i \tan \frac{\theta}{2}} = \frac{\cos \frac{\theta}{2} + i \sin \frac{\theta}{2}}{\cos \frac{\theta}{2} - i \sin \frac{\theta}{2}} = \frac{\exp\bigl(i\frac{\theta}{2}\bigr)}{\exp\bigl(-i\frac{\theta}{2}\bigr)} = e^{i\theta} = \cos \theta + i\sin \theta.$$
So $\cos \theta$ and $\sin \theta$ are both rational for $\lvert\theta\rvert < \pi$ if and only if $\tan \frac{\theta}{2}$ is rational. That is, if and only if
$$\theta = 2\arctan r$$
for some $r \in \mathbb{Q}$. Add the left-out $\theta = \pi$ and extend by periodicity to get the full set of all $\theta \in \mathbb{R}$ for which $\cos \theta$ and $\sin \theta$ are both rational.
