Raising a complex number to integer and complex powers

This came out on today's test: "Under what condition(s) is $a^b$ a real number, if $a$ is a complex number and $b$ is a positive integer?" And of course, the bonus extension: "In general, under what condition(s) is $a^b$ a real number, if both $a$ and $b$ are complex numbers?"

For the first part, I did this: $a^b = r^be^{ib\theta}$. So $b\theta = n\pi$ for some positive integer $n$, or for all integer $n$ in general, outside the context of the question. (we could visualize this using the Argand Diagram).

I have, however, no idea where to start for the second part.

It was worth 10 additional marks in the 50 marks paper though. Not sure if the teachers are really serious about it, or just trolling us.

-
For the first part, note that negative integers for $n$ are also allowed, $e^{-i\pi} = e^{i\pi} = -1$ for instance. – AlexR Feb 25 '14 at 13:54
$i^i=e^{-\frac\pi2}$ – Lucian Feb 25 '14 at 13:58
In my experience, I haven't seen any instances of teachers trolling students. More of them derive pleasure from helping rather than tormenting. I can't say the sadists don't exist, but their proportion must be very small in the overall population. – rschwieb Feb 25 '14 at 14:05
– LutzL Feb 25 '14 at 14:07
@LutzL Thanks for the links, though I am not able to apply the contents of the links to the question I've posted, perhaps because it doesn't seem obvious enough to me how they can be used (I just started on complex numbers, you see!). – Yiyuan Lee Feb 25 '14 at 14:09

Note that for $a\ne 0$ $$a^b := \exp(b \cdot \ln(a)) = \exp(b \cdot (\ln(|a|) + i\arg a)) \\ = \exp(\Re b \ln(|a|) - \Im b \arg a + i (\Re b \arg a + \Im b \ln(|a|)))$$ And $\exp(z) \in \mathbb R \Leftrightarrow \Im(z) \in \pi\mathbb Z$. so $$a^b \in \mathbb R \Leftrightarrow \Re b \arg a + \Im b \ln(|a|) \in \pi\mathbb Z$$ If $a=0$ and $\Re b > 0$, $a^b:=0$ can be defined (for $b\in\mathbb R^+$ it is "natural", if $\Im b\ne 0$, some do NOT define it).
For $a=0, \Re b\le 0$, $a^b$ is not defined.
Note that you have to assume $a \ne 0$ in your formulas, for $\Re b > 0$ you additionally have $0^b = 0 \in \mathbb R$. – gammatester Feb 25 '14 at 14:08