Skip to main content

Tutorial 10: Fourier Series

Tutorial Question

  1. Find the fundamental period of the following function:

    a. cos2x\cos 2 x

    b. sin2πx\sin 2 \pi x

    c. cosnx\cos n x

    d. sin2πnxk\sin \frac{2 \pi n x}{k}

    Solution

    a. 2xp=2πxp=2π2=π2x_p=2\pi\quad\Rightarrow\quad x_p=\frac{2\pi}{2}=\pi

    b. 2πxp=2πxp=2π2π=12\pi x_p=2\pi\quad\Rightarrow\quad x_p=\frac{2\pi}{2\pi}=1

    c. nxp=2πxp=2πnnx_p=2\pi\quad\Rightarrow\quad x_p=\frac{2\pi}{n}

    d. 2πnxk=2πx=kn\frac{2\pi n x}{k}=2\pi\quad\Rightarrow\quad x=\frac{k}{n}

  2. Sketch the given function and find the Fourier Series.

    a. f(x)={1;π<x<02;0<x<π;p=2πf(x)=\left\{\begin{array}{rrr}-1 & ; & -\pi<x<0 \\ 2 & ; & 0<x<\pi\end{array} \quad ; p=2 \pi\right.

    b. f(x)={02<x<121x<010x<101x<2;p=4f(x)=\left\{\begin{array}{lc}0 & -2<x<-1 \\ -2 & -1 \leq x<0 \\ 1 & 0 \leq x<1 \\ 0 & 1 \leq x<2\end{array} \quad ; p=4\right.

    c. f(x)={1;1<x<0x0<x<1;p=2f(x)=\left\{\begin{array}{lr}1 & ;-1<x<0 \\ x & 0<x<1\end{array}\quad;p=2\right.

    Solution

    a.

    a0=1πππf(x)dx=1ππ0(1)dx+1π0π2dx=1an=1πππf(x)cosnxdx=1ππ0cosnxdx+1π0π2cosnxdx=0bn=1πππf(x)sinnxdx=1ππ0sinnxdx+1π0π2sinnxdx=3nπ[1(1)n]f(x)=12+3πn=11(1)nnsinnx\begin{aligned} a_{0}&=\frac{1}{\pi} \int_{-\pi}^{\pi} f(x) d x=\frac{1}{\pi} \int_{-\pi}^{0}(-1) d x+\frac{1}{\pi} \int_{0}^{\pi} 2 d x=1 \\ a_{n}&=\frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \cos n x d x=\frac{1}{\pi} \int_{-\pi}^{0}-\cos n x d x+\frac{1}{\pi} \int_{0}^{\pi} 2 \cos n x d x=0 \\ b_{n}&=\frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \sin n x d x=\frac{1}{\pi} \int_{-\pi}^{0}-\sin n x d x+\frac{1}{\pi} \int_{0}^{\pi} 2 \sin n x d x\\&=\frac{3}{n \pi}\left[1-(-1)^{n}\right] \\\\ &f(x)=\frac{1}{2}+\frac{3}{\pi} \sum_{n=1}^{\infty} \frac{1-(-1)^{n}}{n} \sin n x \end{aligned}

    b.

    a0=1222f(x)dx=12(102dx+011dx)=12an=1222f(x)cosnπ2xdx=12(10(2)cosnπ2xdx+01cosnπ2xdx)=1nπsinnπ2bn=1222f(x)sinnπ2xdx=12(10(2)sinnπ2xdx+01sinnπ2xdx)=3nπ(1cosnπ2)f(x)=14+n=1[1nπsinnπ2cosnπ2x+3nπ(1cosnπ2)sinnπ2x]\begin{aligned} a_{0}&=\frac{1}{2} \int_{-2}^{2} f(x) d x=\frac{1}{2}\left(\int_{-1}^{0}-2 d x+\int_{0}^{1} 1 d x\right)=-\frac{1}{2} \\ a_{n}&=\frac{1}{2} \int_{-2}^{2} f(x) \cos \frac{n \pi}{2} x d x\\&=\frac{1}{2}\left(\int_{-1}^{0}(-2) \cos \frac{n \pi}{2} x d x+\int_{0}^{1} \cos \frac{n \pi}{2} x d x\right)=-\frac{1}{n \pi} \sin \frac{n \pi}{2} \\ b_{n}&=\frac{1}{2} \int_{-2}^{2} f(x) \sin \frac{n \pi}{2} x d x\\&=\frac{1}{2}\left(\int_{-1}^{0}(-2) \sin \frac{n \pi}{2} x d x+\int_{0}^{1} \sin \frac{n \pi}{2} x d x\right)=\frac{3}{n \pi}\left(1-\cos \frac{n \pi}{2}\right) \\ &f(x)=-\frac{1}{4}+\sum_{n=1}^{\infty}\left[-\frac{1}{n \pi} \sin \frac{n \pi}{2} \cos \frac{n \pi}{2} x+\frac{3}{n \pi}\left(1-\cos \frac{n \pi}{2}\right) \sin \frac{n \pi}{2} x\right] \end{aligned}

    c.

    a0=11f(x)dx=101dx+01xdx=32an=11f(x)cosnπxdx=10cosnπxdx+01xcosnπxdx=1n2π2[(1)n1]bn=11f(x)sinnπxdx=10sinnπxdx+01xsinnπxdx=1nπf(x)=34+n=1[(1)n1n2π2cosnπx1nπsinnπx]\begin{aligned} a_{0}&=\int_{-1}^{1} f(x) d x=\int_{-1}^{0} 1 d x+\int_{0}^{1} x d x=\frac{3}{2} \\ a_{n}&=\int_{-1}^{1} f(x) \cos n \pi x d x=\int_{-1}^{0} \cos n \pi x d x+\int_{0}^{1} x \cos n \pi x d x\\&=\frac{1}{n^{2} \pi^{2}}\left[(-1)^{n}-1\right] \\ b_{n}&=\int_{-1}^{1} f(x) \sin n \pi x d x=\int_{-1}^{0} \sin n \pi x d x+\int_{0}^{1} x \sin n \pi x d x=-\frac{1}{n \pi} \\ &f(x)=\frac{3}{4}+\sum_{n=1}^{\infty}\left[\frac{(-1)^{n}-1}{n^{2} \pi^{2}} \cos n \pi x-\frac{1}{n \pi} \sin n \pi x\right] \end{aligned}
  3. Even and Odd Functions. Sketch the given functions, f(x)f(x). Determine whether it is an even, odd or neither odd nor even. For part (a) and (b), find the appropriate Fourier Cosine or Fourier Sine Series.

    a. f(x)=x;π<x<π;f(x)=f(x+2πn),n=integerf(x)=|x| ;-\pi<x<\pi ; f(x)=f(x+2 \pi n), n=\text{integer}

    b. f(x)=x;1<x<1;f(x)=f(x+2n),n=integerf(x)=x ;-1<x<1 ; f(x)=f(x+2 n), n=\text{integer}

    c. f(x)=x2;1<x<1;f(x)=f(x+2n),n=integerf(x)=x^{2} ;-1<x<1 ; f(x)=f(x+2 n), n=\text{integer}

    (Do not find the Fourier Series for 3c)

    d. f(x)=ex;π<x<π;f(x)=f(x+2πn),n=integerf(x)=e^{x} ;-\pi<x<\pi ; f(x)=f(x+2 \pi n), n=\text{integer}

    (Do not find the Fourier Series for 3d)

    Solution

    a.

    Since f(x)f(x) is an even function, we expand in a cosine series:

    a0=2π0πxdx=πan=2π0πxcosnxdx=2n2π[(1)n1].\begin{aligned} &a_{0}=\frac{2}{\pi} \int_{0}^{\pi} x d x=\pi \\ &a_{n}=\frac{2}{\pi} \int_{0}^{\pi} x \cos n x d x=\frac{2}{n^{2} \pi}\left[(-1)^{n}-1\right] . \end{aligned}

    Thus,

    f(x)=π2+n=12n2π[(1)n1]cosnxf(x)=\frac{\pi}{2}+\sum_{n=1}^{\infty} \frac{2}{n^{2} \pi}\left[(-1)^{n}-1\right] \cos n x

    b.

    It is an odd function → a0=an=0a_0=a_n=0

    bn=2L0Lf(x)sinnπxLdx=201xsinnπxdx=2[xnπcosnπx+1nπcosnπx]01=2[xnπcosnπx01+1(nπ)2sinnπx01]=2[1nπcosnπ+00]=2nπcosnπ=2nπ(1)n\begin{aligned}b_n&=\frac{2}{L}\int_0^Lf(x)\sin\frac{n\pi x}{L}dx\\&=2\int_0^1x\sin n\pi xdx\\&=2\left[-\frac{x}{n\pi}\cos n\pi x+\int \frac{1}{n\pi}\cos n\pi x\right]_0^1\\&=2\left[\left.-\frac{x}{n\pi}\cos n\pi x\right|_0^1+\left.\frac{1}{(n\pi)^2}\sin n\pi x\right|_0^1\right]\\&=2\left[-\frac{1}{n\pi}\cos n\pi+0-0\right]\\&=-\frac{2}{n\pi}\cos n\pi\\&=-\frac{2}{n\pi}(-1)^n\end{aligned}f(x)=n=1bnsinnπxL=2π[sinπx12sin2πx+13sin3πx14sin4πx+...]\begin{aligned}f(x)&=\sum_{n=1}^{\infty}b_n\sin\frac{n\pi x}{L}\\&=\frac{2}{\pi}\left[\sin\pi x-\frac{1}{2}\sin2\pi x+\frac{1}{3}\sin3\pi x-\frac{1}{4}\sin4\pi x+...\right]\end{aligned}

    c.

    Even function

    d.

    Neither odd or even

  4. Solve the following questions:

    a. Obtain the Fourier series for a periodic function f(t)f(t) with period 2π2 \pi :

    f(t)=t2,π<t<πf(t)=t^{2}, \quad-\pi<t<\pi

    b. Obtain the Fourier series for a periodic function f(t)f(t) with period 2π2 \pi :

    f(t)=t,π<t<πf(t)=t, \quad-\pi<t<\pi

    c. Differentiate the Fourier series in (a) to obtain f(t)f^{\prime}(t)

    d. Find the Fourier series of f(t)=tf(t)=t by using result in part (c) and compare it with (b).

    Solution

    a. Since f(t)=t2f(t)=t^2 is an even function, bn=0b_n=0

    a0=1π0πt2dt=π33×1π=π23an=2π0πt2cosntdt=2π{(1nsinnt(t2))0π1n0π2tsinntdt}=2π(2n){[1ncosnt(t)]0π+1n0πcosntdt}=4nπ×(1n)(πcosnπ0)=4n2cosnπ=4n2(1)nf(t)=t2=π23+4n=1(1)nn2cosnt\begin{aligned}a_0&=\frac{1}{\pi}\int_0^\pi t^2dt=\frac{\pi^3}{3}\times\frac{1}{\pi}=\frac{\pi^2}{3}\\a_n&=\frac{2}{\pi}\int_0^\pi t^2\cos ntdt\\&=\frac{2}{\pi}\left\{\left.\left(\frac{1}{n}\sin nt(t^2)\right)\right|_0^\pi-\frac{1}{n}\int_0^\pi2t\sin ntdt\right\}\\&=\frac{2}{\pi}\left(-\frac{2}{n}\right)\left\{\left[-\frac{1}{n}\cos nt(t)\right]_0^\pi+\frac{1}{n}\int_0^\pi\cos ntdt\right\}\\&=-\frac{4}{n\pi}\times\left(-\frac{1}{n}\right)\left(\pi\cos n\pi-0\right)\\&=\frac{4}{n^2}\cos n\pi=\frac{4}{n^2}(-1)^n\\\\\therefore f(t)&=t^2=\frac{\pi^2}{3}+4\sum_{n=1}^\infty \frac{(-1)^n}{n^2}\cos nt\end{aligned}

    b. a0=an=0a_0=a_n=0 since f(t)=tf(t)=t. Thus, it is an odd function.

    bn=2π0πtsinntdt=2π{[1ncosnt(t)]0π+1n0πcosntdt}=2π{πcosnπ+1n[1nsinnt]0π}=2π{πncosnπ}=2n(1)n=2n(1)n+1f(t)=t=2n=1(1)n+1nsinnt\begin{aligned}b_n&=\frac{2}{\pi}\int_0^\pi t\sin ntdt\\&=\frac{2}{\pi}\left\{\left[-\frac{1}{n}\cos nt(t)\right]_0^\pi+\frac{1}{n}\int_0^\pi\cos nt dt\right\}\\&=\frac{2}{\pi}\left\{-\pi\cos n\pi+\frac{1}{n}\left[\frac{1}{n}\sin nt\right]_0^\pi\right\}\\&=\frac{2}{\pi}\left\{-\frac{\pi}{n}\cos n\pi\right\}\\&=-\frac{2}{n}(-1)^n=\frac{2}{n}(-1)^{n+1}\\\\\therefore f(t)&=t=2\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n}\sin nt\end{aligned}

    c.

    f(t)=ddt(t2)=ddt(π23+4n=1(1)nn2cosnt)f(t)=2t=4n=1(1)nnsin(nt)\begin{alignat*}{3}f'(t)&=\frac{d}{dt}(t^2)&&=\frac{d}{dt}\left(\frac{\pi^2}{3}+4\sum_{n=1}^\infty \frac{(-1)^n}{n^2}\cos nt\right)\\f'(t)&=2t&&=-4\sum_{n=1}^\infty\frac{(-1)^n}{n}\sin(nt)\end{alignat*}

    d.

    f(t)=t=2n=1(1)nnsin(nt)or2n=1(1)n+1nsin(nt)f(t)=t=-2\sum_{n=1}^\infty\frac{(-1)^n}{n}\sin(nt)\quad\text{or}\quad2\sum_{n=1}^\infty\frac{(-1)^{n+1}}{n}\sin(nt)

    The answer obtained by differentiation is faster and the answer is the same as 4(b).

  5. Consider the following ODE which represents an undamped mass-spring system:

    116d2xdt2+4x=f(t)\frac{1}{16} \frac{d^{2} x}{d t^{2}}+4 x=f(t)

    where f(t)f(t) is a periodic function as shown in Fig. 1. Obtain a particular solution for the ODE.

    Solution

    We expand f(t)f(t) as an odd function.

    f(t)=πt,0<t<1\therefore f(t)=\pi t,\quad0<t<1bn=201πtsinnπtdt=2π{[tnπcosnπt]01+1nπ01cosnπtdt}=2π{1nπcosnπ}=2ncosnπ=2n(1)n+1116d2xdt2+4x=n=12n(1)n+1sinnπt\begin{aligned}b_n&=2\int_0^1\pi t\sin n\pi tdt\\&=2\pi\left\{\left[-\frac{t}{n\pi}\cos n\pi t\right]_0^1+\frac{1}{n\pi}\int_0^1\cos n\pi tdt\right\}\\&=2\pi\left\{-\frac{1}{n\pi}\cos n\pi\right\}\\&=-\frac{2}{n}\cos n\pi=\frac{2}{n}(-1)^{n+1}\\\\\therefore\frac{1}{16}\frac{d^2x}{dt^2}+4x&=\sum_{n=1}^\infty \frac{2}{n}(-1)^{n+1}\sin n\pi t\end{aligned}

    We assume a particular solution of the form

    xp(t)=n=1βnsinnπtxp(t)=n=1βn(nπ)cosnπtxp(t)=n=1βn(nπ)2sinnπt\begin{aligned}x_p(t)&=\sum_{n=1}^\infty\beta_n\sin n\pi t\\x'_p(t)&=\sum_{n=1}^\infty \beta_n(n\pi)\cos n\pi t\\x''_p(t)&=\sum_{n=1}^\infty -\beta_n(n\pi)^2\sin n\pi t\end{aligned}n=1(116n2π2βn+4βn)sinnπt=n=12n(1)n+1sinnπt116n2π2βn+4βn=2n(1)n+1\sum_{n=1}^\infty\left(-\frac{1}{16}n^2\pi^2\beta_n+4\beta_n\right)\sin n\pi t=\sum_{n=1}^\infty\frac{2}{n}(-1)^{n+1}\sin n\pi t\\-\frac{1}{16}n^2\pi^2\beta_n+4\beta_n=\frac{2}{n}(-1)^{n+1}βn=2n(1)n+14116n2π2=32n(1)n+164n2π2xp(t)=n=132(1)n+1n(64n2π2)sinnπt\begin{aligned}\beta_n&=\frac{\frac{2}{n}(-1)^{n+1}}{4-\frac{1}{16}n^2\pi^2}\\&=\frac{\frac{32}{n}(-1)^{n+1}}{64-n^2\pi^2}\\\\\therefore x_p(t)&=\sum_{n=1}^\infty \frac{32(-1)^{n+1}}{n(64-n^2\pi^2)}\sin n\pi t\end{aligned}