# Calculating the fourier series of $f(t)=|t|$

calculate the Fourier series of the $$2\pi$$-periodic continuation of

$$f(t):=|t|, \quad t\in[-\pi,\pi)\tag{1}$$

We know that

$$f(t)=\sum_{k=-N}^N c_k\cdot e^{ikt}\quad \&\quad c_k=\frac{1}{2\pi}\int_{-\pi}^\pi f(t)e^{-ikt}dt\tag{2}$$

So let's calcualte the $$c_k$$.

$$c_k=\frac{1}{2\pi}\int_{-pi}^\pi|t|\cdot e^{-ikt}dt=\frac{2}{2\pi}\int_0^\pi t\cdot \cos(tk) dt=\frac{1}{\pi}[t\cdot\sin(tk)]_0^\pi+\frac{1}{\pi}[\cos(tk)]_0^\pi=0\frac{1}{\pi}(-1-1)=\frac{-2}{\pi}\tag{3}$$

Whereas we used the identity $$\int_{-a}^a|t|e^{-ikt}dt=2\int_0^a t\cos(kt)dt$$ Explanation (wheres the sub $$t\to -t$$ was used in the 2nd step)

So we get

$$f(t)=\sum_{k=-\infty}^\infty \frac{-2}{\pi}e^{ikt}\tag{4}$$

Sadly I don't have any solutions. Is that correct?

• You can never have a nonzero value independent of $k$ for $c_k$, by Riemann Lebesgue Lemma. – Kavi Rama Murthy Jan 31 at 10:13
• Yeah of course, that's a stupid mistake. But do you see any other issue here? – xotix Jan 31 at 10:15
• You will have to calculate $c_0$ seperately. – Kavi Rama Murthy Jan 31 at 10:17

Your integration is incorrect. Note that the anti-derivative of $$\cos(kt)$$ is $$\frac{\sin(kt)}{k}$$, so we have

\begin{align} \int t\cos(kt) dt &= t \color{red}{\frac{\sin(kt)}{k}} - \int\frac{\sin(kt)}{k}dt \\ &= t\color{red}{\frac{\sin(kt)}{k}} + \color{red}{\frac{\cos(kt)}{k^2}} \end{align}

Inserting the limits gives

$$c_k = \frac{1}{\pi}\frac{\cos(k\pi)-1}{k^2} = \begin{cases} 0, && k \text{ even} \\ \dfrac{-2}{\pi k^2}, && k \text{ odd} \end{cases}$$

• Yeah, that was a stupid mistake. Thanks – xotix Jan 31 at 10:15
• There is a small mistake. $c_0$ is not $0$. – Kavi Rama Murthy Jan 31 at 10:18
• @xotix Don't forget $c_0$! – Dylan Jan 31 at 10:19
• @KaviRamaMurthy I didn't say $c_0$ was $0$. Thanks for reminding us though! – Dylan Jan 31 at 10:19
• @Dylan I am a bit confused to the borders of the sum. if I have $\sum_{k=1}^\infty$ it's clear that I have to calculate $c_0$ but when do I have $\sum_{k=-N}^N$ and when do I have $\sum_{k=1}^\infty$ and when do I have $\sum_{k=-\infty}^\infty$? – xotix Jan 31 at 12:15

The right side of 2nd step of your substitution might be better expanded, assuming $$a \ge 0$$, as

$$\int_{-a}^0 |t| (\cos(st) + i \sin(st)) \ dt \\ = \int_{-a}^0 (-t) (\cos(st) + i \sin(st)) \ dt \ [ \ \because |t| = -t, t \le 0 \ ] \\ = \int_0^a t (\cos(-st) + i \sin(-st)) \ dt \ [ \ \text{substituting} \ t \to -t \ ] \\ = \int_0^a t (\cos(st) - i \sin(st)) \ dt$$

• Yeah I didn't really like that they continues with $|t|$ but I though Im not going to change it. Thanks – xotix Jan 31 at 12:17