This problem was taken from the AMC 12 2015 contest B.
Rational numbers $a$ and $b$ are chosen at random among all rational numbers in the interval $[0,2)$ that can be written as fractions $\frac{n}{d}$ where $n$ and $d$ are integers with $1 \le d \le 5$. What is the probability that $$(\text{cos}(a\pi)+i\text{sin}(b\pi))^4$$
My approach: By De Moivre's Theorem, this could be rewritten as $4(\cos{4a\pi}+\sin{4b\pi})$. If this number is real, than the imaginary part must be $0$.
This occurs when $4b\pi = \pi{k}$ for any integer $k$. Or $4b = k$. Or $4\frac{p}{q}=k$ (p and q have GCF of $1$). Since $k$ is an integer, $q$ divides 4. So the denominators of the coveted fractions are factors of $4$.
These are the possible values of a or b: $0,1,\frac12,\frac32,\frac13,\frac23,\frac43,\frac53,\frac14,\frac34,\frac54,\frac74,\frac15,\frac25,\frac35,\frac45,\frac65,\frac75,\frac85,\frac95$ (Note that other possible values of n and d are either out of the interval or simplify to the above fractions.)
Out of these there are $8$ that do the job. I felt that no matter what $a$ is, it is only up to $b$ to determine if the number is real.
So I reached a probability of $\frac25$. The answer is $\frac{6}{25}$. Where did I go wrong? Thanks.
Is De Moivre's theorem even applicable at all?