You are on page 1of 62

TUTORIAL on QUATERNIONS

Part I

Luis Ibanez
August 13, 2001
This document was created using LYX and the LATEX Seminar style.

Introduction
Quaternions are commonly used to represent rotations.
They were introduced by William Hamilton (1805-1865) [1]
Quaternions were conceived as Geometrical Operators
A Complete Calculus of Quaternions was introduced by Hamilton [2]

q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

qrs
q q r r s s
q r s
lim q 0 r 0 s 0 M
dq dr ds

Definition of Vector

A Vector is a line segment with orientation


Vector MN represents the relative position
of point N with respect to point M

Hamiltons Motivation for Quaternions

Create a Mathematical Concept to represent


The RELATIONSHIP between two VECTORS.
In the same way that a Vector represent
The RELATIONSHIP between two POINTS.

q
s
q2
dh
dq

Vector applied dw
to
Point
dx
dy

Given :
Point M and a Vector V

dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

The application of the Vector over


the Point Results in a
q q r
lim q

Unique Point N

0 r

qrs
r s s
q r s
0 s 0 M
dq dr ds

M
V

N
V

y
h
w
q
s
q2

Quaternion applieddh
to Vector
dq
In the same way, Hamilton wanted
that given
q

Vector V and a Quaternion Q

dw
dx
dy
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

qrs
q q r r s s
q r s
lim q 0 r 0 s 0
dq dr ds

The application of the Quaternion


over the Vector Results in a
Unique Vector W

Q
V

Quatenion Rationale
A vector is completly defined by
Length
Orientation
In order to define a vector in terms of another vector
a Quaternion has to represent
Relative Length
Relative Orientaton

dq
q dq
q dq 1
dq q dq 1 Definition of Scalar
q dq q dq 1
A Scalar is zdefined
f x as
y
f xthe
y lengths of two PARALLEL vectors A and B
The ratio between

qrs
q q r r s s
q r s
lim q 0 r 0 s 0
dq dr ds

B
A

S = Scale

It represents the RELATIVE LENGTH of one vector


with respect to the other.
Note that in programming jargon scalar has mistakenly taken the place of real

Scalar - Vector Operations


A

B
A Scalar S is the Quotient between two PARALLEL vectors A and B
A

S B

A Scalar is an Operator that


Changes the SCALE of the vector
Keeps its orientation unchanged
Application the Scalar Operator is noted by the symbol
9

dy
dq 1
q dq
q dq 1
1
dq q dqDefinition
of a Versor
q dq q dq 1
A Versor is defined as
z f xy
The quotient between
f xtwo
y non-parallel vectors of EQUAL LENGTH

q r sA
q q r r s s
q r s
lim q 0 r 0 s 0
dq dr ds

It represents the RELATIVE ORIENTATION of one vector


with respect to the other.

10

Versor - Vector Operations


A

B
A Versor V is the Geometric Quotient between two non-parallel vectors
of EQUAL LENGTH A and B
A

A Versor is an operator that


Changes the ORIENTATION of the vector
Keeps its length unchanged
Application of the Versor Operator is noted by the symbol
11

dx
dy
dq 1
q dq
q dq 1 Right Versors
dq q dq 1
A Right Versor is a Versor that applies a 90 rotation
q dq q dq 1
z f xy
V
f xy

qrs
q q r r s s
q r s
lim q 0 r 0 s 0
dq dr ds

Vector length is left unchanged as in any other Versor application

12

dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

qrs
q r r s s
q r s
r 0 s 0
dq dr ds

Composing Versors
A
V3

V2

V2

V1 C

V2 V1 C

V3 C

V1
Versor composition is the
consecutive application of
two versors operators.

C
V3

V2 V1

It is noted by the symbol

13

dw
dx
dy
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

Composing Right Versors


V

qrs
r r s s B
q r s
0 s 0
dq dr ds

A
A

V V

V V

1 is the INVERSION operator that inverts the direction of a vector.


The double application of a right versor to a vector, inverses the vector.

14

Definition of Quaternion
A

B
A Quaternion is the Geometrical Quotient of two vectors A and B
A

Q B

A Quaternion is an operator that


Changes the ORIENTATION of the vector
Changes the LENGTH of the vector
Application of the Quaternion Operator is noted by the symbol
15

Quaternion Characteristics
Axis(Q) = Unit Vector perpendicular to the plane of rotation
Angle(Q) = Angle between the vectors in the quotient
Index(Q) = In a Right Quaternion is the Axis(Q) multiplied by the
length ratio of the two vectors in the quotient.

16

Representation of Quaternions
Quaternion = A set of Four
From
the Latin Quaternio
the Greek
The combined operation of Scalar and Versor requires 4 numbers:
1 for Scale
1 for Angle
2 for Orientation (common plane)
Quaternion = Scalar combined with Versor
17

