[<< wikibooks] Advanced Mathematics for Engineers and Scientists/Details and Applications of Fourier Series
== Details and Applications of Fourier Series ==
In the study of PDEs (and much elsewhere), a Fourier series (or more generally, trigonometric expansion) often needs to be constructed.

=== Preliminaries ===
Suppose that a function f(x) may be expressed in the following way:

f
(
x
)
=

A

0

2

+

∑

n
=
1

∞

(

A

n

cos
⁡

(

n
π

L

x

)

+

B

n

sin
⁡

(

n
π

L

x

)

)

{\displaystyle f(x)={\frac {A_{0}}{2}}+\sum _{n=1}^{\infty }\left(A_{n}\cos \left({\frac {n\pi }{L}}x\right)+B_{n}\sin \left({\frac {n\pi }{L}}x\right)\right)}
It can be shown (not too difficult, but beyond this text) that the above expansion will converge to f(x), except at discontinuities, if the following conditions hold:

f(x) = f(x + 2L), i.e.  f(x) has period 2L .
f(x), f'(x), and f''(x) are piecewise continuous on the interval -L ≤ x ≤ L.
The pieces that make up f(x), f'(x), and f''(x) are continuous over closed subintervals.The first requirement is most significant; the last two requirements can, to an extent, be partly eased off in most cases without any trouble. An interesting thing happens at discontinuities. Suppose that f(x) is discontinuous at x = a; the expansion will converge to the following value:

1
2

(

lim

x
→

a

−

f
(
x
)
+

lim

x
→

a

+

f
(
x
)

)

{\displaystyle {\frac {1}{2}}\left(\lim _{x\rightarrow a^{-}}f(x)+\lim _{x\rightarrow a^{+}}f(x)\right)\,}
So the expansion converges to the average of the values to the left and the right of the discontinuity. This, and the fact that it converges in the first place, is very convenient. The Fourier series looks unfriendly but it's honestly working for you.
The information needed to express f(x) as a Fourier series are the sequences An and Bn. This is done using orthogonality, which for the sinusoids may be derived easily using a few identities. The following are some useful orthogonality relations, with m and n restricted to integers:

∫

0

L

2
L

sin
⁡

(

m
π

L

x

)

sin
⁡

(

n
π

L

x

)

d
x
=

δ

m
,
n

{\displaystyle \int _{0}^{L}{\frac {2}{L}}\sin \left({\frac {m\pi }{L}}x\right)\sin \left({\frac {n\pi }{L}}x\right)dx=\delta _{m,n}}

∫

0

L

2
L

cos
⁡

(

m
π

L

x

)

cos
⁡

(

n
π

L

x

)

d
x
=

δ

m
,
n

{\displaystyle \int _{0}^{L}{\frac {2}{L}}\cos \left({\frac {m\pi }{L}}x\right)\cos \left({\frac {n\pi }{L}}x\right)dx=\delta _{m,n}}

∫

−
L

L

1
L

sin
⁡

(

m
π

L

x

)

sin
⁡

(

n
π

L

x

)

d
x
=

δ

m
,
n

{\displaystyle \int _{-L}^{L}{\frac {1}{L}}\sin \left({\frac {m\pi }{L}}x\right)\sin \left({\frac {n\pi }{L}}x\right)dx=\delta _{m,n}}

∫

−
L

L

1
L

cos
⁡

(

m
π

L

x

)

cos
⁡

(

n
π

L

x

)

d
x
=

δ

m
,
n

{\displaystyle \int _{-L}^{L}{\frac {1}{L}}\cos \left({\frac {m\pi }{L}}x\right)\cos \left({\frac {n\pi }{L}}x\right)dx=\delta _{m,n}}

∫

−
L

L

sin
⁡

(

m
π

L

x

)

cos
⁡

(

n
π

L

x

)

d
x
=
0

