I’m wondering if there is a formula for the value of $(1+i)^n+(1-i)^n$?
I calculated the first terms starting with $n=1$ to be, in order, $2$, $0$, $-4$, $-8$, $-8$, $0$, $16$, $\dots$
So it seems to be some sequence of positive and negative powers of $2$ with $0$s thrown in. Is there a more explicit formulation of what $(1+i)^n+(1-i)^n$ is, based on $n$?
With the binomial theorem, I get it equal to
$$
\sum_{k=0}^n\binom{n}{k}i^{n-k}(1+(-1)^{n-k}).
$$
Can this be made nicer?
Thanks.
Let us avoid the binomial theorem.
Since $1-\mathrm i$ is the conjugate of $1+\mathrm i$, the number $\color{red}{x_n=(1+\mathrm i)^n+(1-\mathrm i)^n}$ is twice the real part of $(1+\mathrm i)^n$.
Since $\frac{1+\mathrm i}{\sqrt2}=\mathrm e^{\mathrm i\pi/4}$, $(1+\mathrm i)^n$ is $(\sqrt2)^n$ times $\mathrm e^{\mathrm in\pi/4}$.
The real part of $\mathrm e^{\mathrm in\pi/4}$ is $\cos(n\pi/4)$.
Thus, $\color{red}{x_n=\ldots}$
First, notice that $1+i = \sqrt2(\cos\frac{\pi}{4} + i \sin\frac{\pi}{4}$) and $1-i = \sqrt2(\cos(-\frac{\pi}{4}) + i \sin(-\frac{\pi}{4}))$.
Using de Moivre’s formula and the fact that $\sin$ is odd and $\cos$ is even, we get
\begin{align*}
(1+i)^n + (1-i)^n &= 2(\sqrt2)^n\cos\frac{n\pi}{4}
\end{align*}
$(1+i)^n+(1-i)^n = 2 \Re ((1+i)^n)$. Now expand $(1+i)^n$ using the binomial theorem. The real part is formed by the odd-numbered terms.
Another approach is to note that $(1+i)/\sqrt{2}$ is an 8-th root of unity and so $(1+i)^n$ depends only on $n \bmod 8$ except for a power of $\sqrt{2}$.
This is not a particularly elegant solution, but an alternative route is to simply note that $(1 \pm i)^2 = \pm 2i$. I will show a lot of steps, but this method involves only very easy calculations. If $n$ is even, then
$$
(1\pm i)^n = \left((1+i)^2\right)^{ \frac{n}{2}}= (\pm 2i)^{n/2} = \left\{ \begin{array}{ccl}
2^{n/2} & & n = 8k
\\
\pm i \cdot 2^{n/2}& & n = 8k +2
\\
i \cdot 2^{n/2} & & n = 8k + 4
\\
\mp i 2^{n/2} & & n = 8k + 6
\end{array} \right.
$$
Hence,
$$(1+i)^n + (1-i)^n =
\left\{
\begin{array}{ccl}
2^{\frac{n}{2}+1} & & n = 8k
\\
0 & & n = 8k+2 \text{ or } n = 8k+6
\\
i \cdot 2^{\frac{n}{2}+1} & & n = 8k + 4
\end{array}
\right.
$$
This is all you need since if $n$ is odd, then $n-1$ is even. For example, when $n = 8k + 1$, we have
$$\begin{align}
(1+i)^n + (1 – i)^n &= (1+i)^{n-1}(1+i) + (1 -i)^{n-1}(1-i)
\\
&= 2^{\frac{n-1}{2}}(1+i) + 2^{\frac{n-1}{2}} (1-i)
\\
&= 2^{\frac{n-1}{2}} + i 2^{\frac{n-1}{2}} + 2 ^{\frac{n-1}{2}} – i 2^{\frac{n-1}{2}}
\\
&= 2\cdot 2^{\frac{n-1}{2}}
\\
&= 2^{\frac{n+1}{2}}.
\end{align}$$
The cases $n = 8k+3$, $n=8k+5$, and $n = 8k + 7$ follow similarly.
Calculate!
$(1+i)^0=1$, so $(1-i)^0=1$, so $(1+i)^0+(1-i)^0=2$.
$(1+i)^1=1+i$, so $(1-i)^1=1-i$, so $(1+i)^1+(1-i)^1=2$ .
$(1+i)^2=2i$, so $(1-i)^2=-2i$, so $(1+i)^2+(1-i)^2=0$.
$(1+i)^3=-2+2i$, so $(1-i)^3=-2-2i$, so $(1+i)^3+(1-i)^3=-4$.
$(1+i)^4=-4$, so $(1-i)^4=-4$, so $(1+i)^4+(1-i)^4=-8$.
Now the game starts all over again. The pattern of the first four entries continues forever, except that every time $n$ is incremented by $4$, we multiply by $-4$, for the simple reason that $(1+i)^4=(1-i)^4=-4$.
Let $n=4k+r$, where $r=0$, $1$, $2$, or $3$.
Then
$(1+i)^n+(1-i)^n=2(-4)^k=(-1)^k 2^{2k+1}$ if $\;r=0\;$ or $\;r=1$.
$(1+i)^n+(1-i)^n=0$ if $\;r=2$.
$(1+i)^n+(1-i)^n=(-4)^{k+1}=(-1)^{k+1}2^{2k+2}$ if $\;r=3$.
Comment: More briefly, since $(1+i)^4=(1-i)^4=-4$, we have
$$(1+i)^{4k+r}=(-4)^k (1+i)^r\qquad\text{and}\qquad (1-i)^{4k+r}=(-4)^k (1-i)^r,$$
and therefore
$$(1+i)^{4k+r}+(1-i)^{4k+r}=(-4)^k\left((1+i)^r+ (1-i)^r \right).$$
Note that the “cases” expression for $(1+i)^n+(1-i)^n$ can be made into a single expression in various ways.
Method somewhat similar to others already posted, but trying to be a little more rigorous while combining ideas from several approaches:
$$(1+i)^n + (1-i)^n$$
$$= \left(\sqrt{2} \exp{\frac{\imath\pi}{4}}\right)^n + \left(\sqrt{2} \exp{\frac{-\imath\pi}{4}}\right)^n$$
$$= 2^{n/2} \left(\exp{\frac{\imath \pi n}{4}} + \exp{ \frac{-\imath \pi n}{4}}\right)$$
$$= 2^{\frac{n+2}{2}} \left( \frac{\exp{\dfrac{\imath \pi n}{4}} + \exp{ \frac{-\imath \pi n}{4}}}{2} \right)$$
$$= 2^{\frac{n+2}{2}} \cosh\dfrac{i\pi n}{4}$$
$$= 2^{\frac{n+2}{2}} \cos\dfrac{\pi n}{4}$$
OP did request that the solution be made “nicer”.
For variety, here’s a sketch of another approach. Let $x_n = (1+i)^n + (1-i)^n$. Then,
$$\begin{align}x_n^2 &= \left( (1+i)^2 \right)^n + \left( (1-i)^2 \right)^n + 2 \left( (1+i)(1-i) \right)^n
\\ &= (2i)^n + (-2i)^n + 2 \cdot 2^n
\\ &= 2^n (2 + i^n + (-i)^n)
\end{align} $$
at which point it’s pretty easy to work out the pattern; the only thing left is to work out the sign on the non-zero terms: i.e. when is the real part of $(1+i)^n$ positive?