Geometric Algebra Gary Snethen Crystal Dynamics [email protected].

38
Geometric Geometric Algebra Algebra Gary Snethen Gary Snethen Crystal Dynamics Crystal Dynamics [email protected] [email protected]

Transcript of Geometric Algebra Gary Snethen Crystal Dynamics [email protected].

Page 1: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

Geometric Geometric AlgebraAlgebraGary SnethenGary Snethen

Crystal DynamicsCrystal Dynamics

[email protected]@crystald.com

Page 2: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

QuestionsQuestions

How are dot and cross products related?How are dot and cross products related? Why do cross products only exist in 3D?Why do cross products only exist in 3D? Generalize “cross products” to any Generalize “cross products” to any

dimension?dimension? Is it possible to divide by a vector?Is it possible to divide by a vector? What does an imaginary number look like?What does an imaginary number look like? Complex have two, but Quaternions have Complex have two, but Quaternions have

four. Why?four. Why? Why do quaternions rotate vectors?Why do quaternions rotate vectors? Generalize quaternions to any dimension?Generalize quaternions to any dimension?

Page 3: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

HistoryHistory

Babylonia – 1800 BCBabylonia – 1800 BC First known use of algebraic equationsFirst known use of algebraic equations Number system was base-60Number system was base-60 Multiplication table impractical (3600 entries to Multiplication table impractical (3600 entries to

remember!)remember!) Used table of squares to multiply any two integersUsed table of squares to multiply any two integers

And this equation:And this equation:

2 2 2

2

a b a bab

2 2 2

2

a b a bab

Page 4: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

HistoryHistory Babylonia – 1800 BCBabylonia – 1800 BC

AB

A2

B2

AB

B

A

BA

Page 5: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

HistoryHistory

Greece – 300 BCGreece – 300 BC Euclid wrote ElementsEuclid wrote Elements Covered GeometryCovered Geometry

From “Geo” meaning “Earth”From “Geo” meaning “Earth” And “Metric” meaning “Measurement”And “Metric” meaning “Measurement”

Geometry was the study of Earth MeasurementsGeometry was the study of Earth Measurements Extended: Earth to space, space-time and beyondExtended: Earth to space, space-time and beyond

Alexandria – 50 ADAlexandria – 50 AD Heron tried to find volume of a frustum, but it Heron tried to find volume of a frustum, but it

required using the square root of a negative required using the square root of a negative numbernumber

Page 6: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

HistoryHistory Persia – 820Persia – 820

Al-Khwarizmi wrote a mathematics text based on…Al-Khwarizmi wrote a mathematics text based on… Al-jabr w’al-MuqabalaAl-jabr w’al-Muqabala Al-jabr: “Reunion of broken parts”Al-jabr: “Reunion of broken parts” W’al-Muqabala: “through balance and opposition”W’al-Muqabala: “through balance and opposition”

Pisa – 1202Pisa – 1202 Leonardo Fibonacci introduces the method to Leonardo Fibonacci introduces the method to

EuropeEurope Name is shortened to Al-jabrName is shortened to Al-jabr Westernized to AlgebraWesternized to Algebra

Page 7: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

HistoryHistory 1637 – René Descartes1637 – René Descartes

Coined the term “imaginary number”Coined the term “imaginary number” 1777 – Leonard Euler1777 – Leonard Euler

Introduced the symbol Introduced the symbol ii for imaginary numbers for imaginary numbers 1799 – Caspar Wessel1799 – Caspar Wessel

Described complex numbers geometricallyDescribed complex numbers geometrically Made them acceptable to mainstream Made them acceptable to mainstream

mathematiciansmathematicians 1831 – Carl Gauss1831 – Carl Gauss

Discovered that complex numbers could be Discovered that complex numbers could be written a + written a + i i bb

Page 8: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

HistoryHistory 1843 – Rowan Hamilton1843 – Rowan Hamilton

Discovered quaternions (3D complex numbers)Discovered quaternions (3D complex numbers) Coined the term “vector” to represent the non-scalar Coined the term “vector” to represent the non-scalar

partpart Invented dot and cross productsInvented dot and cross products

1844 – Hermann Grassmann1844 – Hermann Grassmann Exterior product (generalization of cross product)Exterior product (generalization of cross product)

