2018-02-17

# learning about geometric algebra 2017

in particular for understanding it well enough to use or implement software based on it

a collection of notes that gets extended as i learn (see the date in the top right of this page for the last modification date)

these are the resources that helped me the most:

clifford algebra: a visual introduction

colapinto - articulating space dissertation. particularly for context

dorst, fontijne, mann - geometric algebra for computer science non-free book. explanations and additionally consideration of some software implementation details. its structure does not seem to be bottom-up

gaviewer tutorial excellent application and tutorial text

geometric algebra video series by mathoma

suter - geometric algebra primer introduction to the elements and operations. mentions some important details that are often assumed

wild linear algebra youtube video series by n j wildberger about linear algebra, which includes fundamental knowledge for understanding geometric algebra (what are vectors, etc)

## software

gaviewer for experimentation with calculations and visualisation

libvsr c++ template based implementation, which means algebras for different metrics are pre-compiled and fast but perhaps cant easily be run-time created. some additional usage information may be found in the text "articulating space"

reference implementation from the book "geometric algebra for computer science"

sph-cga experimental implementation in scheme based on this text

versor.js javascript port of libvsr

# dependent concepts

with currently available material, understanding of the following concepts tends to be assumed in definitions and explanations:

abstract algebra, algebra, bilinearity, codirectionality, coefficient, colinearity, commutativity, coordinate free, covector, dual, eigenbasis, eigenvalue, euclidean geometry, field, homogeneous space, ideal number, linear algebra, linear algebra minor, linear dependence, mathematical closure, matrix, matrix determinant, matrix multiplication, metric, metric signature, metric space, orthogonal, orthonormal, parametric equation, parity of a permutation, permutation, projection, real numbers, scalar, subspace, tensor, tensor product, vector algebra, vector basis, vector cross product, vector dot product, vector spaces, vectors

# concepts

```k-vector
versor
pseudoscalar
multivector
bivector
trivector
geometric product
outer product
inner product
meet
join
dual
rotor
motor
spinor```

# operations

## geometric product

### function signature

op :: k-vector k-vector -> scalar k-vector

### perpendicularity and parallelness

perpendicularity and parallelness lead to zeros for either the defining inner product or outer product part

is inner product if parallel. is outer product if perpendicular

gp(a, a): outer product part equals zero

### result

gp(a, b) -> scalar + vector -> multivector

sum between scalar and bivector

the geometric product produces multivectors of mixed grade

### fundamentality

the geometric product is more fundamental than the inner or outer product

inner and outer product can be expressed in terms of the geometric product

the geometric product can be expressed in terms of the inner and outer product

the gp is the fundamental product in geometric algebra, you will not need any other product, since it contains all geometric relationships between its arguments [1]

### other

linear and associative

commutative only in the case of collinear (op(a, b) = 0) or orthogonal (ip(a, b) = 0) vectors

inverse gp: gp division

reflection: gp(mirror, igp(object, mirror))

the gp seems to be very much defined by properties of the traditional cross product and dot product. the one collapses at perpendicularity, the other at parallelity.

### equations

```gp(a, b) = ip(a, b) + op(a, b)
gp(a, b) = ip(b, a) - op(b, a)
ip(a, b) = gp(1/2, gp(a, b) + gp(b, a)) = ip(b, a)
op(a, b) = gp(1/2, gp(a, b) - gp(b, a)) = -op(b, a)
gp(a, b) = -gp(b, a) + gp(2, ip(a, b))
gp(b, a) = gp(a, b) - gp(2, op(a, b))
gp(a, a) = norm(a) ** 2
gp(scalar-x, scalar-y) = scalar-x * scalar-y
gp(a, a) = ip(a, a) = scalar
gp(a, gp(b, c)) = gp(gp(a, b), c)```

orthonormal unit vectors: e1, e2

```gp(e1, e1) = 0 + ip(e1, e1) = 1
gp(e1, e2) = op(e1, e2) + 0```

## outer product

### function signature

op :: k-vector k-vector -> k-vector

### properties

associativity, distributivity/linearity, antisymmetry, scalar operation, commutativity not required

### equations

x, y: scalar

```norm(op(a, b)) = norm(a) * norm(b) * sin(angle(a, b))
op(a, b) = -op(b, a)
op(a, a) = -op(a, a) = 0
op(x, y) = x * y
op(x, a) = op(a, x) = x * a
op(x + y, c) = op(x, c) + op(y, c)
op(a, op(b, c)) = op(op(a, b), c)
op(a, x * b + y * c) = x * op(a, b) + y * op(a, c)```