dh
dq

dw
dx
Opposite Quaternions
dy
dq 1
has an Opposite quaternion O Q
q dq The quaternion Q
q dq 1
dq q dq 1
A
A
Q
O
Q
Q
dq q dq 1
B
B
z f xy
f xy

qrs
q r r s s
q r s
0 r 0 s 0
A
dq dr ds

B
O(Q)
Q

18

dw
dx
dy
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

qrs
q r r s s
q r s
0 r 0 s 0
A
dq dr ds

Opposite Quaternion Properties


Angle Q
Axis Q

Angle O Q
Axis O Q

B
O(Q)
Q

19

dy

dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

A
qrs
q r r s s
q r s
0 r 0 s 0
dq dr ds

Reciprocal Quaternions
B

B
The quaternion Q has a Reciprocal
quaternion R Q

R(Q)
Q

RQ

A
Their composition (one quaternion
applied after the other) is
Q RQ

The 1 operator is an Identity Operator that leaves vectors unchanged.


20

q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

qrs
q q r r s s
q r s
0 r 0 s 0
dq dr ds

dq

dw
dx
Conjugate Quaternion
dy
dq 1
q dq
The geometric reflection of vector
B
q dq 1
B (the denominator) over vector
dq q dq 1
A (the numerator) will be vector
1
q
dq
q
dq
Q
C
z f xy
f xy

C
Given the pair of vectors A and B
qrs
and their quotient
q q r r s s
q r s
A
Q lim q 0 r 0 s 0
B
dq dr ds

21

B
A
Q

dq
q dq
q dq 1
dq q dq 1
q dq q dq 1
Conjugate Quaternion
z f xy
f xy
The Conjugate of Quaternion Q is
C
defined as the quotient K Q
qrs
q
A
K Q
lim qC

q r
0 r

r s s
q r s K(Q)
0 s 0
dq dr ds

Angle Q

Angle K Q

Axis Q

Axis K Q

22

B
A
Q

dw
dx
dy
Norm ofdq
a Quaternion
1
q dq
The Norm is the composition of 1a Quaternion with its Conjugate
q dq
dq q dq 1
N Q
Q K Q
q dq q dq 1
B
A
Q
z f xy
A
f xy
Q
B

N Q

qrs
C
K Q q q r r s s
A
q r s
lim q 0 r 0 s 2 0
A dr ds
dq
A C
C
B

23

K(Q)

dw
dx
dy
dq 1
dq
Norm of qa Quaternion
q dq 1
dq q dq 1
The rotation of the Conjugate
q dqK qQ dq 1
A
compensates the rotation of the
z f xy
quaternion Q.
f xy
K(Q)
qrs
q q r r s s
The operator N Q produce a q r s
limhence
q N0 r
parallel vector,
Q is 0 s 0
dq dr ds
always a positive Scalar operator

24

q2
dh
dq

dw
dx
dy
The Square
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

qrs
q q r r s s
q r s
q 0 r 0 s 0
dq dr ds

Square of a Quaternion
of a Quaternion is defined as :
Applying the quaternion twice

Q C

Q B

Q C

Q Q C
C

Q Q
Q
25

C
C

q q dq 1
z f xy
f xy

Composing Right Quaternions

qrs
r s s
q r s
0 s 0
dq dr dsB

The succesive application of a Right Quaternion over a Vector


results in a Vector in the opposite direction.
A
B

D
E

The square of any right quaternion is a NEGATIVE scalar operator


26

Versor of a Quaternion
Versor of a Vector = Unit vector parallel to the vector
A

U A

A
Versor of a Quaternion = Quotient of the Versors of the vectors

U Q

U A

U B

It is the part of the Quaternion that represents Relative Orientation

27

Tensor of a Quaternion
Tensor of a Vector = Length of the vector
T

Tensor of a Quaternion = Quotient of the tensor of the vectors

T Q

It is the part of the Quaternion that represents Relative Sscale

28

Tensor and Versor of a Quaternion


Versor operator applies VERSION to a vector
Changes vectors orientation
Tensor operator applies TENSION to a vector
Stretches the vector and change its length

29

Tensor and Versor of a Quaternion


A Vector can be decomposed in Versor and Tensor parts
A

U A

A Quaternion can be decomposed in Versor and Tensor parts

T Q

T Q

U A

U B

U Q

30

dx
dy
dq 1
q dq
q dq 1
Vector - Arcs
dq q dq 1
q dq q dq 1
Versors can be represented on the
z f xy
surface of a unit sphere.
f xy

qrs
A
V
B q q r r s s
q r s
Application of versor V will
lim q 0 r 0 s 0
move point B to point A
dq dr ds

V
A

