Report 7
Intermediate Engineering Analysis
Section 7566
Team 11
Due date: April 25, 2012.
Solved by Andrea Vargas
Verify (4)-(5) pg 19-9:
(4)
⟨
ϕ
i
,
ϕ
j
⟩
=
0
{\displaystyle \langle \phi _{i},\phi _{j}\rangle =0\!}
for
i
≠
j
{\displaystyle i\neq j\!}
(5)
⟨
ϕ
j
,
ϕ
j
⟩
=
L
2
{\displaystyle \langle \phi _{j},\phi _{j}\rangle ={\frac {L}{2}}\!}
for
i
=
j
{\displaystyle i=j\!}
From the lecture notes on p.19-9 we know that:
(2)
ϕ
i
=
sin
(
ω
i
x
)
{\displaystyle \phi _{i}=\sin(\omega _{i}x)\!}
(3)
⟨
ϕ
i
,
ϕ
j
⟩
=
∫
0
L
ϕ
i
(
x
)
ϕ
j
(
x
)
d
x
{\displaystyle \langle \phi _{i},\phi _{j}\rangle =\int _{0}^{L}\phi _{i}(x)\phi _{j}(x)dx\!}
Then, we have
⟨
ϕ
i
,
ϕ
j
⟩
=
∫
0
L
ϕ
i
(
x
)
ϕ
j
(
x
)
d
x
=
∫
0
L
s
i
n
(
ω
i
x
)
sin
(
ω
j
x
)
d
x
{\displaystyle \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
)
{\displaystyle \sin(x)\!}
is
2
π
{\displaystyle 2\pi \!}
and we know that
p
=
2
L
{\displaystyle p=2L\!}
, we can assume that
L
=
π
{\displaystyle 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
ω
i
{\displaystyle \omega _{i}\!}
and b is
ω
j
{\displaystyle \omega _{j}\!}
. The software generates the following answer:
∫
0
L
sin
(
a
x
)
s
i
n
(
b
x
)
=
b
sin
(
π
a
)
cos
(
π
b
)
−
a
cos
(
π
a
)
sin
(
π
b
)
a
2
−
b
2
{\displaystyle \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
ω
i
{\displaystyle \omega _{i}\!}
and
ω
j
{\displaystyle \omega _{j}\!}
:
∫
0
L
sin
(
a
x
)
s
i
n
(
b
x
)
=
ω
j
sin
(
π
ω
i
)
cos
(
π
ω
j
)
−
ω
i
cos
(
π
ω
i
)
sin
(
π
ω
j
)
ω
i
2
−
ω
j
2
{\displaystyle \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
π
)
=
0
{\displaystyle \sin(c\pi )=0\!}
where c is any integer. We can cancel any terms with
sin
(
π
ω
i
)
{\displaystyle \sin(\pi \omega _{i})\!}
or
sin
(
π
ω
j
)
{\displaystyle \sin(\pi \omega _{j})\!}
as they are equal to zero.
Then, we can verify:
(4)
⟨
ϕ
i
,
ϕ
j
⟩
=
0
{\displaystyle \langle \phi _{i},\phi _{j}\rangle =0\!}
for
i
≠
j
{\displaystyle i\neq j\!}
Similarly we can verify (5).
We have
⟨
ϕ
j
,
ϕ
j
⟩
=
∫
0
L
ϕ
j
(
x
)
ϕ
j
(
x
)
d
x
=
∫
0
L
s
i
n
(
ω
j
x
)
sin
(
ω
j
x
)
d
x
{\displaystyle \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
→
L
{\displaystyle 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
ω
j
{\displaystyle \omega _{j}\!}
. The software generates the following answer:
∫
0
L
sin
(
a
x
)
2
=
L
2
−
sin
(
2
a
L
)
4
a
{\displaystyle \int _{0}^{L}\sin(ax)^{2}={\frac {L}{2}}-{\frac {\sin(2aL)}{4a}}\!}
Substituting for
ω
j
{\displaystyle \omega _{j}\!}
:
∫
0
L
sin
(
a
x
)
2
=
L
2
−
sin
(
2
L
ω
j
)
4
ω
j
{\displaystyle \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
=
π
{\displaystyle L=\pi \!}
.So,we can apply the same assumption as before that
sin
(
c
π
)
=
0
{\displaystyle \sin(c\pi )=0\!}
where c is any integer. This allows us to cancel any terms with
s
i
n
(
2
L
ω
j
)
{\displaystyle sin(2L\omega _{j})\!}
as they are equal to zero.
Then, we can verify:
(5)
⟨
ϕ
j
,
ϕ
j
⟩
=
L
2
{\displaystyle \langle \phi _{j},\phi _{j}\rangle ={\frac {L}{2}}\!}
for
i
=
j
{\displaystyle i=j\!}
Solved by Francisco Arrieta
Plot the truncated series
u
(
x
,
t
)
=
∑
j
=
1
n
a
j
cos
C
ω
j
t
sin
ω
j
x
{\displaystyle u(x,t)=\sum _{j=1}^{n}a_{j}\cos C\omega _{j}t\sin \omega _{j}x\!}
with
n
=
5
{\displaystyle n=5\!}
and for:
t
=
α
P
1
=
α
2
π
C
ω
1
=
α
2
L
C
{\displaystyle t=\alpha P_{1}=\alpha {\frac {2\pi }{C\omega _{1}}}=\alpha {\frac {2L}{C}}\!}
α
=
0.5
,
1
,
1.5
,
2
{\displaystyle \alpha =0.5,1,1.5,2\!}
Using:
{
f
(
x
)
=
x
(
x
−
2
)
g
(
x
)
=
0
C
=
3
L
=
4
{\displaystyle \left\{{\begin{matrix}f(x)=x(x-2)\\g(x)=0\\C=3\\L=4\end{matrix}}\right.\!}
Then:
a
j
=
2
L
∫
0
L
f
(
x
)
sin
ω
j
x
d
x
{\displaystyle a_{j}={\frac {2}{L}}\int _{0}^{L}f(x)\sin \omega _{j}xdx\!}
=
2
[
(
−
1
)
j
−
1
π
3
j
3
]
{\displaystyle =2\left[{\frac {(-1)^{j}-1}{\pi ^{3}j^{3}}}\right]\!}
∴
a
j
=
0
{\displaystyle \therefore a_{j}=0\!}
for all even values of j
Plugging back to the truncated series:
u
(
x
,
t
)
=
∑
j
=
1
n
2
[
(
−
1
)
j
−
1
π
3
j
3
]
cos
[
C
j
π
L
α
2
L
C
]
sin
[
j
π
L
x
]
{\displaystyle 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]\!}
=
∑
j
=
1
n
2
[
(
−
1
)
j
−
1
π
3
j
3
]
cos
(
α
j
2
π
)
sin
(
j
π
2
x
)
{\displaystyle =\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
{\displaystyle n=5\!}
:
u
(
x
,
t
)
=
[
−
4
π
3
cos
(
2
π
α
)
sin
(
π
x
2
)
]
+
[
−
4
27
π
3
cos
(
6
π
α
)
sin
(
3
π
x
2
)
]
+
[
−
4
125
π
3
cos
(
10
π
α
)
sin
(
5
π
x
2
)
]
{\displaystyle 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
α
=
0.5
{\displaystyle \alpha =0.5\!}
:
When
α
=
1
{\displaystyle \alpha =1\!}
:
When
α
=
1.5
{\displaystyle \alpha =1.5\!}
:
When
α
=
2
{\displaystyle \alpha =2\!}
:
--Egm4313.s12.team11.arrieta (talk ) 06:20, 22 April 2012 (UTC)
Find (a) the scalar product, (b) the magnitude of
f
{\displaystyle f\!}
and
g
{\displaystyle g\!}
,(c) the angle between
f
{\displaystyle f\!}
and
g
{\displaystyle g\!}
for:
1)
f
(
x
)
=
c
o
s
(
x
)
,
g
(
x
)
=
x
f
o
r
−
2
≤
x
≤
10
{\displaystyle f(x)=cos(x),\ g(x)=x\ for-2\leq x\leq 10\!}
2)
f
(
x
)
=
1
2
(
3
x
2
−
1
)
,
g
(
x
)
=
1
2
(
5
x
3
−
3
x
)
f
o
r
−
1
≤
x
≤
1
{\displaystyle f(x)={\frac {1}{2}}(3x^{2}-1),\ g(x)={\frac {1}{2}}(5x^{3}-3x)\ for-1\leq x\leq 1\!}
solved by Kyle Gooding
<
f
,
g
>=
∫
a
b
f
(
x
)
g
(
x
)
d
x
{\displaystyle <f,g>=\int _{a}^{b}f(x)g(x)\ dx\!}
<
f
,
g
>=
∫
−
2
10
x
cos
(
x
)
d
x
{\displaystyle <f,g>=\int _{-2}^{10}x\cos(x)\ dx\!}
Using integration by parts;
<
f
,
g
>=
[
x
sin
(
x
)
+
cos
(
x
)
]
−
2
10
{\displaystyle <f,g>=[x\sin(x)+\cos(x)]_{-2}^{10}}
<
f
,
g
>=
−
7.68
{\displaystyle <f,g>=-7.68\!}
‖
f
‖
=<
f
,
f
>
1
/
2
=
∫
a
b
f
2
(
x
)
d
x
{\displaystyle \|f\|=<f,f>^{1/2}=\int _{a}^{b}f^{2}(x)\ dx\!}
=
∫
−
2
10
[
cos
(
x
)
]
2
d
x
{\displaystyle =\int _{-2}^{10}[\cos(x)]^{2}\ dx\!}
=
[
.5
(
x
+
sin
(
x
)
cos
(
x
)
|
−
2
10
]
1
/
2
{\displaystyle =[.5(x+\sin(x)\cos(x)|_{-2}^{10}]^{1/2}}
‖
f
‖
=
2.457
{\displaystyle \|f\|=2.457\!}
‖
g
‖
=
∫
a
b
g
2
(
x
)
d
x
{\displaystyle \|g\|=\int _{a}^{b}g^{2}(x)\ dx\!}
=
∫
−
2
10
x
2
d
x
{\displaystyle =\int _{-2}^{10}x^{2}\ dx}
=
[
x
3
/
3
]
−
2
10
{\displaystyle =[x^{3}/3]_{-2}^{10}}
‖
g
‖
=
1008
3
{\displaystyle \|g\|={\frac {1008}{3}}\!}
Angle Between Functions
edit
c
o
s
(
θ
)
=
<
f
,
g
>
‖
f
‖
‖
g
‖
{\displaystyle cos(\theta )={\frac {<f,g>}{\|f\|\|g\|}}\!}
c
o
s
(
θ
)
=
−
7.68
1008
3
(
2.457
)
{\displaystyle cos(\theta )={\frac {-7.68}{{\frac {1008}{3}}(2.457)}}}
θ
=
89.47
{\displaystyle \theta =89.47}
The two functions are nearly orthogonal.
solved by Luca Imponenti
<
f
,
g
>=
∫
a
b
f
(
x
)
g
(
x
)
d
x
{\displaystyle <f,g>=\int _{a}^{b}f(x)g(x)\ dx\!}
<
f
,
g
>=
∫
−
1
1
[
1
2
(
3
x
2
−
1
)
]
[
1
2
(
5
x
3
−
3
x
)
]
d
x
{\displaystyle <f,g>=\int _{-1}^{1}[{\frac {1}{2}}(3x^{2}-1)][{\frac {1}{2}}(5x^{3}-3x)]\ dx\!}
=
∫
−
1
1
1
4
(
15
x
5
−
4
x
3
+
3
x
)
d
x
{\displaystyle =\int _{-1}^{1}{\frac {1}{4}}(15x^{5}-4x^{3}+3x)\ dx\!}
=
1
4
(
15
6
x
6
−
x
4
+
3
2
x
2
)
|
−
1
1
{\displaystyle =\left.{\frac {1}{4}}({\frac {15}{6}}x^{6}-x^{4}+{\frac {3}{2}}x^{2})\right|_{-1}^{1}\!}
=
1
4
[
(
15
6
1
6
−
1
4
+
3
2
1
2
)
−
(
15
6
(
−
1
)
6
−
(
−
1
)
4
+
3
2
(
−
1
)
2
)
]
{\displaystyle ={\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
<
f
,
g
>=
0
{\displaystyle <f,g>=0\!}
‖
f
‖
=<
f
,
f
>
1
/
2
=
∫
a
b
f
2
(
x
)
d
x
{\displaystyle \|f\|=<f,f>^{1/2}=\int _{a}^{b}f^{2}(x)\ dx\!}
=
∫
−
1
1
[
1
2
(
3
x
2
−
1
)
]
2
d
x
{\displaystyle =\int _{-1}^{1}[{\frac {1}{2}}(3x^{2}-1)]^{2}\ dx\!}
=
∫
−
1
1
1
4
(
9
x
4
−
6
x
2
+
1
)
d
x
{\displaystyle =\int _{-1}^{1}{\frac {1}{4}}(9x^{4}-6x^{2}+1)\ dx\!}
=
1
4
(
9
5
x
5
−
2
x
3
+
x
)
|
−
1
1
{\displaystyle =\left.{\frac {1}{4}}({\frac {9}{5}}x^{5}-2x^{3}+x)\right|_{-1}^{1}\!}
=
1
4
[
(
9
5
1
5
−
2
(
1
)
3
+
1
)
−
(
9
5
(
−
1
)
5
−
2
(
−
1
)
3
+
(
−
1
)
)
]
{\displaystyle ={\frac {1}{4}}[({\frac {9}{5}}1^{5}-2(1)^{3}+1)-({\frac {9}{5}}(-1)^{5}-2(-1)^{3}+(-1))]\!}
=
1
4
[
4
5
−
(
−
4
5
)
]
{\displaystyle ={\frac {1}{4}}[{\frac {4}{5}}-(-{\frac {4}{5}})]\!}
‖
f
‖
=
2
5
{\displaystyle \|f\|={\frac {2}{5}}\!}
‖
g
‖
=
∫
a
b
g
2
(
x
)
d
x
{\displaystyle \|g\|=\int _{a}^{b}g^{2}(x)\ dx\!}
=
∫
−
1
1
[
1
2
(
5
x
3
−
3
x
)
]
2
d
x
{\displaystyle =\int _{-1}^{1}[{\frac {1}{2}}(5x^{3}-3x)]^{2}\ dx\!}
=
∫
−
1
1
1
4
(
25
x
6
−
30
x
4
+
9
x
2
)
d
x
{\displaystyle =\int _{-1}^{1}{\frac {1}{4}}(25x^{6}-30x^{4}+9x^{2})\ dx\!}
=
1
4
(
25
7
x
7
−
6
x
5
+
3
x
3
)
|
−
1
1
{\displaystyle =\left.{\frac {1}{4}}({\frac {25}{7}}x^{7}-6x^{5}+3x^{3})\right|_{-1}^{1}\!}
=
1
4
[
(
25
7
1
7
−
6
(
1
)
5
+
3
(
1
)
3
)
−
(
25
7
(
−
1
)
7
−
6
(
−
1
)
5
+
3
(
−
1
)
3
)
]
{\displaystyle ={\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})]\!}
=
1
4
[
4
7
−
(
−
4
7
)
]
{\displaystyle ={\frac {1}{4}}[{\frac {4}{7}}-(-{\frac {4}{7}})]\!}
‖
g
‖
=
2
7
{\displaystyle \|g\|={\frac {2}{7}}\!}
Angle Between Functions
edit
c
o
s
(
θ
)
=
<
f
,
g
>
‖
f
‖
‖
g
‖
{\displaystyle cos(\theta )={\frac {<f,g>}{\|f\|\|g\|}}\!}
Since
<
f
,
g
>=
0
{\displaystyle <f,g>=0\!}
the two functions are orthogonal
θ
=
90
{\displaystyle \theta =90\!}
Solved by Gonzalo Perez
Sketch or graph
f
(
x
)
{\displaystyle f(x)\!}
which for
−
π
<
x
<
π
{\displaystyle -\pi <x<\pi \!}
is given as follows:
f
(
x
)
=
|
x
|
{\displaystyle f(x)=\left|x\right|\!}
The MATLAB code shown below was used to developed the graph of
f
(
x
)
=
|
x
|
{\displaystyle f(x)=\left|x\right|\!}
:
Sketch or graph
f
(
x
)
{\displaystyle f(x)\!}
which for
−
π
<
x
<
π
{\displaystyle -\pi <x<\pi \!}
is given as follows:
f
(
x
)
=
{
x
,
i
f
:
−
π
<
x
<
0
π
−
x
,
i
f
:
0
<
x
<
π
{\displaystyle f(x)=\left\{{\begin{matrix}x,if:-\pi <x<0\\\pi -x,if:0<x<\pi \end{matrix}}\right.\!}
The MATLAB code shown below was used to developed the graph of the piecewise function
f
(
x
)
=
{
x
,
i
f
:
−
π
<
x
<
0
π
−
x
,
i
f
:
0
<
x
<
π
{\displaystyle f(x)=\left\{{\begin{matrix}x,if:-\pi <x<0\\\pi -x,if:0<x<\pi \end{matrix}}\right.\!}
:
Solved by Jonathan Sheider
Find the Fourier series of the given function which is assumed to have a period of
2
π
{\displaystyle 2\pi \!}
. Show the details of your work.
Sketch or graph the partial sums up to that including
c
o
s
(
5
x
)
{\displaystyle cos(5x)\!}
and
s
i
n
(
5
x
)
{\displaystyle sin(5x)\!}
Given:
f
(
x
)
=
|
x
|
{\displaystyle f(x)=|x|\!}
The Fourier series of a function with a period of
p
=
2
π
{\displaystyle p=2\pi \!}
is defined:
f
(
x
)
=
a
0
+
∑
n
=
1
∞
(
a
n
c
o
s
(
n
x
)
+
b
n
s
i
n
(
n
x
)
)
{\displaystyle f(x)=a_{0}+\sum _{n=1}^{\infty }(a_{n}cos(nx)+b_{n}sin(nx))\!}
Where:
a
0
=
1
2
π
∫
−
π
π
f
(
x
)
d
x
{\displaystyle a_{0}={\frac {1}{2\pi }}\int _{-\pi }^{\pi }f(x)dx\!}
a
n
=
1
π
∫
−
π
π
f
(
x
)
c
o
s
(
n
x
)
d
x
{\displaystyle a_{n}={\frac {1}{\pi }}\int _{-\pi }^{\pi }f(x)cos(nx)dx\!}
b
n
=
1
π
∫
−
π
π
f
(
x
)
s
i
n
(
n
x
)
d
x
{\displaystyle 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
)
=
{
−
x
if
−
π
≤
x
≤
0
x
if
0
≤
x
≤
π
{\displaystyle 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
{\displaystyle a_{0}\!}
:
a
0
=
1
2
π
(
∫
−
π
0
−
x
d
x
+
∫
0
π
x
d
x
)
{\displaystyle a_{0}={\frac {1}{2\pi }}\left(\int _{-\pi }^{0}-xdx+\int _{0}^{\pi }xdx\right)\!}
a
0
=
1
2
π
(
[
−
x
2
2
]
−
π
0
+
[
x
2
2
]
0
π
)
{\displaystyle 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
=
1
2
π
(
−
(
−
π
2
2
)
+
(
π
2
2
)
)
{\displaystyle a_{0}={\frac {1}{2\pi }}\left(-\left({\frac {-\pi ^{2}}{2}}\right)+\left({\frac {\pi ^{2}}{2}}\right)\right)\!}
a
0
=
1
2
π
(
π
2
)
{\displaystyle a_{0}={\frac {1}{2\pi }}(\pi ^{2})\!}
a
0
=
π
2
{\displaystyle a_{0}={\frac {\pi }{2}}\!}
Calculating the coefficient
a
n
{\displaystyle a_{n}\!}
:
a
n
=
1
π
(
∫
−
π
0
−
x
c
o
s
(
n
x
)
d
x
+
∫
0
π
x
c
o
s
(
n
x
)
d
x
)
{\displaystyle a_{n}={\frac {1}{\pi }}\left(\int _{-\pi }^{0}-xcos(nx)dx+\int _{0}^{\pi }xcos(nx)dx\right)\!}
a
n
=
1
π
(
−
∫
−
π
0
x
c
o
s
(
n
x
)
d
x
+
∫
0
π
x
c
o
s
(
n
x
)
d
x
)
{\displaystyle 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
{\displaystyle u=x\!}
and therefore
d
u
=
d
x
{\displaystyle du=dx\!}
d
v
=
c
o
s
(
n
x
)
d
x
{\displaystyle dv=cos(nx)dx\!}
and therefore
v
=
1
n
s
i
n
(
n
x
)
{\displaystyle v={\frac {1}{n}}sin(nx)\!}
This yields for the integral:
a
n
=
1
π
(
−
[
1
n
x
s
i
n
(
n
x
)
−
∫
1
n
s
i
n
(
n
x
)
d
x
]
−
π
0
+
[
1
n
x
s
i
n
(
n
x
)
−
∫
1
n
s
i
n
(
n
x
)
d
x
]
0
π
)
{\displaystyle 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
=
1
π
(
−
[
1
n
x
s
i
n
(
n
x
)
+
1
n
2
c
o
s
(
n
x
)
]
−
π
0
+
[
1
n
x
s
i
n
(
n
x
)
+
1
n
2
c
o
s
(
n
x
)
]
0
π
)
{\displaystyle 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
=
1
π
(
−
[
1
n
2
−
(
1
n
(
−
π
)
s
i
n
(
−
n
π
)
+
1
n
2
c
o
s
(
−
n
π
)
)
]
+
[
1
n
π
s
i
n
(
n
π
)
+
1
n
2
c
o
s
(
n
π
)
−
1
n
2
]
)
{\displaystyle 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... :
s
i
n
(
n
π
)
=
0
{\displaystyle sin(n\pi )=0\!}
as
s
i
n
(
π
)
=
s
i
n
(
2
π
)
=
s
i
n
(
3
π
)
.
.
.
=
0
{\displaystyle sin(\pi )=sin(2\pi )=sin(3\pi )...=0\!}
therefore these terms are evaluated as zero, which yields:
a
n
=
1
π
(
−
[
1
n
2
−
(
0
+
1
n
2
c
o
s
(
−
n
π
)
)
]
+
[
0
+
1
n
2
c
o
s
(
n
π
)
−
1
n
2
]
)
{\displaystyle 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
=
1
π
(
−
1
n
2
+
1
n
2
c
o
s
(
−
n
π
)
+
1
n
2
c
o
s
(
n
π
)
−
1
n
2
)
{\displaystyle 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
c
o
s
(
−
x
)
=
c
o
s
(
x
)
{\displaystyle cos(-x)=cos(x)\!}
therefore:
a
n
=
1
π
(
−
1
n
2
+
1
n
2
c
o
s
(
n
π
)
+
1
n
2
c
o
s
(
n
π
)
−
1
n
2
)
{\displaystyle 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
=
1
π
(
−
2
n
2
+
2
n
2
c
o
s
(
n
π
)
)
{\displaystyle a_{n}={\frac {1}{\pi }}\left(-{\frac {2}{n^{2}}}+{\frac {2}{n^{2}}}cos(n\pi )\right)\!}
a
n
=
1
π
(
(
−
2
n
2
)
(
1
−
c
o
s
(
n
π
)
)
{\displaystyle a_{n}={\frac {1}{\pi }}\left(\left(-{\frac {2}{n^{2}}}\right)(1-cos(n\pi )\right)\!}
a
n
=
−
2
n
2
π
(
1
−
c
o
s
(
n
π
)
)
{\displaystyle a_{n}=-{\frac {2}{n^{2}\pi }}\left(1-cos(n\pi )\right)\!}
To evaluate the term
(
1
−
c
o
s
(
n
π
)
)
{\displaystyle (1-cos(n\pi ))\!}
:
Note that
c
o
s
(
n
π
)
=
−
1
{\displaystyle cos(n\pi )=-1\!}
for odd n values as
c
o
s
(
π
)
=
c
o
s
(
3
π
)
=
c
o
s
(
5
π
)
.
.
.
=
−
1
{\displaystyle cos(\pi )=cos(3\pi )=cos(5\pi )...=-1\!}
And that
c
o
s
(
n
π
)
=
1
{\displaystyle cos(n\pi )=1\!}
for even n values as
c
o
s
(
2
π
)
=
c
o
s
(
4
π
)
=
c
o
s
(
6
π
)
.
.
.
=
1
{\displaystyle cos(2\pi )=cos(4\pi )=cos(6\pi )...=1\!}
.
Therefore, it can be concluded that for odd n values:
(
1
−
c
o
s
(
n
π
)
)
=
1
−
(
−
1
)
=
2
{\displaystyle (1-cos(n\pi ))=1-(-1)=2\!}
And for even n values:
(
1
−
c
o
s
(
n
π
)
=
1
−
(
1
)
=
0
{\displaystyle (1-cos(n\pi )=1-(1)=0\!}
Therefore, for the coefficient
a
n
{\displaystyle 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):
a
n
=
−
4
n
2
π
for
n
=
1
,
3
,
5...
{\displaystyle a_{n}=-{\frac {4}{n^{2}\pi }}{\text{ for }}n=1,3,5...\!}
Calculating the coefficient
b
n
{\displaystyle b_{n}\!}
:
b
n
=
1
π
(
∫
−
π
0
−
x
s
i
n
(
n
x
)
d
x
+
∫
0
π
x
s
i
n
(
n
x
)
d
x
)
{\displaystyle b_{n}={\frac {1}{\pi }}\left(\int _{-\pi }^{0}-xsin(nx)dx+\int _{0}^{\pi }xsin(nx)dx\right)\!}
b
n
=
1
π
(
−
∫
−
π
0
x
s
i
n
(
n
x
)
d
x
+
∫
0
π
x
s
i
n
(
n
x
)
d
x
)
{\displaystyle 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
{\displaystyle u=x\!}
and therefore
d
u
=
d
x
{\displaystyle du=dx\!}
d
v
=
s
i
n
(
n
x
)
d
x
{\displaystyle dv=sin(nx)dx\!}
and therefore
v
=
−
1
n
c
o
s
(
n
x
)
{\displaystyle v={\frac {-1}{n}}cos(nx)\!}
This yields for the integral:
b
n
=
1
π
(
−
[
−
1
n
x
c
o
s
(
n
x
)
−
∫
−
1
n
c
o
s
(
n
x
)
d
x
]
−
π
0
+
[
−
1
n
x
c
o
s
(
n
x
)
−
∫
−
1
n
c
o
s
(
n
x
)
d
x
]
0
π
)
{\displaystyle 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
=
1
π
(
−
[
−
1
n
x
c
o
s
(
n
x
)
+
1
n
2
s
i
n
(
n
x
)
]
−
π
0
+
[
−
1
n
x
c
o
s
(
n
x
)
+
1
n
2
s
i
n
(
n
x
)
]
0
π
)
{\displaystyle 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
=
1
π
(
−
[
0
−
(
−
1
n
(
−
π
)
c
o
s
(
−
n
π
)
+
1
n
2
s
i
n
(
−
n
π
)
)
]
+
[
−
1
n
π
c
o
s
(
n
π
)
+
1
n
2
s
i
n
(
n
π
)
−
0
]
)
{\displaystyle 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... :
s
i
n
(
n
π
)
=
0
{\displaystyle sin(n\pi )=0\!}
as
s
i
n
(
π
)
=
s
i
n
(
2
π
)
=
s
i
n
(
3
π
)
.
.
.
=
0
{\displaystyle sin(\pi )=sin(2\pi )=sin(3\pi )...=0\!}
therefore these terms are evaluated as zero, which yields:
b
n
=
1
π
(
−
[
0
−
(
−
1
n
(
−
π
)
c
o
s
(
−
n
π
)
+
0
)
]
+
[
−
1
n
π
c
o
s
(
n
π
)
+
0
]
)
{\displaystyle 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
=
1
π
(
[
1
n
(
π
)
c
o
s
(
−
n
π
)
]
+
[
−
1
n
π
c
o
s
(
n
π
)
]
)
{\displaystyle 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
c
o
s
(
−
x
)
=
c
o
s
(
x
)
{\displaystyle cos(-x)=cos(x)\!}
therefore:
b
n
=
1
π
(
1
n
π
c
o
s
(
n
π
)
+
−
1
n
π
c
o
s
(
n
π
)
)
{\displaystyle b_{n}={\frac {1}{\pi }}\left({\frac {1}{n}}\pi cos(n\pi )+{\frac {-1}{n}}\pi cos(n\pi )\right)\!}
b
n
=
1
π
(
0
)
{\displaystyle b_{n}={\frac {1}{\pi }}\left(0\right)\!}
b
n
=
0
{\displaystyle b_{n}=0\!}
Therefore there will be no
s
i
n
(
n
x
)
{\displaystyle sin(nx)\!}
terms in the Fourier representation.
In conclusion, the Fourier series representation for the given function is as follows:
f
(
x
)
=
π
2
−
4
π
c
o
s
(
x
)
−
4
3
2
π
c
o
s
(
3
x
)
−
4
5
2
π
c
o
s
(
5
x
)
+
.
.
.
{\displaystyle f(x)={\frac {\pi }{2}}-{\frac {4}{\pi }}cos(x)-{\frac {4}{3^{2}\pi }}cos(3x)-{\frac {4}{5^{2}\pi }}cos(5x)+...\!}
f
(
x
)
=
π
2
−
4
π
(
c
o
s
(
x
)
+
1
9
c
o
s
(
3
x
)
+
1
25
c
o
s
(
5
x
)
+
.
.
.
)
{\displaystyle f(x)={\frac {\pi }{2}}-{\frac {4}{\pi }}\left(cos(x)+{\frac {1}{9}}cos(3x)+{\frac {1}{25}}cos(5x)+...\right)\!}
A graph of the function, and the Fourier series for
n
=
1
,
3
,
5
{\displaystyle n=1,3,5\!}
is shown below:
--Egm4313.s12.team11.sheider (talk ) 06:00, 22 April 2012 (UTC)
Find the Fourier series of the given function which is assumed to have a period of
2
π
{\displaystyle 2\pi \!}
. Show the details of your work.
Sketch or graph the partial sums up to that including
c
o
s
(
5
x
)
{\displaystyle cos(5x)\!}
and
s
i
n
(
5
x
)
{\displaystyle sin(5x)\!}
Given:
f
(
x
)
=
{
−
x
if
−
π
<
x
<
0
π
−
x
if
0
<
x
<
π
{\displaystyle f(x)=\left\{{\begin{matrix}-x{\text{ if }}-\pi <x<0\\\pi -x{\text{ if }}0<x<\pi \end{matrix}}\right.\!}
The Fourier series of a function with a period of
p
=
2
π
{\displaystyle p=2\pi \!}
is defined:
f
(
x
)
=
a
0
+
∑
n
=
1
∞
(
a
n
c
o
s
(
n
x
)
+
b
n
s
i
n
(
n
x
)
)
{\displaystyle f(x)=a_{0}+\sum _{n=1}^{\infty }(a_{n}cos(nx)+b_{n}sin(nx))\!}
Where:
a
0
=
1
2
π
∫
−
π
π
f
(
x
)
d
x
{\displaystyle a_{0}={\frac {1}{2\pi }}\int _{-\pi }^{\pi }f(x)dx\!}
a
n
=
1
π
∫
−
π
π
f
(
x
)
c
o
s
(
n
x
)
d
x
{\displaystyle a_{n}={\frac {1}{\pi }}\int _{-\pi }^{\pi }f(x)cos(nx)dx\!}
b
n
=
1
π
∫
−
π
π
f
(
x
)
s
i
n
(
n
x
)
d
x
{\displaystyle b_{n}={\frac {1}{\pi }}\int _{-\pi }^{\pi }f(x)sin(nx)dx\!}
Calculating the first term
a
0
{\displaystyle a_{0}\!}
:
a
0
=
1
2
π
(
∫
−
π
0
x
d
x
+
∫
0
π
(
π
−
x
)
d
x
)
{\displaystyle a_{0}={\frac {1}{2\pi }}\left(\int _{-\pi }^{0}xdx+\int _{0}^{\pi }(\pi -x)dx\right)\!}
a
0
=
1
2
π
(
[
x
2
2
]
−
π
0
+
[
π
x
−
x
2
2
]
0
π
)
{\displaystyle 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
=
1
2
π
(
−
(
π
2
2
)
+
(
π
2
−
π
2
2
)
)
{\displaystyle a_{0}={\frac {1}{2\pi }}\left(-\left({\frac {\pi ^{2}}{2}}\right)+\left(\pi ^{2}-{\frac {\pi ^{2}}{2}}\right)\right)\!}
a
0
=
1
2
π
(
−
π
2
2
+
π
2
−
π
2
2
)
{\displaystyle a_{0}={\frac {1}{2\pi }}\left(-{\frac {\pi ^{2}}{2}}+\pi ^{2}-{\frac {\pi ^{2}}{2}}\right)\!}
a
0
=
1
2
π
(
π
2
−
π
2
)
{\displaystyle a_{0}={\frac {1}{2\pi }}\left(\pi ^{2}-\pi ^{2}\right)\!}
a
0
=
0
{\displaystyle a_{0}=0\!}
Calculating the coefficient
a
n
{\displaystyle a_{n}\!}
:
a
n
=
1
π
(
∫
−
π
0
x
c
o
s
(
n
x
)
d
x
+
∫
0
π
(
π
−
x
)
c
o
s
(
n
x
)
d
x
)
{\displaystyle 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
∫
−
π
0
x
c
o
s
(
n
x
)
d
x
{\displaystyle \int _{-\pi }^{0}xcos(nx)dx\!}
:
u
=
x
{\displaystyle u=x\!}
and therefore
d
u
=
d
x
{\displaystyle du=dx\!}
d
v
=
c
o
s
(
n
x
)
d
x
{\displaystyle dv=cos(nx)dx\!}
and therefore
v
=
1
n
s
i
n
(
n
x
)
{\displaystyle v={\frac {1}{n}}sin(nx)\!}
Using integration by parts with the following substitutions for the integral
∫
0
π
(
π
−
x
)
c
o
s
(
n
x
)
d
x
{\displaystyle \int _{0}^{\pi }(\pi -x)cos(nx)dx\!}
:
u
=
π
−
x
{\displaystyle u=\pi -x\!}
and therefore
d
u
=
−
d
x
{\displaystyle du=-dx\!}
d
v
=
c
o
s
(
n
x
)
d
x
{\displaystyle dv=cos(nx)dx\!}
and therefore
v
=
1
n
s
i
n
(
n
x
)
{\displaystyle v={\frac {1}{n}}sin(nx)\!}
This yields for the overall expression:
a
n
=
1
π
(
[
1
n
x
s
i
n
(
n
x
)
−
∫
1
n
s
i
n
(
n
x
)
d
x
]
−
π
0
+
[
1
n
(
π
−
x
)
s
i
n
(
n
x
)
−
∫
−
1
n
s
i
n
(
n
x
)
d
x
]
0
π
)
{\displaystyle 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
=
1
π
(
[
1
n
x
s
i
n
(
n
x
)
+
1
n
2
c
o
s
(
n
x
)
]
−
π
0
+
[
1
n
(
π
−
x
)
s
i
n
(
n
x
)
−
1
n
2
c
o
s
(
n
x
)
]
0
π
)
{\displaystyle 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
=
1
π
(
[
1
n
2
−
(
1
n
(
−
π
)
s
i
n
(
−
n
π
)
+
1
n
2
c
o
s
(
−
n
π
)
)
]
+
[
−
1
n
2
c
o
s
(
n
π
)
+
1
n
2
]
)
{\displaystyle 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... :
s
i
n
(
n
π
)
=
0
{\displaystyle sin(n\pi )=0\!}
as
s
i
n
(
π
)
=
s
i
n
(
2
π
)
=
s
i
n
(
3
π
)
.
.
.
=
0
{\displaystyle sin(\pi )=sin(2\pi )=sin(3\pi )...=0\!}
therefore these terms are evaluated as zero, which yields:
a
n
=
1
π
(
[
1
n
2
−
0
−
1
n
2
c
o
s
(
−
n
π
)
]
+
[
−
1
n
2
c
o
s
(
n
π
)
+
1
n
2
]
)
{\displaystyle 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
=
1
π
(
1
n
2
−
1
n
2
c
o
s
(
−
n
π
)
−
1
n
2
c
o
s
(
n
π
)
+
1
n
2
)
{\displaystyle 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
c
o
s
(
−
x
)
=
c
o
s
(
x
)
{\displaystyle cos(-x)=cos(x)\!}
therefore:
a
n
=
1
π
(
1
n
2
−
1
n
2
c
o
s
(
n
π
)
−
1
n
2
c
o
s
(
n
π
)
+
1
n
2
)
{\displaystyle 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
=
1
π
(
2
n
2
−
2
n
2
c
o
s
(
n
π
)
)
{\displaystyle a_{n}={\frac {1}{\pi }}\left({\frac {2}{n^{2}}}-{\frac {2}{n^{2}}}cos(n\pi )\right)\!}
a
n
=
1
π
(
(
2
n
2
)
(
1
−
c
o
s
(
n
π
)
)
)
{\displaystyle a_{n}={\frac {1}{\pi }}\left(\left({\frac {2}{n^{2}}}\right)(1-cos(n\pi ))\right)\!}
a
n
=
2
n
2
π
(
1
−
c
o
s
(
n
π
)
)
{\displaystyle a_{n}={\frac {2}{n^{2}\pi }}\left(1-cos(n\pi )\right)\!}
To evaluate the term
(
1
−
c
o
s
(
n
π
)
)
{\displaystyle (1-cos(n\pi ))\!}
:
Note that
c
o
s
(
n
π
)
=
−
1
{\displaystyle cos(n\pi )=-1\!}
for odd n values as
c
o
s
(
π
)
=
c
o
s
(
3
π
)
=
c
o
s
(
5
π
)
.
.
.
=
−
1
{\displaystyle cos(\pi )=cos(3\pi )=cos(5\pi )...=-1\!}
And that
c
o
s
(
n
π
)
=
1
{\displaystyle cos(n\pi )=1\!}
for even n values as
c
o
s
(
2
π
)
=
c
o
s
(
4
π
)
=
c
o
s
(
6
π
)
.
.
.
=
1
{\displaystyle cos(2\pi )=cos(4\pi )=cos(6\pi )...=1\!}
.
Therefore, it can be concluded that for odd n values:
(
1
−
c
o
s
(
n
π
)
)
=
1
−
(
−
1
)
=
2
{\displaystyle (1-cos(n\pi ))=1-(-1)=2\!}
And for even n values:
(
1
−
c
o
s
(
n
π
)
)
=
1
−
(
1
)
=
0
{\displaystyle (1-cos(n\pi ))=1-(1)=0\!}
Therefore, for the coefficient
a
n
{\displaystyle 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):
a
n
=
4
n
2
π
for
n
=
1
,
3
,
5...
{\displaystyle a_{n}={\frac {4}{n^{2}\pi }}{\text{ for }}n=1,3,5...\!}
Calculating the coefficient
b
n
{\displaystyle b_{n}\!}
:
b
n
=
1
π
(
∫
−
π
0
x
s
i
n
(
n
x
)
d
x
+
∫
0
π
(
π
−
x
)
s
i
n
(
n
x
)
d
x
)
{\displaystyle 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
∫
−
π
0
x
s
i
n
(
n
x
)
d
x
{\displaystyle \int _{-\pi }^{0}xsin(nx)dx\!}
:
u
=
x
{\displaystyle u=x\!}
and therefore
d
u
=
d
x
{\displaystyle du=dx\!}
d
v
=
s
i
n
(
n
x
)
d
x
{\displaystyle dv=sin(nx)dx\!}
and therefore
v
=
−
1
n
c
o
s
(
n
x
)
{\displaystyle v={\frac {-1}{n}}cos(nx)\!}
Using integration by parts with the following substitutions for the integral
∫
0
π
(
π
−
x
)
s
i
n
(
n
x
)
d
x
{\displaystyle \int _{0}^{\pi }(\pi -x)sin(nx)dx\!}
:
u
=
π
−
x
{\displaystyle u=\pi -x\!}
and therefore
d
u
=
−
d
x
{\displaystyle du=-dx\!}
d
v
=
s
i
n
(
n
x
)
d
x
{\displaystyle dv=sin(nx)dx\!}
and therefore
v
=
−
1
n
c
o
s
(
n
x
)
{\displaystyle v={\frac {-1}{n}}cos(nx)\!}
This yields for the overall expression:
b
n
=
1
π
(
[
−
1
n
x
c
o
s
(
n
x
)
−
∫
−
1
n
c
o
s
(
n
x
)
d
x
]
−
π
0
+
[
−
1
n
(
π
−
x
)
c
o
s
(
n
x
)
−
∫
−
−
1
n
c
o
s
(
n
x
)
d
x
]
0
π
)
{\displaystyle 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
=
1
π
(
[
−
1
n
x
c
o
s
(
n
x
)
+
1
n
2
s
i
n
(
n
x
)
]
−
π
0
+
[
−
1
n
(
π
−
x
)
c
o
s
(
n
x
)
−
1
n
2
s
i
n
(
n
x
)
]
0
π
)
{\displaystyle 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
=
1
π
(
[
0
−
(
−
1
n
(
−
π
)
c
o
s
(
−
n
π
)
+
1
n
2
s
i
n
(
−
n
π
)
)
]
+
[
−
1
n
2
s
i
n
(
n
π
)
−
(
−
1
n
π
)
]
)
{\displaystyle 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
=
1
π
(
−
1
n
π
c
o
s
(
−
n
π
)
−
1
n
2
s
i
n
(
−
n
π
)
−
1
n
2
s
i
n
(
n
π
)
+
1
n
π
)
{\displaystyle 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... :
s
i
n
(
n
π
)
=
0
{\displaystyle sin(n\pi )=0\!}
as
s
i
n
(
π
)
=
s
i
n
(
2
π
)
=
s
i
n
(
3
π
)
.
.
.
=
0
{\displaystyle sin(\pi )=sin(2\pi )=sin(3\pi )...=0\!}
therefore these terms are evaluated as zero, which yields:
b
n
=
1
π
(
−
1
n
π
c
o
s
(
−
n
π
)
−
0
−
0
+
1
n
π
)
{\displaystyle b_{n}={\frac {1}{\pi }}\left(-{\frac {1}{n}}\pi cos(-n\pi )-0-0+{\frac {1}{n}}\pi \right)\!}
b
n
=
1
π
(
1
n
π
−
1
n
π
c
o
s
(
−
n
π
)
)
{\displaystyle b_{n}={\frac {1}{\pi }}\left({\frac {1}{n}}\pi -{\frac {1}{n}}\pi cos(-n\pi )\right)\!}
Note that
c
o
s
(
−
x
)
=
c
o
s
(
x
)
{\displaystyle cos(-x)=cos(x)\!}
therefore:
b
n
=
1
π
(
1
n
π
−
1
n
π
c
o
s
(
n
π
)
)
{\displaystyle b_{n}={\frac {1}{\pi }}\left({\frac {1}{n}}\pi -{\frac {1}{n}}\pi cos(n\pi )\right)\!}
b
n
=
1
π
(
(
π
n
)
(
1
−
c
o
s
(
n
π
)
)
)
{\displaystyle b_{n}={\frac {1}{\pi }}\left(\left({\frac {\pi }{n}}\right)(1-cos(n\pi ))\right)\!}
b
n
=
1
n
(
1
−
c
o
s
(
n
π
)
)
{\displaystyle b_{n}={\frac {1}{n}}\left(1-cos(n\pi )\right)\!}
To evaluate the term
(
1
−
c
o
s
(
n
π
)
)
{\displaystyle (1-cos(n\pi ))\!}
:
Note that
c
o
s
(
n
π
)
=
−
1
{\displaystyle cos(n\pi )=-1\!}
for odd n values as
c
o
s
(
π
)
=
c
o
s
(
3
π
)
=
c
o
s
(
5
π
)
.
.
.
=
−
1
{\displaystyle cos(\pi )=cos(3\pi )=cos(5\pi )...=-1\!}
And that
c
o
s
(
n
π
)
=
1
{\displaystyle cos(n\pi )=1\!}
for even n values as
c
o
s
(
2
π
)
=
c
o
s
(
4
π
)
=
c
o
s
(
6
π
)
.
.
.
=
1
{\displaystyle cos(2\pi )=cos(4\pi )=cos(6\pi )...=1\!}
.
Therefore, it can be concluded that for odd n values:
(
1
−
c
o
s
(
n
π
)
)
=
1
−
(
−
1
)
=
2
{\displaystyle (1-cos(n\pi ))=1-(-1)=2\!}
And for even n values:
(
1
−
c
o
s
(
n
π
)
)
=
1
−
(
1
)
=
0
{\displaystyle (1-cos(n\pi ))=1-(1)=0\!}
Therefore, for the coefficient
b
n
{\displaystyle 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):
b
n
=
2
n
for
n
=
1
,
3
,
5...
{\displaystyle b_{n}={\frac {2}{n}}{\text{ for }}n=1,3,5...\!}
In conclusion, the Fourier series representation for the given function is as follows:
f
(
x
)
=
0
+
(
4
π
c
o
s
(
x
)
+
4
3
2
π
c
o
s
(
3
x
)
+
4
5
2
π
c
o
s
(
5
x
)
+
.
.
.
)
+
(
2
s
i
n
(
x
)
+
2
3
s
i
n
(
3
x
)
+
2
5
s
i
n
(
5
x
)
+
.
.
.
)
{\displaystyle 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)\!}
f
(
x
)
=
4
π
(
c
o
s
(
x
)
+
1
9
c
o
s
(
3
x
)
+
1
25
c
o
s
(
5
x
)
+
.
.
.
)
+
2
(
s
i
n
(
x
)
+
1
3
s
i
n
(
3
x
)
+
1
5
s
i
n
(
5
x
)
+
.
.
.
)
{\displaystyle f(x)={\frac {4}{\pi }}\left(cos(x)+{\frac {1}{9}}cos(3x)+{\frac {1}{25}}cos(5x)+...\right)+2\left(sin(x)+{\frac {1}{3}}sin(3x)+{\frac {1}{5}}sin(5x)+...\right)\!}
A graph of the function, and the Fourier series for
n
=
1
,
3
,
5
{\displaystyle n=1,3,5\!}
is shown below:
--Egm4313.s12.team11.sheider (talk ) 06:00, 22 April 2012 (UTC)
Solved by Daniel Suh
Consider the following,
⟨
ϕ
2
j
−
1
,
ϕ
2
k
−
1
⟩
=
∫
0
p
ϕ
2
j
−
1
(
x
)
⋅
ϕ
2
k
−
1
(
x
)
d
x
{\displaystyle \left\langle \phi _{2j-1},\phi _{2k-1}\right\rangle =\int _{0}^{p}\phi _{2j-1}(x)\cdot \phi _{2k-1}(x)dx\!}
⟨
ϕ
2
j
−
1
,
ϕ
2
k
−
1
⟩
=
∫
0
p
sin
j
ω
x
⋅
sin
k
ω
x
d
x
{\displaystyle \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
≠
k
a
n
d
j
,
k
=
1
,
2
,
.
.
.
{\displaystyle j\neq k\;and\;j,k=1,2,...\!}
, and
p
=
2
π
,
j
=
2
,
k
=
3
{\displaystyle 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.
Trigonometric Identities
edit
Angle Sum and Difference Identities
(
1
)
cos
(
a
+
b
)
=
cos
a
cos
b
−
sin
a
sin
b
{\displaystyle (1)\cos {(a+b)}=\cos {a}\cos {b}-\sin {a}\sin {b}\!}
(
2
)
cos
(
a
−
b
)
=
cos
a
cos
b
+
sin
a
sin
b
{\displaystyle (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
)
{\displaystyle (1)\sin {a}\sin {b}=\cos {a}\cos {b}-\cos {(a+b)}\!}
(
2
)
cos
a
cos
b
=
cos
(
a
−
b
)
−
sin
a
sin
b
{\displaystyle (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
)
{\displaystyle \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
)
{\displaystyle 2\sin {a}\sin {b}=\cos {(a-b)}-\cos {(a+b)}\!}
sin
a
sin
b
=
1
2
cos
(
a
−
b
)
−
1
2
cos
(
a
+
b
)
{\displaystyle \sin {a}\sin {b}={\frac {1}{2}}\cos {(a-b)}-{\frac {1}{2}}\cos {(a+b)}\!}
Utilize Trig Identities
edit
⟨
ϕ
2
j
−
1
,
ϕ
2
k
−
1
⟩
=
∫
0
p
sin
j
w
x
⋅
sin
k
w
x
d
x
{\displaystyle \left\langle \phi _{2j-1},\phi _{2k-1}\right\rangle =\int _{0}^{p}\sin {jwx}\cdot \sin {kwx}\;dx\!}
⟨
ϕ
2
j
−
1
,
ϕ
2
k
−
1
⟩
=
∫
0
2
π
sin
2
ω
x
⋅
sin
3
ω
x
d
x
{\displaystyle \left\langle \phi _{2j-1},\phi _{2k-1}\right\rangle =\int _{0}^{2\pi }\sin {2\omega x}\cdot \sin {3\omega x}\;dx\!}
⟨
ϕ
2
j
−
1
,
ϕ
2
k
−
1
⟩
=
∫
0
2
π
1
2
cos
(
2
ω
x
−
3
ω
x
)
−
1
2
cos
(
2
ω
x
+
3
ω
x
)
d
x
{\displaystyle \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\!}
⟨
ϕ
2
j
−
1
,
ϕ
2
k
−
1
⟩
=
1
2
∫
0
2
π
cos
(
−
ω
x
)
d
x
−
1
2
∫
0
2
π
cos
(
5
ω
x
)
d
x
{\displaystyle \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\!}
⟨
ϕ
2
j
−
1
,
ϕ
2
k
−
1
⟩
=
1
2
sin
(
−
ω
x
)
|
0
2
π
−
1
2
sin
(
5
ω
x
)
|
0
2
π
{\displaystyle \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 }\!}
⟨
ϕ
2
j
−
1
,
ϕ
2
k
−
1
⟩
=
(
0
−
0
)
−
(
0
−
0
)
{\displaystyle \left\langle \phi _{2j-1},\phi _{2k-1}\right\rangle =(0-0)-(0-0)\!}
⟨
ϕ
2
j
−
1
,
ϕ
2
k
−
1
⟩
=
0
{\displaystyle \left\langle \phi _{2j-1},\phi _{2k-1}\right\rangle =0\!}
>> X = 0:2*pi/100:2*pi;
>> Y = sin(2*X).*sin(3*X);
>> Z = trapz(X,Y)
Z =
2.9490e-017