colinear: op(a, b) = 0

coplanar: op(a, b, c) = 0

#### outer product for 3d vectors

```op(a, b)
= op(a1 * e1 + a2 * e2 + a3 * e3,
b1 * e1 + b2 * e2 + b3 * e3)
= (a1 * b2 - a2 * b1) * op(e1, e2) +
(a2 * b3 - a3 * b2) * op(e2, e3) +
(a3 * b1 - a1 * b3) * op(e3, e1)```

### other

an orthogonal vector with a norm that corresponds to the area of a parallelogram between two vectors

the outer product is not defined to be replaceable by a number except in the zero or scalar case. in many cases it is not further reducible. any possible vector element multiplication or subtraction follows from its properties

the outer product of two 2d vectors is an e1e2 (or e12) bivector that can be represented as an object with only one value, a scale factor. there would be six scale factors for 4d bivectors, three for 3d bivectors. the number of scale factors is determined by the number of irreducible outer products when equation elements are distributed. this corresponds to the grade of blades

grade increasing. k-vector -> (k + 1)-vector

generates a new type op(e1, e2) which cant be further simplified. if we then multiply by another vector, say e3, then this will produce yet a further new type op(e1, e2, e3) and so on

allows the formal specification of subspaces (blades)

null result if and only if the factors are linearly dependent

associated geometric properties: direction, orientation, magnitude

inner product: distance and orthogonality/perpendicularity. outer product: area and parallelism

op(e1, e2) represents the right-angled turn from the direction e1 to e2

similar to the cross product

alternative names: exterior product, wedge product. the name outer product is often used because of the symmetry with inner product and because interior product has another perhaps more commonly used meaning compared to outer product, which also has different meaning in other contexts

## inner product

### function signature

ip :: k-vector k-vector -> (k - 1)-vector/scalar

### equations

```ip(a, b) = norm(a) * norm(b) * cos(angle)
ip(a, b) = sum(a1 * b1, ..., an * bn)
sqrt(ip(a, a)) = norm(a)
ip((0, 1), (1, 0)) = 0
ip((0, 20), (3, 0)) = 0
projection(a, b) = ip(a, b) / norm(b)
angle = arccos(ip(a, b) / ip(norm(a), norm(b)))
norm(a) * norm(b) * (cos(pi/2) = 0) = 0
ip(a, b) = multiply(projection(a, b), norm(b))```

### properties

positivity: ip(a, a) >= 0

symmetry: ip(a, b) = ip(b, a)

linearity, x and y being scalars: ip(a, x * b + y * c) = x * ip(a, b) + y * ip(a, c)

### descriptions

equal to scaling the vector "b" by a factor equal to the length of the orthogonal projection of "a" on "b" (where the right angle is on the "b" side)

two vectors are orthogonal if and only if their inner product is zero

the inner product is the dot product generalised to higher dimensional spaces

in geometric algebra the inner product is not only defined for vectors

grade decreasing. k-vector -> (k - 1)-vector

can be used to calculate lengths/distances and angles between vectors

## dual, pseudoscalar

pseudoscalar: i

### equations

```i = op(e1, ..., edim)
gp(i, i) = -1
dual(a) = gp(a, i)```

in r3

```i = e1e2e3 = op(e1, e2, e3)
gp(e1, e1e2e3) = e2e3
gp(e1, e2) = gp(i, e3)
gp(e2, e3) = gp(i, e1)
gp(e3, e1) = gp(i, e2)
gp(i, i) = e1e2e3e1e2e3 = e1e2e1e2 = -1
gp(i, op(e1, e2)) = gp(i, op(e1, e2, e3, e3)) = gp(i, i, e3) = -e3```

in odd dimensional space: gp(i, a) = gp(a, i)

undual: dedualisation, dual(dual(x)) (perhaps sign issues)

multiplying (gp) by the pseudoscalar collapses all vectors that are non-zero

multiplication (gp) by the pseudoscalar represents a 90 degree turn in all three dimensions. therefore two such 90 degree turns in each of the three dimensions results in a total reversal of direction, which is equivalent to a negation, and thus gp(i, i) = -1

in odd dimension, the pseudoscalar commutes. in even dimension, it anticommutes

## meet, join

calculates intersections of lines, planes, spheres, cylinders, etc

similarities: (meet: intersection) (join: union)

meet(a, b) = ip(dual(a), b)

# structures

## bivectors

