What I would like to do
I have the following latex snippet and I would like to centre the last line = \cos\theta + i\sin\theta
without having to exit this latex section as that creates giant gap between the equations.
$$
\begin{aligned}
e^{i\theta} & =1+\mathrm{i}\theta+\frac{(\mathrm{i}\theta)^{2}}{2!}+\frac{(\mathrm{i}\theta)^{3}}{3!}+\frac{(\mathrm{i}\theta)^{4}}{4!}+\frac{(\mathrm{i}\theta)^{5}}{5!}+\frac{(\mathrm{i}\theta)^{6}}{6!}+\ldots \\
& =1+\mathrm{i}\theta+\frac{\mathrm{i}^{2}\theta^{2}}{2!}+\frac{\mathrm{i}^{3}\theta^{3}}{3!}+\frac{\mathrm{i}^{4}\theta^{4}}{4!}+\frac{\mathrm{i}^{5}\theta^{5}}{5!}+\frac{\mathrm{i}^{6}\theta^{6}}{6!}+\ldots \\
& =1+\mathrm{i}\theta-\frac{\theta^{2}}{2!}-\frac{\mathrm{i}\theta^{3}}{3!}+\frac{\theta^{4}}{4!}+\frac{\mathrm{i}\theta^{5}}{5!}-\frac{\theta^{6}}{6!}+\ldots \\
& =\left(1-\frac{\theta^{2}}{2!}+\frac{\theta^{4}}{4!}-\frac{\theta^{6}}{6!}+\ldots\right)+\mathrm{i}\left(\theta-\frac{\theta^{3}}{3!}+\frac{\theta^{5}}{5!}-\ldots\right) \\
\\
= \cos\theta + i\sin\theta
\end{aligned}
$$
Things I have tried
I have tried to simply put it after the \end{aligned} but no matter what latex environment it’s placed in after that it its put off to the side in the.
I’ve also tried using the gather*/gather environment but that ruins the alignment of what I currently have and putting an aligned environment within a gather doesn’t work either.
Using array environment doesn’t work either so far it also changes the formatting of the previous stuff.