Finding Fourier Coefficients given $f(x) = \left\{ \begin{array}{rcl} -4\,x & \text{if} & -\pi<x<0 \\ 4\,x & \text{if} & 0<x<\pi \end{array}\right.$

373 Views Asked by At

The Fourier series of the function $f(x) = \left\{ \begin{array}{rcl} -4\,x & \text{if} & -\pi<x<0 \\ 4\,x & \text{if} & 0<x<\pi \end{array}\right.$

is given by $f(x) \sim c_0 - \displaystyle \sum\limits_{n=0}^\infty c_n\;\cos\big((2\,n+1)\,x\big) - \sum\limits_{n=1}^\infty b_n\;\sin\big(n\,x\big)$

I'm asked to find $c_0$, $c_n$, and $b_n$.

Given that this is an even function, we get $b_n =0$.

I have already found $c_0=4\pi$, but I am having trouble finding $c_n$.

Here is where I get confused. The general formula that I am given to find $c_n$ is given as

$$c_n=\frac{2}{L} \int_{0}^{L} f(x)\cos(\frac{n\pi x}{L})dx$$

where $L$ are the boundary conditions.

However, given that I have $cos((2n+1)x)$, I'm assuming I would have to modify the general formula to accommodate this term.

Solving for $c_n$, I get

$$c_n=\frac{2}{\pi} \int_{0}^{\pi} 4x\cos((2n+1)x)dx$$

$$c_n=\frac{2}{\pi} [\frac{-4\pi(2n+1)\sin(2\pi n)-4\cos(2\pi n)}{(2n+1)^2} -\frac{4}{(2n+1)^2}]$$

$$c_n=\frac{-8}{\pi} \frac{\pi(2n+1)\sin(2\pi n)+\cos(2\pi n)+1}{(2n+1)^2}$$

Apparently this is not correct, so I'm not sure what I'm doing wrong. Any help would be appreciated!

2

There are 2 best solutions below

0
On BEST ANSWER

I think you had the correct anti-derivative, but you evaluated the limits incorrectly $$ c_n = \frac{2}{\pi} \left.\left( -\frac{4x\sin \big((2n+1)x\big)}{2n+1} - \frac{4\cos\big((2n+1)x\big)}{(2n+1)^2} \right)\right|_{x=0}^{\pi} \\ = \frac{8}{\pi} \left(-\frac{\pi\sin \big((2n+1)\pi\big)}{2n+1} - \frac{\cos\big((2n+1)\pi\big)-1}{(2n+1)^2} \right) $$

Since $\sin\big((2n+1)\pi\big) = \sin(\pi) = 0$ and $\cos\big((2n+1)\pi\big) = \cos(\pi) = -1$, this simplifies to

$$ c_n = \frac{16}{\pi(2n+1)^2} $$

1
On

use $-\pi$ and $\pi$ as your boundary conditions, and your period is $L = 2\pi$

$a_n = $$\frac {1}{\pi} \int_{-\pi}^{\pi} f(x)\cos nx\ dx\\ \frac {1}{\pi} \int_{-\pi}^{0} -x\cos nx\ dx + \int_{0}^{\pi} x\cos nx\ dx\\ \frac {2}{\pi}\int_{0}^{\pi} x\cos nx\ dx\\ \frac {2}{\pi}(\frac {x}{n}\sin nx - \frac {1}{n^2} \cos nx)|_0^{\pi}\\ \frac {4}{n^2\pi}$

If $n$ is odd, and $0$ if $n$ is even.

$a_{2n+1} = \frac {4}{(2n+1)^2\pi}$