# Fourier series periodic extension sketch

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?

• Do you mean $x^2$? Periodic extension means to extend this function so it is defined on all of $x$, and so that $f(x+2) = f(x).$ Feb 22, 2017 at 16:51
• Yes sorry x^2 I really dont understand what to do
– Malk
Feb 22, 2017 at 17:22
• $f(x)$ is periodic, so $f(x)$ looks like $x^2$ inside the interval, the they cycle repeats (both to the left an the right), creating a sort of scalloped wave. Feb 22, 2017 at 17:30

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:

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}$$

• Shouldn't it be ceil instead of floor? Jul 19, 2020 at 20:32
• @ShortandFuzzy Edits of this scope should probably be mentioned in a comment or posted as an alternate answer. Also, it seems that you have unsimplified the result? What you've written is correct, but we assume $n$ is a nonzero integer here and thus we can simplify to the expressions contained in this post. Oct 14, 2020 at 5:52
• Nice. Is there a method to these extensions?
– MSIS
Dec 13, 2021 at 0:26

Focus on the words:

• A function $g$ is periodic with period $T$ if $g(x+T) = g(x)$ for all $x$. This means that shifting the graph of $f$ to the right by $T$ produces an identical copy of the graph. Or, the graph repeats over each interval that is $T$ wide. As an example, the sine function is periodic with period $2\pi$.
• A function $g$ is an extension of a function $f$ if $g(x) = f(x)$ for all $x$ in the domain of $f$. That is, $g$'s domain contains $f$'s domain, and agrees with $f$ on the domain of $f$.

So you want to construct a function $g$ which agrees with $f$ on $[-1,1]$, and is periodic with period $2$. There is only one way to do that.

• I dont understand what that means sorry
– Malk
Feb 22, 2017 at 17:03
• would I then just sketch (x+2)^2
– Malk
Feb 22, 2017 at 17:14
• @Malk: I've added some more context to the definition of periodic. Hope that helps. Feb 22, 2017 at 18:45