1870 – William Kingdon Clifford1870 – William Kingdon Clifford Generalized complex numbers, dot and cross productsGeneralized complex numbers, dot and cross products Died young, and his approach didn’t catch onDied young, and his approach didn’t catch on Variants of his approach are often called Clifford Variants of his approach are often called Clifford

AlgebrasAlgebras 1966 – David Orlin Hestenes1966 – David Orlin Hestenes

Rediscovered, refined and renamed “Geometric Rediscovered, refined and renamed “Geometric Algebra”Algebra”

Claims that “Geometric Algebra” is the name Clifford Claims that “Geometric Algebra” is the name Clifford wantedwanted

Page 9: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

Geometric AlgebraGeometric AlgebraIntroductionIntroduction

Direction is similar to a unit, like mass or energy, but even more similar to - and +

Pick a symbol that represents one unit of direction – like i.

We live in a 3D universe, so we need three directions: i, j and k

Direction is similar to a unit, like mass or energy, but even more similar to - and +

Pick a symbol that represents one unit of direction – like i.

We live in a 3D universe, so we need three directions: i, j and k

How do we represent direction?How do we represent direction?

Page 10: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

Geometric AlgebraGeometric AlgebraIntroductionIntroduction

i+i = 2i Parallel directions combine

i+j = i+j Orthogonal directions do not combine

No matter how many terms we add together, we’ll wind up with some combination of i, j and k:

(ai + bj + ck)

We call these vectors…

i+i = 2i Parallel directions combine

i+j = i+j Orthogonal directions do not combine

No matter how many terms we add together, we’ll wind up with some combination of i, j and k:

(ai + bj + ck)

We call these vectors…

How do we add direction?How do we add direction?

Page 11: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

Geometric AlgebraGeometric AlgebraSimplifying ProductsSimplifying Products

How do we multiply orthogonal directions?How do we multiply orthogonal directions?

( )( ) i j ij( )( ) i j ij

jj

ii==== ijij

(2 )(3 ) 6i j ij(2 )(3 ) 6i j ij

3j3j

2i2i

==== 6ij6ij

We call these bivectors…We call these bivectors…

Page 12: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

Geometric AlgebraGeometric AlgebraIntroductionIntroduction

What are the unit directions in 2D & 3D?What are the unit directions in 2D & 3D?

Note: In 3D, there are three vector directions and three bivector directions – this leads to confusion!Note: In 3D, there are three vector directions and three bivector directions – this leads to confusion!

2D 3D

Scalar: 1 1

Vector: i j i j k

Bivector: ij jk ki ij

Trivector: ijk

Page 13: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

Geometric AlgebraGeometric AlgebraIntroductionIntroduction

Which are vectors? Which are bivectors?Which are vectors? Which are bivectors?

VelocityAngular velocityForceTorqueNormalDirection of rotationDirection of reflectionCross product of two vectorsThe vector portion of a quaternion

VelocityAngular velocityForceTorqueNormalDirection of rotationDirection of reflectionCross product of two vectorsThe vector portion of a quaternion

Page 14: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

Geometric AlgebraGeometric AlgebraIntroductionIntroduction

Geometric AlgebraGeometric AlgebraIntroductionIntroduction

What does a negative bivector represent?What does a negative bivector represent?

( )( ) i j ij( )( ) i j ijjj

-i-i====

-ij-ij

( )( ) i j ij( )( ) i j ij

-j-j

ii====

-ij-ij

( )( ) j i ij( )( ) j i ij

jj

ii ====-ij-ij

ji ijji ij

Page 15: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

Geometric AlgebraGeometric AlgebraIntroductionIntroduction

How do we multiply parallel directions?How do we multiply parallel directions?

ii=?ii=?

i represents direction, like 1 or -1 on a number line

(1)(1) = 1

(-1)(-1) = 1

(i)(i) = 1

ii = 1 i is its own inverse!

i represents direction, like 1 or -1 on a number line

(1)(1) = 1

(-1)(-1) = 1

(i)(i) = 1

ii = 1 i is its own inverse!

Page 16: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

Just like the dot product!Just like the dot product!

Geometric AlgebraGeometric AlgebraIntroductionIntroduction

Just like the cross

product!

Just like the cross

product!