{\displaystyle \int _{-L}^{L}\sin \left({\frac {m\pi }{L}}x\right)\cos \left({\frac {n\pi }{L}}x\right)dx=0}
δm,n is called the Kronecker delta, defined by:

δ

m
,
n

=

{

1
,

m
=
n

0
,

m
≠
n

{\displaystyle \delta _{m,n}={\begin{cases}1,&m=n\\0,&m\neq n\end{cases}}}
The Kronecker delta may be thought of as a discrete version of the Dirac delta "function". Relevant to this topic is its sifting property:

∑

n
=
−
∞

∞

A

n

δ

m
,
n

=

A

m

{\displaystyle \sum _{n=-\infty }^{\infty }A_{n}\delta _{m,n}=A_{m}\,}

=== Derivation of the Fourier Series ===
We're now ready to find An and Bn.

f
(
x
)
=

A

0

2

+

∑

n
=
1

∞

(

A

n

cos
⁡

(

n
π

L

x

)

+

B

n

sin
⁡

(

n
π

L

x

)

)

{\displaystyle f(x)={\frac {A_{0}}{2}}+\sum _{n=1}^{\infty }\left(A_{n}\cos \left({\frac {n\pi }{L}}x\right)+B_{n}\sin \left({\frac {n\pi }{L}}x\right)\right)}

1
L

cos
⁡

(

m
π

L

x

)

⋅
f
(
x
)
=

1
L

cos
⁡

(

m
π

L

x

)

⋅

(

A

0

2

+

∑

n
=
1

∞

(

A

n

cos
⁡

(

n
π

L

x

)

B

n

sin
⁡

(

n
π

L

x

)

)

)

{\displaystyle {\frac {1}{L}}\cos \left({\frac {m\pi }{L}}x\right)\cdot f(x)={\frac {1}{L}}\cos \left({\frac {m\pi }{L}}x\right)\cdot \left({\frac {A_{0}}{2}}+\sum _{n=1}^{\infty }\left(A_{n}\cos \left({\frac {n\pi }{L}}x\right)B_{n}\sin \left({\frac {n\pi }{L}}x\right)\right)\right)\,}

∫

−
L

L

1
L

cos
⁡

(

m
π

L

x

)

f
(
x
)
d
x
=

∫

−
L

L

A

0

2
L

cos
⁡

(

m
π

L

x

)

d
x
+

∑

n
=
1

∞

(

A

n

δ

m
,
n

+

B

n

L

⋅
0

)

{\displaystyle \int _{-L}^{L}{\frac {1}{L}}\cos \left({\frac {m\pi }{L}}x\right)f(x)dx=\int _{-L}^{L}{\frac {A_{0}}{2L}}\cos \left({\frac {m\pi }{L}}x\right)dx+\sum _{n=1}^{\infty }\left(A_{n}\delta _{m,n}+{\frac {B_{n}}{L}}\cdot 0\right)}
This is supposed to hold for an arbitrary integer m. If m = 0, note that the sum doesn't allow n = 0 and so the sum would be zero since in no case does m = n. This leads to:

∫

−
L

L

1
L

cos
⁡

(

0
⋅
π

L

x

)

f
(
x
)
d
x
=

∫

−
L

L

A

0

2
L

cos
⁡

(

0
⋅
π

L

x

)

d
x

{\displaystyle \int _{-L}^{L}{\frac {1}{L}}\cos \left({\frac {0\cdot \pi }{L}}x\right)f(x)dx=\int _{-L}^{L}{\frac {A_{0}}{2L}}\cos \left({\frac {0\cdot \pi }{L}}x\right)dx}

∫

−
L

L

1
L

f
(
x
)
d
x
=

A

0

∫

−
L

L

d
x

2
L

{\displaystyle \int _{-L}^{L}{\frac {1}{L}}f(x)dx=A_{0}\int _{-L}^{L}{\frac {dx}{2L}}}

∫

−
L

L

1
L

f
(
x
)
d
x
=

A

0

{\displaystyle \int _{-L}^{L}{\frac {1}{L}}f(x)dx=A_{0}}
This secures A0. Now suppose that m > 0. Since m and n are now in the same domain, the Kronecker delta will do its sifting:

∫

−
L

L

1
L

cos
⁡

(

m
π

L

x

)

f
(
x
)
d
x
=

∫

−
L

L

A

0

2
L

cos
⁡

(

m
π

L

x

)

d
x
+

∑

n
=
1

∞

(

A

n

δ

m
,
n

)

{\displaystyle \int _{-L}^{L}{\frac {1}{L}}\cos \left({\frac {m\pi }{L}}x\right)f(x)dx=\int _{-L}^{L}{\frac {A_{0}}{2L}}\cos \left({\frac {m\pi }{L}}x\right)dx+\sum _{n=1}^{\infty }\left(A_{n}\delta _{m,n}\right)}

∫

−
L

L

1
L

cos
⁡

(

m
π

L

x

)

f
(
x
)
d
x
=

A

0

sin
⁡
(
m
π
)

m
π

+

A

m

{\displaystyle \int _{-L}^{L}{\frac {1}{L}}\cos \left({\frac {m\pi }{L}}x\right)f(x)dx={\frac {A_{0}\sin(m\pi )}{m\pi }}+A_{m}}

∫

−
L

L

1
L

cos
⁡

(

m
π

L

x

)

f
(
x
)
d
x
=
0
+

A

m

{\displaystyle \int _{-L}^{L}{\frac {1}{L}}\cos \left({\frac {m\pi }{L}}x\right)f(x)dx=0+A_{m}}

A

n

=

∫

−
L

L

1
L

cos
⁡

(

n
π

L

x

)

f
(
x
)
d
x

{\displaystyle A_{n}=\int _{-L}^{L}{\frac {1}{L}}\cos \left({\frac {n\pi }{L}}x\right)f(x)dx}
In the second to the last step, sin(mπ) = 0 for integer m. In the last step, m was replaced with n. This defines An for n > 0. For the case n = 0,

A

0

=

∫

−
L

L

1
L

cos
⁡

(

0
⋅
π

L

x

)

f
(
x
)
d
x

{\displaystyle A_{0}=\int _{-L}^{L}{\frac {1}{L}}\cos \left({\frac {0\cdot \pi }{L}}x\right)f(x)dx}

A

0

=

∫

−
L

L

1
L

f
(
x
)
d
x

{\displaystyle A_{0}=\int _{-L}^{L}{\frac {1}{L}}f(x)dx}
Which happens to match the previous development (now you know why it's A0/2 and not just A0). So the sequence An is now completely defined for any value of n of interest:

A

n

=

∫

−
L

L

1
L

cos
⁡

(

n
π

L

x

)

f
(
x
)
d
x

{\displaystyle A_{n}=\int _{-L}^{L}{\frac {1}{L}}\cos \left({\frac {n\pi }{L}}x\right)f(x)dx}
To get Bn, nearly the same routine is used.

f
(
x
)
=

A

0

2

+

∑

n
=
1

∞

(

A

n

cos
⁡

(

n
π

L

x

)

+

B

n

sin
⁡

(

n
π

L

x

)

)

{\displaystyle f(x)={\frac {A_{0}}{2}}+\sum _{n=1}^{\infty }\left(A_{n}\cos \left({\frac {n\pi }{L}}x\right)+B_{n}\sin \left({\frac {n\pi }{L}}x\right)\right)}

1
L

sin
⁡

(

m
π

L

x

)

⋅
f
(
x
)
=

1
L

sin
⁡

(

m
π

L

x

)

⋅

(

A

0

2

+

∑

n
=
1

∞

(

A

n

cos
⁡

(

n
π

L

x

)

B

n

sin
⁡

(

n
π

L

x

)

)

)

{\displaystyle {\frac {1}{L}}\sin \left({\frac {m\pi }{L}}x\right)\cdot f(x)={\frac {1}{L}}\sin \left({\frac {m\pi }{L}}x\right)\cdot \left({\frac {A_{0}}{2}}+\sum _{n=1}^{\infty }\left(A_{n}\cos \left({\frac {n\pi }{L}}x\right)B_{n}\sin \left({\frac {n\pi }{L}}x\right)\right)\right)\,}

∫

−
L

L

1
L

sin
⁡

(

m
π

L

x

)

f
(
x
)
d
x
=

A

0

2
L

⋅
0
+

∑

n
=
1

∞

(

A

n

L

⋅
0
+

B

n

δ

m
,
n

)

{\displaystyle \int _{-L}^{L}{\frac {1}{L}}\sin \left({\frac {m\pi }{L}}x\right)f(x)dx={\frac {A_{0}}{2L}}\cdot 0+\sum _{n=1}^{\infty }\left({\frac {A_{n}}{L}}\cdot 0+B_{n}\delta _{m,n}\right)}

∫

−
L

L

1
L

sin
⁡

(

m
π

L

x

)

f
(
x
)
d
x
=

B

m

{\displaystyle \int _{-L}^{L}{\frac {1}{L}}\sin \left({\frac {m\pi }{L}}x\right)f(x)dx=B_{m}}

B

n

=

∫

−
L

L

1
L

sin
⁡

(

n
π

L

x

)

f
(
x
)
d
x

{\displaystyle B_{n}=\int _{-L}^{L}{\frac {1}{L}}\sin \left({\frac {n\pi }{L}}x\right)f(x)dx}
The Fourier series expansion of f(x) is now complete. To have it all in one place:

f
(
x
)
=

A

0

2

+

∑

n
=
1

∞

(

A

n

cos
⁡

(

n
π

L

x

)

+

B

n

sin
⁡

(

n
π

L

x

)

)

{\displaystyle f(x)={\frac {A_{0}}{2}}+\sum _{n=1}^{\infty }\left(A_{n}\cos \left({\frac {n\pi }{L}}x\right)+B_{n}\sin \left({\frac {n\pi }{L}}x\right)\right)}

A

n

=

∫

−
L

L

1
L

cos
⁡

(

n
π

L

x

)

f
(
x
)
d
x

{\displaystyle A_{n}=\int _{-L}^{L}{\frac {1}{L}}\cos \left({\frac {n\pi }{L}}x\right)f(x)dx}

B

n

=

∫

−
L

L

1
L

sin
⁡

(

n
π

L

x

)

f
(
x
)
d
x

{\displaystyle B_{n}=\int _{-L}^{L}{\frac {1}{L}}\sin \left({\frac {n\pi }{L}}x\right)f(x)dx}
It's finally time for an example. Let's derive the Fourier series representation of a square wave, pictured at the right:
This "wave" may be quantified as f(x):

f
(
x
)
=

{

1
,

−
1
<
x
<
0

−
1
,

0
<
x
<
1

f
(
x
+
2
)

{\displaystyle f(x)={\begin{cases}1,&-1 0, the solution has nothing in common with a Fourier series.
What's trying to be emphasized is flexibility. Knowledge of Fourier series makes it much easier to solve problems. In the parallel plate problem, knowing what a Fourier sine series is motivates the construction of the sum of un. In the end it's the problem that dictates what needs to be done. For the separable IBVPs, expansions will be a recurring nightmare theme and it is most important to be familiar and comfortable with orthogonality and its application to making sense out of infinite sums. Many functions have orthogonality properties, including Bessel functions, Legendre polynomials, and others.
The keyword is orthogonality. If an orthogonality relation exists for a given situation, then a series solution is easily possible. As an example, the diffusion equation used in the previous chapter can, with sufficiently ugly BCs, require a trigonometric series solution that is not a Fourier series (non-integer, not evenly spaced frequencies of the sinusoids). Sturm-Liouville theory rescues us in such cases, providing the right orthogonality relation.