Taylor/Maclaurin series type question I want to express $\cos(z)$ in a Taylor series centred on $z_0=\frac{\pi}{4}$.
Using the formula $\sum_{k=0}^{\infty} \dfrac{f^{(k)}(z_0)z^k}{k!}
$ and the fact that $f^{(k)}(z)=\cos(z+\frac{k\pi}{2})$ in this case I found that the Taylor series is $$\sum_{k=0}^{\infty} \frac{\cos(\frac{\pi}{4}+\frac{k\pi}{2})}{k!} (z-\frac{\pi}{4})^k$$ which is also what Wolfram Alpha claims the Taylor series to be.
I decided I wanted to get this Taylor series another way. Instead of plugging stuff into the formula directly, I wanted to work from the Maclaurin series of $\cos(z)$ to get the Taylor series. This is what I have so far:
$$\cos(z)=\cos(z-\frac{\pi}{4}+\frac{\pi}{4})\\=\cos(z-\frac{\pi}{4})\cos(\frac{\pi}{4})-\sin(z-\frac{\pi}{4})\sin(\frac{\pi}{4})\\=\frac{1}{\sqrt{2}}\cos(z-\frac{\pi}{4})-\frac{1}{\sqrt{2}}\sin(z-\frac{\pi}{4})\\=\frac{1}{\sqrt{2}}(\sum_{k=0}^{\infty} (-1)^k\frac{(z-\frac{\pi}{4})^{2k}}{(2k)!}-\sum_{k=0}^{\infty} (-1)^k\frac{(z-\frac{\pi}{4})^{2k+1}}{(2k+1)!})\\=\frac{1}{\sqrt{2}}\sum_{k=0}^{\infty} [(-1)^k\frac{(z-\frac{\pi}{4})^{2k}}{(2k)!}(1-\frac{z-\frac{\pi}{4}}{2k+1})]$$
But I don't know how to simplify this to get $\sum_{k=0}^{\infty} \frac{\cos(\frac{\pi}{4}+\frac{k\pi}{2})}{k!} (z-\frac{\pi}{4})^k$.
If somebody could help me out I'd really appreciate it!
 A: It is convenient to continue your calculation one line before the last line.
Note, that
\begin{align*}
  \cos(z)=\frac{1}{\sqrt{2}}
  \sum_{k=0}^\infty\frac{(-1)^k}{(2k)!}\left(z-\frac{\pi}{4}\right)^{2k}
  - \frac{1}{\sqrt{2}}
  \sum_{k=0}^\infty\frac{(-1)^k}{(2k+1)!}\left(z-\frac{\pi}{4}\right)^{2k+1}\tag{1}
  \end{align*}
is a representation in even and odd part of a series according to
\begin{align*}
  \sum_{k=0}^\infty a_k\frac{z^k}{k!}
  =\sum_{k=0}^\infty a_{2k}\frac{z^{2k}}{(2k)!}+\sum_{k=0}^\infty a_{2k+1}\frac{z^{2k+1}}{(2k+1)!}
  \end{align*}

We can merge the series in (1) and obtain
  \begin{align*}
\cos(z)=\frac{1}{\sqrt{2}}
  \sum_{k=0}^\infty\frac{(-1)^{s(k)}}{k!}\left(z-\frac{\pi}{4}\right)^k  
  \end{align*}
  with
  \begin{align*}
  s(k)=\begin{cases}
  1\quad&k\equiv 0,3(4)\\
  -1\quad&k\equiv 1,2(4)\\
  \end{cases}\qquad\qquad \qquad k\geq 0
  \end{align*}
Since $$\frac{1}{\sqrt{2}}(-1)^{s(k)}=\cos\left(\frac{\pi}{4}+\frac{k\pi}{2}\right)\qquad\qquad\quad\ \  k\geq 0$$
  the claim follows.