magnitude and direction

are not specific in shape

magnitude can be thought of as the area

are equal as long as the area is equal. example: op(a, b) = op(2 * a, b / 2)

## multivector

are combinations of possibly different k-vector types: scalar, bivector, trivector, etc

defined to be the sum of different-grade k-blades, such as the summation of a scalar, a vector, and a 2-vector. a sum of only k-grade components is called a k-vector, or a homogeneous multivector

if a given element is homogeneous of a grade k, then it is a k-vector, but not necessarily a k-blade. such an element is a k-blade when it can be expressed as the wedge product of k vectors

sum of elements of different dimensions

## k-vector

multivector parts can be recovered, not like normal addition

the exact parallelogram of bivectors can often not be recovered

k-vector: a sum of only k-grade components. homogeneous multivector

are k-vectors that can be build using the outer product

blades represent unit lines, unit areas and unit volumes

often defined to be orthonormal, which means all are orthogonal, which means they are perpendicular to each other with no overlap in dimensions

bi-/trivector: k-vector

only one combination of lower-grade basis vectors is relevant per grade even though multiple combinations/orderings are possible in higher dimensions

all "permutations" of dimensions

`2 ** dimensions`

`d! / (d - g)! / g!`

# conformal geometric algebra

uses more dimensions for calculation then projects to lower dimensions. operations are particularly generic

no: null vector at origin

ni: null vector at infinity (a point that is infinitely far away from any other point), closing point at infinity

null vector: vector with norm zero

points are represented by null vectors

inner product is proportional to the squared point distance

## equations

```ip(no, no) = 0
ip(ni, ni) = 0
ip(no, ni) = -1
ip(ni, no) = -1
ip(p, p) = 0
ip(p / ip(-inf, p), q / ip(-inf, q)) = -1/2 square(distance(P, Q))
pt(p) = no, p, 1/2 * p * p * ni)```

# vectors for shapes

multiple vectors can describe shapes. the vectors can be imagined as being chained, with each going into a different dimension

because of associativity, different combinations of sides can describe the same shape

# vector space

any set of objects satisfying the following: scalar multiplication, vector addition and null object defined

a vector space seems to define the size/dimensionality of vectors, the type for values and the possible values

# orthonormal

the direction of the vectors is perpendicular to each other so they point in separate directions like axis

# software implementations

basis blade representation and operations. bitmaps for identifiers, operations like grade, reverse, compare

multivector representation and operations

product calculations: geometric/outer/inner product

use a metric signature

# vector projection/rejection

## description 1

let c and d be vectors with tails at an origin. let e be a vector with its tail at the head of c meeting d at a right angle. e is the rejection. a vector from the tail of d to the head of of e is the projection

## description 2

start with two vectors, introduce a third vector to complete a right triangle. if the first two vectors are not perpendicular, the triangle has two catheti, with the one lying on the second vector being the projection, and the third vector being the rejection

## equations

```projection(a, b) = ip(a, b) / norm(b)
rejection(a, b) = a - projection(a, b)```

# vector base notation

elements are often written as multiples of a unit/basis vector, which can be for example a vector that goes 1 into a distinct direction

base vectors represent directions

`a * e1 + b * e2 + c * e3 == [a * e1, b * e2, c * e3] == [a, b, c]`

e1: (1, 0, 0)

e2: (0, 1, 0)

e3: (0, 0, 1)

## if orthonormal / linearly independent

inner product with themselves is 1

e1 ip e1 = e2 ip e2 = e3 ip e3 = 1

inner product with each other is 0

e1 ip e2 = e2 ip e3 = e3 ip e1 = 0

# metric

a function that associates a scalar to each possible pair of vectors

distance, length, area, angle, orthogonality, orthogonal maps, projections, rotations and other concepts are based on it

norm = metric(vector-a, vector-a)

oblique coordinate system: the bases are not necessarily unit vectors and the inner product of different base vectors may not be 0

## signature

p q r notation: positive negative zero

matrix notation: matrix from all inner product combinations of basis vectors

vector notation: numbers from the diagonal of the inner product matrix. length of the signature usually corresponds to dimensionality

only sign and not the magnitude might matter

# nullspace

set of all vector pairs that evaluate to zero for some function

inner product nullspace: infinite orthogonal plane. where op(a, b) = 0

outer product nullspace: infinite colinear line. where op(a, b) = 0

# drawing

k-vectors can still have scalars for basis vectors (as far as the outer product it is built with are not further reducible), and the scalars/weights are the coordinates

