SJ Alvst Andiga Arbeten I Matematik: Spherical Harmonics: A Theoretical and Graphical Study
SJ Alvst Andiga Arbeten I Matematik: Spherical Harmonics: A Theoretical and Graphical Study
av
Christian Helanow
2009 - No 8
Christian Helanow
2009
Abstract
The topic of harmonic polynomials is briefly discussed to show that
every polynomial on Rn can be decomposed into harmonic polynomials.
Using this property it is proved that every function that is square inte-
grable on the hypersphere can be represented by a series of spherical har-
monics (harmonic polynomials restricted to the hypersphere), and that
the series is converging with respect to the norm in this space. Explicit
formulas for these functions and series are calculated for three dimensional
euclidean space and used for graphical illustrations. By applying stereo-
graphic projection a way of graphically illustrating spherical harmonics in
the plane and how a given function is approximated by a sum of spherical
harmonics is presented.
1
Contents
1 Introduction 3
2 Harmonic polynomials 4
2.1 Definitions and notations . . . . . . . . . . . . . . . . . . . . . . 4
2.2 The orthogonal decomposition of polynomials . . . . . . . . . . . 4
2.3 The dimension of homogeneous harmonic polynomials . . . . . . 7
2.4 Spherical Harmonics . . . . . . . . . . . . . . . . . . . . . . . . . 8
3 Zonal Harmonics 12
3.1 Zonal Harmonics in the series expansion of a given function . . . 12
3.2 Properties of zonal harmonics . . . . . . . . . . . . . . . . . . . . 14
5 Graphical illustrations 27
5.1 Illustrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.1.1 Legendre polynomials and Zonal Harmonics . . . . . . . . 28
5.1.2 Spherical Harmonics . . . . . . . . . . . . . . . . . . . . . 30
5.1.3 Approximation of functions in stereographic coordinates . 32
A Appendix A 40
A.1 The Laplace operator in Spherical Coordinates . . . . . . . . . . 40
A.1.1 The spherical Laplace operator in stereographic coordinates 41
B Appendix B 42
2
1 Introduction
From Fourier analysis it is known that an infinite set of orthogonal sine and
cosine functions span the space of square integrable functions on the interval
[−π, π]. By considering functions in n-dimensional space that solve Laplace’s
equation, a subclass of functions called spherical harmonics can be defined.
These functions can be shown to be an analogue to the sine and cosine functions
in the sense that spherical harmonics of different degrees form an orthogonal
basis that spans the space of functions that are square integrable on the sphere.
This study is meant to present some of the available information on spherical
harmonics in a way that appeals to a reader at the undergraduate level. The
main aim is to establish a clear connection between the special cases of Fourier
analysis in R2 and spherical harmonics in R3 , both by using theory and by
graphically illustrating the spherical harmonics in a number of ways.
Each section is structured around one or a few central results. These will
be introduced at the beginning of each section, in the form of a discussion or
as a stated theorem. After this is done, the tools needed to prove the relevant
theorems will be introduced. The purpose of this layout is to give the reader an
appreciation of the importance and consequences of the central theorems.
The first part of this study, presented in section 2 and 3, is concerned with
the general topic of harmonic polynomials and how these can be restricted to the
sphere to define spherical harmonics. Since this theoretical part is not greatly
facilitated by only considering three dimensional euclidean space, it will include
complex valued functions f (x) : Rn 7→ C. No explicit formulas for spheri-
cal harmonics are derived in this section, which can make it seem somewhat
abstract. It is recommended that the reader looks through the graphical illus-
trations at the end of this study to get an intuitive understanding of spherical
harmonics while reading the general theory. Later sections will take a more
formal approach to these illustrations. The main result of section 2 is the or-
thogonal decomposition of functions that are square integrable on the sphere
into spherical harmonics, which is presented in Theorem 2.6. In section 3 we
focus on a way to calculate the unique spherical harmonics that decompose a
given function, which is given by the formula in Theorem 3.2. However, as can
be seen in later sections that include explicit calculations, this formula is of
theoretical rather than practical value.
The second part (section 4) is theory applied to three dimensional euclidean
space. The emphasis in this section is on finding the solution to Laplace’s
equation in spherical coordinates. The answer results in an explicit expression
for spherical harmonics in three dimensions. In Theorem 4.4 it is summarized
how to find the expansion of a given function into spherical harmonics. We will
only consider the case of real-valued functions, thus finding formulas that can
be applied directly in the final section containing the illustrations.
The last part (section 5) graphically illustrates the theoretical concepts from
part two. Examples will be given of both traditional ways of doing this, as well
as less common ways (not found in literature during the research of this study).
To accomplish this, some theory about stereographic projection is presented.
The general disposition of section 2 and 3 are inspired heavily by [1, Chapter
5]. Some theorems have been added or chosen to be proved in a different way.
If so, their source will be referred to in the text. The idea to section 4 is from
[3, Chapter 10], [4] and [8].
3
2 Harmonic polynomials
2.1 Definitions and notations
In this study n will always denote a positive integer. A function f that is
square integrable on Rn is written as f ∈ L2 (Rn ). A function f (x) defined on
an open subset of Rn that is at least twice continuously differentiable and fulfills
Laplace’s equation (1)
∂2f ∂2f
2 + ··· + ≡ 0, (1)
∂x1 ∂x2n
is called harmonic. Defining the Laplacian operator ∆ as the sum of all the
second partial derivatives the above condition can be written as
∆f ≡ 0. (2)
Note that this definition applies to complex valued functions, since it would only
mean that the real and imaginary parts of f are both harmonic.
As is customary R denotes the real numbers and C the complex numbers.
If a function f is continuous on a given set K, this will be denoted f ∈ C(K).
The unit sphere is defined as the boundary of the unit ball, and denoted as S.
It is understood that if dealing with a subset of Rn , the surface that is the unit
sphere has dimension n − 1.
However, before proving the statement above, let us consider some impor-
tant consequences. Theorem 2.1 states that every homogeneous polynomial
p ∈ Pk (Rn ) can be decomposed in this way. Naturally this argument can be
transferred to a homogeneous polynomial q ∈ Pk−2 (Rn ). Extending this to
polynomials of lesser degree we get:
4
This relation holds k2 times (or the largest integer less than this), leaving the
last term to contain either a polynomial of degree 1 or a constant. Substituting
the above relations stepwise leads us to a corollary to Theorem 2.1.
Corollary 2.2. Every p ∈ Pk (Rn ) can be uniquely written in the form
p = pk + |x|2 pk−2 + · · · + |x|2m pk−2m ,
k
where m denotes the largest integer less than or equal to 2 (that is k −2m equals
0 if k is even, 1 if k is odd) and pj ∈ Hj (Rn ).
Proof. The proof has already been outlined in the argument above. Noting that
Pk (Rn ) = Hk (Rn ) for k = 0, 1 , we see that the statement is true for these values
of k. For k ≥ 2, the proof is by induction assuming that the equality holds when
k is replaced by k − 2. This holds because of Theorem 2.1, giving the above
result.
For the uniqueness of the decomposition, assume that
pk + |x|2 qk−2 = p̃k + |x|2 q̃k−2 ,
where pk , p̃k ∈ Hk (Rn ) and qk−2 , q̃k−2 ∈ Pk−2 (Rn ). This is equivalent to
pk − p̃k = |x|2 q̃k−2 − |x|2 qk−2 .
Since the left hand side of the equation above is a harmonic polynomial, this
must also be true for the right hand side. But according to Theorem 2.1 the
right hand side does not belong to Hk (Rn ). Hence the only way the equality
can hold is if qk−2 − q̃k−2 = 0.
The importance of this corollary becomes apparent when considering poly-
nomials that are restricted to the sphere. In this special case Corollary 2.2
becomes the following statement.
Corollary 2.3. Any homogeneous polynomial p ∈ Pk (Rn ) restricted to the unit
sphere can be uniquely written on the form
p = pk + pk−2 + · · · + pk−2m ,
k
where m denotes the largest integer less than or equal to 2 (that is k −2m equals
0 if k is even, 1 if k is odd) and pj ∈ Hj (Rn ).
Proof. Just applying the fact that any power of the factor |x|2 = 1 on S to
Corollary 2.2, gives us the decomposition of p. We will only comment on the
uniqueness by observing that the decomposition is harmonic and is the (unique)
solution to the Dirichlet problem for the ball (see [1, p. 12]) when the boundary
data is the restriction of p to the sphere.
From our initial discussion about homogeneous polynomials we know that
Corollary 2.3 indirectly states that any polynomial on the sphere can be written
as a sum of unique harmonic homogeneous polynomials (on the sphere). Here
we have already hinted at the importance of Theorem 2.1 and that this leads to
a special reason to study harmonic polynomials on the sphere. Since this topic
will be more thoroughly discussed in section 2.4, we leave this special case for
now.
So far we have only stated Theorem 2.1. For the proof it will be necessary to
rely on some facts from linear algebra about the decomposition of dual spaces.
In particular the following about adjoint mappings is used ([5, p. 204]).
5
Adjoint mappings. Let E and F be inner product spaces. Then the linear map
ϕ : E 7→ F induces a map ϕ̃ : F 7→ E satisfying
For a thorough discussion on the definitions and the linear algebra used, see
for instance [5, Chapter II]. We now prove Theorem 2.1 ([7, Theorem 4.1.1]).
Proof of Theorem 2.1. The goal of this proof is to find adjoint maps from Pk (Rn ) →
Pk−2 (Rn ) and Pk−2 (Rn ) → Pk (Rn ), such that equation (4) can be used to de-
termine the orthogonal decomposition of these spaces. To accomplish this an
inner product is defined to suit this specific purpose. To facilitate this process
we introduce multi-index notation at this point.
If x ∈ Rn and α = (α1 , α2 , . . . , αn ) we define
xα = xα1 α2 αn
1 x2 . . . xn ,
α! = α1 !α2 ! . . . αn !,
|α| = α1 + α2 + · · · + αn and
∂α ∂ ∂ ∂
= α2 . . . αn .
∂xα ∂xα 1
1
∂x 2 ∂xn
∂α
an inner product on Pk (Rn ) can be
P
Using the operator p(D) = α cα ∂xα ,
defined as follows.
hp, qi = p(D)[q]
X ∂α X
= cα α dβ xβ
∂x
|α|=k |β|=k
X
= cα dβ δαβ α!,
|α|,|β|=k
6
0 for all q ∈ Pk−2 (Rn ). Then by the definition of the inner product we get
2
|x| q, p = (|x|2 q)(D)[p]
n 2 X α
X ∂ ∂
= 2 x2
cα α (p)
j=1
∂ j ∂x
= ∆q(D)[p] = q(D)[∆p]
= q(D)[∆p] = hq, ∆pi = 0.
According to the above argument and equation (3) this has the adjoint map
With Im ϕ̃ = {|x|2 q; q ∈ Pk−2 (Rn )} and ker ϕ = {p; p ∈ Hk (Rn )}, equation
(4) shows that
Pk (Rn ) = Hk (Rn ) ⊕ Pk−2 (Rn ).
Finally, note that the orthogonality in Theorem 2.1 implies that no polyno-
mial times the factor |x|2 is harmonic.
7
Proof. If we use the multi-index notation introduced in the proof of Theorem
2.1, we are looking for all the unique monomials
This set of combinations can be seen as a basis for the space of homogeneous
polynomials of degree k, since every p ∈ Pk (Rn ) is a linear combination of these
elements.
In other words, we are asking the question “What is the number of unordered
selections, with repetition, of k objects from a set of n objects that can be made? “
([2, Theorem 11.2]). The answer is found in combinatorics and is
n+k−1 n+k−1
= .
k n−1
n+k−3
Hence the expression above equals dimPk (Rn ). Similarly dimPk−2 (Rn ) =
n−1 .
Since dimHk (Rn ) =dimPk (Rn )−dimPk−2 (Rn ), this finishes the proof.
We can easily calculate dimHk (Rn ) for n = 2, by using the formula from
Theorem 2.2.
k+1 k−1
dimHk (R2 ) = − = (k + 1) − (k − 1) = 2
1 1
for values of k ≥ 2. This confirms our previous argument that any p ∈ Hk (R2 ) is
in the complex linear span of {z k , z k }. For n = 3 a similar calculation show that
dimHk (R3 ) = 2k + 1, so the dimension of homogeneous harmonic polynomials
increase linearly with the degree. Further calculations can be made and will
reveal that if n = 4 the dimension will increase in a quadratic manner, if n = 5
in a cubic manner etc.
Now that we have discussed the basic properties of homogeneous harmonic
polynomials, we are ready to study what the results will be if these are restricted
to the sphere. This will be the main purpose of the next section, which contains
the general theory of spherical harmonics.
8
function f (x) ∈ L2 [−π, π] into trigonometric functions on the interval [−π, π].
This is usually written as
∞
a0 X
f (x) = + (ak cos kx + bk sin kx),
2
k=1
2 2i
(where θ is the angle from the positive x-axis). This gives us the above Fourier
series in exponential form
∞
X
f (x) = ck eikθ , (5)
k=−∞
where ck are complex constants that are directly related to ak and bk from
the ordinary Fourier series. From Parseval’s equation and Fourier analysis we
conclude that the (complex) linear span of {eikθ , e−ikθ }∞k=0 is dense in the space
of L2 [−π, π]([3], p. 191). But when θ ∈ [−π, π] the set {eikθ , e−ikθ }∞ k=0 is just
the restriction of {z k , z k }∞
k=0 to the one dimensional subspace that is the unit
circle.
Hence the Fourier series in equation (5) can be seen as an expansion into
spherical harmonics. Thus, in the special case n = 2, a Fourier expansion into
spherical harmonics and Parseval’s equation shows us that L2 (S) = ⊕∞ k=0 Hk (S).
This leads us to state the main theorem of this section.
∞
Theorem 2.6. The infinite set {Hk (S)}k=0 is an orthogonal decomposition of
the space L2 (S) so that
L2 (S) = ⊕∞
k=0 Hk (S).
9
• to each x ∈ K there corresponds a function g ∈ A such that g(x) 6= 0 (A
vanishes at no point of K),
then A is dense in C(K).
If we can confirm that the space of polynomials (A in S-W) restricted to the
sphere (K in S-W) fulfills the conditions in Theorem 2.7, we can say that these
are dense in the space of continuous functions restricted to the sphere.
Hence spherical harmonics are dense in C(S). To show the orthogonal decompo-
sition of the space L2 (S), we need to introduce an inner product. The (standard)
inner product of this space is defined by
Z
hf, gi = f g dσ, (6)
S
where B is the unit ball, dV is the volume measure and ds is the surface measure.
Dn refers to differentiation with respect to the outwards unit normal, n. Note
that the left hand side of Green’s identity equals 0 if the two functions u, v are
harmonic. If Green’s identity is applied to p ∈ Hk (S) and q ∈ Hm (S), k 6= m
then we have Z
qDn p − pDn q dσ = 0.
S
10
When x ∈ S the vector n is only rx, where r = 1 on the unit sphere. So dif-
ferentiating with respect to r is the same as differentiating with respect to n.
Hence, because of the homogeneity of p,
d d k
(Dn p)(x) = p(rx) = (r p(x)) = krk−1 p(x) = kp(x).
dr dr
The same applies to q, and Green’s identity then gives us
Z
(k − m) pq dσ = 0. (7)
S
Since k 6= m we conclude that the integral in the equation above must equal
zero.
With the properties of Hk (S) that follow from the Stone-Weierstrass theorem
and Green’s identity we have enough to prove the main theorem of this section.
The conditions for the direct sum used in the proof of Theorem 2.6, come from
Hilbert space theory (which deals with euclidean spaces of infinite dimension,
as we are studying here). For the most part these conditions are quite intuitive,
and the theory behind them will not be discussed in detail.
Proof of Theorem 2.6. The conditions that must hold for Theorem 2.6 to be
true are:
11
3 Zonal Harmonics
3.1 Zonal Harmonics in the series expansion of a given
function
We will now try to find an analogue in Rn to what the Fourier coefficients are
in R2 . That there exists a unique series of spherical harmonics for any given
function f ∈ L2 (S) is clear from Theorem 2.6. Hence
∞
X
f= pk where pk ∈ Hk (S). (8)
k=0
With the zonal harmonic, we can state the main result of this section, which
presents a way to calculate the spherical harmonics of the series expansion in
equation (8).
Theorem 3.2. If f ∈ L2 (S) and
∞
X
f (x) = pk (x) where pk ∈ Hk (S),
k=0
Since the proof of the above theorem follows almost directly form the defi-
nition of zonal harmonics, we state it here.
12
Proof. If f ∈ L2 (S), then according to Theorem 2.6 f can be written as
∞
X
f (y) = pi (y) where pi ∈ Hk (S).
i=0
a = e−ikϕ
b = eikϕ
13
which gives
1. Zk is real valued,
14
Proof. To prove property 1, we assume that pk ∈ Hk (S) and is real valued. This
gives that
0 = Im pk (x)
Z
= Im pk (y)Zk (y, x) dσ(y).
S
Now if we define pk (y) = ImZk (y, x), then the above statement implies that
Z
(ImZk (y, x))2 dσ(y) = 0,
S
which, because of the inner product defined, gives that ImZk (y, x) = 0.
To prove property 2, note that it applies for all pk ∈ Hk that
The last equality is due to the rotational invariance property of both the spher-
ical harmonics and the standard surface measure σ. On the other hand we can
also write
Z
pk (T (x)) = pk (y)Zk (y, T (x)) dσ(y).
S
Thus Z Z
pk (y)Zk (y, T (x)) dσ(y) = pk (y)Zk (T −1 (y), x) dσ(y).
S S
Due to the uniqueness of zonal harmonics asserted by Theorem 3.3, we conclude
that property 2 is true.
For property 3, let e1 , . . . , ehk be an orthonormal basis of Hk (S). Then the
linear combination of Zk (·, x) in this basis is
j=h
Xk j=h
Xk
Zk (·, x) = hZk (·, x), ej i ej = ej (x)ej ,
j=1 j=1
where the last equality is due to the reproducing property of zonal harmonics.
Hence we have that
j=h
Xk j=h
Xk
Zk (x, x) = ej (x)ej (x) = |ej (x)|2 .
j=1 j=1
By property 2 we have that Zk (T (x), T (x)) = Zk (x, x), so that the function
x 7→ Zk (x, x) is constant on S. Integrating the equation above over the sphere
and using the orthonormal properties of the basis gives that
Z Z j=h
Xk
Zk (x, x) = Zk (x, x) = |ej (x)|2 dσ(x) = hk = dimHk .
S S j=1
15
To prove property 4, note that property 3 and the reproducing property of zonal
harmonics give that
||Zk (·, x)||22 = hZk (·, x), Zk (·, x)i = Zk (x, x) = dimHk ,
where || ||2 denotes the norm in L2 (S). Using the Cauchy-Schwarz inequality
we get that
|Zk (y, x)| = | hZk (·, x), Zk (·, y)i | ≤ ||Zk (·, x)||2 ||Zk (·, y)||2 = dimHk .
The last property, which we here will only comment on, is that any spherical
harmonic possessing the properties of a zonal harmonic, must be a zonal har-
monic times a scalar constant. For a detailed discussion of this topic see [1, p.
101 -103].
We have now with Theorem 3.2 accomplished what we set out to do. We have
shown that the concept of Fourier analysis can be extended to n-dimensional
space with spherical harmonics playing the role of the infinite set of orthogonal
functions and zonal harmonics as the tool to determine what specific spherical
harmonics are to be used in a series expansion. The remainder of this study
will focus on developing explicit formulas for spherical and zonal harmonics and
applying these in a series in the special case when n = 3. In section 5 we
illustrate these functions graphically in different ways to develop an intuitive
understanding of the theoretical concepts from the previous sections.
16
4 Spherical Harmonics in Spherical Coordinates
4.1 Eigenfunctions to Laplace’s equation
In this section we will be performing direct calculations, so it is only natural
to find a suitable coordinate system. Applying the theory from the previous
sections to real-valued functions will lead to expressions of spherical and zonal
harmonics in the spherical coordinate system.
Consider a harmonic polynomial p(x, y, z) ∈ Hk (R3 ). A change of variables
x = r sin θ cos ϕ, y = r sin θ sin ϕ, z = r cos θ
where
r is the radius of the sphere,
ϕ is the angle from the positive x-axis to the projection in the xy-plane,
θ is the angle from the positive z-axis,
gives the polynomial p(r, ϕ, θ) in spherical coordinates. Because p(x, y, z) is
homogeneous of degree k, it is possible to factor out rk so that p(x, y, z) →
p(r, ϕ, θ) = rk f (ϕ, θ). By applying the laplacian for spherical coordinates (for
a derivation, see Appendix A.1),
∂2
1 ∂ ∂ 1 1 ∂ ∂
∆= 2 r2 + 2 2 + sin θ , (10)
r ∂r ∂r r sin θ ∂ϕ2 r2 sin θ ∂θ ∂θ
to p(r, ϕ, θ) we obtain the relation (11).
∂ 2 p 2 ∂p 1
∆p = + + 2 ∆s p = 0, (11)
∂r2 r ∂r r
where ∆s is the spherical Laplace operator defined as
1 ∂2
1 ∂ ∂
∆s = sin θ + .
sin θ ∂θ ∂θ sin2 θ ∂ϕ2
The partial derivatives of p(r, ϕ, θ) with respect to r can be calculated to be
∂p k
= krk−1 f (ϕ, θ) = p and
∂r r
∂2p k(k − 1)
= k(k − 1)rk−2 f (ϕ, θ) = p.
∂r2 r2
Inserting the expressions of the partial derivatives into equation (11) gives
k(k + 1)p + ∆s p = 0. (12)
Since the spherical Laplace operator ∆s does not act in the variable r, we can
divide equation (12) by rk resulting in the expression for spherical harmonics
k(k + 1)f (ϕ, θ) + ∆s f (ϕ, θ) = 0. (13)
Equation (13) is a partial differential equation that can be solved by separation
of variables. Let f (ϕ, θ) = Φ(ϕ)Θ(θ). If equation (13) is divided by f = ΦΘ we
get
∆s (ΦΘ)
k(k + 1) + = 0.
ΦΘ
17
From the above relation we can see that spherical harmonics are the eigenfunc-
tions to the spherical Laplace operator ∆s . Inserting the full expression for ∆s
and simplifying we get that
∂2Φ
1 ∂ ∂Θ 1
k(k + 1) + sin θ + 2 = 0. (14)
sin θΘ ∂θ ∂θ Φ sin θ ∂ϕ2
Equation (14) suggests that its last term is dependent only on the variable θ.
Therefore it holds that
1 ∂2Φ
= −n2 , (15)
Φ ∂ϕ2
where n is a positive constant. By standard tools for solving ordinary differential
equations, the solution to equation (15) is
Note that if Φ would be complex valued n would not need to be positive for
Φ to be periodic, since with A, B ∈ C the solution to Φ(ϕ) could be written
as a complex linear combination of einϕ and e−inϕ . Inserting the expression in
equation (15) into equation (14) and multiplying by Θ results in
n2
1 ∂ ∂Θ
sin θ + k(k + 1) − Θ = 0. (16)
sin θ ∂θ ∂θ sin2 θ
If the function Θ is assumed to solve equation (16), then the solution to equation
(13) are functions of the kind
which are spherical harmonics of degree k. Combining this with the facts that
p(r, ϕ, θ) = rk f (ϕ, θ) and f = ΦΘ gives us the harmonic polynomials
n2
2 ′′ ′
(1 − z )y (z) − 2zy (z) + k(k + 1) − y(z) = 0. (18)
1 − z2
Equation (18) is called Legendre’s associated equation and the solutions to this
will be the topic of the next section.
18
R3 . Equation (19) is well known in the field of ordinary differential equations
and special functions and is known as Legendre’s equation. The solution to
Legendre’s equation is here only outlined, but a more extensive discussion can
be found in for instance [3, Ch. 10].
ODE theory tells us that z = 0 is an ordinary point of equation (19). This
means that we should seek a series solution to Legendre’s equation in the form
∞
X
y= aj z j .
j=0
Differentiating this series term by term, and plugging the series expressions of
y, y ′ and y ′′ into equation (19) gives a recurrence relation between aj and aj+2
j(j + 1) − k(k + 1)
aj+2 = aj . (20)
(j + 2)(j + 1)
The important thing to note about the recurrence relation in (20) is that when
j = k, the coefficients ak+2 = ak+4 = ak+6 = · · · = 0. Hence one of the
independent solutions will always be a polynomial of degree k (with only even
or odd powers of z, depending on the value of k), while the other is an infinite
series. The polynomial solution is called the Legendre polynomial of degree k
and will be denoted Pk (z). The series solution is named the Legendre function
of the second kind, and denoted Qk (z). By applying the Cauchy ratio test to
the recurrence relation in (20) it can be shown that this series converges for
−1 < z < 1, however it diverges for |z| ≥ 1. This can be seen by observing that
1+z
the series converges to a function for a specific k. For instance Q0 = 12 ln 1−z ,
which diverges at the points z = ±1 ([6, p. 710]). Since spherical harmonics
are defined on the whole sphere, the solution that we seek must be continuous
on the closed interval cos θ = z ∈ [−1, 1]. By the continuity of polynomials, the
Legendre polynomial is continuous for z ∈ [−1, 1]. Hence we focus on Pk (z) to
be the solution. We now try to find a formula for Pk (z).
The recurrence relation
(j + 2)(j + 1)
aj = − aj+2
(k − j)(k + j + 1)
follows directly from (20). If we start with the value j + 2 = k, and use the
above formula i times (where i is a positive integer), we can find the following
expression
(−1)i k(k − 1) · · · (k − 2i + 1)
ak−2i = i
· ak . (21)
2 i! (2k − 1)(2k − 3) · · · (2k − 2i + 1)
19
k (k−1)
It follows that if k is even the Legendre polynomial has 2 terms, or 2 if k
is odd. This gives the sum
m
1 X (−1)i (2k − 2i)!
Pk (z) = k
· z k−2i , k = 0, 1, 2 . . . , (22)
2 i=0 i! (k − 2i)!(k − i)!
where
k/2 if k is even,
m=
(k − 1)/2 if k is odd.
We know from section 3 that Pk (z) times some constant c is a zonal harmonic
and that this set of polynomials is orthogonal. From the variable change z =
cos θ we can see that this particular zonal harmonic has its pole in the point
(x, y, z) = (0, 0, 1). Using the notation for the unit vector in the z-axis direction
ẑ we can write Zk (θ, ẑ) = cPk (cos θ). The following proposition shows the
relation between the zonal harmonic and its corresponding Legendre polynomial.
c = dimHk (S) = 2k + 1,
which proves 1.
To prove 2, we again use Proposition 3.5 together with the result above.
||Zk (·, ẑ)||22 = hZk (·, ẑ), Zk (·, ẑ)i = h(2k + 1)Pk (z), (2k + 1)Pk (z)i
Z 2π Z 1
= [(2k + 1)Pk (z)]2 dσ(z)dσ(ϕ) = 2k + 1,
0 −1
where the last equality holds since dimHk (S) = 2k + 1. The last line in the
equation above indicates that
Z 1
d(z)
[(2k + 1)Pk (z)]2 = 2k + 1,
−1 2
20
Calculating the first few Legendre polynomials shows that
P0 (z) = 1, P1 (z) = z
P2 (z) = 12 (3z 2 − 1), P3 (z) = 12 (5z 3 − 3z),
P4 (z) = 18 (35z 4 − 30z 2 + 3), P5 (z) = 18 (63z 5 − 70z 3 + 15z).
From Proposition 4.1 we know that the Legendre polynomials are zonal har-
monics times a constant. Hence we have that Pk (z) ∈ Hk (S). However, if we
consider a Legendre polynomial, for instance P5 (z),
1
P5 (x, y, z) = (63z 5 − 70z 3 + 15z),
8
this polynomials does not look to be either homogeneous of degree 5 or harmonic.
By observing that if a function is restricted to the unit sphere any power of
(x2 + y 2 + z 2 ) is equal to one, we can expand P5 (z) as follows
1
P5 (x, y, z) = (63z 5 − 70z 3 (x2 + y 2 + z 2 ) + 15z(x2 + y 2 + z 2 )2 ).
8
This indeed is a homogeneous harmonic polynomial of degree 5, so P5 (x, y, z) ∈
H5 (S) which was to be expected from the previous theoretical discussion.
which implies that Pk (z) has at least one zero in the interval (−1, 1). To see
that the zeros in this interval are distinct, assume that z = z1 is a multiple zero.
21
Pk (z)
In this case it follows that (z−z1 )2 ∈ Pk−2 (R), which is orthogonal to Pk (z).
This gives that
1 1 2
Pk (z) Pk (z)
Z Z
0= Pk (z) dz = dz.
−1 (z − z1 )2 −1 (z − z1 )
Since the last the expression in the last integral is greater or equal to zero on
[−1, 1], the above equation is a contradiction. If we assume that Pk (z) has j ≥ 1
distinct zeros in (−1, 1) and that j < k we have that
where p(z) is a polynomial of constant sign on (−1, 1) and q(z) ∈ Pj (R). Using
the orthogonality of q(z) and Pk (z) we get that
Z 1 Z 1
0= q(z)Pk (z) dz = [q(z)]2 p(z) dz.
−1 −1
This can not be true, since the expression [q(z)]2 p(z) has constant sign on
(−1, 1). This gives that j = k and p(x) = 1.
The relation between the Legendre polynomials and zonal harmonics and
the above theorem tells us that Zk (·, ẑ) vanishes on k circles perpendicular to
the z-axis.
d2 y ′ dy ′
(1 − z 2 ) − 2 · 2z + (k(k + 1) − 2) y ′ = 0 first derivative,
dz 2 dz
d2 y ′′ dy ′′
(1 − z 2 ) 2 − 2 · 3z + (k(k + 1) − 2(1 + 2)) y ′′ = 0 second derivative,
dz dz
d2 y ′′′ dy ′′′
(1 − z 2 ) 2
− 2 · 4z + (k(k + 1) − 2(1 + 2 + 3)) y ′′′ = 0 third derivative.
dz dz
Continuing this process gives the general formula for differentiating n times.
d2 y (n) dy (n)
(1−z 2 ) −2(n+1)z +(k(k + 1) − n(n + 1)) y (n) = 0 n:th derivative.
dz 2 dz
(23)
Since we know that Pk (z) solves Legendre’s equation, a solution to equation
n
Pk (z)
(23) is the n:th derivative of this function, d dz n .
22
n
If we make the substitution y = (1−z 2 ) 2 u in Legendre’s associated equation
(18) we get
d2 u du
(1 − z 2 ) 2
− 2 · 2z + (k − n)(k + n + 1)u = 0.
dz dz
This equation is the same as the the relation arrived at in equation (23) with u
instead of y (n) . By the substitution made and relation just mentioned we can
conclude that a solution to Legendre’s associated equation (18) is
n dn Pk (z)
Pkn (z) = (1 − z 2 ) 2 . (24)
dz n
n
Qk (z)
In a similar way it can be shown that (1 − z 2 ) 2 d dz
n
n is the other solution to
n
equation (18), independent of Pk (z). However, the series solution is not of any
particular interest when deriving an expression for spherical harmonics. Pkn (z)
is called the associated Legendre function of degree k and order n, and as will be
shown in the coming section, this function will be important when expanding a
function f ∈ L2 (S) into a series of spherical harmonics.
23
From section 2.4 we know that any function f (z, ϕ) ∈ L2 (S) can be de-
veloped in an orthogonal series of spherical harmonics. For it to be possible
to express any spherical harmonic of degree k in the series, we need all the
2k + 1 spherical harmonics of degree k to be available. This leads to the double
summation in the series expansion of f , presented in the final theorem of this
study.
Theorem 4.4. Let f (θ, ϕ) ∈ L2 (S) be a real-valued function defined on the unit
sphere. Then f can be expressed as a series of spherical harmonics, such that
∞
" n=k
#
X X
n n
f (θ, ϕ) = A0,k Pk (cos θ) + An,k cos nϕPk (cos θ) + Bn,k sin nϕPk (cos θ) ,
k=0 n=1
where
2π π
2k + 1
Z Z
A0,k = f (θ, ϕ) cos nϕPk (cos θ) sin θ dθ dϕ,
4π 0 0
2π π
2k + 1 (k − n)!
Z Z
An,k = f (θ, ϕ) cos nϕPkn (cos θ) sin θ dθ dϕ and
2π (k + n)! 0 0
2π π
2k + 1 (k − n)!
Z Z
Bn,k = f (θ, ϕ) sin nϕPkn (cos θ) sin θ dθ dϕ.
2π (k + n)! 0 0
Note that in the theorem above the substitution z = cos θ has been made,
resulting in Z 1 Z π
f (z) dz = f (θ) sin θ dθ.
−1 0
Proposition 4.5. Let Pkn (z) and Pln (z) be the associated Legendre functions of
order n and degrees k and l respectively. Then
Z 1 (
0 if k 6= l,
Pkn (z)Pln (z) dz = 2 (k+n)!
−1 2k+1 (k−n)! if k = l.
24
Proof. By equation (24) and integration by parts we get
Z 1
dn Pl (z) dn Pk (z)
(1 − z 2 )n dz = (26)
−1 dz n dz n
Z 1 n−1 n
d Pl (z) d 2 n d Pk (z)
− · (1 − z ) dz.
−1 dz n−1 dz dz n
Inspired by the differentiation formula for associated Legendre functions, we
n−1
Pk (z)
substitute n by n − 1 in equation (23) (remember that d dzn−1 is a solution
to this equation) to get
which is the series in Theorem 4.4 after the substitution cos θ = z and a change of
indices. Suppose we want to find An,k in equation (27). It is natural to multiply
the series by cos nϕPkn (z) and integrate over the sphere. Since cos nϕPkn (z)
is a spherical harmonic of degree k, the orthogonality of spherical harmonics
immediately gives that all terms in the outer sum where m 6= k equal zero.
Hence the only possible non-zero inner products are the components of the k:th
term of the outer sum in equation (27). These are of the form
R 2π R 1 R 2π R 1
0 −1
cos nϕPkn (z) cos lϕPkl (z) dz dϕ, 0 −1 cos nϕPkn (z) sin lϕPkl (z) dz dϕ,
R 2π R 1 R 2π R 1
0 −1
cos nϕ sin nϕ[Pkn (z)]2 dz dϕ, 0 −1
cos2 nϕ[Pkn (z)]2 dz dϕ,
25
4.5, we can see
R 2πthat 2the only non-zero term above is the last. By Proposition
2π (k+n)!
4.5 and that 0 cos nϕ dϕ = π, the last integral equals 2k+1 (k−n)! . Thus we
get that all the terms except the one involving An,k equals zero and
2π 1
2k + 1 (k − n)!
Z Z
An,k = f (z, ϕ) cos nϕPkn (z) dz dϕ
2π (k + n)! 0 −1
2k + 1 (k − n)! 2π π
Z Z
An,k = f (θ, ϕ) cos nϕPkn (cos θ) sin θ dθ dϕ.
2π (k + n)! 0 0
We can calculate the constants A0,k and Bn,k in a similar way. This proves
Theorem 4.4.
26
5 Graphical illustrations
In this section we use the theory from section 4 to create graphical illustrations
of the spherical harmonics. Hopefully the following figures will help to increase
the readers intuition about these.
Several ways of representing the spherical harmonics have been chosen. For
one kind of illustration we emphasize the link to Fourier analysis by letting
the value of the spherical harmonic be represented as distance from a reference
sphere. This corresponds to the representation of the sine and cosine functions
on the unit circle. Secondly a more common representation is used where the
values of the spherical harmonic takes on different colors on the unit sphere. A
third way of illustration is chosen for purposes of literature reference, namely
the squared absolute magnitude of the harmonic. In this illustration the value
at a given point is represented by the distance from the origin.
Finally a less common way to represent spherical harmonics that has not
been found in literature will be attempted. By using stereographic projection,
we can view harmonics as is commonly done when considering a function in
the plane. In Fourier analysis a projection of the unit circle onto the line is
easily accomplished by using the 2π-periodicity of a function defined on the
circle. However, for a function defined on the unit sphere, there is no easy way
of representing the periodicity in the plane. The stereographic projection of a
function corresponds to projection a function on the circle to the real line in
Fourier analysis. It is this way that is chosen to illustrate the main result of the
previous section: the approximation of a given function on the sphere by a sum
of spherical harmonics.
27
5.1 Illustrations
5.1.1 Legendre polynomials and Zonal Harmonics
We start this section by illustrating a few of the Legendre polynomials. Note
that these are well defined on the whole real axis. Here it becomes visually
clear that the polynomials oscillate only in the interval [−1, 1] and that they are
symmetric around z = 0. By construction all the polynomials also pass through
the point (1,1). From the figures one can see that on the interval [−1, 1], the
behavior of Legendre polynomials is similar to both sine and cosine functions.
The amplitude is smaller than the standard sine/cosine function (this can be
remedied by a constant) but the oscillatory behavior is related. The polynomials
plotted in Figure 1 are
5 3 3 6435 8 3003 6 3465 4 315
P3 (z) = z − z, P8 (z) = z − z + z −
2 2 128 32 64 32
9694845 15 35102025 13 50702925 11 37182145 9
P15 (z) = z − z + z − z
2048 2048 2048 2048
14549535 7 2909907 5 255255 3 6435
+ z − z + z − z
2048 2048 2048 2048
28
Legendre polynomial of degree 3
1.5
3
P3(x) = 5/2 x −3/2 x Value of |Z |2
3
1 1
0.5 0.5
0 0
z
−0.5 −0.5
−1 −1
(a) (a)
Legendre polynomial of degree 8
1.5
8 6 4 2
P8(x) = 6435/128 x −3003/32 x +3465/64 x −315/32 x +35/128
0.5
−0.5
−1
−1.5
−1.5 −1 −0.5 0 0.5 1 1.5
x
(b) (b)
Legendre polynomial of degree 15
1.5
P (x) = 9694845/2048 x15−35102025/2048 x13+...−6435/2048 x
15
0.5
−0.5
−1
−1.5
−1.5 −1 −0.5 0 0.5 1 1.5
x
(c) (c)
29
5.1.2 Spherical Harmonics
For the graphical representation of general spherical harmonics, we will use the
function Ỹkn from Definition 4.3, with constants A, B = 1. The value of the
constants A and B does not significantly change the general appearance of the
spherical harmonic, they only change its magnitude and rotate the harmonic in
the variable ϕ. Since spherical harmonics can take on values greater than one,
we can not use the same approach as with the zonal harmonics. In order to
keep the same type of representation as in Figure 2b, we approach this problem
by increasing the radius of the reference sphere to the maximum of |Ỹkn |. Hence
the minimum value of the spherical harmonic will again be close to the origin.
Note that when the order of the spherical harmonic equals the degree, that is
n = k in relation (25)
where AP is the constant resulting from the k:th derivative of the Legendre
polynomial. This gives that the positions on the sphere where Ỹkk equals zero is
dependent only on ϕ, since the factor sin θ is zero only at the poles. Hence we
have a spherical harmonic that has a zonal structure that is perpendicular to
zonal harmonics. This special case of a spherical harmonic is called a sectorial
harmonic ([8, p. 132]), and is plotted in Figure 4b.
In Figure 3a the squared absolute magnitude of Ỹ32 is illustrated. This rep-
resentation of a spherical harmonic is mostly used when Ỹkn is complex-valued,
since it is the only effective way of plotting the imaginary part of Ỹkn . Since
we have restricted our graphical illustrations to real-valued spherical harmonics,
this representation does not help us in any way to see the connection between
the trigonometrical functions and spherical harmonics. The illustration in Fig-
ure 3b is an analogue to the trigonometrical functions on the circle, and it is
an effective way to show the oscillatory behavior of a spherical harmonic. The
disadvantage is that it is hard to tell what value the harmonic takes in a specific
point. On the other hand, this is adequately represented in Figure 4a. The
compromise one makes with this type of illustration, which is a more accurate
way of presenting the values of the spherical harmonic, is that the general shape
of the function can be harder to make out. From Figure 4b we can see that for
the sectorial harmonic of degree 5, there are 10 sectors (a sector being a part
of the sphere where the spherical harmonics is only positive or negative valued)
and that these are π5 apart (in the variable ϕ).
30
22 40
Value of |Y3|
30
50
20
10
0
z
−10
−50
−20
50
50 −30
0
0
−50 −50 −40
y x
(a) (a)
(b) (b)
31
5.1.3 Approximation of functions in stereographic coordinates
So far we have followed the natural choice of expressing spherical harmonics in
spherical coordinates. However, the surface of the sphere can be mapped to a
plane through the means of stereographic projection. This can be accomplished
by fixing a point on the surface of the sphere, the projection point, and defining
a plane onto which points on the sphere can be projected. The plane is chosen
so that its normal goes through both the origin and the projection point.
The main reason for exploring spherical harmonics in a stereographic coordi-
nate system is the reduction of discontinuities. In a spherical coordinate system
there exist discontinuities in two points, one when the angle θ ± n · 2π = 0 and
the other at θ ± n · 2π = π, where n = 0, 1, . . . . At these points the angle ϕ can
not be single-valued. In a stereographic projection a discontinuity exists in only
one point, the projection point. If this point is to be projected onto the plane,
its distance from the origin would be infinite and it would be defined in every
direction.
For the projection of spherical harmonics the unit sphere with the projection
point (x, y, z) = (0, 0, 1) is chosen. The plane onto which the points of the sphere
are projected is the xy-plane, that is the equatorial plane. From the reasoning
above it is clear that stereographic projection is a mapping from S 2 → R2 and
that a point on the sphere P = (x, y, z) is projected to a point P ′ = (x′ , y ′ , 0) or
P ′ = (x′ , y ′ ). By basic geometry and the fact that the radius of the sphere equals
one, it is possible to derive the following relations in Cartesian coordinates.
x x′ x
= ⇐⇒ x′ = .
1−z 1 1−z
Similarly
y
y′ =.
1−z
The purpose of this section is to investigate the change of variables in the spher-
ical coordinate system that lead to stereographic coordinates. The relations for
this transformation are derived in a similar way as for the Cartesian system
described above. It is suitable to use the standard polar coordinate system to
describe the position of a point in the plane, that is P ′ = (ρ, ϕ). Since the
azimuthal angle does not change when projected onto the plane, it remains to
find ρ as a function of θ. The geometry of triangles can be used to see that
sin θ ρ sin θ
= ⇐⇒ ρ= .
1 − cos θ 1 1 − cos θ
Furthermore, using the trigonometrical identities sin 2θ = 2 sin θ cos θ and cos 2θ =
1 − 2 sin2 θ, the following useful expression for θ can be derived.
32
Hence, given the calculations above, the important relations between spherical
and stereographic coordinates can be summarized as follows:
sin θ θ
(ρ, ϕ) = , ϕ = cot , ϕ and
1 − cos θ 2
1
θ = 2 tan−1 . (28)
ρ
For a derivation of the spherical Laplace operator in stereographic coordinates,
see Appendix A.1.1
To avoid the discontinuity at the projection point, we choose to only project
the bottom part of the sphere (and spherical harmonic). That is we restrict
π/2 ≤ θ ≤ π. This means that the harmonic will parametrized by the unit disc,
and that the z-axis in the stereographic projection represents the value of the
spherical harmonic. In Figures 5a and 5b the stereographic projections of Z8
from Figure 6a and Ỹ32 from 6b are shown. We can see that the zonal harmonic
becomes a radial function. This is to be expected, since a given latitude on the
sphere (θ is fixed) is projected onto a circle of radius tan θ2 , according to the
relation above. Since zonal harmonics are constant on latitudes of the sphere (see
Figures 1 and 2), the projected zonal harmonic will be constant on concentric
circles.
When approximating a given function f we use only a finite number of terms
from the spherical harmonic series expansion of f . In this section the approxi-
mation of a given function is a sum of spherical harmonics up to degree k, for a
chosen fixed k. To see how these sums of spherical harmonics approximate the
chosen functions, different numbers of terms from the series are included. The
graphical representations presented below are plotted using the stereographic
projection and are a direct application of the theory from section 4.5.
We start by approximating a smooth function defined on the sphere f (θ, ϕ) =
cos 4θ θ
2 + sin 2 , shown in Figure 7a. The choice of using a function dependent only
on the variable θ is to avoid the problem of ϕ not being single-valued at the
poles of the sphere, which can cause the function to be not smooth in the areas
surrounding these. The two approximations of the chosen function (Figure 7b
and 8a) are expansions of f up to degree 3 and 14. The difference plotted in
Figure 8b is f minus the approximation of f . We will denote the approximation
of f up to degree k as fAk and the difference f − fAk as fDk . From Figure 7
we can see that the first approximation fA3 has not yet started to resemble the
original function. This is because of the small number of terms included in the
approximating sum. However, from the plot of fA14 we can visually confirm
that after only 14 spherical harmonics the approximation is almost identical to
f . This is also evident in Figure 8b, where the magnitude of fD14 is in the order
of 10−4 , which is small compared to the values taken by f .
In Figure 9 we approximate a function that is not continuous on the sphere,
namely f (θ, ϕ) = π2 − ϕ. This is to graphically examine what happens near
points where the function is discontinuous. Figure 9 shows the stereographic
projection of f as well as fA3 , and in Figure 10 fA14 and fD14 are plotted. One
can notice two things about the approximations. First, in the illustration of
the approximating function in Figure 10a it looks like the section connecting
the surfaces at the line of discontinuity only takes on two distinct color-values.
This is because MATLAB can only assign one color to each partition of the
33
plotted surface. Near the discontinuity, the connecting section is so steep that
only two partitions fit the surface. This is not true, since spherical harmonics
are continuous and take all values between 0 and 2π. Secondly, in Figure 10b, it
becomes apparent that something similar to the Gibbs phenomenon in Fourier
analysis exists in spherical harmonic expansions. This means that at the line
of discontinuity an increase in oscillation can be observed in the approximating
partial sums. Note that the difference fD14 for this function is much larger than
in the approximation of the smooth function. In Figure 10b we see that for
some points, the magnitude of fD14 is in the same order as the values of the
original function.
The final graphical example is an approximation of the function f (θ, ϕ) =
θ3 cos (6θ) sin ϕ. This function is chosen to examine the approximating function
when the original function has a more complicated oscillatory behavior and is
dependent on both θ and ϕ. Note that f is discontinuous at the south pole.
The stereographic projection of f is shown in Figure 11 and the approximating
function fA3 in Figure 12. From Figure 13b one can see that the largest discrep-
ancies of the approximated function from f are near the point of discontinuity or
where the function oscillates intensely. Hence the Gibbs phenomenon is present
even though f only has a point discontinuity. Comparing Figures 10b and 13a
it seems that the expansion converges faster to f than in the previous approxi-
mation. Hence it seems that functions with point discontinuity are more easily
approximated than functions with line discontinuity, and that the expansions of
smooth functions converge faster than expansions of discontinuous functions of
any kind. This concludes our study about spherical harmonics.
34
Y0 in stereographic projection
8
0.8
1 0.6
0.5 0.4
z
0 0.2
−0.5 0
1
0.5 1 −0.2
0 0.5
−0.5 0
−0.5
−1 −1
y x
(a) (a)
8
Y23 in stereographic projection
6
4
5
0
z
−5 −2
−4
1
0.5 1
0.5 −6
0
0
−0.5
−0.5 −8
y −1 −1
x
(b) (b)
35
Chosen Function Spherical Harmonic expansion
1.3 1.3
1.8 1.8
1.6 1.2 1.6 1.2
z
1 1
0.9 0.9
0.8 0.8
0.6 0.8 0.6 0.8
0.7 0.7
1 1
0.5 0.6 0.5 0.6
1 1
0 0.5 0 0.5
−0.5 0 0.5 −0.5 0 0.5
−0.5 −0.5
−1 −1 −1 −1
y x y x
(a) (a)
Spherical Harmonic expansion Difference −4
x 10
1.1 8
10
1 6
5
0.9 4
z
0 2
0.8
−5 0
0.7
1 1
0.5 1 0.5 1 −2
0 0.5 0 0.5
−0.5 0 −0.5 0
−0.5 −0.5 −4
−1 −1 −1 −1
y x y x
(b) (b)
36
Chosen Function Spherical Harmonic expansion
0 0
0
−1 −1
−1
−2
z
−2
z
−3 −2
−3
−4
−4
−5 −3
−5
−6
−6 −4
1
1
0 1 0
0.5 0.5 1
−0.5 0 −1 0
−1 −1 −1 −0.5
y x y
x
(a) (a)
Spherical Harmonic expansion Difference
1 1.5 1
0
0 1
0.5
−1 −1 0.5
−2
z
0 0
z
−3 −2 −0.5
−0.5
−4 −1
−3
−5 −1.5
−1
−6 −2
−4 1
1 1
0.5 1 0.5 0.5 −1.5
0 0 0.5 0 0
−0.5 −0.5 −0.5 −0.5
−1 −1 −1 −1
y x y x
(b) (b)
37
Chosen Function
30
f(u,v)
20
30
10
20
10
0
0
z
−10 −10
−20 1
0.5
−30 −20
1 0
0.5
0 −0.5
−0.5 −30
−1 −1 x
y
1
2
0.5
1
0
0
z
−0.5
−1 1 −1
0 −1.5
−2
1
0.5
0
−0.5 −1 x
−1
y
38
Spherical Harmonic expansion
10
20
5
10
0
0
z
−5
−10
1 −10
0.5
−20
1 0 −15
0.5
0 −0.5
−0.5
−1 −1 x
y
(a)
Difference
30
Difference
20
30
10
20
10 0
0
z
−10 −10
1
−20
0.5
−20
−30 0
1
0.5 −0.5
0 −30
−0.5 −1 x
−1
y
(b)
39
A Appendix A
A.1 The Laplace operator in Spherical Coordinates
A problem can sometimes be simplified if one changes coordinates from the
regular Cartesian xyz-system to a more suitable way of describing the position
of any given point. The most common examples of such systems are cylindrical
and spherical coordinates (for a thorough discussion about the Laplace operator
in spherical coordinates, see [3], p. 66-67).
In cylindrical coordinates a point in space is described in the same way as
in polar coordinates, with the addition of the z-axis having the same role as in
the Cartesian coordinates. In this way, any point in Cartesian coordinates can
be transformed to cylindrical coordinates with the relations
and p y
ρ= x2 + y 2 , ϕ = tan−1 , z = z, (30)
x
where ρ is the distance from the origin in the xy-plane and θ is the angle between
the x-axis and ρ̂. Similarly one can derive the relations between Cartesian and
spherical coordinates,
where r is the distance from the origin, ϕ is the angle between the x-axis and
the projection of r̂ in the xy-plane and θ is the angle between the z-axis and r̂.
Furthermore, from equation (29) and equation (31) one can deduce the relations
between cylindrical and spherical coordinates to be
Note the similarity between equation (29) and equation (32). This relation will
be useful in significantly shortening the derivation of the Laplace operator. To
be able to determine whether a given function f (r, ϕ, θ) is harmonic one must
be able to express Laplace’s equation
40
To derive the laplacian in spherical coordinates, one can use that the ex-
pressions (29) and (32) are identical except for notation. Motivated by this a
change of notation (y → ρ, ρ → r, ϕ → θ and x → z) the relations
∂f ∂f cos θ ∂f
= sin ϕ + (34)
∂ρ ∂r r ∂θ
and
∂2f ∂2f 1 ∂f 1 ∂2f
2
= 2
+ + 2 2 (35)
∂z ∂r r ∂r r ∂θ
can be derived. When comparing the laplacian in cylindrical coordinates in
equation (33) and equation (35), one can see that two of the terms are repre-
sented in both expressions. Furthermore, the relations in (32) together with
equation (34) suggest that the remaining terms can be expressed as
1 ∂f 1 ∂2f 1 ∂f cot θ ∂f 1 ∂2f
+ 2 2
= + 2 + 2 2 . (36)
ρ ∂ρ ρ ∂ϕ r ∂r r ∂θ r sin θ ∂ϕ2
Adding equation (35) and equation (36) covers all of the the terms in the ex-
pression for the cylindrical laplacian. Hence the sum of these two expressions
give the laplacian for spherical coordinates
∂2f 2 ∂f 1 ∂2f 1 ∂2f 1 ∂2f cot θ ∂f
∆f = 2
+ + 2 2 + 2 2 2
+ 2 2 + 2 (37)
∂r r ∂r r ∂θ r sin θ ∂ϕ r ∂θ r ∂θ
for a function f (r, ϕ, θ). This can also be written as
∂2f
1 ∂ 2 ∂f 1 1 ∂ ∂f
∆f = 2 r + 2 2 + 2 sin θ . (38)
r ∂r ∂r r sin θ ∂ϕ2 r sin θ ∂θ ∂θ
For the purpose of spherical harmonics it will be convenient to define the
spherical Laplace operator ∆s as the part of equation (38) that is independent
of r, that is
1 ∂2f
1 ∂ ∂f
∆s = sin θ + . (39)
sin θ ∂θ ∂θ sin2 θ ∂ϕ2
41
Given the relations in (40) and (41), the first and second partial derivatives for
a function f (ρ, ϕ) can be expressed as
∂f ∂f dρ ∂f 1
= =− and
∂θ ∂ρ dθ ∂ρ 1 − cos θ
∂2f ∂2f 1 ∂f sin θ
2
= 2 2
+ .
∂θ ∂ρ (1 − cos θ) ∂ρ (1 − cos θ)2
With the appropriate variable change from (θ, ϕ) → (ρ, ϕ), using the chain rule
for composite functions in the expression for the spherical Laplace operator for
a function f (ρ, ϕ) gives
2
cos θ ∂f 1 ∂ f 1 ∂f sin θ
∆s f = − + +
sin θ ∂ρ 1 − cos θ ∂ρ2 (1 − cos θ)2 ∂ρ (1 − cos θ)2
1 ∂2f
+
sin2 θ ∂ϕ2
∂f 1 ∂2f 1 1 ∂2f
= + 2 +
∂ρ sin θ(1 − cos θ) ∂ρ (1 − cos θ) 2
sin2 θ ∂ϕ2
∂f 1 − cos θ ∂ 2 f
1 1 ∂f
= + +
(1 − cos θ)2 ∂ρ sin θ ∂ρ2 sin2 θ ∂ 2 ϕ
(ρ2 + 1)2 1 ∂f
∂2f 1 ∂2f
= + 2 + 2 2
4 ρ ∂ρ ∂ρ ρ ∂ ϕ
(ρ2 + 1)2 ∂f 2 ∂ 2
f ∂2f
= ρ + ρ + . (42)
4ρ2 ∂ρ ∂ρ2 ∂2ϕ
Note that the expression in brackets in equation (42) is the laplacian in polar
coordinates (see Appendix A.1). Hence the laplacian in stereographic coordi-
nates, regarding functions defined on the unit sphere, is a function of ρ times
the laplacian in polar coordinates.
B Appendix B
For this study, MATLAB was used to plot all the figures in section 5. A sepa-
rate code was written for every type of function. However, since the script for
approximating functions contains most of the code written, only this script will
be included to not overburden the appendix. The script can be copied into the
MATLAB editor and used without any processing.
The script below produces the approximating sum of a chosen function that
is defined on the sphere. Furthermore, it uses stereographic projection to plot
the chosen function, approximating function and their difference. Calculations
in the script can be used to plot for instance zonal or spherical harmonics,
but a specification how to graphically represent these would have to be added
in the code. One known problem with this source code, is that for too large
n (if the degree of spherical harmonics included in the sum is around 30 or
larger, depending on the function approximated), MATLAB cannot process the
calculations due to a too large directory name.
function y = SpHarmonicapprx(func,n)
42
%spherical harmonics. The variables u,v must be symbolic and n refers to the
%first summation index, thus producing the first (n)*(n+1)/2 terms of the
%series expansion.
%Computing the Zonal Harmonics with its norm squared (pi factor omitted
%in these calculations for clarity in output),ZNn,up to degree n and sorting
%them in a 1x(n+1) matrix = [ZN0 ZN1 ZN2 ... ZNn]. This is used when computing the
%constants A0. Also computes the Zonal Harmonics for the series and
%arranges them in a matrix [Z0 Z1 ... Zn].
ZNtot = [];
Ztot = [];
for i = 0:n
s = floor(i/2);
f = ((-1)^k/sym('k!'))*sym('(2*q - 2*k)!')/(sym('(q -2*k)!')*sym('(q - k)!'))*x^(q - 2*k);
Pol = (1/2^q)*symsum(f,k,0,s);
Legendre = subs(Pol,q,i);
Legsimple = simplify(Legendre);
P = expand(Legsimple);
ZN = (2*i+1)/(4)*subs(P,x,cos(u));
ZNtot = [ZNtot ZN];
Z = subs(P,x,cos(u));
Ztot = [Ztot Z];
end
Ztot = Ztot;
ZNtot = ZNtot;
%Computing every order of the Associated Legendre function with its norm squared
%(pi factor omitted in these calculations for clarity in output),PNmn, up to degree n,
%sorting them in two 1x(n(n+1)/2) -matrixes with the corresponding sine or cosine
%function [cos(v)*PN11 cos(v)*PN12 cos(2v)*PN22 cos(v)*PN31... cos(n-1)*PN(n-1)n
%cos(nv)*PNnn] and the same for sine. Also computes the Spherical Harmonics
%for the series expansion and arranges them in two matrixes [cos(v)*P11 ...
%cos(nv)*Pnn] and [sin(v)*P11... ]
Ycos = [];
YNcos = [];
for i = 1:n;
s = floor(i/2);
f = ((-1)^k/sym('k!'))*sym('(2*q - 2*k)!')/(sym('(q -2*k)!')*sym('(q - k)!'))*x^(q - 2*k);
Pol = (1/2^q)*symsum(f,k,0,s);
Legendre = subs(Pol,q,i);
Legsimple = simplify(Legendre);
P = expand(Legsimple);
Yleg = [];
Pleg = [];
for j = 1:i
Pmnx = diff(P,j);
YNmncos = (2*i+1)/(2)*factorial(i-j)/factorial(i+j)*cos(j*v)*sin(u)^j*subs(Pmnx,x,cos(u));
Yleg = [Yleg YNmncos];
Pmn = cos(j*v)*sin(u)^j*subs(Pmnx,x,cos(u));
Pleg = [Pleg Pmn];
end
YNcos = [YNcos Yleg];
Ycos = [Ycos Pleg];
end
YNcos = YNcos;
Ycos = Ycos;
Ysin = [];
YNsin = [];
43
for i = 1:n;
s = floor(i/2);
f = ((-1)^k/sym('k!'))*sym('(2*q - 2*k)!')/(sym('(q -2*k)!')*sym('(q - k)!'))*x^(q - 2*k);
Pol = (1/2^q)*symsum(f,k,0,s);
Legendre = subs(Pol,q,i);
Legsimple = simplify(Legendre);
P = expand(Legsimple);
Yleg = [];
Pleg = [];
for j = 1:i
Pmnx = diff(P,j);
YNmnsin = (2*i+1)/(2)*factorial(i-j)/factorial(i+j)*sin(j*v)*sin(u)^j*subs(Pmnx,x,cos(u));
Yleg = [Yleg YNmnsin];
Pmn = sin(j*v)*sin(u)^j*subs(Pmnx,x,cos(u));
Pleg = [Pleg Pmn];
end
YNsin = [YNsin Yleg];
Ysin = [Ysin Pleg];
end
YNsin = YNsin;
Ysin = Ysin;
%Calculating the coefficients A0n (for Zonal Harmonics) and Anm (for cos*Pmn) and
%Bnm (for sin*Pmn) of the series of Spherical Harmonics.
A0tot = [];
a0 = numel(ZNtot);
F = func*sin(u);
for i = 1:a0;
Z = ZNtot(1,i);
A0 = int(int(F*Z,v,0,2*pi),u,0,pi);
A0tot = [A0tot A0];
end
A0tot = A0tot;
a = numel(YNcos);
Atot = [];
for i = 1:a;
Pcos = YNcos(1,i);
A = int(int(F*(Pcos),v,0,2*pi),u,0,pi);
Atot = [Atot A];
end
Atot = Atot;
b = numel(YNsin);
Btot = [];
for i = 1:b;
Psin = YNsin(1,i);
B = int(int(F*(Psin),v,0,2*pi),u,0,pi);
Btot = [Btot B];
end
Btot = Btot;
%Projecting the Spherical Harmonic expansion onto the disc with radius 1
%with the aid of Stereographic Coordinates. Only the bottom part of the
%sphere (pi/2 < theta > pi) is projected to avoid the dicontinuities in the
%projection point, (0,0,1).
figure('Name','Spherical Harmonic expansion');
ezsurf(sin(u)*cos(v)/(1 - cos(u)),sin(u)*sin(v)/(1 - cos(u)),y2,[pi/2,pi,0,2*pi])
%colormap([1 .1 .6])
legend(['Spherical harmonic expansion up to degree ' int2str(subs(C,c,n))],'Location','Best')
set(gca,'Title',text('String','Spherical Harmonic expansion'));
%Projecting the chosen function, defined on the sphere, onto the disc of radius 1.
44
figure('Name','Stereographical projection of chosen function for reference');
ezsurf(sin(u)*cos(v)/(1 - cos(u)),sin(u)*sin(v)/(1 - cos(u)),func,[pi/2,pi,0,2*pi])
%colormap([0 0 1])
legend('f(u,v)')
set(gca,'Title',text('String','Chosen Function'));
%A surface plot of the difference between the chosen function and its
%Spherical harmonic approximation of degree n
if simple(y-func)==0
figure1 = figure(...
'Color',[1 1 1],...
'PaperPosition',[0.6345 6.345 20.3 15.23],...
'PaperSize',[20.98 29.68]);
annotation1 = annotation(...
figure1,'textbox',...
'Position',[0.08214 0.3452 0.8143 0.5669],...
'LineStyle','none',...
'Color',[0 0.749 0.749],...
'FitHeightToText','off',...
'FontName','Bell MT',...
'FontSize',35,...
'HorizontalAlignment','center',...
'String',{'The chosen function','and the Spherical','Harmonic expansion','are identical!'});
else
figure('Name','Difference between function and approximation');
ezsurf(sin(u)*cos(v)/(1 - cos(u)),sin(u)*sin(v)/(1 - cos(u)),func-y2,[pi/2,pi,0,2*pi]);
legend('Difference')
end
set(gca,'Title',text('String','Difference'))
45
References
[1] Axler, S., Bourdon, P. and Ramey, W. Harmonic Function Theory. Springer-Verlag New York,
Inc., 2nd edition, 2001. Digital Copy.
[2] Biggs, N. L. Discrete Mathematics. Oxford University Press, 2nd edition, 2002.
[3] Brown, J. W. and Churchill, R. V. Fourier Series and Boundary Value Problems. McGraw-
Hill Companies, Inc., 7th edition, 2008.
[4] Byerly, W. E. An Elementary Treatise on Fourier’s Series and Spherical, Cylindrical and
Ellipsoidal Harmonics, with Applications to Problems in Mathematical Physics. Dover Pub-
lications, Inc., 1893. Digital Copy.
[5] Greub, W. H. Linear Algebra. Springer-Verlag New York, Inc., 3rd edition, 1967. Digital Copy.
[6] Jerri, A. J. Integral and Discrete Transforms with Applications and Error Analysis. Marcel
Dekker Inc., 1992. Digital Copy.
[10] Retherford, J. R. Hilbert Space: Compact Operators and the Trace Theorem. Cambridge
University Press, 1993. Digital Copy.
[11] Rudin, W. Principles of Mathematical Analysis. McGraw-Hill Companies, Inc., 3rd edition,
1976.
46