[Math] Fourier series periodic extension sketch

fourier series

Hi there don't really get this question:

Sketch the periodic extension of the function $f(x) = x^2$ for $−1 ≤ x ≤ 1$ with period 2 and find its Fourier series.

Does this just mean draw a normal $x^2$ graph from $-1$ to $1$? And then I would calculate the Fourier series for $x^2$ separately?

Best Answer

We need to extend the function $f(x)$ so that $f(x)=f(x+2)$ and $f(x)=x^2$ for $-1\leq x \leq 1$. Note that the following function works: $$f(x)=\left(x-2\left\lfloor{\frac{x+1}{2}}\right\rfloor\right)^2$$ Let's try to compute $f(x+2)$: \begin{align*} f(x+2)&=\left(x+2-2\left\lfloor{\frac{x+3}{2}}\right\rfloor\right)^2\\ &=\left(x+2-2\left\lfloor{1+\frac{x+1}{2}}\right\rfloor\right)^2\\ &=\left(x+2-2\left(1+\left\lfloor{\frac{x+1}{2}}\right\rfloor\right)\right)^2\\ &=\left(x+\left\lfloor{\frac{x+1}{2}}\right\rfloor\right)^2\\ &=f(x) \end{align*} For $-1\leq x< 1$, we note that $\left\lfloor{\frac{x+1}{2}}\right\rfloor=0$. Ergo, $f(x)=x^2$ on the domain $[-1,1)$. We can also confirm that $f(1)=1$, implying that $f(x)=x^2$ on the domain $[-1,1]$. So we have confirmed that $f(x)$ meets both of our requirements. If we graph this function, we get exactly what we expect — parabolas that repeat every $2$ units: Graph

To compute the Fourier series, we note first that $f(x)$ is even, so its Fourier series will only contain cosines. We have to compute the following integral: $$\int_{-1}^1 x^2\cos\left(n\pi x\right)\, dx$$ When $n=0$, the integral is simple: \begin{align*} \int_{-1}^1 x^2\cos(0)\,dx&=\int_{-1}^1 x^2\,dx\\ &=\frac{x^3}{3}\Bigg|_{-1}^{1}\\ &=\frac{2}{3} \end{align*} In cases in which $n\neq 0$, we can integrate by parts: \begin{align*} \int_{-1}^1 x^2\cos\left(n\pi x\right)\,dx&=\frac{2x\sin\left(n\pi x\right)}{n\pi}\Bigg|_{-1}^1-\frac{2}{n\pi}\int_{-1}^1x\sin\left(n\pi x\right)\,dx\\ &=0-\frac{2}{n\pi}\int_{-1}^1x\sin\left(n\pi x\right)\,dx\\ &=\frac{2x\cos\left(n\pi x\right)}{n^2 \pi^2}\Bigg|_{-1}^{1}-\frac{2}{n^2\pi^2}\int_{-1}^{1}\cos\left(n\pi x\right)\,dx\\ &=\frac{2(-1)^n}{n^2\pi^2}+\frac{2(-1)^n}{n^2\pi^2}-\frac{2\sin\left(n\pi x\right)}{n^3 \pi^3}\Bigg|_{-1}^{1}\\ &=\frac{4(-1)^n}{n^2\pi^2} \end{align*} Ergo, our Fourier series is the following: $$\frac{1}{3}+\frac{4}{\pi^2}\sum_{n=1}^\infty (-1)^n\frac{\cos\left(n\pi x\right)}{n^2}$$

Related Question