# Maths - Clifford Algebra - Arithmetic

This page defines the general concepts of mathematical operations that can be applied to any dimensional multivectors.

The specific rules for multivectors based on a given dimension vector is explained on these pages:

The above pages also contain a calculator for these multivectors.

The multivector is made up of elements of different grades (scalar, vector, bivector, etc.) for example:

 parameter e; scalar e1,e2,e3 vector e1 = e1,e2 = e2 ,e3 = e3 e12,e31,e23 bivector e12 = e1 ^ e2 ,e31 = e3 ^ e1 ,e23 = e2 ^ e3 e123 trivector e123 = e1 ^ e2 ^ e3

Just add each corresponding element independently.

For example if we are adding multivectors a and b, if multivector 'a' contains the element a.e2 and multivector 'b' contains the element b.e2 then the corresponding element in a+b will be:

e2 = a.e2 + b.e2

## Subtracting multi vectors numbers

Just subtract each corresponding element independently.

## Multiplying multi vectors numbers (geometric product)

There are different types of multiplication defined for multivectors. Here we are discussing the geometric product which is the main type of multiplication and is what is meant when we use the '*' symbol.

To multiply two multivectors (a * b) then we multiply each part of a by each part of b, so that we have multiplied every combination of terms.

The main type of multiplication, which is described here, is geometric multiplication.

Each term can be calculated as follows, for example when working out the 5th term in the first multivector a.e12 e1^ e2 multiplied by the 6th term in the second multivector b.e31 e3^ e1 we get the magnitude a.e12*b.e31 and the type e1^ e2 * e3^ e1 which can be calculated as follows:

The type of each term can be calculated by following these rules:

1. Write down the indices of both terms, the indices of the left hand multiplicand followed immediately by the indices of the right hand multiplicand without a space. If either of the terms is negative then put a negative sign in front, if both terms are negative then the composite is positive.
2. We then need to convert this into a valid element for the multivector, to do this we need to remove any duplicate indices and get the indices in the right order for the multivector (the order of indices chosen for a given multivector is not standardised but we must be consistent about it so I have defined what basis I will use here for given multivectors here: 2D, 3D, 4D or 5D). In order to do this we apply the following rules as often as required to get to a valid element.
3. Adjacent duplicate indices can be removed, in other words if two of the same index like '22' are next to each other they are both removed. If the dimention squares to a negative value then the sign of the term is also changed. If the dimention squares to zero then the whole term is set to zero.
4. We can swap adjacent indices, every swap of adjacent numbers inverts the sign. The exception to this is if the adjacent numbers are identical, in this case apply the rule for adjacent duplicate indices above.
5. If we need to swap non-adjacent numbers we can do this by a sequence of adjacent swaps (each one inverting the sign). As a short cut we can also swap any non-adjacent indices, just inverting the sign once, this short cut only works if neither of the two indices being swapped crosses over an index which is the same as itself (because that would be equivalent to swapping adjacent duplicate indices which is not allowed). In this case restrict yourself to adjacent swaps until the duplicate is removed.
6. If there are no numbers left the result is e (or -e if negative).

The pages listed at the top, containing arithmetic of multivectors based on various dimensional vectors, contain complete tables containing the result of multiplying every permutation of elements so you don't have to learn the above rules unless you are interested.

### Other Methods for multiplication

```Eddington Basis for aMonad
E Number 1 : 0, 0, 0, *0
E Number 2 : 0, 0, 1, *1
E Number 3 : 0, 0, 2, *2
E Number 4 : 0, 0, 3, *3
E Number 5 : 0, 1, 2, *6
E Number 6 : 0, 1, 3, *7
E Number 7 : 0, 2, 3, *11
E Number 8 : 1, 2, 3, *27

E Number 1 : 1, 2, 3, 4, 5, 6, 7, 8, *0
E Number 2 : 2, 1, 5, 6, 3, 4, 8, 7, *1
E Number 3 : 3, -5, 1, 7, -2, -8, 4, -6, *2
E Number 4 : 4, -6, -7, 1, 8, -2, -3, 5, *3
E Number 5 : 5, -3, 2, 8, -1, -7, 6, -4, *6
E Number 6 : 6, -4, -8, 2, 7, -1, -5, 3, *7
E Number 7 : 7, 8, -4, 3, -6, 5, -1, -2, *11
E Number 8 : 8, 7, -6, 5, -4, 3, -2, -1, *27

E Number 1 : 1, 2, 3, 4, 5, 6, 7, 8, *0
E Number 2 : 2, -1, 5, 6, -3, -4, 8, -7, *1
E Number 3 : 3, -5, -1, 7, 2, -8, -4, 6, *2
E Number 4 : 4, -6, -7, -1, 8, 2, 3, -5, *3
E Number 5 : 5, 3, -2, 8, -1, 7, -6, -4, *6
E Number 6 : 6, 4, -8, -2, -7, -1, 5, 3, *7
E Number 7 : 7, 8, 4, -3, 6, -5, -1, -2, *11
E Number 8 : 8, -7, 6, -5, -4, 3, -2, 1, *27
```

