# University of Florida/Egm4313/s12.team11.R7

Report 7
Intermediate Engineering Analysis Section 7566 Team 11 Due date: April 25, 2012.

## R7.1

Solved by Andrea Vargas

### Problem Statement

Verify (4)-(5) pg 19-9: (4) $\langle \phi _{i},\phi _{j}\rangle =0\!$ for $i\neq j\!$ (5) $\langle \phi _{j},\phi _{j}\rangle ={\frac {L}{2}}\!$ for $i=j\!$

### Solution

From the lecture notes on p.19-9 we know that: (2) $\phi _{i}=\sin(\omega _{i}x)\!$ (3) $\langle \phi _{i},\phi _{j}\rangle =\int _{0}^{L}\phi _{i}(x)\phi _{j}(x)dx\!$
Then, we have $\langle \phi _{i},\phi _{j}\rangle =\int _{0}^{L}\phi _{i}(x)\phi _{j}(x)dx=\int _{0}^{L}sin(\omega _{i}x)\sin(\omega _{j}x)dx\!$
Since the period of $\sin(x)\!$ is $2\pi \!$ and we know that $p=2L\!$, we can assume that $L=\pi \!$ for simplicity.
We can compute the result of the previous integral using Wolfram ALpha (Mathematica software). The following is the input given to the software: int from 0 to pi sin(ax)sin(bx)
where a is $\omega _{i}\!$ and b is $\omega _{j}\!$. The software generates the following answer:
$\int _{0}^{L}\sin(ax)sin(bx)={\frac {b\sin(\pi a)\cos(\pi b)-a\cos(\pi a)\sin(\pi b)}{a^{2}-b^{2}}}\!$
Substituting for $\omega _{i}\!$ and $\omega _{j}\!$: $\int _{0}^{L}\sin(ax)sin(bx)={\frac {\omega _{j}\sin(\pi \omega _{i})\cos(\pi \omega _{j})-\omega _{i}\cos(\pi \omega _{i})\sin(\pi \omega _{j})}{\omega _{i}^{2}-\omega _{j}^{2}}}\!$ We also know that $\sin(c\pi )=0\!$ where c is any integer. We can cancel any terms with $\sin(\pi \omega _{i})\!$ or $\sin(\pi \omega _{j})\!$ as they are equal to zero. Then, we can verify:
Similarly we can verify (5). We have $\langle \phi _{j},\phi _{j}\rangle =\int _{0}^{L}\phi _{j}(x)\phi _{j}(x)dx=\int _{0}^{L}sin(\omega _{j}x)\sin(\omega _{j}x)dx\!$
Here, we will keep the integration boundaries as $0\rightarrow L\!$ to be consistent with the problem statement.
We can compute the result of the previous integral using Wolfram ALpha (Mathematica software). The following is the input given to the software: int 0 to L (sin(ax))^2
where a is $\omega _{j}\!$. The software generates the following answer:
$\int _{0}^{L}\sin(ax)^{2}={\frac {L}{2}}-{\frac {\sin(2aL)}{4a}}\!$
Substituting for $\omega _{j}\!$: $\int _{0}^{L}\sin(ax)^{2}={\frac {L}{2}}-{\frac {\sin(2L\omega _{j})}{4\omega _{j}}}\!$
We know from the previous explanation that $L=\pi \!$.So,we can apply the same assumption as before that $\sin(c\pi )=0\!$ where c is any integer. This allows us to cancel any terms with $sin(2L\omega _{j})\!$ as they are equal to zero. Then, we can verify:

## R7.2

Solved by Francisco Arrieta

### Problem Statement

Plot the truncated series $u(x,t)=\sum _{j=1}^{n}a_{j}\cos C\omega _{j}t\sin \omega _{j}x\!$ with $n=5\!$ and for:
$t=\alpha P_{1}=\alpha {\frac {2\pi }{C\omega _{1}}}=\alpha {\frac {2L}{C}}\!$
$\alpha =0.5,1,1.5,2\!$

### Solution