The Maximum Arc joining points B and A is defined as Vector-Arc

31

dx
dy
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

Sliding Vector - Arcs


In the same way that Vectors can be translated on a plane

qrs
q r r s s
q r s
r 0 s 0
dq dr ds
Vector arcs can freely slide along the great circle
and still represent the SAME Versor.
32

dx
dy
dq 1
Composition of qBiplanar
Versors
dq
q dq 1
dq q dq 1
A q dq q dq 1
VBA
B
z f xy
A
composed with
f xy

qrs
B
VCB
Cq q r r s s
q r s
results in the versor
lim q 0 r 0 s 0
dq dr ds
A B
A
VCA
B C
C

33

VBA

VCA

B
VCB

dw
dx
dy
Multiplication and Division
dq 1 of Diplanar Versor
q dq
dq 1to define versor operations
The Spherical Triangle ABCqis used
dq q dq 1is used for vector operations
analogously to how the parallelogram
q dq q dq 1
Multiplication of Versors as
z f xy
A
f xy
VCA VBA VCB
VBA

qrs
q q r r s s
Division of Versors as
q r s
V
VBA
lim qVCA
0 r 0 s 0
CB
like the difference of vectors dq dr ds
like the sum of vectors

34

VCA

B
VCB

dy
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

Versor Composition is Non-Commutative

qrs
q r r s s
A
q r s
r 0 s 0
dq dr ds

C
A

A
C

The resulting versors VCA and VA C have the same angle


but different axis (and so, different planes)

35

dw
dx
dy
dq 1
q dq
Composition of two Orthogonal
Right Versors
q dq 1
dq q dq 1
The multiplication of twoq dq q dq 1
A
orthogonal Right Versors produce
z af x y
Right Versor orthogonal to them f x y

VCB VBA VCA


qrs
q q r r s s
An when the order is reversed q r s C
lim q 0 r 0 s 0
dq dr ds
VCA
VBA VCB

36

w
q
s
q2
dh
dq

dw
dx
dy
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

qrs
q q r r s s
q r s
im q 0 r 0 s 0
dq dr ds

Square of Elementary Versors


The Square of an operator is the operator applied twice

i i=i

The square of Right Versors is always the

37

i = 1
1 Operator

dw
dx
dy
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

qrs
r r s s
q r s
0 s 0
dq dr ds

Elementary Versors
Composition of Elementary Versors

j
right-hand

i
k

38

self

i j

i i

j k

j j

k i

k k

dh
dq
dw
dx
dy
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

qrs
r r s s
q r s
r 0 s 0
dq dr ds

Index of Right Quaternions


The Index of a Right Quaternion is

S<1

S=1

S>1

the Axis of the quaternion Scaled by the ratio of lengths

39

Sum of Versors
Versors are Quotients.
They can be summed ONLY when they have
a COMMON DENOMINATOR

VBC
VBA

C
B
A
B

VBC

VBA

A
B

A Common Denominator can ALWAYS be found

40

dy
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

qrs
q r r s s
q r s
0 r 0 s 0
dq dr ds

Getting a Common Denominator

B
VBA
D

A
VDC
C

VBA

VDC

41

C
D

dx
dy
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

qrs
q r r s s A
q r s
0 r 0 s 0
dq dr ds

Getting a Common Denominator


Slide both versors along their great circles

B
B
A

C
Until their origins coincide

The vector B in the intersection is the common denominator


42

dw
dx
dy
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

Geometrical Interpretation of the Sum


As with Vectors, first SLIDE both
Vector-Arcs to a common origin

qrs
q r r s s
q r s
0 r 0 s 0
dq dr ds
In order to get a common denominator
43

dx
dy
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

Geometrical Interpretation of the Sum


Add the two vectors in the numerator

qrs
q r r s s
q r s
0 r 0 s 0
dq dr ds
Finally get the new Quotient

44

dq

dw
dx
dy
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

qrs
r r s s
q r s
0 s 0
dq dr ds

Sum of two Right Versors


It is always a right quaternion

H/2 H/2

Its plane BISECTS those of the original two versors


and has a Scalar characteristic
45

dw
dx
dy
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

qrs
r r s s
q r s
0 s 0
dq dr ds

Sum of two Right Versors


The Index of the resulting Versor

H/2 H/2
H/2
H/2

is equal to the sum of indices of the two versors

46

q2
dh
dq
dw
dx
dy
dq 1
q dq
q dq 1
dq q dq 1
dq q dq 1
z f xy
f xy

qrs
r r s s
q r s
r 0 s 0
dq dr ds

Multiplying a Right Versor by a Scalar


Multiplication by a Scalar affects
only the Scalar part of the Right Versor

S<1

S=1

S>1

It modifies the length ration of the vectors in the Quotient


47

dq

