A question in Larson "Calculus" asks for the Taylor series centered at $\frac{\pi}{4}$ of $\cos(x)$.
This expands to:
$a_n = \frac{\sqrt{2}}{2} - \frac{\sqrt{2}}{2}(x - \frac{\pi}{4}) - \frac{\sqrt{2}}{2}(x - \frac{\pi}{4})^2(\frac{1}{2!}) + \frac{\sqrt{2}}{2}(x - \frac{\pi}{4})^3(\frac{1}{3!}) + \dots$
Which is:
$a_n = \frac{\sqrt{2}}{2}\sum_{n=0}^{\infty}\frac{(-1)^z}{n!}\left(x - \frac{\pi}{4}\right)^n$
But $z$ is unknown...because of the way the derivative of $cos(x)$ oscillates in sign, to get a serial summation I need to find a way to represent the following series:
$\{+1, -1, -1, +1, +1, \dots\} = (-1)^z$ where $z$ is an unknown function of $n$.
The textbook gives $z = n(n+1)/2$. However, it provides no explanation of how it arrived at this value. Is there a technique I can use to find the function of $z$ I need given any particular sign pattern?