Using:
$\left\{{\begin{matrix}f(x)=x(x-2)\\g(x)=0\\C=3\\L=4\end{matrix}}\right.\!$
Then:
$a_{j}={\frac {2}{L}}\int _{0}^{L}f(x)\sin \omega _{j}xdx\!$
       $=2\left[{\frac {(-1)^{j}-1}{\pi ^{3}j^{3}}}\right]\!$
$\therefore a_{j}=0\!$ for all even values of j
Plugging back to the truncated series:
$u(x,t)=\sum _{j=1}^{n}2\left[{\frac {(-1)^{j}-1}{\pi ^{3}j^{3}}}\right]\cos[C{\frac {j\pi }{L}}\alpha {\frac {2L}{C}}]\sin[{\frac {j\pi }{L}}x]\!$
          $=\sum _{j=1}^{n}2\left[{\frac {(-1)^{j}-1}{\pi ^{3}j^{3}}}\right]\cos(\alpha j2\pi )\sin({\frac {j\pi }{2}}x)\!$
For $n=5\!$ :
$u(x,t)=[{\frac {-4}{\pi ^{3}}}\cos(2\pi \alpha )\sin({\frac {\pi x}{2}})]+[{\frac {-4}{27\pi ^{3}}}\cos(6\pi \alpha )\sin({\frac {3\pi x}{2}})]+[{\frac {-4}{125\pi ^{3}}}\cos(10\pi \alpha )\sin({\frac {5\pi x}{2}})]\!$
When $\alpha =0.5\!$ :
When $\alpha =1\!$ :
When $\alpha =1.5\!$ :
When $\alpha =2\!$ :
--Egm4313.s12.team11.arrieta (talk) 06:20, 22 April 2012 (UTC)

## R7.3
#### Problem Statement

Find (a) the scalar product, (b) the magnitude of $f\!$ and $g\!$ ,(c) the angle between $f\!$ and $g\!$ for:
1) $f(x)=cos(x),\ g(x)=x\ for-2\leq x\leq 10\!$
2) $f(x)={\frac {1}{2}}(3x^{2}-1),\ g(x)={\frac {1}{2}}(5x^{3}-3x)\ for-1\leq x\leq 1\!$

#### Part 1

solved by Kyle Gooding

##### Scalar Product

$<f,g>=\int _{a}^{b}f(x)g(x)\ dx\!$
$<f,g>=\int _{-2}^{10}x\cos(x)\ dx\!$
Using integration by parts;
$<f,g>=[x\sin(x)+\cos(x)]_{-2}^{10}$

##### Magnitude