dw
dx
Right Versor in terms of Orthogonal Right Versor
dy
dq 1
If the three Orthogonal Right Versors i j k are multiplied by Scalars x y z
q dq
q dq 1 Q x i y j z k
x2 y2 z2 1
dq q dq 1
dq q dq 1
z f xy
f xy

qrs
q r r s s
q r s
0 r 0 s 0
dq dr ds

Their sum will be a Right Versor whose axis has x y z as componets.


48

dy
dq 1
q dq
q dq 1
dq q dq 1
1
Scalarqand
of Quaternions
dqRight
q dqParts
z f xy
A Quaternion operator
f x y applied to a vector B
performs an operation that
produces another vector A

qrs
A
Q q q r r s s
B
q r s
lim q 0 r 0 s 0
dq dr ds
A Q B

49

A
Q
B

q dq
q dq 1
f xy
f xy

qrs
r s s
q r s B R
0 s 0
dq dr ds

Scalar and Right Parts of Quaternions


The new vector A can be
expressed as a sum of two
orthogonal vectors

BS

BR

One parallel to B and


another orthogonal to B

BS

50

q dq 1
z f xy
f xy

qrs
r s s
q r s
0 s 0
dq dr ds

Scalar and Right Parts of Quaternions

A
BR
B

BS

B S is obtained by applying
an Scalar Operator to B

B R is obtained by applying
a Right Quaternion to B

51

q dq
dq q dq 1
dq q dq 1
z f xy
f xy

Tensor and Versor Part of a Quaternion


The same operation can be decomposed in
a Tensor Operator and a Versor Operator

qrs
r r s s
q r s
r 0 s 0
dq dr ds

A
V

T
BT

B
BT

52

BT

BT

Scalar and Right versus Tensor and Versor


SCALAR and RIGHT parts are a
Representation in RECTANGULAR coordinates
TENSOR and VERSOR parts are a
Representation in POLAR coordinates

53

dq q dq 1
1
qQuaternions
dq q dq
as Four Coefficients
z f xy
f between
x y vectors A and B is L
Let L be the Ratio of lenghts
The Scalar factor

qrs
q qBrS r s s
S
q r s B R
B
lim q should
0 be
requal to0 s 0
dq dr ds
L cos

54

A
B

BS

dq q dq 1
1
qQuaternions
dq q dq
as Four Coefficients
z f xy
f between
x y vectors A and B is L
Let L be the Ratio of lenghts
The Tensor of he Right part

qrs
q qBrR r s s
R
q r s B R
B
lim q should
0 be
requal to0 s 0
dq dr ds
L sin

55

A
B

BS

Quaternions as Four Coefficients


The Quaternion Q can then be written as
Q

xi

yj

zk

Where

x2

y2

L cos

z2

L sin

The real number w represents the Scalar part,


The sum x i

yj

z k represents the Right part.

56

Product of Quaternions
Two quaternions Q1 and Q2 are composed by
Q1 Q2

T Q1 U Q1

T Q2 U Q2

That is equivalent to
Q1 Q2

T Q1 T Q2 U Q1

57

U Q2

Product of Quaternions
Given a Quaternion Q resulting from the composition
Q

Q1 Q2

Its Tensor is
T Q

T Q1 T Q2

Its Versor is
U Q

U Q1

58

U Q2

Representation by four coefficients


Let P and Q be two Quaternions, represented by four coefficients
P

xp i

yp j

zp k

wp

xq i

yq j

zq k

wq

Their composition P Q can be expressed by

P Q

LPQ

wp

zp

zp

wp
xp

yp
xp

yp

59

yp

xp

xq

xp

yp

yq

wp

zp

zq

zp

wp

wq

Representation by four coefficients


Let P and Q be two Quaternions, represented by four coefficients
P

xp i

yp j

zp k

wp

xq i

yq j

zq k

wq

Their composition P Q can be expressed by

P Q

RQP

wq

zq

zq

wq

yq
xq

60

yq

xq

xp

xq

yq

yp

xq

wq

zq

zp

yq

zq

wq

wp

Rotating a Vector (Finally !!)


A Quaternion q

x y z w rotates a Vector v by using the product


v

q v q

Which can be reduced to a Matrix-Vector multiplication L q R q


w2

x2

y2

2xy

2wz

2xz

2wy
0

z2

2xy
w2

2wz

x2

y2

2yz

z2
w2

2wx
0

2xz

2wy

2yz

2wx

x2

y2
0

61

z2

0
w2

x2

y2

z2

References
[1] W.R. Hamilton. Elements of Quaternions, volume I. Chelsea
Publishing Company, third edition, 1969. The original was published
in 1866.
[2] C.J. Joly. A Manual of Quaternions. MacMillan and Co., Limited,
1905.

62

You might also like