0

So I've been asked to find the fourier series of the following function: enter image description here

The method I use is explained in this old post: Express in terms of Legendre polynomials (Method 2 in the top answer)

How does the method used here differ when f(x) is set out like it is in my question and how does the "f(x+4)) = f(x)" affect my working out/answer? Or is there a completely new method I should use to tackle a function set out like this?

Thanks in advance

Maximus
  • 73
  • Here, the main difficulty is that the period is 4 (not 1 or $2\pi$), so the Fourier basis is $e^{ni\pi {x\over 2}}$, or $\cos ( n\pi {x\over 2}), \sin ( n\pi {x\over 2})$, then you can use safely standard formulas. – Thomas Apr 14 '21 at 13:48

1 Answers1

1

Your are over-complicating things. The fact that $f(x+4)=f(x)$ only implies that your fuction is $4$-periodic, and thus through a transformation of the variable

$$x\leftrightarrow \frac{2 x}{\pi}$$

you could consider the $2\pi$-periodic, piece-wise continuous function

$$g(x) = f\left(\frac{2 x}{\pi}\right),\quad x\in [-\pi,\pi]$$

on which you can apply the usual methods to calculate the Fourier coefficients. Note, of course, that the integrals should be split in two, given that $f$ is defined piece-wise.

Further explanation

The logic behind this variable transformation is that, for a $T$-periodic function defined on $[-\frac{T}{2}, \frac{T}{2}]$, you are looking for a $k$ satisfying $k \pi = \frac{T}{2}$ (so at $x = \pi$ you get $k x = \frac{T}{2}$). In your case $\frac{T}{2} = 2$ so $k = \frac{2}{\pi}$.

If your $n$th Fourier coefficient for a $2\pi$-periodic function $f$ is given by

$$c_n = \frac{1}{2\pi}\int_{-\pi}^\pi f(x)e^{-i n x} dx$$

then you can calculate it too for you $T$-periodic function $f$ thanks to the previous variable transformation and applying the corresponding change of variables to the integral:

$$c_n = \frac{1}{2\pi}\int_{-\pi}^\pi f\left(\frac{T}{2\pi}x\right)e^{-i n x} dx = \frac{1}{T}\int_{-T/2}^{T/2} f\left(s\right)e^{-i n s (2 \pi / T)} ds$$

where the change of variables was $\frac{T}{2 \pi} x \equiv s$. If it is not clear for you why we had to perform the transformation $x\leftrightarrow \frac{2 x}{\pi}$, think about the fact that the Fourier coefficient is calculated as an integral from $-\pi$ to $\pi$ for a function whose period, in your case, is defined on $[-2,2]$, so we need to "tweak" our function for it to be periodic over $[-\pi, \pi]$.

Albert
  • 727
  • Ok, it makes sense but I have a couple questions, how did you get that transformation that turns x into 2x/pi? And am i now essentially working out the fourier series for 2x/pi? What happened to f(x) being 0 between -2 and 0 and f(x) being x if between 0 and 2? – Maximus Apr 14 '21 at 15:50
  • @Maximus, look to the edited answer. – Albert Apr 14 '21 at 19:21
  • 1
    Thanks a lot, I think I get it now – Maximus Apr 15 '21 at 10:47