i
i
i
i
i
i
i
i
Appendix B
Trigonometry
“Life is good for only two things, discovering mathematics and
teaching mathematics.”
—Sim´eon Poisson
This appendix is intended to be a reference to some simple laws of trigonom-
etry as well as some more sophisticated ones. The laws of trigonometry are
particularly important tools in computer graphics. One example of their
usefulness is that they provide ways to simplify equations and thereby to
increase speed.
B.1 Definitions
According to Figure B.1, where p =(p
x
,p
y
) is a unit vector, i.e., ||p|| =1,
the fundamental trigonometric functions, sin, cos, and tan, are defined by
Equation B.1.
Fundamental trigonometric functions :
sin φ = p
y
cos φ = p
x
tan φ =
sin φ
cos φ
=
p
y
p
x
(B.1)
The sin, cos, and tan functions can be expanded into MacLaurin se-
ries, as shown in Equation B.2. MacLaurin series are a special case of the
more general Taylor series. A Taylor series is an expansion about an ar-
bitrary point, while a MacLaurin series always is developed around x =0.
913
i
i
i
i
i
i
i
i
914 B. Trigonometry
Figure B.1. The geometry for the definition of the sin, cos, and tan functions is shown
to the left. The right-hand part of the figure shows p
x
=cosφ and p
y
=sinφ,which
together traces out the circle.
MacLaurin series are beneficial because they clarify the origins of some of
the derivatives (shown in Equation set B.4).
MacLaurin series :
sin φ = φ −
φ
3
3!
+
φ
5
5!
−
φ
7
7!
+ ···+(−1)
n
φ
2n+1
(2n +1)!
+ ...
cos φ =1−
φ
2
2!
+
φ
4
4!
−
φ
6
6!
+ ···+(−1)
n
φ
2n
(2n)!
+ ...
tan φ = φ +
φ
3
3
+
2φ
5
15
+ ···+(−1)
n−1
2
2n
(2
2n
− 1)
(2n)!
B
2n
φ
2n−1
+ ...
(B.2)
The two first series hold for −∞ <φ<∞, the last one for −π/2 <
φ<π/2andB
n
is the nth Bernoulli number.
1
The inverses of the trigonometric functions, arcsin, arccos, and arctan,
aredefinedasinEquationB.3.
Inverses of trigonometric functions :
p
y
=sinφ ⇔ φ =arcsinp
y
, −1 ≤ p
y
≤ 1, −
π
2
≤ φ ≤
π
2
p
x
=cosφ ⇔ φ = arccos p
x
, −1 ≤ p
x
≤ 1, 0 ≤ φ ≤ π
p
y
p
x
=tanφ ⇔ φ =arctan
p
y
p
x
, −∞ ≤
p
y
p
x
≤∞, −
π
2
≤ φ ≤
π
2
(B.3)
1
The Bernoulli numbers can be generated with a recursive formula, where B
0
=1
and then for k>1,
k−1
j=0
k
j
B
j
=0.
i
i
i
i
i
i
i
i
B.2. Trigonometric Laws and Formulae 915
Figure B.2. A right triangle and its notation.
The derivatives of the trigonometric functions and their inverses are
summarized below.
Trigonometric derivatives :
d sin φ
dφ
=cosφ
d cos φ
dφ
= −sin φ
d tan φ
dφ
=
1
cos
2
φ
=1+tan
2
φ
d arcsin t
dt
=
1
√
1 − t
2
d arccos t
dt
= −
1
√
1 − t
2
d arctan t
dt
=
1
1+t
2
(B.4)
B.2 Trigonometric Laws and Formulae
We begin with some fundamental laws about right triangles. To use the
notation from Figure B.2, the following laws apply:
i
i
i
i
i
i
i
i
916 B. Trigonometry
Right triangle laws :
sin α =
a
c
cos α =
b
c
tan α =
sin α
cos α
=
a
b
(B.5)
Pythagorean relation : c
2
= a
2
+ b
2
(B.6)
For arbitrarily angled triangles, the following well-known rules are valid,
using the notation from Figure B.3.
Law of sines :
sin α
a
=
sin β
b
=
sin γ
c
Law of cosines : c
2
= a
2
+ b
2
− 2ab cos γ
Law of tangents :
a + b
a − b
=
tan
α + β
2
tan
α − β
2
(B.7)
Figure B.3. An arbitrarily angled triangle and its notation.
i
i
i
i
i
i
i
i
B.2. Trigonometric Laws and Formulae 917
Named after their inventors, the following two formulae are also valid
for arbitrarily angled triangles.
Newton
sformula:
b + c
a
=
cos
β − γ
2
sin
α
2
Mollweide
sformula:
b − c
a
=
sin
β − γ
2
cos
α
2
(B.8)
The definition of the trigonometric functions (Equation B.1) together
with the Pythagorean relation (Equation B.6) gives the trigonometric iden-
tity:
Trigonometric identity :cos
2
φ +sin
2
φ =1 (B.9)
Here follow some laws that can be exploited to simplify equations and
thereby make their implementation more efficient.
Double angle relations :
sin 2φ =2sinφ cos φ =
2tanφ
1+tan
2
φ
cos 2φ =cos
2
φ − sin
2
φ =1− 2sin
2
φ =2cos
2
φ − 1=
1 − tan
2
φ
1+tan
2
φ
tan 2φ =
2tanφ
1 − tan
2
φ
(B.10)
Extensions of these laws are called the multiple angle relations,shown
below.
Multiple angle relations :
sin(nφ)=2sin((n −1)φ)cosφ − sin((n − 2)φ)
cos(nφ)=2cos((n − 1)φ)cosφ − cos((n − 2)φ)
tan(nφ)=
tan((n − 1)φ)+tanφ
1 − tan((n − 1)φ)tanφ
(B.11)
Get Real-Time Rendering, Third Edition, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.