Fourier series of $f(x) = 1$ for $x\in[-\pi,0]$, $f(x) = -1$ for $x\in[0,\pi]$.

5.6k Views Asked by At

I am attempting to solve a Fourier series problem where we have the question defined by a piecewise function:

$$f(x) = \begin{cases} 1 & -\pi \leq x \leq 0 \\ -1 & 0 \leq x \leq \pi \end{cases}$$

I can solve it out where I calculate that $A_{n} = 0$, and $A_{0} = 1$, and I then integrate $$B_{n} = \frac{2}{\pi} \, (1-\cos(\pi \,n))$$

At this point when trying to solve for an equation, it doesn't match up to any of the example solutions online I can find.

1

There are 1 best solutions below

2
On

Just for the Fourier series: \begin{align} f(x) &= A_{0} + \sum_{n=1}^{\infty} \left( A_{n} \, \cos(n x) + B_{n} \, \sin(n x) \right) \\ A_{0} &= \frac{1}{2 \pi} \, \int_{-\pi}^{\pi} f(x) \, dx \\ A_{n} &= \frac{1}{\pi} \, \int_{-\pi}^{\pi} f(x) \, \cos(n x) \, dx \\ B_{n} &= \frac{1}{\pi} \, \int_{-\pi}^{\pi} f(x) \, \sin(n x) \, dx. \end{align} With $$f(x) = \begin{cases} 1 & -\pi \leq x \leq 0 \\ -1 & 0 \leq x \leq \pi \end{cases}$$ then \begin{align} A_{0} &= \frac{1}{2 \pi} \, \left[ \int_{-\pi}^{0} (1) \, dx + \int_{0}^{\pi} (-1) \, dx \right] = 0 \\ A_{n} &= 0 \\ B_{n} &= \frac{2}{\pi \, n} \, (1 - \cos(n \pi)) = \frac{2 \, (1 - (-1)^{n})}{n \pi } \end{align} and $$f(x) = \frac{2}{\pi} \sum_{n=1}^{\infty} \frac{1 - (-1)^{n}}{n} \, \sin(n x) = \frac{4}{\pi} \, \sum_{n=0}^{\infty} \frac{\sin(2n+1)x}{2n+1}.$$