<s>[INST] Grouping the real and imaginary terms in the proof of Euler's formula using the MacLaurin series The MacLaurin series:
\begin{align}
\sin x&=\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n+1)!}x^{2n+1}=x-\frac{x^3}{3!}+\frac{x^5}{5!}-\cdots
\\\\
\cos x&=\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n)!}x^{2n}=1-\frac{x^2}{2!}+\frac{x^4}{4!}-\cdots
\\\\
e^z&=\sum_{n=0}^{\infty}\frac{z^n}{n!}=1+z+\frac{z^2}{2!}+\frac{z^3}{3!}+\cdots
\end{align}
Substitute $z=ix$ in the last series:
\begin{align}
e^{ix}&=\sum_{n=0}^{\infty}\frac{(ix)^n}{n!}=1+ix+\frac{(ix)^2}{2!}+\frac{(ix)^3}{3!}+\cdots
\\\\
&=1+ix-\frac{x^2}{2!}-i\frac{x^3}{3!}+\frac{x^4}{4!}+i\frac{x^5}{5!}-\cdots
\\\\
&=1-\frac{x^2}{2!}+\frac{x^4}{4!}+\cdots +i\left(x-\frac{x^3}{3!}+\frac{x^5}{5!}-\cdots\right)
\\\\
&=\cos x+i\sin x
\end{align}
My question is how do we group $1-\frac{x^2}{2!}+\frac{x^4}{4!}+\cdots$ and $+i\left(x-\frac{x^3}{3!}+\frac{x^5}{5!}-\cdots\right)$ or how do we apply the fact that if a series is absolutely convergent, then every rearrangement of
the series converges to the same sum? It seems like $1-\frac{x^2}{2!}+\frac{x^4}{4!}+\cdots +i\left(x-\frac{x^3}{3!}+\frac{x^5}{5!}-\cdots\right)$ corresponds to $\mathbb{N}\times\mathbb{N}$.
 [/INST] If $\sum_{n=1}^{\infty}a_n = L$, then so is $\sum_{n=1}^{\infty}b_n=L$ for $b_n = a_{n/2}$ if $n$ is even, and $0$ if $n$ is odd. This is because $$\sum_{n=1}^{2N}b_n = \sum_{n=1}^{2N+1}b_n = \sum_{n=1}^{N}a_n\to L$$ as $N\to\infty$. Hence from the convergence of series for cosine and sines, we have \begin{align*}&\left(1-\frac{x^2}{2}+\frac{x^4}{4!}-\cdots\right)+i\left(x-\frac{x^3}{3!}+\frac{x^5}{5!}-\cdots\right) \\ &= \left(1+0-\frac{x^2}{2}+0+\frac{x^4}{4!}+\cdots\right)+\left(0+ix+0-\frac{ix^3}{3!}+0+\frac{ix^5}{5!}+\cdots\right)\\ &= 1+ix-\frac{x^2}{2}-\frac{ix^3}{3!}+\frac{x^4}{4!}+\frac{ix^5}{5!}+\cdots\\ &= e^{ix}\end{align*} by just summing two series like $\sum(a_n+b_n) = \sum a_n+\sum b_n$.
</s>