Real and imaginary parts of $(x + iy)^n$ For $z = x + iy$, we have, for example:
$\Re (z)=x$ and $\Im (z)=y$
$\Re (z^2)= x^2-y^2$ and $\Im (z^2)=2xy$
$\Re(z^3)=x^3-3xy^2$ and $\Im (z^3)=3yx^2-y^3$
I know that I have seen the formulas for $\Re (z^n)$ and $\Im (z^n)$ as explicit functions of $x$ and $y$ (polynomials in two variables, $x$ and $y$) in one book, but I do not know where that book is. So:

What are the formulas for $\Re (z^n)$ and $\Im (z^n)$?

 A: Well, assuming that $\text{n}\in\mathbb{R}$:
$$\text{z}^\text{n}=\left(\left|\text{z}\right|e^{\left(\arg\left(\text{z}\right)+2\pi\text{k}\right)i}\right)^\text{n}=\left|\text{z}\right|^\text{n}\cdot e^{\text{n}\left(\arg\left(\text{z}\right)+2\pi\text{k}\right)i}\tag1$$
Where $\text{k}\in\mathbb{Z}$ and $0\le\arg\left(\text{z}\right)<2\pi$
Now, use Euler's formula:
$$\text{z}^\text{n}=\left|\text{z}\right|^\text{n}\cdot\cos\left(\text{n}\left(\arg\left(\text{z}\right)+2\pi\text{k}\right)\right)+\left|\text{z}\right|^\text{n}\cdot\sin\left(\text{n}\left(\arg\left(\text{z}\right)+2\pi\text{k}\right)\right)i\tag2$$
A: Expanding $(x + i y)^n$ with the binomial formula gives
$$(x + i y)^n = \sum_{k = 0}^n {n \choose k} x^{n - k} (iy)^k $$
Now, we can split the sum into real and imaginary parts using $i^{2 k} = (-1)^k$ and $i^{2 k + 1} = (-1)^k i$:
$$(x + i y)^n = \underbrace{\sum_{\begin{array}{c}k = 0 \\ k \equiv 0 \pmod 2\end{array}}^{n} (-1)^{k / 2} {n \choose k} x^{n - k} y^k}_{\Re [(x + iy)^n]} + i \underbrace{\sum_{\begin{array}{c}k = 0 \\ k \equiv 1 \pmod 2\end{array}}^{n} (-1)^{(k - 1) / 2} {n \choose k} x^{n - k} y^k}_{\Im [(x + iy)^n]} .$$
One can eliminate the modulus conditions $k \equiv r \pmod 2$ in the summations by reindexing. For example,
$$\Re[(x + iy)^n] = \sum_{j = 0}^{\lfloor\frac{n}{2}\rfloor} (-1)^j {n \choose 2j} x^{n - 2j} y^{2j} .$$
These formulas tell us, by the way that we can read the coefficients off of Pascal's Triangle. For each $n$, the coefficients of the real part are given by looking at the $n$th row of Pascal's Triangle (here, we take the initial row, $1$ to be the $0$th row), and reading off every other entry with alternating signs, starting with the first. For the imaginary part, we do the same, but starting with the second entry. For example, for $n = 4$, the corresponding row is
$$\matrix{\color{blue}{1} & \color{red}{4} & \color{blue}{6} & \color{red}{4} & \color{blue}{1}} .$$
Our algorithm then tells us that we can read off these coefficients to give
$$\Re[(x + iy)^4] = + \color{blue}{1} x^4 - \color{blue}{6} x^2 y^2 + \color{blue}{1} y^4 = x^4 - 6 x^2 y^2 + y^4$$
and
$$\Im[(x + iy)^4] = + \color{red}{4} x^3 y - \color{red}{4} x y^3 = 4 x^3 y - 4 x y^3 .$$
A: By the Binomial theorem,
$$(x+iy)^n=\sum_{k=0}^n\binom nk x^{n-k}(iy)^{k}.$$
The real part is made of the even terms (even powers of $i$)
$$\Re (x+iy)^n=\sum_{k=0}^{2k\le n}\binom n{2k} x^{n-2k}(iy)^{2k}=\sum_{k=0}^{2k\le n}\binom n{2k} x^{n-2k}(-1)^ky^{2k}.$$
The imaginary part is made of the odd terms, with a factor $i$ dropped
$$\Im (x+iy)^n=\sum_{k=0}^{2k+1\le n}\binom n{2k+1} x^{n-2k-1}(iy)^{2k}=\sum_{k=0}^{2k+1\le n}\binom n{2k+1} x^{n-2k}(-1)^ky^{2k}.$$

Operationally,


*

*expand $(x+y)^n$ using Pascal's triangle,

*take every other term apart (the first term goes to the real part),

*alternate the signs (the first terms are positive).