As with matrix and quaternion multiplication the order of the multiplicands is important (multiplication on mutivectors is not commutative). As you can see from the first table some of the terms are symmetric (a*b = b*a) and some are anti-symmetric (a*b = - b*a) so overall the multiplication operation is not symmetrical.

## Division

We dont tend to use the notation for division, since multivector multiplication is not commutative we need to be able to distinguish between [a][b]-1 and [b]-1[a]. So instead of a divide operation we tend to multiply by the inverse.

So the problem is, how to calculate the inverse of a multivector, this is discussed here.

## Inner and Outer Product

In addition to the geometric product there are two more types of multiplication used in Geometric Algebra. These are analogous to, extend and generalise the 'dot' and 'cross' products used in 3D vector algebra.

The inner and outer terms in the product table are the same as the geometric product terms except that some terms are set to zero according to the following rules:

outer product term inner product term
or equivalently:
terms are zero if
= 0 if operands have 1 or more common bases. = 0 if all second operands bases are not also in first operand bases.
examples: e1^ e1= 0
e1^ e2=e12
e1• e1= 1
e1• e2=0

Alternatively the outer product can be calculated the following rules:

• When two independent base vectors are outer multiplied, for instance e1^ e2, we cant further simplify the result so we just leave the result as: e1^ e2.
• When two parallel base vectors are outer multiplied, for instance e1^ e1 the result is zero, so if the same base occurs 2 or more times in any term then the whole term is zero.

We can see that these two methods of calculating the outer product are equivalent because they both specify that if a term appears in both operands the result will be zero (if a term appears in both operands then in the geometric product the term will cancel out and so the grade will be less than the total of the separate grades).

In some cases there is a duality between the inner and outer product in that when one is zero the other is not zero and visa versa. When this happens we can see that:

a*b = a•b + a^b

However, this is not always the case, if the second operand contains some bases which are in the first operand and some which are not then both the inner and outer products will be zero and a•b + a^b = 0 and not a*b.

So the inner and outer products are not as symmetrical as we would like.

#### Special Cases

If a, b or both are vectors then a*b = a•b + a^b.

This means that outer multiplication by a vector always increases the grade by 1 and inner multiplication by a vector always decreases the grade by 1: So, in the special case of vectors:

• The inner product is equivalent to the dot product.
• The outer product is equivalent to the cross product.

The following identities relate the inner, outer and geometric products of vectors (grade one multivector) :

 a•b = ½ (ab + ba) This is symmetrical (a•b = b•a) a^b = ½ (ab - ba) This is anti-symmetrical (a^b = - b^a) a * b = a•b + a^b

Where:

• a and b are vectors
• Kk a multivector of grade k

We can extend this to the multipication of a vector by a general multivector as follows:

a•K = ½ (aK + (-1)k+1Ka)

a^K = ½ (aK + (-1)k Ka)

a*K = a•K + a^K

Where k is the grade of K. The (-1)k factor alternates the sign as follows:

 grade k (-1)k (-1)k+1 a•K = ½ (aK + (-1)k+1Ka) a^K = ½ (aK + (-1)k Ka) 0 (scalar) 1 -1 a•K = ½ (aK - Ka) = 0 a^K = ½ (aK + Ka) = aK 1 (vector) -1 1 a•K = ½ (aK + Ka) = aK a^K = ½ (aK - Ka) = 0 2 (bivector) 1 -1 a•K = ½ (aK - Ka) = 0 a^K = ½ (aK + Ka) = aK 3 (trivector) -1 1 a•K = ½ (aK + Ka) = aK a^K = ½ (aK - Ka) = 0

However we have not yet created a general expression for any grade of multivector, for instance a bivector times a bivector, which does not follow the above pattern.

A<2> ^ B<2> = 0

Can anyone help with a more general expression.

#### Other identities for •

(a^b)•(c^d) = a•(b•(c^d))= b•(c^d)•a

from Hestenes (New Foundations of Classical Mechanics) pp47 exercise 2.1

The inner product is not associative: a•(b•c) may not equal (a•b)•c

## Outer product

We want the outer product to be an extension of the vector cross product:

x = Ay * Bz - By * Az
y = Az * Bx - Bz * Ax
z = Ax * By - Bx * Ay

This gives a bivector which is mutually perpendicular to the vectors being multiplied. But how do we extend this so that we can multiply non-vectors? There are different definitions for the outer product so we need to be careful, if you use other websites or books you may find that they use different definitions.

This has the following nice properties:

• It is a superset of the vector cross product.
• ^ product with a vector increases the grade by one.
• It is associative.
• It is linear - multiplication by a scalar does not change the grade.

if gradeof(row)+gradeof(column) != gradeof(entry) then the entry is set to zero otherwise the entry is the same as the geometric product

## Inner product.

