Fourier-Series of rectangle function: $f(x) = 1$ if $|x|\le \pi/2$ and $0$ otherwise.

292 Views Asked by At

I have to create the Fourier-series of the function:

$$ f(x) = \begin{cases} 1, & \text{$|x| \le π/2 $} \\ 0, & \text{otherwise} \end{cases}$$

My approach:

$$a_0=\frac1π\int_{-π}^π f(x) \,dx= \frac2π\int_0^{π/2} 1 \,dx = 1$$

$$a_n=\frac1π\int_{-π}^π f(x) {cos(nx)} \,dx= \frac2π\int_0^{π/2} cos(nx) \,dx = \frac2π \frac{sen(n{π/2})}n $$

Observing that:

$$ sen(n{π/2}) = \begin{cases} (-1)^k, & \text{if $ n = 2k +1 $} \\ 0, & \text{if $ n = 2k$} \end{cases}$$

Finally;

$$f(x)= \frac12 +\frac2π\sum_{n=0}^{\infty} \frac{(-1)^n}{2n+1}cos[(2n+1)x]$$

But the correct answer is;

$$f(x)= \frac4π\sum_{n=0}^{\infty} \frac{(-1)^n}{2n+1}cos[(2n+1)x]$$

Where am I wrong ?

1

There are 1 best solutions below

0
On BEST ANSWER

Your solution is the correct one.

Notice that $x=\frac{3\pi}{4}$ is within the interval $(-\pi,\pi)$ of values unchanged by the Fourier series so should still have its original definition $f(x)=0$. But then the "correct" formula would have $$\begin{align}\cos\left(\left(2n+1\right)\cdot\frac{3\pi}{4}\right)&=\begin{cases}\frac{1}{\sqrt{2}},&n\equiv 1,2\mod 4 \\ \frac{-1}{\sqrt{2}},&n\equiv 0,3\mod 4\end{cases} \\ \\ \frac{4}{\pi}\sum_{n=0}^{\infty}\frac{\left(-1\right)^{n}}{2n+1}\cos\left(\left(2n+1\right)\cdot\frac{3\pi}{4}\right) &=\frac{4}{\pi\sqrt{2}}\sum_{n\ge 0\\n\equiv 1,2\\\operatorname{mod} 4}\frac{\left(-1\right)^{n}}{2n+1}-\frac{4}{\pi\sqrt{2}}\sum_{n\ge 0\\n\equiv 0,3\\\operatorname{mod} 4}\frac{\left(-1\right)^{n}}{2n+1} \\ &=\frac{4}{\pi\sqrt{2}}\sum_{k=0}^{\infty}\left(\frac{-1}{8k+1}+\frac{-1}{8k+3}+\frac{1}{8k+5}+\frac{1}{8k+7}\right) \\ &=\frac{4}{\pi\sqrt{2}}\sum_{k=0}^{\infty}\frac{-(64k^{2}+64k+13)}{\left(8k+1\right)\left(8k+3\right)\left(8k+5\right)\left(8k+7\right)} \\ &\le\frac{-4}{\pi\sqrt{2}}\sum_{k=0}^{\infty}\frac{64k^{2}}{\left(8k+7\right)^{4}} \\ &\le\frac{-4}{\pi\sqrt{2}}\sum_{k=1}^{\infty}\frac{64}{8^{4}}\frac{1}{2^{4}k^{2}}=-\frac{\pi}{6}\cdot2^{-\frac{17}{2}}\approx −0.001 \\ &\ne 0 \end{align}$$

which is not $0$. In fact it is $-1$ and their function takes the value of $-1$ where it should be $0$. Assuming you copied down the function correctly, it may just be a mistake in the worksheet.