Fourier series for $f(x) = |x|$

148 Views Asked by At

I am trying to find the Fourier series for $f(x) = |x|$ on the interval $(-\pi, \pi]$ extended periodically with period $2\pi$.

I know that $a_0 = \displaystyle\frac{\pi}{2}$. I am having trouble with $a_n$.

I know the formula for $a_n = \displaystyle\frac{1}{\pi} \int_{-\pi}^{\pi} f(t)$ cos$(nt)$ $dt$

So plugging in: $a_n = \displaystyle\frac{1}{\pi} \int_{-\pi}^{\pi} |t|$ cos $(nt)$ $dt$

I am having trouble with this integral. I know I have to use integration by parts which I know how to do. I am just stuck integrating $|t|$.

4

There are 4 best solutions below

2
On BEST ANSWER

Integrate it piecewise. Since $|t|$ is $(-t)$ on $[-\pi,0]$ and is $t$ on $[0,\pi]$, you have $$\int_{-\pi}^{\pi}|t|\cos nt\; dt = \int_{-\pi}^{0}(-t)\cos nt\; dt + \int_{0}^{\pi}t\cos nt\; dt$$

Or, since the integrand is even, you could just say

$$\int_{-\pi}^{\pi}|t|\cos nt\; dt = 2\int_{0}^{\pi}t\cos nt\; dt$$

They are the same thing, if you simplify the first one a little bit.

5
On

This is an even function.

\begin{align} a_n &= \frac1{\pi} \int_{-\pi}^\pi |t|\cos(nt) \, dt \\ &= \frac{2}{\pi}\int_{0}^\pi t \cos(nt) \, dt \end{align}

We have removed the absolute value sign, can you complete it?

0
On

$f(t)$ is an even function, so the coefficients of all of the sin terms will be even.

And for the cosine terms we can say

$\frac 1{\pi}\int_{-\pi}^{\pi} |x| \cos nx \ dx = \frac {2}{\pi}\int_{0}^{\pi} x \cos nx \ dx$

Which we solve using integration by parts.

$\frac {2}{\pi}(\frac {\sin nx}{n} - \frac {1}{n^2} \cos nx) |_0^{\pi}$

If $n$ is even $\cos n\pi - \cos 0 = 0$

If $n$ is odd... $a_n = \frac {4\cos nx}{n^2\pi}$

0
On

A bit late to the party, but since $f(-t) = f(t)$ then

\begin{eqnarray} a_n &=& \frac{1}{\pi}\int_{-\pi}^{\pi}|t| \cos(nt)~{\rm d}t \\ &=& \frac{2}{\pi}\int_{0}^{\pi}t \cos(nt)~{\rm d}t \\ &=& \frac{2}{\pi}\left[\underbrace{\left.\frac{t}{n}\sin(nt)\right|_{0}^{\pi}}_{=0}-\frac{1}{n}\int_{0}^{\pi} \sin(nt)~{\rm d}t \right] \\ &=& -\left.\frac{2}{\pi n^2}\cos(nt)\right|_{0}^{\pi} \\ &=& \frac{2}{n^2}[(-1)^n - 1] \\ &=& \begin{cases} 0 &,& n~\text{even}\\ 4/\pi n^2 &,& n~\text{odd} \end{cases} \end{eqnarray}

And this is a little graph showing the sum

$$ \tilde{f}(x) = a_0 + \sum_{n=1}^{n_{\rm max}} a_n \cos(n x) $$

enter image description here