Maths - Sandwich Product

When we are transforming something we use the 'sandwich' product as follows:

Pout = M Pin M-1

where:

The multiplicative inverse may not exist for all multivectors and can be hard to calculate, for algebras based on 3D (and less) vectors then the multiplicative inverse is equivalent to the reverse (described on this page). Other words M-1 = M† can only be guaranteed in 3D or less.

Pout = M Pin M†

where:

On this page we will look at the algebra (as opposed to the geometric interpretation) of this product in the hope of finding the most efficient way to implement it and to see if it will give us a better intuitive understanding.

The Sandwich Product

One way to look at the product:

M Pin M-1

Is that it is equal to:

Pout * M M-1

Which is just 'Pout' (the result we want) because a quaternion times its inverse is unity (M M-1 = 1).

So by just reversing the order of the multiplication we change Pin into Pout. Now if M and Pin have common factors, for instance if,

M = e12

Pin = e2

then reversing the order will change the sign, so,

Pout = - e2

But for independent terms, for instance if,

M = e12

Pin = e3

then reversing the order will not effect the sign, so,

Pout = e3

In this case 'e3' is the axis of rotation so its not effected by the rotation. For other values of M we can start to see that the component along the axis of rotation will not be effected by the transform but the component in the plane of rotation will be rotated.

Using a single element

If a and b are single elements then the product of the form a b a† will produce either +b or -b, for example,

e12 e3 e21

gives

e3

We can easily calculate this by merging the suffixes together:

e12321

then applying the rules on this page.

If we do this for different elements we can start to see a pattern emerging:

number of terms in a number of terms in b number of common terms sign example
1 1 0 -ve e1 e2 e1 = -e2
1 1 1 +ve e1 e1 e1 = -e1
2 1 0 +ve e12 e3 e21 = e3
2 1 1 -ve e12 e1 e21 = -e1
2 2 0 +ve e12 e34 e21 = e34
2 2 1 -ve e12 e13 e21 = -e13
2 2 2 +ve e12 e12 e21 = e12
3 1 0 -ve e123 e4 e321 = -e4
3 1 1 +ve e123 e1 e321 = e1
3 2 0 +ve e123 e45 e321 = e45
3 2 1 -ve e123 e14 e321 = -e14
3 2 2 +ve e123 e12 e321 = e12
4 1 0 +ve e1234 e5 e4321 = e5
4 1 1 -ve e1234 e1 e4321 = -e1

So we can compress this down to:

number of terms in a number of terms in b number of common terms sign
even even even +ve
even even odd -ve
even odd even +ve
even odd odd -ve
odd even even +ve
odd even odd -ve
odd odd even -ve
odd odd odd +ve

so if:

then the expression for the sign is

(a & b) ^ c

where

Using Multivectors (multiple elements)

Instead of 'a' being a single element it may now be a sum such as ax+ay so the sandwich product will be:

(ax + ay) b (ax† + ay†)

multiplying out all the terms gives:

ax b ax† + ay b ax† + ax b ay† + ay b ay†

So now we have terms which have different leading and trailing terms, so this transform can change b into a different basis. but can it change it to a different grade? If so under what circumstances?

Transforms in Different Dimensions

As we have seen, the results depend on the dimension of the vectors that the algebra is based on. For more details see the appropriate page for each dimension:

 


metadata block
see also:

 

Correspondence about this page

Book Shop - Further reading.

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.

flag flag flag flag flag flag Geometric Algebra for Computer Science: An Object-oriented Approach to Geometry. This book stresses the Geometry in Geometric Algebra, although it is still very mathematically orientated. Programmers using this book will need to have a lot of mathematical knowledge. Its good to have a Geometric Algebra book aimed at computer scientists rather than physicists. There is more information about this book here.

 

Terminology and Notation

Specific to this page here:

 

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2017 Martin John Baker - All rights reserved - privacy policy.