# Question about Fourier cosine series

I'm trying to find Fourier cosine series for function $$f(x) = \begin{cases} \frac{\pi}{2}-x,\quad &\text{if } x\in\left[0,\frac{\pi}{2}\right) \\ \pi,\quad &\text{if } x\in\left[\frac{\pi}{2},\pi\right] \end{cases}$$ in $$[0,\pi]$$.

I found coefficients $$b_k=0,\quad a_0=\frac{5\pi}{4}\quad \text{and}\quad a_k=\frac{2}{\pi}\cdot\frac{1-\cos\frac{k\pi}{2} + k\pi\sin k\pi - k\pi\sin\frac{k\pi}{2}}{k^2}$$ where $$k\in\mathbb{N}$$, but I don't know how to simplify $$a_k$$ to write cosine series as $$\frac{5\pi}{4}+\sum_{k=1}^{\infty}\ ...\ \cos kx$$ and investigate pointwise convergence in $$[0,\pi]$$.

Can anyone help me with this?

• Finding the coefficients amounts to finding the series. For convergence use the Dirichlet condition Dec 7, 2020 at 21:50

$$a_k=0$$ if $$k$$ is a multiple of $$4$$. $$a_k=\frac 1 {\pi j^{2}}$$ if $$k=2j$$ with $$j$$ odd. $$a_k=\frac 1 {\pi} \frac { 1-(2j-1)\pi(-1)^{j+1}} {(2j-1)^{2}}$$ if $$k=2j-1$$.
In all cases $$|a_k| \leq \frac C {k^{2}}$$ for some $$C$$ so $$\sum |a_k| <\infty$$. This imlies that the Fourier series converges to $$f$$ at very point.