the norm of the coordinate vector appears to be the diameter of circles and spheres or diagonal of squares

## vector norm

calculated using multiplication from elementary arithmetic

`(x ** 2 + y ** 2 + z ** 2) // 2`

# other

much of geometric algebra can be and is described in a coordinate free way, that means without information about how it would be mapped to coordinates

like with complex numbers, a plus sign might be used but the entities are meant to be kept separated, with the plus sign not having the meaning it has in elementary arithmetic

rules like associativity/distributivity/commutativity define how equations can be reformulated, solved or simplified

algebra concerns relations between entities and what the entities are supposed to represent and much less so how the entities or operations themselves can be represented using for example numbers and arithmetic

an algebra can be "generated"

multiplication from elementary arithmetic might be replaced with the geometric product. then letter combinations and exponents use the geometric product instead of the multiplication of elementary arithmetic. for example x ** 2 then means gp(x, x)

knowledge relation: linear-algebra -> geometric-algebra -> conformal-geometric-algebra

anticommutativity: each pairing has an anti-pair

addition of bivectors can be visualised as creating a plane like a hypotenuse between planes (similar to vector addition)

how is it possible to work with infinity (for example outer product with infinity). answer: the outer product does not resolve it, it is used as a constant

# questions

how to draw higher dimensional shapes in lower dimensions. just leave out parts of point vectors?

difference between k-vector, blade and versor

how to calculate angle between vectors

why is no/ni used instead of em/ep

what does the pqr notations, the inner product matrices and metrices really mean. how does the metric influence the products

how to map points from r3 to cga and back

how to use a degenerate/oblique metric

how to create complex shapes like paths and polygons

transformations. rotation, translation, scaling

# unsorted

## equations

```gp(e1, e1) = 1
gp(op(e1, e2), op(e1, e2)) = -1
gp(a, a) = gp(norm(a), norm(a))
gp(a, a) / gp(norm(a), norm(a)) = 1
gp(a / gp(norm(a), norm(a)), a) = 1
inv(a) = a / gp(norm(a), norm(a))
inv(a) = a / gp(norm(a), norm(a)) = a / ip(a, a)
inverse is either shorter or longer
if norm(a) > 1 then inverse is shorter
if norm(a) < 1 then inverse is longer
if norm(a) = 1 then inverse the same
par(a, b) -> gp(a, b) = gp(b, a) -> commutes
perp(a, b) -> gp(a, b) = -gp(b, a) -> anticommutes
gp(a, b) = ip(a, b) + op(a, b)
gp(b, a) = ip(b, a) + op(b, a)
gp(b, a) = ip(a, b) - op(a, b)
gp(a, b) + gp(b, a) = gp(2, ip(a, b))
ip(a, b) = gp(1/2, gp(a, b) + gp(b, a))
gp(a, b) - gp(b, a) = gp(2, op(a, b))
op(a, b) = gp(1/2, gp(a, b) - gp(b, a))
a = par(a) + perp(a)
perp(a) = a - par(a)
gp(a, b) = gp(par(a), b) + gp(perp(a), b)
gp(a, b) = gp(par(a), b) - gp(b, perp(a))
gp(a, b) = gp(par(a), b) - gp(b, a - par(a))
gp(a, b) = gp(par(a), b) - gp(b, a) + gp(b, par(a))
gp(a, b) = gp(par(a), b) - gp(b, a) + gp(par(a), b)
gp(a, b) + gp(b, a) = gp(2, par(a), b)
gp(1/2, gp(a, b) + gp(b, a)) = gp(par(a), b)
ip(a, b) = gp(par(a), b)
gp(ip(a, b), inv(b)) = gp(par(a), b, inv(b))
par(a) = gp(ip(a, b), inv(b))
par(a) = ip(a, b) / ip(b, b) * b
if norm(a) = 1 then inv(a) = a
par(a) = gp(ip(a, b), inv(b))
perp(a) = gp(op(a, b), inv(b))```

### reflection

```a = par(a) + perp(a)
ref(a) = par(a) - perp(a)
b ref(a) = b par(a) - b perp(a)
b ref(a) = par(a) b + perp(a) b
b ref(a) = (par(a) + perp(a)) b
b ref(a) = a b
inv(b) b ref(a) = inv(b) a b
ref(a) = inv(b) a b```

# sources

a: dorst, fontijne, mann - geometric algebra for computer science (2007)

1: [a] section 6.3 p151

tags: start guide textual mathematics math geometric-algebra