Expand in Fourier series the function $$f(x)=\sec(x) \quad x\in(-\pi/4,\pi/4).$$ Hint: Deduce a relation between the coefficients $a_n$ and $a_{n-2}$
Since this function is even, $b_n=0$ and $$a_n=\frac{8}{\pi}\int_0^{\pi/4}\sec(x)\cos(4nx)dx$$ and $$\begin{align} a_{n-2} & = \frac{8}{\pi}\int_0^{\pi/4}\sec(x)\cos(4nx-8x)dx \\ & = \frac{8}{\pi}\int_0^{\pi/4}\sec(x)(\cos(4nx)\cos(8x)+\sin(4nx)\sin(8x))dx \end{align}$$
From here I don't know how to follow the hint, it just get messier and messier, because they all have different arguments.
$$\begin{eqnarray*}\int_{-\pi/4}^{\pi/4}\frac{\cos((4n+4)x)-\cos(4nx)}{\cos x}\,dx &=& -4\int_{\pi/4}^{\pi/4}\sin(x)\sin((4n+2)x)\,dx\\&=&-\frac{4\sqrt{2}(-1)^n}{(4n+2)^2-1}\\&=&-\frac{4\sqrt{2}(-1)^n}{(4n+1)(4n+3)}\\&=&2\sqrt{2}\left(\frac{(-1)^n}{4n+3}-\frac{(-1)^n}{4n+1}\right)\tag{1}\end{eqnarray*}$$ so summing both sides of this identity for $n=0,\ldots,N-1$ we get:
$$\int_{-\pi/4}^{\pi/4}\frac{\cos(4Nx)}{\cos x}\,dx = I_0 + 2\sqrt{2}\sum_{n=0}^{N-1}\left(\frac{(-1)^n}{4n+3}-\frac{(-1)^n}{4n+1}\right) \tag{2} $$ where: $$ I_0 = \int_{-\pi/4}^{\pi/4}\frac{dx}{\cos x} = 2\,\text{arccoth}(\sqrt{2}) = 2\log(1+\sqrt{2}).\tag{3}$$
Incidentally, line $(2)$ together with the Riemann-Lebesgue lemma gives: $$ \sum_{n=0}^{+\infty}\left(\frac{1}{8n+1}-\frac{1}{8n+3}-\frac{1}{8n+5}+\frac{1}{8n+7}\right)=\frac{1}{\sqrt{2}}\,\log(1+\sqrt{2}).\tag{4}$$ $(2)$ is also enough to prove that $c_N$, the coefficient of $\cos(4Nx)$ in the Fourier series of $\frac{1}{\cos x}$, behaves like $C\cdot\frac{(-1)^N}{N^2}$ for large $N$s. $(2)$ may be seen also as a consequence of: $$ \mathcal{L}\left(\frac{1}{\cosh x}\right) = \frac{1}{2}\left(\psi\left(\frac{s+3}{4}\right)-\psi\left(\frac{s+1}{4}\right)\right),\tag{5}$$ where $\psi(z)=\frac{d}{dz}\log\Gamma(z)=\frac{\Gamma'(z)}{\Gamma(z)}.$