Rule 1: If i and j are orthogonal unit vectors, then:

ji = -ij

Rule 1: If i and j are orthogonal unit vectors, then:

ji = -ij

Rule 2: For any unit vector i:

ii = 1

Rule 2: For any unit vector i:

ii = 1

That’s it! Now we can multiply arbitrary vectors!That’s it! Now we can multiply arbitrary vectors!

How do we multiply directions?How do we multiply directions?

Page 17: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

Geometric AlgebraGeometric AlgebraSimplifying ProductsSimplifying Products

Try simplifying these expressions…Try simplifying these expressions…

iijjiijj 11ijikijik -jk-jkijkjkijijkjkij -j-j

kjijkkjijk ii

Page 18: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

(ai + bj + ck) (xi + yj + zk)

Geometric ProductGeometric ProductHow do we multiply two vectors?How do we multiply two vectors?

Page 19: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

(ai + bj + ck) (xi + yj + zk)

Geometric ProductGeometric Product

+ axii + ayij + azik

+ bxji + byjj + bzjk

+ cxki + cykj + czkk

=

Page 20: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

(ai + bj + ck) (xi + yj + zk)

Geometric Product – Geometric Product – SimplifySimplify

+ axii + ayij + azik

+ bxji + byjj + bzjk

+ cxki + cykj + czkk

=

ii = 1

jj = 1

kk = 1

Page 21: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

(ai + bj + ck) (xi + yj + zk)

Geometric Product – Geometric Product – SimplifySimplify

+ ax + ayij + azik

+ bxji + by + bzjk

+ cxki + cykj + cz

=

ii = 1

jj = 1

kk = 1

Page 22: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

(ai + bj + ck) (xi + yj + zk)

Geometric Product – Geometric Product – SimplifySimplify

+ ax + ayij + azik

+ bxji + by + bzjk

+ cxki + cykj + cz

=

ji = -ij

ik = -ki

kj = -jk

Page 23: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

(ai + bj + ck) (xi + yj + zk)

Geometric Product – Geometric Product – SimplifySimplify

+ ax + ayij + azik

- bxij + by + bzjk

+ cxki + cykj + cz

=

ji = -ij

ik = -ki

kj = -jk

Page 24: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

(ai + bj + ck) (xi + yj + zk)

Geometric Product – Geometric Product – SimplifySimplify

+ ax + ayij - azki

- bxij + by + bzjk

+ cxki + cykj + cz

=

ji = -ij

ik = -ki

kj = -jk

Page 25: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

(ai + bj + ck) (xi + yj + zk)

Geometric Product – Geometric Product – SimplifySimplify

+ ax + ayij - azki

- bxij + by + bzjk

+ cxki - cyjk + cz

=

ji = -ij

ik = -ki

kj = -jk

Page 26: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

(ai + bj + ck) (xi + yj + zk)

Geometric Product – Group Geometric Product – Group TermsTerms

=

+ ax + ayij - azki

- bxij + by + bzjk

+ cxki - cyjk + cz

= (ax + by + cz) + …

Page 27: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

(ai + bj + ck) (xi + yj + zk)

Geometric Product – Group Geometric Product – Group TermsTerms

=

+ ax + ayij + azik

- bxij + by + bzjk

- cxik - cyjk + cz

= (ax + by + cz) + (bz–cy) jk + (cx–az) ki + (ay–bx) ij

Page 28: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

(ai + bj + ck) (xi + yj + zk)

Geometric ProductGeometric ProductInner & Outer ProductsInner & Outer Products

=

+ ax + ayij + azik

- bxij + by + bzjk

- cxik - cyjk + cz

= (ax + by + cz) + (bz–cy) jk + (cx–az) ki + (ay–bx) ij

... A B

Page 29: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

(ai + bj + ck) (xi + yj + zk)

Geometric ProductGeometric ProductInner & Outer ProductsInner & Outer Products

=

+ ax + ayij + azik

- bxij + by + bzjk

- cxik - cyjk + cz

= (ax + by + cz) + (bz–cy) jk + (cx–az) ki + (ay–bx) ij

A B A B

Page 30: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

(ai + bj + ck) (xi + yj + zk)

Geometric ProductGeometric ProductInner & Outer ProductsInner & Outer Products

=

+ ax + ayij + azik

