sum of series $\sum_{k = 0}^n (-1/4)^k \cos((\pi/4) k)$ What is the sum of series $$\sum_{k=0}^n \left(-\frac14\right)^k \cdot \cos \left(\frac{k\pi}4\right) \text{ ?}$$
I was trying to see over some inputs its behavior: (to see if cos has some interesting information) for $n=1: (1/2)^{0.5}$, $n=2:0$,   $n=3$: $-(1/2)^{0.5}$ $n=4: -1$, $n=5:-(1/2)^{0.5}$, $n=6$: $(3/4)^{0.5},\ldots$ but with no conclusions. It reminds a bit of fourier series, but it isn't a function of $x$.
 A: Consider the series
\begin{align}
S_{n}(x) = \sum_{k=0}^{n} e^{\frac{i k \pi}{4}} x^{k}
\end{align}
It can quickly be determined that
\begin{align}
S_{n}(x) = \frac{1 - e^{- \pi i/4} x - e^{(n+1) \pi i/4} x^{n+1} + e^{n \pi i/4} x^{n+2} }{ 1 - \sqrt{2} x + x^{2}}. 
\end{align}
Taking the real part leads to, where $Re(S_{n}(x))$ is the desired series,
\begin{align}
\sum_{k=0}^{n} \cos\left(\frac{k \pi}{4} \right) \, x^{k} = \frac{1 - \cos(\pi/4) x - \cos((n+1) \pi/4) x^{n+1} + \cos(n \pi/4) x^{n+2} }{ 1 - \sqrt{2} x + x^{2}}.
\end{align}
Taking the imaginary part leads to
\begin{align}
\sum_{k=0}^{n} \sin\left(\frac{k \pi}{4} \right) \, x^{k} = - \frac{x}{\sqrt{2}} \, \frac{1 + \sqrt{2} \left(\sin\left(\frac{(n+1)\pi}{4} \right) 
- \sin\left(\frac{n\pi}{4} \right) x \, \right) x^{n+1} }{ 1 - \sqrt{2} x + x^{2}}.
\end{align}
If $x \to \frac{1}{x}$ then the series becomes
\begin{align}
\sum_{k=0}^{n} \cos\left(\frac{k \pi}{4} \right) \, \left(\frac{1}{x}\right)^{k} = \frac{x^{n+1} \left(x - \frac{1}{\sqrt{2}} \right) - x \cos\left(\frac{(n+1) \pi}{4}\right) + \cos\left(\frac{n \pi}{4}\right)}{ 
(1 - \sqrt{2} x + x^{2}) \, x^{n} }.
\end{align}
When $x = -1/4$ the result becomes
\begin{align}
\sum_{k=0}^{n} \cos\left( \frac{k \pi}{4} \right) \, \left( \frac{-1}{4} \right)^{k} = \frac{1}{17 + 2 \sqrt{2}} \, \left[ 16 + 2 \sqrt{2} + \frac{(-1)^{n}}{4^{n}} \left( 4 \cos\left( \frac{(n+1) \pi}{4} \right) + \cos\left( \frac{n \pi}{4} \right) \right) \right]
\end{align}
and
\begin{align}
\sum_{k=0}^{n} \sin\left( \frac{k \pi}{4} \right) \, \left( \frac{-1}{4} \right)^{k} = \frac{1}{8 + 17 \sqrt{2}} \, \left[ 2 \sqrt{2} + \frac{(-1)^{n}}{4^{n}} \left( 4 \sin\left( \frac{(n+1) \pi}{4} \right) + \sin\left( \frac{n \pi}{4} \right) \right) \right].
\end{align}
For the case $x = -4$ the series become
\begin{align}
\sum_{k=0}^{n} \cos\left( \frac{k \pi}{4} \right) \, (-4)^{k} = \frac{1}{17 + 4 \sqrt{2}} \, \left[ 1 + 2 \sqrt{2} + (-4)^{n} \left( \cos\left( \frac{(n+1) \pi}{4} \right) + 4 \cos\left( \frac{n \pi}{4} \right) \right) \right]
\end{align}
A: There's a sequence of 4 terms here that repeats. The first 4 terms are:
$$\sum_{k=0}^{3} = 1 -\frac{\sqrt{2}}8 + 0 + \frac{\sqrt{2}}{128} = \frac{128 - 15\sqrt{2}}{128}$$
The next 4 terms are just that sum divided by $-4^4 = -256$ and so on. So it's just a simple geometric series:
$$\sum_{k=0}^{\infty} = \frac{a}{1-r} = \frac{128 - 15\sqrt{2}}{128}\cdot\frac{256}{257} = \frac{256 - 30\sqrt{2}}{257} \approx 0.83103$$