$\|f\|=<f,f>^{1/2}=\int _{a}^{b}f^{2}(x)\ dx\!$
$=\int _{-2}^{10}[\cos(x)]^{2}\ dx\!$
$=[.5(x+\sin(x)\cos(x)|_{-2}^{10}]^{1/2}$
$\|g\|=\int _{a}^{b}g^{2}(x)\ dx\!$
$=\int _{-2}^{10}x^{2}\ dx$ $=[x^{3}/3]_{-2}^{10}$

##### Angle Between Functions

$cos(\theta )={\frac {<f,g>}{\|f\|\|g\|}}\!$
$cos(\theta )={\frac {-7.68}{{\frac {1008}{3}}(2.457)}}$

#### Part 2

solved by Luca Imponenti

##### Scalar Product

$<f,g>=\int _{a}^{b}f(x)g(x)\ dx\!$
$<f,g>=\int _{-1}^{1}[{\frac {1}{2}}(3x^{2}-1)][{\frac {1}{2}}(5x^{3}-3x)]\ dx\!$
          $=\int _{-1}^{1}{\frac {1}{4}}(15x^{5}-4x^{3}+3x)\ dx\!$
          $=\left.{\frac {1}{4}}({\frac {15}{6}}x^{6}-x^{4}+{\frac {3}{2}}x^{2})\right|_{-1}^{1}\!$
          $={\frac {1}{4}}[({\frac {15}{6}}1^{6}-1^{4}+{\frac {3}{2}}1^{2})-({\frac {15}{6}}(-1)^{6}-(-1)^{4}+{\frac {3}{2}}(-1)^{2})]\!$
Since all exponents are even, everything in brackets cancels out

##### Magnitude

$\|f\|=<f,f>^{1/2}=\int _{a}^{b}f^{2}(x)\ dx\!$
       $=\int _{-1}^{1}[{\frac {1}{2}}(3x^{2}-1)]^{2}\ dx\!$
       $=\int _{-1}^{1}{\frac {1}{4}}(9x^{4}-6x^{2}+1)\ dx\!$
       $=\left.{\frac {1}{4}}({\frac {9}{5}}x^{5}-2x^{3}+x)\right|_{-1}^{1}\!$
       $={\frac {1}{4}}[({\frac {9}{5}}1^{5}-2(1)^{3}+1)-({\frac {9}{5}}(-1)^{5}-2(-1)^{3}+(-1))]\!$
       $={\frac {1}{4}}[{\frac {4}{5}}-(-{\frac {4}{5}})]\!$
$\|g\|=\int _{a}^{b}g^{2}(x)\ dx\!$
       $=\int _{-1}^{1}[{\frac {1}{2}}(5x^{3}-3x)]^{2}\ dx\!$
       $=\int _{-1}^{1}{\frac {1}{4}}(25x^{6}-30x^{4}+9x^{2})\ dx\!$
       $=\left.{\frac {1}{4}}({\frac {25}{7}}x^{7}-6x^{5}+3x^{3})\right|_{-1}^{1}\!$
       $={\frac {1}{4}}[({\frac {25}{7}}1^{7}-6(1)^{5}+3(1)^{3})-({\frac {25}{7}}(-1)^{7}-6(-1)^{5}+3(-1)^{3})]\!$
       $={\frac {1}{4}}[{\frac {4}{7}}-(-{\frac {4}{7}})]\!$

##### Angle Between Functions

$cos(\theta )={\frac {<f,g>}{\|f\|\|g\|}}\!$
Since $<f,g>=0\!$ the two functions are orthogonal

## R7.4

Solved by Gonzalo Perez

### K 2011 pg.482 pb. 6
#### Problem Statement

Sketch or graph $f(x)\!$ which for $-\pi <x<\pi \!$ is given as follows:
$f(x)=\left|x\right|\!$

#### Solution

The MATLAB code shown below was used to developed the graph of $f(x)=\left|x\right|\!$:

### K 2011 pg.482 pb. 9
#### Problem Statement

Sketch or graph $f(x)\!$ which for $-\pi <x<\pi \!$ is given as follows:
$f(x)=\left\{{\begin{matrix}x,if:-\pi <x<0\\\pi -x,if:0<x<\pi \end{matrix}}\right.\!$

#### Solution

The MATLAB code shown below was used to developed the graph of the piecewise function $f(x)=\left\{{\begin{matrix}x,if:-\pi <x<0\\\pi -x,if:0<x<\pi \end{matrix}}\right.\!$:
Solved by Jonathan Sheider

### K 2011 p.482 pb. 12
#### Problem Statement

Find the Fourier series of the given function which is assumed to have a period of $2\pi \!$. Show the details of your work.
Sketch or graph the partial sums up to that including $cos(5x)\!$ and $sin(5x)\!$
Given:
$f(x)=|x|\!$

#### Solution

The Fourier series of a function with a period of $p=2\pi \!$ is defined:
$f(x)=a_{0}+\sum _{n=1}^{\infty }(a_{n}cos(nx)+b_{n}sin(nx))\!$
Where:
$a_{0}={\frac {1}{2\pi }}\int _{-\pi }^{\pi }f(x)dx\!$ $a_{n}={\frac {1}{\pi }}\int _{-\pi }^{\pi }f(x)cos(nx)dx\!$ $b_{n}={\frac {1}{\pi }}\int _{-\pi }^{\pi }f(x)sin(nx)dx\!$
This particular function given in the problem can be also defined in a piecewise manner over this interval, namely:
$f(x)=\left\{{\begin{matrix}-x{\text{ if }}-\pi \leq x\leq 0\\x{\text{ if }}0\leq x\leq \pi \end{matrix}}\right.\!$
Calculating the first term $a_{0}\!$:
$a_{0}={\frac {1}{2\pi }}\left(\int _{-\pi }^{0}-xdx+\int _{0}^{\pi }xdx\right)\!$ $a_{0}={\frac {1}{2\pi }}\left(\left[{\frac {-x^{2}}{2}}\right]_{-\pi }^{0}+\left[{\frac {x^{2}}{2}}\right]_{0}^{\pi }\right)\!$ $a_{0}={\frac {1}{2\pi }}\left(-\left({\frac {-\pi ^{2}}{2}}\right)+\left({\frac {\pi ^{2}}{2}}\right)\right)\!$ $a_{0}={\frac {1}{2\pi }}(\pi ^{2})\!$
Calculating the coefficient $a_{n}\!$:
$a_{n}={\frac {1}{\pi }}\left(\int _{-\pi }^{0}-xcos(nx)dx+\int _{0}^{\pi }xcos(nx)dx\right)\!$ $a_{n}={\frac {1}{\pi }}\left(-\int _{-\pi }^{0}xcos(nx)dx+\int _{0}^{\pi }xcos(nx)dx\right)\!$
Using integration by parts with the following substitutions:
$u=x\!$ and therefore $du=dx\!$ $dv=cos(nx)dx\!$ and therefore $v={\frac {1}{n}}sin(nx)\!$
This yields for the integral:
$a_{n}={\frac {1}{\pi }}\left(-\left[{\frac {1}{n}}xsin(nx)-\int {\frac {1}{n}}sin(nx)dx\right]_{-\pi }^{0}+\left[{\frac {1}{n}}xsin(nx)-\int {\frac {1}{n}}sin(nx)dx\right]_{0}^{\pi }\right)\!$ $a_{n}={\frac {1}{\pi }}\left(-\left[{\frac {1}{n}}xsin(nx)+{\frac {1}{n^{2}}}cos(nx)\right]_{-\pi }^{0}+\left[{\frac {1}{n}}xsin(nx)+{\frac {1}{n^{2}}}cos(nx)\right]_{0}^{\pi }\right)\!$ $a_{n}={\frac {1}{\pi }}\left(-\left[{\frac {1}{n^{2}}}-\left({\frac {1}{n}}(-\pi )sin(-n\pi )+{\frac {1}{n^{2}}}cos(-n\pi )\right)\right]+\left[{\frac {1}{n}}\pi sin(n\pi )+{\frac {1}{n^{2}}}cos(n\pi )-{\frac {1}{n^{2}}}\right]\right)\!$
Note that for all n = 1,2,3... : $sin(n\pi )=0\!$ as $sin(\pi )=sin(2\pi )=sin(3\pi )...=0\!$ therefore these terms are evaluated as zero, which yields:
$a_{n}={\frac {1}{\pi }}\left(-\left[{\frac {1}{n^{2}}}-\left(0+{\frac {1}{n^{2}}}cos(-n\pi )\right)\right]+\left[0+{\frac {1}{n^{2}}}cos(n\pi )-{\frac {1}{n^{2}}}\right]\right)\!$ $a_{n}={\frac {1}{\pi }}\left(-{\frac {1}{n^{2}}}+{\frac {1}{n^{2}}}cos(-n\pi )+{\frac {1}{n^{2}}}cos(n\pi )-{\frac {1}{n^{2}}}\right)\!$
Note that $cos(-x)=cos(x)\!$ therefore:
$a_{n}={\frac {1}{\pi }}\left(-{\frac {1}{n^{2}}}+{\frac {1}{n^{2}}}cos(n\pi )+{\frac {1}{n^{2}}}cos(n\pi )-{\frac {1}{n^{2}}}\right)\!$ $a_{n}={\frac {1}{\pi }}\left(-{\frac {2}{n^{2}}}+{\frac {2}{n^{2}}}cos(n\pi )\right)\!$ $a_{n}={\frac {1}{\pi }}\left(\left(-{\frac {2}{n^{2}}}\right)(1-cos(n\pi )\right)\!$ $a_{n}=-{\frac {2}{n^{2}\pi }}\left(1-cos(n\pi )\right)\!$
To evaluate the term $(1-cos(n\pi ))\!$:
Note that $cos(n\pi )=-1\!$ for odd n values as $cos(\pi )=cos(3\pi )=cos(5\pi )...=-1\!$
And that $cos(n\pi )=1\!$ for even n values as $cos(2\pi )=cos(4\pi )=cos(6\pi )...=1\!$.
Therefore, it can be concluded that for odd n values:
$(1-cos(n\pi ))=1-(-1)=2\!$
And for even n values:
$(1-cos(n\pi )=1-(1)=0\!$
Therefore, for the coefficient $a_{n}\!$, all even terms will equal zero while all odd terms will have a multiplier of 2, this yields (for all odd n values):
Calculating the coefficient $b_{n}\!$:
$b_{n}={\frac {1}{\pi }}\left(\int _{-\pi }^{0}-xsin(nx)dx+\int _{0}^{\pi }xsin(nx)dx\right)\!$ $b_{n}={\frac {1}{\pi }}\left(-\int _{-\pi }^{0}xsin(nx)dx+\int _{0}^{\pi }xsin(nx)dx\right)\!$
Using integration by parts with the following substitutions:
$u=x\!$ and therefore $du=dx\!$ $dv=sin(nx)dx\!$ and therefore $v={\frac {-1}{n}}cos(nx)\!$
This yields for the integral:
$b_{n}={\frac {1}{\pi }}\left(-\left[{\frac {-1}{n}}xcos(nx)-\int {\frac {-1}{n}}cos(nx)dx\right]_{-\pi }^{0}+\left[{\frac {-1}{n}}xcos(nx)-\int {\frac {-1}{n}}cos(nx)dx\right]_{0}^{\pi }\right)\!$ $b_{n}={\frac {1}{\pi }}\left(-\left[{\frac {-1}{n}}xcos(nx)+{\frac {1}{n^{2}}}sin(nx)\right]_{-\pi }^{0}+\left[{\frac {-1}{n}}xcos(nx)+{\frac {1}{n^{2}}}sin(nx)\right]_{0}^{\pi }\right)\!$ $b_{n}={\frac {1}{\pi }}\left(-\left[0-\left({\frac {-1}{n}}(-\pi )cos(-n\pi )+{\frac {1}{n^{2}}}sin(-n\pi )\right)\right]+\left[{\frac {-1}{n}}\pi cos(n\pi )+{\frac {1}{n^{2}}}sin(n\pi )-0\right]\right)\!$
Note that for all n = 1,2,3... : $sin(n\pi )=0\!$ as $sin(\pi )=sin(2\pi )=sin(3\pi )...=0\!$ therefore these terms are evaluated as zero, which yields:
$b_{n}={\frac {1}{\pi }}\left(-\left[0-\left({\frac {-1}{n}}(-\pi )cos(-n\pi )+0\right)\right]+\left[{\frac {-1}{n}}\pi cos(n\pi )+0\right]\right)\!$ $b_{n}={\frac {1}{\pi }}\left(\left[{\frac {1}{n}}(\pi )cos(-n\pi )\right]+\left[{\frac {-1}{n}}\pi cos(n\pi )\right]\right)\!$
Note that $cos(-x)=cos(x)\!$ therefore:
$b_{n}={\frac {1}{\pi }}\left({\frac {1}{n}}\pi cos(n\pi )+{\frac {-1}{n}}\pi cos(n\pi )\right)\!$ $b_{n}={\frac {1}{\pi }}\left(0\right)\!$
Therefore there will be no $sin(nx)\!$ terms in the Fourier representation. In conclusion, the Fourier series representation for the given function is as follows:
$f(x)={\frac {\pi }{2}}-{\frac {4}{\pi }}cos(x)-{\frac {4}{3^{2}\pi }}cos(3x)-{\frac {4}{5^{2}\pi }}cos(5x)+...\!$
A graph of the function, and the Fourier series for $n=1,3,5\!$ is shown below:
--Egm4313.s12.team11.sheider (talk) 06:00, 22 April 2012 (UTC)

### K 2011 p.482 pb. 13
#### Problem Statement

Find the Fourier series of the given function which is assumed to have a period of $2\pi \!$. Show the details of your work.
Sketch or graph the partial sums up to that including $cos(5x)\!$ and $sin(5x)\!$
Given:
$f(x)=\left\{{\begin{matrix}-x{\text{ if }}-\pi <x<0\\\pi -x{\text{ if }}0<x<\pi \end{matrix}}\right.\!$

#### Solution

The Fourier series of a function with a period of $p=2\pi \!$ is defined:
$f(x)=a_{0}+\sum _{n=1}^{\infty }(a_{n}cos(nx)+b_{n}sin(nx))\!$
Where:
$a_{0}={\frac {1}{2\pi }}\int _{-\pi }^{\pi }f(x)dx\!$ $a_{n}={\frac {1}{\pi }}\int _{-\pi }^{\pi }f(x)cos(nx)dx\!$ $b_{n}={\frac {1}{\pi }}\int _{-\pi }^{\pi }f(x)sin(nx)dx\!$
Calculating the first term $a_{0}\!$:
$a_{0}={\frac {1}{2\pi }}\left(\int _{-\pi }^{0}xdx+\int _{0}^{\pi }(\pi -x)dx\right)\!$ $a_{0}={\frac {1}{2\pi }}\left(\left[{\frac {x^{2}}{2}}\right]_{-\pi }^{0}+\left[\pi x-{\frac {x^{2}}{2}}\right]_{0}^{\pi }\right)\!$ $a_{0}={\frac {1}{2\pi }}\left(-\left({\frac {\pi ^{2}}{2}}\right)+\left(\pi ^{2}-{\frac {\pi ^{2}}{2}}\right)\right)\!$ $a_{0}={\frac {1}{2\pi }}\left(-{\frac {\pi ^{2}}{2}}+\pi ^{2}-{\frac {\pi ^{2}}{2}}\right)\!$ $a_{0}={\frac {1}{2\pi }}\left(\pi ^{2}-\pi ^{2}\right)\!$
Calculating the coefficient $a_{n}\!$:
$a_{n}={\frac {1}{\pi }}\left(\int _{-\pi }^{0}xcos(nx)dx+\int _{0}^{\pi }(\pi -x)cos(nx)dx\right)\!$
Using integration by parts with the following substitutions for the integral $\int _{-\pi }^{0}xcos(nx)dx\!$:
$u=x\!$ and therefore $du=dx\!$ $dv=cos(nx)dx\!$ and therefore $v={\frac {1}{n}}sin(nx)\!$
Using integration by parts with the following substitutions for the integral $\int _{0}^{\pi }(\pi -x)cos(nx)dx\!$:
$u=\pi -x\!$ and therefore $du=-dx\!$ $dv=cos(nx)dx\!$ and therefore $v={\frac {1}{n}}sin(nx)\!$
This yields for the overall expression:
$a_{n}={\frac {1}{\pi }}\left(\left[{\frac {1}{n}}xsin(nx)-\int {\frac {1}{n}}sin(nx)dx\right]_{-\pi }^{0}+\left[{\frac {1}{n}}(\pi -x)sin(nx)-\int -{\frac {1}{n}}sin(nx)dx\right]_{0}^{\pi }\right)\!$ $a_{n}={\frac {1}{\pi }}\left(\left[{\frac {1}{n}}xsin(nx)+{\frac {1}{n^{2}}}cos(nx)\right]_{-\pi }^{0}+\left[{\frac {1}{n}}(\pi -x)sin(nx)-{\frac {1}{n^{2}}}cos(nx)\right]_{0}^{\pi }\right)\!$ $a_{n}={\frac {1}{\pi }}\left(\left[{\frac {1}{n^{2}}}-\left({\frac {1}{n}}(-\pi )sin(-n\pi )+{\frac {1}{n^{2}}}cos(-n\pi )\right)\right]+\left[-{\frac {1}{n^{2}}}cos(n\pi )+{\frac {1}{n^{2}}}\right]\right)\!$
Note that for all n = 1,2,3... : $sin(n\pi )=0\!$ as $sin(\pi )=sin(2\pi )=sin(3\pi )...=0\!$ therefore these terms are evaluated as zero, which yields:
$a_{n}={\frac {1}{\pi }}\left(\left[{\frac {1}{n^{2}}}-0-{\frac {1}{n^{2}}}cos(-n\pi )\right]+\left[-{\frac {1}{n^{2}}}cos(n\pi )+{\frac {1}{n^{2}}}\right]\right)\!$
$a_{n}={\frac {1}{\pi }}\left({\frac {1}{n^{2}}}-{\frac {1}{n^{2}}}cos(-n\pi )-{\frac {1}{n^{2}}}cos(n\pi )+{\frac {1}{n^{2}}}\right)\!$
Note that $cos(-x)=cos(x)\!$ therefore:
$a_{n}={\frac {1}{\pi }}\left({\frac {1}{n^{2}}}-{\frac {1}{n^{2}}}cos(n\pi )-{\frac {1}{n^{2}}}cos(n\pi )+{\frac {1}{n^{2}}}\right)\!$
$a_{n}={\frac {1}{\pi }}\left({\frac {2}{n^{2}}}-{\frac {2}{n^{2}}}cos(n\pi )\right)\!$ $a_{n}={\frac {1}{\pi }}\left(\left({\frac {2}{n^{2}}}\right)(1-cos(n\pi ))\right)\!$ $a_{n}={\frac {2}{n^{2}\pi }}\left(1-cos(n\pi )\right)\!$
To evaluate the term $(1-cos(n\pi ))\!$:
Note that $cos(n\pi )=-1\!$ for odd n values as $cos(\pi )=cos(3\pi )=cos(5\pi )...=-1\!$
And that $cos(n\pi )=1\!$ for even n values as $cos(2\pi )=cos(4\pi )=cos(6\pi )...=1\!$.
Therefore, it can be concluded that for odd n values:
$(1-cos(n\pi ))=1-(-1)=2\!$
And for even n values:
$(1-cos(n\pi ))=1-(1)=0\!$
Therefore, for the coefficient $a_{n}\!$, all even terms will equal zero while all odd terms will have a multiplier of 2, this yields (for all odd n values):
Calculating the coefficient $b_{n}\!$:
$b_{n}={\frac {1}{\pi }}\left(\int _{-\pi }^{0}xsin(nx)dx+\int _{0}^{\pi }(\pi -x)sin(nx)dx\right)\!$
Using integration by parts with the following substitutions for the integral $\int _{-\pi }^{0}xsin(nx)dx\!$:
$u=x\!$ and therefore $du=dx\!$ $dv=sin(nx)dx\!$ and therefore $v={\frac {-1}{n}}cos(nx)\!$
Using integration by parts with the following substitutions for the integral $\int _{0}^{\pi }(\pi -x)sin(nx)dx\!$:
$u=\pi -x\!$ and therefore $du=-dx\!$ $dv=sin(nx)dx\!$ and therefore $v={\frac {-1}{n}}cos(nx)\!$
This yields for the overall expression:
$b_{n}={\frac {1}{\pi }}\left(\left[{\frac {-1}{n}}xcos(nx)-\int {\frac {-1}{n}}cos(nx)dx\right]_{-\pi }^{0}+\left[{\frac {-1}{n}}(\pi -x)cos(nx)-\int -{\frac {-1}{n}}cos(nx)dx\right]_{0}^{\pi }\right)\!$ $b_{n}={\frac {1}{\pi }}\left(\left[{\frac {-1}{n}}xcos(nx)+{\frac {1}{n^{2}}}sin(nx)\right]_{-\pi }^{0}+\left[{\frac {-1}{n}}(\pi -x)cos(nx)-{\frac {1}{n^{2}}}sin(nx)\right]_{0}^{\pi }\right)\!$ $b_{n}={\frac {1}{\pi }}\left(\left[0-\left({\frac {-1}{n}}(-\pi )cos(-n\pi )+{\frac {1}{n^{2}}}sin(-n\pi )\right)\right]+\left[-{\frac {1}{n^{2}}}sin(n\pi )-\left({\frac {-1}{n}}\pi \right)\right]\right)\!$ $b_{n}={\frac {1}{\pi }}\left(-{\frac {1}{n}}\pi cos(-n\pi )-{\frac {1}{n^{2}}}sin(-n\pi )-{\frac {1}{n^{2}}}sin(n\pi )+{\frac {1}{n}}\pi \right)\!$
Note that for all n = 1,2,3... : $sin(n\pi )=0\!$ as $sin(\pi )=sin(2\pi )=sin(3\pi )...=0\!$ therefore these terms are evaluated as zero, which yields:
$b_{n}={\frac {1}{\pi }}\left(-{\frac {1}{n}}\pi cos(-n\pi )-0-0+{\frac {1}{n}}\pi \right)\!$ $b_{n}={\frac {1}{\pi }}\left({\frac {1}{n}}\pi -{\frac {1}{n}}\pi cos(-n\pi )\right)\!$
Note that $cos(-x)=cos(x)\!$ therefore:
$b_{n}={\frac {1}{\pi }}\left({\frac {1}{n}}\pi -{\frac {1}{n}}\pi cos(n\pi )\right)\!$ $b_{n}={\frac {1}{\pi }}\left(\left({\frac {\pi }{n}}\right)(1-cos(n\pi ))\right)\!$ $b_{n}={\frac {1}{n}}\left(1-cos(n\pi )\right)\!$
To evaluate the term $(1-cos(n\pi ))\!$:
Note that $cos(n\pi )=-1\!$ for odd n values as $cos(\pi )=cos(3\pi )=cos(5\pi )...=-1\!$
And that $cos(n\pi )=1\!$ for even n values as $cos(2\pi )=cos(4\pi )=cos(6\pi )...=1\!$.
Therefore, it can be concluded that for odd n values:
$(1-cos(n\pi ))=1-(-1)=2\!$
And for even n values:
$(1-cos(n\pi ))=1-(1)=0\!$
Therefore, for the coefficient $b_{n}\!$, all even terms will equal zero while all odd terms will have a multiplier of 2, this yields (for all odd n values):
In conclusion, the Fourier series representation for the given function is as follows:
$f(x)=0+\left({\frac {4}{\pi }}cos(x)+{\frac {4}{3^{2}\pi }}cos(3x)+{\frac {4}{5^{2}\pi }}cos(5x)+...\right)+\left(2sin(x)+{\frac {2}{3}}sin(3x)+{\frac {2}{5}}sin(5x)+...\right)\!$
A graph of the function, and the Fourier series for $n=1,3,5\!$ is shown below:
--Egm4313.s12.team11.sheider (talk) 06:00, 22 April 2012 (UTC)

## R7.5

Solved by Daniel Suh

### Problem Statement

Consider the following,
$\left\langle \phi _{2j-1},\phi _{2k-1}\right\rangle =\int _{0}^{p}\phi _{2j-1}(x)\cdot \phi _{2k-1}(x)dx\!$
$\left\langle \phi _{2j-1},\phi _{2k-1}\right\rangle =\int _{0}^{p}\sin {j\omega x}\cdot \sin {k\omega x}\;dx\!$
with $j\neq k\;and\;j,k=1,2,...\!$, and $p=2\pi ,j=2,k=3\!$
1. Find the integration with the given data.
2. Confirm the results with Matlab's trapz command for the trapezoidal rule.

### Solution
#### Part 1
##### Trigonometric Identities

Angle Sum and Difference Identities
$(1)\cos {(a+b)}=\cos {a}\cos {b}-\sin {a}\sin {b}\!$ $(2)\cos {(a-b)}=\cos {a}\cos {b}+\sin {a}\sin {b}\!$
Rearrange
$(1)\sin {a}\sin {b}=\cos {a}\cos {b}-\cos {(a+b)}\!$ $(2)\cos {a}\cos {b}=\cos {(a-b)}-\sin {a}\sin {b}\!$
Substitute and Combine
$\sin {a}\sin {b}=\cos {(a-b)}-\sin {a}\sin {b}-\cos {(a+b)}\!$ $2\sin {a}\sin {b}=\cos {(a-b)}-\cos {(a+b)}\!$ $\sin {a}\sin {b}={\frac {1}{2}}\cos {(a-b)}-{\frac {1}{2}}\cos {(a+b)}\!$

##### Utilize Trig Identities

$\left\langle \phi _{2j-1},\phi _{2k-1}\right\rangle =\int _{0}^{p}\sin {jwx}\cdot \sin {kwx}\;dx\!$
$\left\langle \phi _{2j-1},\phi _{2k-1}\right\rangle =\int _{0}^{2\pi }\sin {2\omega x}\cdot \sin {3\omega x}\;dx\!$
$\left\langle \phi _{2j-1},\phi _{2k-1}\right\rangle =\int _{0}^{2\pi }{\frac {1}{2}}\cos {(2\omega x-3\omega x)}-{\frac {1}{2}}\cos {(2\omega x+3\omega x)}\;dx\!$
$\left\langle \phi _{2j-1},\phi _{2k-1}\right\rangle ={\frac {1}{2}}\int _{0}^{2\pi }\cos {(-\omega x)}\;dx-{\frac {1}{2}}\int _{0}^{2\pi }\cos {(5\omega x)}\;dx\!$
$\left\langle \phi _{2j-1},\phi _{2k-1}\right\rangle ={\frac {1}{2}}\sin {(-\omega x)}|_{0}^{2\pi }-{\frac {1}{2}}\sin {(5\omega x)}|_{0}^{2\pi }\!$
$\left\langle \phi _{2j-1},\phi _{2k-1}\right\rangle =(0-0)-(0-0)\!$

#### Part 2

>> X = 0:2*pi/100:2*pi;
>> Y = sin(2*X).*sin(3*X);
>> Z = trapz(X,Y)
Z =