- bxij + by + bzjk

- cxik - cyjk + cz

= (ax + by + cz) + (bz–cy) jk + (cx–az) ki + (ay–bx) ij

A B A B

Page 31: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

Vectors can be inverted!

Geometric ProductGeometric ProductInverseInverse

1

1

1

1

1aa

aaa a

aa a a

aa

aa

Page 32: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

2D Product2D Product2D Product2D Product

AB = (ax + by) + (ay – bx) ijAB = (ax + by) + (ay – bx) ij

A = ai + bjA = ai + bj

B = xi + yjB = xi + yj

Point-like “vector” (a scalar)Point-like “vector” (a scalar)Captures the parallel relationship between A and BCaptures the parallel relationship between A and B

Plane-like “vector” (a bivector)Plane-like “vector” (a bivector)The perpendicular relationship between A and BThe perpendicular relationship between A and B

Page 33: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

2D Rotation2D Rotation2D Rotation2D Rotation

nn

mm

v’ = vnmv’ = vnm

nmnm

v’ = v(nm) = vnmv’ = v(nm) = vnm

vv

nmnm

Note: This only works when n, m and v are in the same plane!Note: This only works when n, m and v are in the same plane!

Page 34: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

A Complex ConnectionA Complex ConnectionA Complex ConnectionA Complex Connection

What is the square of ij?What is the square of ij?

(ij)(ij) = (-ji)(ij) = -jiij = -j(ii)j = -jj = -1(ij)(ij) = (-ji)(ij) = -jiij = -j(ii)j = -jj = -1

2( ) 1ij 2( ) 1ij !!!!!!

1 ij 1 ij !!!!!!

ij = iij = i !!!!!!

So… (a + bij) is a complex number !!!So… (a + bij) is a complex number !!!

Page 35: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

The Complex ConnectionThe Complex ConnectionThe Complex ConnectionThe Complex Connection

This gives a geometric interpretation to imaginary numbers:This gives a geometric interpretation to imaginary numbers:

Imaginary numbers are bivectors (plane-like vectors).Imaginary numbers are bivectors (plane-like vectors).

The planar product (“2D cross product”) of two vectors.The planar product (“2D cross product”) of two vectors.

The full geometric product of a pair of 2D vectors has a scalar (real) part “ ” and a bivector (imaginary) part “ ”.The full geometric product of a pair of 2D vectors has a scalar (real) part “ ” and a bivector (imaginary) part “ ”.

It’s a complex number! (2 + 3ij is the same as 2 + 3i)It’s a complex number! (2 + 3ij is the same as 2 + 3i)

So, complex numbers can be used to represent a 2D rotation. This is the major reason they appear in real-world physics!So, complex numbers can be used to represent a 2D rotation. This is the major reason they appear in real-world physics!

Page 36: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

2D Reflection2D Reflection2D Reflection2D Reflection

nn

vv

v’ = n(vn) = nvnv’ = n(vn) = nvn

v’v’

vnvn

Page 37: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

Rotation by Double Rotation by Double ReflectionReflection

Rotation by Double Rotation by Double ReflectionReflection

nnmm

vv v’v’

v’’v’’

v’ = nvnv’ = nvn

v’’ = m(v’)m = m(nvn)m = mnvnm = (mn)v(nm)v’’ = m(v’)m = m(nvn)m = mnvnm = (mn)v(nm)

Note: Rotation by double reflection works in any dimension!Note: Rotation by double reflection works in any dimension!

Angle of rotation is equal to twice the angle between n and m.Angle of rotation is equal to twice the angle between n and m.

Page 38: Geometric Algebra Gary Snethen Crystal Dynamics gsnethen@crystald.com.

Rotation by Double Rotation by Double ReflectionReflection

Rotation by Double Rotation by Double ReflectionReflection

nnmm

vv v’v’

v’’v’’

v’ = nvnv’ = nvn

v’’ = m(v’)m = m(nvn)m = mnvnm = (mn)v(nm)v’’ = m(v’)m = m(nvn)m = mnvnm = (mn)v(nm)

The product mn is a quaternion and nm is its conjugate!The product mn is a quaternion and nm is its conjugate!

Angle of rotation is equal to twice the angle between n and m.Angle of rotation is equal to twice the angle between n and m.