# Maths - Clifford Algebra - 2D Arithmetic

The arithmetic on this page assumes the operands are a general case of a 2D multivector:

a.e + a.e1 e1 + a.e2 e2 + a.e12 e1^ e2

and a second multivector:

b.e + b.e1 e1 + b.e2 e2 + b.e12 e1^ e2

The following calculator allows you to calculate multivector arithmetic. Enter the values into the top two multivectors and then press "+ - or * " to display the result in the bottom multivector:

Just add each component independently as follows:

e = a.e + b.e
ex = a.ex + b.ex
ey = a.ey + b.ey
exy = a.exy + b.exy

When adding blades of different grade then we cant reduce it further and we leave the + in the number.

For example:

3 + 4 e1 + 5 e12

5 + 4 e2 + 3 e12

gives

8 + 4 e1 + 4 e2 + 8 e12

## Subtracting multi vectors numbers

Just subtract each component independently as follows:

e = a.e - b.e
ex = a.ex - b.ex
ey = a.ey - b.ey
exy = a.exy - b.exy

## Multiplying 2D multivectors numbers (geometric product)

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

So if we have a general case of a 2D multivector:

a.e + a.e1 e1 + a.e2 e2 + a.e12 e1^ e2

and a second multivector:

b.e + b.e1 e1 + b.e2 e2 + b.e12 e1^ e2

Since * is distributive over + we can multiply out the terms:

(a.e + a.e1 e1 + a.e2 e2 + a.e12 e1^ e2) * (b.e + b.e1 e1 + b.e2 e2 + b.e12 e1^ e2)

this gives the result:

 e = a.e * b.e + a.e1 * b.e1 + a.e2 * b.e2 - a.e12 * b.e12 e1 = a.e1 * b.e + a.e * b.e1 - a.e12 * b.e2 + a.e2 * b.e12 e2 = a.e2 * b.e + a.e12 * b.e1 + a.e * b.e2 - a.e1 * b.e12 e12 = a.e12 * b.e + a.e2 * b.e1 - a.e1 * b.e2 + a.e * b.e12

### Derivation

Each term can be calculated as follows, for example when working out the 2nd term in the first multivector a.e1 e1multiplied by the 3rd term in the second multivector b.e2 e2we get the magnitude a.e1*b.e2 and the type e1^ e2which 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. If this contains any duplicate numbers, then swap any two numbers to make the duplicate numbers adjacent, every swap inverts the sign.
3. Adjacent duplicate numbers can then be removed, repeat step 2 until all duplicate terms are removed.
4. If the remaining numbers are not in the same order as the base values then swap any two numbers, as before every swap inverts the sign.
5. If there are no numbers left the result is e (or -e if negative).

As an example, using 2D vectors, we can use the above rules to calculate a table showing all possible combinations:

In order to make sure we work out all possible combinations of products, I suggest using a table. The entries in the table only shows the type and sign change of the product, it does not show its absolute value. We therefore need to prefix the product by its numerical value which is the real number which is the product of the numbers at the top and left headings.

So we can start by entering the above results in the table, the value to the left of the * is represented by the columns and the value to the right of the * is represented by the rows. So when calculating a^b the column headings are denoted by a.?? and the rows are denoted by b.??

 a*b b.e b.e1 b.e2 b.e12 a.e 1 e1 e2 e12 a.e1 e1 e11 = 1 [rule 5] e12 e112 = e2 [rule 3] a.e2 e2 a21 = -e12 [rule 4] e22 = 1 [rule 5] e212 = -e221 [rule 2] = -e1 [rule 3] a.e12 e12 e121 = -e112 [rule 2] = -e2 [rule 3] e122 = e1 [rule 3] e1212 = -e1122 [rule 2] = -1 [rule 5]

So the finished table is:

 a*b b.e b.e1 b.e2 b.e12 a.e 1 e1 e2 e12 a.e1 e1 1 e12 e2 a.e2 e2 -e12 1 -e1 a.e12 e12 -e2 e1 -1

In the above table we can see that some entries are commutative and some are anti-commutative, that is, if we swap rows and columns (or reflect in leading diagonal) some values remain the same and the others have their sign changed. We can also see that (A * B)† = B†* A† because if we rotate the whole table by 90 degrees then the entry will become its reversal.

I guess what we really need to know is that, given a multivector with numerical values: a.e, a.e1, a.e2 and a.e12 multiplied by a second multivector with numerical values: b.e, b.e1, b.e2, and b.e12 then what are the resulting numerical values. Multiplying out each term gives the following result:

 e = a.e * b.e + a.e1 * b.e1 + a.e2 * b.e2 - a.e12 * b.e12 e1 = a.e1 * b.e + a.e * b.e1 - a.e12 * b.e2 + a.e2 * b.e12 e2 = a.e2 * b.e + a.e12 * b.e1 + a.e * b.e2 - a.e1 * b.e12 e12 = a.e12 * b.e + a.e2 * b.e1 - a.e1 * b.e2 + a.e * b.e12

### alternative method

Some programs implement multiplication by using Eddington Basis

## Inner and Outer products In addition to the geometric product there are two more types of multiplication used in Geometric Algebra. These extend and generalise the 'dot' and 'cross' products used in 3D vector algebra to algebras of different grades in this case 2D.

Inner product by a vector reduces the grade of a multivector. It is related to the dot product.

Outer product by a vector increases the grade of a multivector. It is related to the cross product.

## 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 to other dimensions and 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. Here is the full 2D Outer multiplication table:

 a^b b.e b.e1 b.e2 b.e12 a.e e e1 e2 e12 a.e1 e1 0 e12 0 a.e2 e2 -e12 0 0 a.e12 e12 0 0 0

This is explained here.

## Inner product.

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

A • B = Ax * Bx + Ay * By

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' which has the following 2D Inner multiplication table:

 a•b b.e b.e1 b.e2 b.e12 a.e 0 0 0 0 a.e1 0 e 0 e2 a.e2 0 0 e -e1 a.e12 0 -e2 e1 -e

This is explained here.

## Division

We don't 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.

## Multivector Calculator

 scalar e vector e1 e2 bivector e12
 scalar e vector e1 e2 bivector e12
=
 scalar e vector e1 e2 bivector e12

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.