User:Egm4313.s12.team8.koester/R7.4

Problem
K 2011 page 482 # 6, 9, 12, 13

-for 6 and 9 graph f(x) on $$ \displaystyle -\pi $$ to $$ \displaystyle \pi $$

-for 12 and 13 find the Fourier series of the given function f(x) and sketch or graph the partial sums up to that including $$ \displaystyle \cos(5x) $$ and $$ \displaystyle \sin(5x) $$.

6.
$$ \displaystyle f(x)=|x| $$

Matlab Code:

>> x=linspace(-pi,pi)

>> y=abs(x)

>> plot(x,y)

9.
$$ \displaystyle f(x)=x $$ on $$ \displaystyle (-\pi,0) $$

$$ \displaystyle f(x)=-x+\pi $$ on $$ \displaystyle (0,\pi) $$

Matlab Code:

>> x1=linspace(-pi,0)

>> y1=x1

>> x2=linspace(0,pi)

>> y2=pi-x2

>> plot(x1,y1,x2,y2)

12.
$$ \displaystyle f(x)=|x| $$

This function is an even function.

This is proven by the fact that $$ \displaystyle f(-x)=f(x) $$

Since this is an even function and of period $$ \displaystyle 2\pi $$ its Fourier series reduces to the Fourier cosine series shown here:

$$ \displaystyle f(x)=a_0 + \sum_{n = 1}^{\infty} a_n\cos(nx) $$

Where the coefficients are equal to:

$$ \displaystyle a_0=\frac{1}{\pi}\int_{0}^{\pi}f(x)dx $$

$$ \displaystyle a_n=\frac{2}{\pi}\int_{0}^{\pi}f(x)\cos(nx)dx $$

$$ \displaystyle a_0=\frac{1}{\pi}\int_{0}^{\pi}xdx $$

$$ \displaystyle a_0=\frac{\pi}{2} $$

$$ \displaystyle a_n=\frac{2}{\pi}\int_{0}^{\pi}x\cos(nx)dx $$

Using integration by parts:

$$ \displaystyle a_n=\frac{2}{\pi}(\frac{nx\sin(nx)+\cos(nx)}{n^2})$$ evaluated on x=$$ \displaystyle (0,\pi) $$

Evaluating, reduces to:

$$ \displaystyle a_n=\frac{2}{\pi}(\frac{\cos(\pi n)-1}{n^2}) $$

Plugging this back into the function equation:

$$ \displaystyle f(x)=\frac{\pi}{2} + \sum_{n = 1}^{\infty} \frac{2}{\pi}(\frac{\cos(\pi n)-1}{n^2}) \cos(nx) $$

Expanding this, one obtains:

$$ \displaystyle f(x)=\frac{\pi}{2} - \frac{4}{\pi}(\cos x+ \frac{1}{9}\cos3x+ \frac{1}{25}\cos5x+...) $$

Matlab Code:

>> x=linspace(-pi,pi)

>> y=pi/2-(4/pi)*(cos(x)+(1/9)*cos(3*x)+(1/25)*cos(5*x))

>> plot(x,y)

13.
$$ \displaystyle f(x)=x $$ on $$ \displaystyle (-\pi,0) $$

$$ \displaystyle f(x)=-x+\pi $$ on $$ \displaystyle (0,\pi) $$

Since the function has a period of $$ \displaystyle 2\pi $$ its Fourier series is:

$$ \displaystyle f(x)=a_0 + \sum_{n = 1}^{\infty}(a_n\cos(nx)+ b_n\sin(nx)) $$

Where the coefficients equal:

$$ \displaystyle a_0=\frac{1}{2\pi}\int_{-\pi}^{\pi}f(x)dx $$

$$ \displaystyle a_n=\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\cos(nx)dx $$

$$ \displaystyle b_n=\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\sin(nx)dx $$

$$ \displaystyle a_0=\frac{1}{2\pi}\int_{-\pi}^{\pi}f(x)dx $$

$$ \displaystyle a_0=\frac{1}{2\pi}(\int_{-\pi}^{0}xdx+ \int_{0}^{\pi}(\pi-x)dx) $$

$$ \displaystyle a_0=\frac{1}{2\pi}(\frac{-\pi^2}{2}+\pi^2-\frac{\pi^2}{2}) $$

$$ \displaystyle a_0=0 $$

$$ \displaystyle a_n=\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\cos(nx)dx $$

$$ \displaystyle a_n=\frac{1}{\pi}(\int_{-\pi}^{0}x\cos(nx)dx + \int_{0}^{\pi}(\pi-x)\cos(nx)dx) $$

$$ \displaystyle a_n=\frac{1}{\pi}(\int_{-\pi}^{0}x\cos(nx)dx + \int_{0}^{\pi}\pi\cos(nx)dx - \int_{0}^{\pi}x\cos(nx)dx) $$

Using integration by parts and then cancelling like terms:

$$ \displaystyle a_n=\frac{1}{\pi}(\frac{2-2\cos(\pi n)}{n^2})=\frac{2-2\cos(\pi n)}{\pi n^2} $$

$$ \displaystyle b_n=\frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\sin(nx)dx $$

$$ \displaystyle b_n=\frac{1}{\pi}(\int_{-\pi}^{0}x\sin(nx)dx + \int_{0}^{\pi}(\pi-x)\sin(nx)dx) $$

$$ \displaystyle b_n=\frac{1}{\pi}(\int_{-\pi}^{0}x\sin(nx)dx + \int_{0}^{\pi}\pi\sin(nx)dx - \int_{0}^{\pi}x\sin(nx)dx) $$

Using integration by parts and then cancelling like terms:

$$ \displaystyle b_n=\frac{1}{\pi}(\frac{\pi-\pi cos(\pi n)}{n})=\frac{1-cos(\pi n)}{n} $$

Plugging this back into the function equation:

$$ \displaystyle f(x)=\sum_{n = 1}^{\infty}(\frac{2-2\cos(\pi n)}{\pi n^2}\cos(nx)+ \frac{1-cos(\pi n)}{n}\sin(nx)) $$

Expanding this, one obtains:

$$ \displaystyle f(x)=\frac{4}{\pi}(\cos x+\frac{1}{9}\cos3x+\frac{1}{25}\cos5x) + 2(\sin x + \frac{1}{3}\sin3x + \frac{1}{5}\sin5x) $$

Matlab Code:

>> x=linspace(-pi,pi)

>> y=(4/pi)*(cos(x)+(1/9)*cos(3*x)+(1/25)*cos(5*x))+2*(sin(x)+(1/3)*sin(3*x)+(1/5)*sin(5*x))

>> plot(x,y)