# [SOLVED]Fourier |sin|

#### dwsmith

##### Well-known member
$f(-\theta) = |\sin(-\theta)| = |-\sin\theta| = |\sin\theta| = f(\theta)$.
Hence, $f$ is even, and we need to only consider.
$$f(\theta) = \frac{a_0}{2} + \sum_{n = 1}^{\infty}a_n\cos n\theta.$$

$$a_0 = \frac{1}{\pi}\int_{-\pi}^{\pi}|\sin\theta|d\theta = \frac{1}{\pi}\int_{0}^{\pi}\sin\theta d\theta - \frac{1}{\pi}\int_{-\pi}^0\sin\theta d\theta = \frac{2}{\pi}\int_{0}^{\pi}\sin\theta d\theta$$
but when I solve this integral, I get 0.
How do I solve this integral?
$$a_n =\frac{1}{\pi}\int_{-\pi}^{\pi}|\sin\theta|\cos n\theta d\theta = \frac{2}{\pi}\int_{-\pi}^{\pi}\sin\theta\cos n\theta d\theta$$

#### Sudharaka

##### Well-known member
MHB Math Helper
Hi dwsmith, $f(-\theta) = |\sin(-\theta)| = |-\sin\theta| = |\sin\theta| = f(\theta)$.
Hence, $f$ is even, and we need to only consider.
$$f(\theta) = \frac{a_0}{2} + \sum_{n = 1}^{\infty}a_n\cos n\theta.$$

$$a_0 = \frac{1}{\pi}\int_{-\pi}^{\pi}|\sin\theta|d\theta = \frac{1}{\pi}\int_{0}^{\pi}\sin\theta d\theta - \frac{1}{\pi}\int_{-\pi}^0\sin\theta d\theta = \frac{2}{\pi}\int_{0}^{\pi}\sin\theta d\theta$$
but when I solve this integral, I get 0.
$\int_{0}^{\pi}\sin\theta d\theta=\left. -\cos\theta\right|^{\pi}_{0}=-\cos\pi+\cos 0=1+1=2$

How do I solve this integral?
$$a_n =\frac{1}{\pi}\int_{-\pi}^{\pi}|\sin\theta|\cos n\theta d\theta = \frac{2}{\pi}\int_{-\pi}^{\pi}\sin\theta\cos n\theta d\theta$$
\begin{eqnarray}

\int_{-\pi}^{\pi}|\sin\theta|\cos n\theta d\theta&=&-\int_{-\pi}^{0}\sin\theta\cos n\theta d\theta+\int_{0}^{\pi}\sin\theta\cos n\theta d\theta\\

&=&\int_{0}^{\pi}\sin\theta\cos (n\pi-n\theta) d\theta+\int_{0}^{\pi}\sin\theta\cos n\theta d\theta\\

&=&(-1)^{n}\int_{0}^{\pi}\sin\theta\cos n\theta d\theta+\int_{0}^{\pi}\sin\theta\cos n\theta d\theta\\

\end{eqnarray}

$\therefore a_{2n}=\frac{2}{\pi}\int_{0}^{\pi}\sin\theta\cos 2n\theta d\theta\mbox{ and }a_{2n+1}=0\mbox{ where }n\geq 1$

Use integration by parts to evaluate this integral. Solution can be found >>here<<.

Kind Regards,
Sudharaka.

Last edited:

#### dwsmith

##### Well-known member
$$\int_{0}^{\pi}\sin\theta\cos (n\pi+n\theta) d\theta+\int_{0}^{\pi}\sin\theta\cos n\theta d\theta$$
$$(-1)^{n}\int_{0}^{\pi}\sin\theta\cos n\theta d\theta+\int_{0}^{\pi}\sin\theta\cos n\theta d\theta$$
Why do you have this instead of
$$2\int_{0}^{\pi}\sin\theta\cos n\theta d\theta$$

#### Opalg

##### MHB Oldtimer
Staff member
$f(-\theta) = |\sin(-\theta)| = |-\sin\theta| = |\sin\theta| = f(\theta)$.
Hence, $f$ is even, and we need to only consider.
$$f(\theta) = \frac{a_0}{2} + \sum_{n = 1}^{\infty}a_n\cos n\theta.$$

$$a_0 = \frac{1}{\pi}\int_{-\pi}^{\pi}|\sin\theta|d\theta = \frac{1}{\pi}\int_{0}^{\pi}\sin\theta d\theta - \frac{1}{\pi}\int_{-\pi}^0\sin\theta d\theta = \frac{2}{\pi}\int_{0}^{\pi}\sin\theta d\theta$$
but when I solve this integral, I get 0.
$\displaystyle \int_{0}^{\pi}\sin\theta\, d\theta = 2$, so you should get $a_0 = 4/\pi.$

How do I solve this integral?
$$a_n =\frac{1}{\pi}\int_{-\pi}^{\pi}|\sin\theta|\cos n\theta d\theta = \frac{2}{\pi}\int_{\color{red}0}^{\pi}\sin\theta \cos n\theta d\theta$$
Integrate by parts twice, to get $$\int_{0}^{\pi}\sin\theta\cos n\theta\, d\theta = \begin{cases}\frac{-2}{n^2-1} & (n \text{ even}), \\ 0 & (n \text{ odd}). \end{cases}$$

#### Sudharaka

##### Well-known member
MHB Math Helper
Why do you have this instead of
$$2\int_{0}^{\pi}\sin\theta\cos n\theta d\theta$$

Kind Regards,
Sudharaka.

#### dwsmith

##### Well-known member
The Fourier series is
$$\frac{2}{\pi} - 2\sum_{n = 1}^{\infty}\frac{1}{4n^2 - 1}\cos 2n\theta.$$

#### Opalg

##### MHB Oldtimer
Staff member
The Fourier series is
$$\frac{2}{\pi} - 2\sum_{n = 1}^{\infty}\frac{1}{4n^2 - 1}\cos 2n\theta.$$
Getting there! But you have still forgotten to multiply the integral by $2/\pi$ to get $a_n.$ The answer should be $$\frac{2}{\pi} - \frac4\pi\sum_{n = 1}^{\infty}\frac{1}{4n^2 - 1}\cos 2n\theta.$$

#### dwsmith

##### Well-known member
Getting there! But you have still forgotten to multiply the integral by $2/\pi$ to get $a_n.$ The answer should be $$\frac{2}{\pi} - \frac4\pi\sum_{n = 1}^{\infty}\frac{1}{4n^2 - 1}\cos 2n\theta.$$
$$\frac{-2}{n\pi}\left[\left.\frac{\cos\theta\cos n\theta}{n}\right|_0^{\pi} - \frac{1}{n}\int_0^{\pi}\cos n\theta\sin\theta d\theta\right] = \frac{2}{\pi}\int_0^{\pi}\cos n\theta\sin\theta d\theta$$
The $2/\pi$ canceled.
The $2/\pi$ canceled.