<s>[INST] $(1+i)$ to the power $n$ 
Possible Duplicate:
Complex number: calculate $(1 + i)^n$. 

I came across a difficult problem which I would like to ask you about:
Compute
$ (1+i)^n $ for $ n \in \mathbb{Z}$
My ideas so far were to write out what this expression gives for $n=1,2,\ldots,8$, but I see no pattern such that I can come up with a closed formula.
Then I remember that one can write any complex number $a+bi$ like:
$$(a+bi)=\sqrt{a^2+b^2} \cdot \left( \frac{a}{\sqrt{a^2+b^2}}+\frac{b}{\sqrt{a^2+b^2}}\cdot i\right)$$
and $\frac{a}{\sqrt{a^2+b^2}} = \cos(\phi)$ and $\frac{b}{\sqrt{a^2+b^2}} = \sin(\phi)$  where $\phi$ is $\arctan{\frac{b}{a}} $
So it becomes, 
$(a+bi)=\sqrt{a^2+b^2} \cdot ( \cos(\phi)+\sin(\phi)\cdot i)$ Taking this entire thing to the power $n$ using De Moivre
$$(a+bi)^n=(\sqrt{a^2+b^2})^n \cdot ( \cos(n\phi)+\sin(n\phi)\cdot i)$$
Substituting my $a=1$ and $b=1$
$(1+i)^n=(\sqrt{2})^n \cdot ( \cos(n\cdot\frac{\pi}{4})+\sin(n\cdot\frac{\pi}{4})\cdot i)$
$\phi$ is 45 degrees hence $\frac{\pi}{4}$
But now I don't know how to continue further and I would really appreciate any help! Again, Im looking for a closed formula depending on n.
Best regards
 [/INST] I think you are making this much too difficult, because:
$$(1+i)^2 = 2i.$$  
So $(1+i)^{2m} = (2i)^m = 2^mi^m$. 
That takes care of the even powers of $1+i$.
For the odd powers, just multiply by $1+i$ again: $(1+i)^{2m+1} = (1+i)^{2m}(1+i) = 2^mi^m(i+1)$. 

If you want to simplify further, you need to know the remainder when $m = \bigl\lfloor \frac n2 \bigr\rfloor$ is divided by 4, so that you can reduce the $i^m$ part.
Say $n$ is even, and $m=n/2 = 4k+j$, where $0\le j<3$; then $n=8k+2j$:
$$\begin{array}{ll}
j & (1+i)^{n=8k+2j} \\
\hline
0 & \hphantom{-}2^m   \\
1 & \hphantom{-}2^mi \\
2 & -2^m \\
3 & -2^mi
\end{array}$$
If $n$ is odd, and $m=(n-1)/2 = 4k+j$, where $0\le j<3$, then $n=8k+2j+1$:
$$\begin{array}{ll}
j & (1+i)^{n=8k+2j+1} \\
\hline
0 & \hphantom{-}2^m+2^mi   \\
1 & -2^m+2^mi \\
2 & -2^m-2^mi \\
3 & \hphantom{-}2^m-2^mi
\end{array}$$
Putting these together into one table, we can just say that $n=8k+j'$, where $0\le j'\lt 8$:
$$\begin{array}{lrl}
j' & (1+i)^{n=8k+j'} \\
\hline
0 & \hphantom{-}2^m &  \\
1 & \hphantom{-}2^m&+2^mi   \\
2 & &\hphantom{-}2^mi \\
3 & -2^m&+2^mi \\
4 & -2^m& \\
5 & -2^m&-2^mi \\
6 & &-2^mi \\
7 & \hphantom{-}2^m&-2^mi
\end{array}$$
(And remember $m=\bigl\lfloor \frac n2 \bigr\rfloor$.)
</s>