So, knowing that $$f(x) = \sum_{n=0}^\infty \frac{f^n(a)(x-a)^n}{n!}$$
For my case I write $$\cos(2x) = \sum_{n=0}^\infty \frac{\frac{d^n(cos(\frac{\pi}{4}))}{d(\frac{\pi}{8})^n}(x-\frac{\pi}{8})^n}{n!}$$
I would now like to derive the sum formula for my specific case, for which I suppose I would have to derive the $n^{th}$ derivative.
I couldn't quite see a single clear pattern when deriving each derivative or each term of the sequence (although there seems to be one in derivatives, same doesn't hold for terms): $$f(\frac{\pi}{8}) = \frac{1}{\sqrt2}$$ $$f'(\frac{\pi}{8}) = -\sqrt2$$ $$f''(\frac{\pi}{8}) = -2\sqrt2$$ $$f'''(\frac{\pi}{8}) = 4\sqrt2$$
$\cos(2x) = \frac{1}{\sqrt2} - \sqrt2(x-\frac{\pi}{8}) - \sqrt2(x-\frac{\pi}{8})^2 + \frac{2}{3}\sqrt2(x-\frac{\pi}{8})^3 + \frac{1}{3}\sqrt2(x-\frac{\pi}{8})^4 - \frac{2}{15}\sqrt2(x-\frac{\pi}{8})^5 ...$
I also found that for $f(x) = \cos(ax)$
$f^{(n)} (x)=(-a^2)^{(n-1)/2}(-a)\sin ax,$ for $n$ odd
and $f^{(n)} (x)=(-a^2)^{n/2}\cos ax,$ for $n$ even from this answer:
https://math.stackexchange.com/q/2536056 by John Doe (https://math.stackexchange.com/users/399334/john-doe)
But while it reduces to a simpler form for my case where $a = \frac{\pi}{8}$, I still can't get my head around uniting all this into a single formula forth both odd and even values of $n$.
Any help appreciated!