We want the outer product to be an extension of the vector dot product:

A • B = Ax * Bx + Ay * By + Az * Bz

if gradeof(row)-gradeof(column) != gradeof(entry) then the entry is set to zero otherwise the entry is the same as the geometric product

This gives a scalar which depends on the angle between the vectors being multiplied, it is zero if the vectors are perpendicular and zero if the vectors are parallel. But how do we extend this so that we can multiply non-vectors? There are different definitions for the inner product so we need to be careful, if you use other websites or books you may find that they use different definitions. Here we will use the 'semi-commutative inner product'

This has the following nice properties:

• It is a superset of the vector dot product.
• • product with a vector decreases the grade by one.
• It is not associative.

By starting with the vector cross product terms we can derive the remaining terms in the table as follows:

As with vector cross product vectors anticommute, we can also derive this because the vectors will cancel out when a general vector is squared: (a e1 + b e2+ c e3)2 =a2 + b2+ c2

The result of inner multiplying a vector base by a bivector base depends on weather they contain a common base,

if they do, make the bases adjacent then the common base cancels out: e1 • e12 =e2

if they don't the result is zero: e1•(e2^e3)=0

Same thing for inner multiplying by a tri-vector.

When multiplying two bivectors, if the bivectors have the same bases then we need to reverse one of them to get adjacent terms together, then we can cancel out terms, so we always get -e.

If the bivectors are different the result will always be zero.

When multiplying a bivector by a trivector we reverse as necesarily to cancel out two of the terms to leave a vector.

The inner product is similar to the vector dot product, for the vector part of the multivector the type is given by the following table:

 • b.e1 b.e2 b.e3 a.e1 e 0 0 a.e2 0 e 0 a.e3 0 0 e

This is symmetrical (a•b = b•a)

So the inner product produces a scalar as follows:

 e = + a.e1 * b.e1 + a.e2 * b.e2 + a.e3 * b.e3

This can be defined from the geometric product as follows:

a•b = ½ (ab + ba)

The outer product is similar to the vector cross product except that it produces a bivector as output, for the vector part of the multivector the type is given by the following table:

 ^ a.e1 a.e2 a.e3 b.e1 0 e12 -e31 b.e2 -e12 0 e23 b.e3 e31 -e23 0

This is anti-symetrical (a^b = - b^a)

So the outer product produces a bivector as follows:

 e12 = a.e2 * b.e1 - a.e1 * b.e2 e31 = a.e1 * b.e3 - a.e3 * b.e1 e23 = a.e3 * b.e2 - a.e2 * b.e3

This can be defined from the geometric product as follows:

a^b = ½ (ab - ba)

So for vectors the inner product reduces the grade from 1 to 0, in other words from vectors to scalars. The outer product increases the grade from 1 to 2, in other words from vectors to bivectors.

The geometric product is given by adding the inner and outer products:

a * b = a•b + a^b

## Axiom Program

There are a number of open source programs that can support Clifford algebra. I have used Axiom, how to install Axiom here.

As an example the following shows how to generate exterior product using Clifford algebra.

I have put user input in red:

 `(1) -> K := Fraction Polynomial Integer` ``` (1) Fraction Polynomial Integer Type: Domain``` ```(2) -> m := matrix[[0,0,0],[0,0,0],[0,0,0]] +0 0 0+ | | (2) |0 0 0| | | +0 0 0+ Type: Matrix Integer``` ``` (3) -> Ext := CliffordAlgebra(3, K, quadraticForm m)``` ``` (3) CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX) Type: Domain (4) -> i: Ext := e(1) (4) e 1 Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX) (5) -> j: Ext := e(2) (5) e 2 Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX) (6) -> k: Ext := e(3)``` ``` (5) e 3 Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)``` `(7) -> x:= x1*i + x2*j + x3*k` ``` (7) x1 e + x2 e + x3 e 1 2 3 Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)``` ```(8) -> y:= y1*i + y2*j + y3*k (8) y1 e + y2 e + y3 e 1 2 3 Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)``` `(9) -> x + y` ` (9) (y1 + x1)e + (y2 + x2)e + (y3 + x3)e 1 2 3Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)` ```(10) -> x * y (10) (x1 y2 - x2 y1)e e + (x1 y3 - x3 y1)e e + (x2 y3 - x3 y2)e e 1 2 1 3 2 3 Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)```

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.      Clifford Algebra to Geometric Calculus: A Unified Language for Mathematics and Physics (Fundamental Theories of Physics). This book is intended for mathematicians and physicists rather than programmers, it is very theoretical. It covers the algebra and calculus of multivectors of any dimension and is not specific to 3D modelling.      New Foundations for Classical Mechanics (Fundamental Theories of Physics). This is very good on the geometric interpretation of this algebra. It has lots of insights into the mechanics of solid bodies. I still cant work out if the position, velocity, etc. of solid bodies can be represented by a 3D multivector or if 4 or 5D multivectors are required to represent translation and rotation.