
Less Weird Quaternions Using Geometric Algebra - Kristine1975
https://probablydance.com/2017/08/05/intuitive-quaternions/
======
arnioxux
For people trying to understand quaternions, the faster way to intuition is
understanding axis-angle first. I think axis-angle is totally intuitive. First
pick a direction (some 3d unit vector) and then rotate around that direction
by some amount (so some scalar). Then convert those four numbers to
quaternions

    
    
      qx = ax * sin(angle/2)
      qy = ay * sin(angle/2)
      qz = az * sin(angle/2)
      qw = cos(angle/2)
    

where (ax, ay, az) is the unit direction (ax^2 + ay^ + az^2 = 1) and angle is
the amount you want to rotate.

[http://www.euclideanspace.com/maths/geometry/rotations/conve...](http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/)

[http://www.euclideanspace.com/maths/geometry/rotations/conve...](http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/)

------
klodolph
A couple things to add.

For notation, we would often see the basis vectors named (e_1, e_2, e_3)
instead of (x, y, z).

The quaternions are the even-ordered subalgebra of the 3D exterior algebra.
The exterior algebra has scalars (1), vectors (x, y, z), bivectors (xy, yz,
zx), and pseudoscalars (xyz). The even-ordered subalgebra is scalars and
bivectors (1, xy, yz, zx). Adding or multiplying two even-ordered multivectors
will always give you an even-ordered multivector, and 1 is even-ordered, so
the even-ordered multivectors form a subalgebra.

We can also conceive of this subalgebra, the quaternions, as a Clifford
algebra. Clifford algebras are generalizations of exterior algebras. Instead
of saying v * v = 0, we can put something else on the RHS, and for quaternions
we can start with just two basis vectors e_1 and e_2, and then define e_1 *
e_1 = e_2 * e_2 = -1. The third basis vector for quaternions is then just e_1
* e_2.

~~~
logfromblammo
The odd-ordered subalgebra (x, y, z, xyz) is symmetrical to the even-ordered
subalgebra (1, xy, yz, zx), and can also represent quaternions.

~~~
Govindae
That doesn't work, the odd space isn't closed.

xx = 1

~~~
logfromblammo
I don't know what I was thinking....

------
Grustaf
Quaternions are beautiful and natural, not weird, but I'm always happy when
they get some attention! This was a very interesting article, thanks. It does
seem to confuse quaternions in general with (unit) quaternions as used for
rotating vectors. For example:

>So don’t think of quaternions as a 4 dimensional hypersphere of radius 1

This is also a bit weird:

>But nobody would ever suggest that we should think of a rotation matrix as a
9 dimensional hyper-cube with rounded edges of radius 3.

Even weirder when they claim that the axis-angle interpretation of (unit)
quaternions "breaks down".

Anyway, back in high-school when I first became fascinated with quaternions I
certainly didn't expect to be working with them on a daily basis two decades
later. The moral of this is that anything you learn can become crucial to your
career...

------
Govindae
While we all learned in middle school geometric algebra that the even
subalgebra of G3 is isomorphic to the quaternions, what is the relationship
between the even subalgebra of G4 and the octonions?

If you write out a multiplication table, it seems that it's isomorphic. But...
Octonions aren't associtive. Does the even subalgebra of G4 somehow lose
associativity? Is it equivalent to Octonions with a cannonical multiplication
order?

------
marcv81
Quarternions aren't weird. With a 2D angle we use 2 numbers (sin and cos) to
calculate vector rotations. It turns out that in 3D we use 4 numbers.

~~~
klodolph
There's a lot of hand waving in that phrase, "it turns out". Sure, "it turns
out" that 3D uses four numbers. Why?

Geometric algebra explains that in a succinct way that also appeals to our
intuition about geometry. Start by using bivectors to represent reflections,
then take the closure of your bivectors and you get the even-ordered
subalgebra. This will have dimension 2^(N-1)... so 2 for 2D, 4 for 3D, and 8
for 4D.

This, to me, takes the mystery out of _why_ quaternions can represent
rotations, and it places quaternions in a coherent theory of geometry that
works in any number of dimensions, not just 3D. Alternatively, we could accept
that the math just happens to work out that way, or we could even show that
quaternions are a double cover of SO(3), but all that does is analyze why
something works, whereas the geometric algebra version is a bit less of a leap
and builds quaternions from the ground up.

~~~
yequalsx
I think there is a lot of unintentional irony in what you wrote. You start out
saying, "There's a lot of hand waving in that phrase..." and then go on to
write:

"Start by using bivectors to represent reflections, then take the closure of
your bivectors and you get the even-ordered subalgebra."

It reminds me of the running joke we had in graduate school. Any book whose
title starts off with "An Elementary Introduction to..." was going to be very
difficult.

~~~
twic
There's definitely something a bit "just a monoid in the category of
endofunctors" about that description. Which is not to say that it's not both
true and helpful - it's just not very accessible. Perhaps if there was a one-
sentence explanation of what a bivector was, it would be a lot clearer.

~~~
defen
A bivector is a plane spanned by two vectors, with an associated orientation.

~~~
abainbridge
That hasn't helped!

~~~
defen
In a geometric setting - if you have two vectors, you can position them so
that both have one end at the origin. This spans a plane (test it out yourself
in 2D or 3D space with two pencils, put the eraser at the origin for each;
it's a parallelogram). The area of the plane will depend on the length of the
pencils. You can assign an orientation to the plane by imagining a rotor
embedded in the plane that spins either clockwise or counterclockwise.

~~~
abainbridge
Hmmm.

"The area of the plane will depend on the length of the pencils". Surely the
area of the plane is infinite? The area of the _parallelogram_ will depend on
the length of the pencils.

And I can't see how "you can assign an orientation to the plane" other than by
changing the directions of the pencils. Again this description sounds like it
refers to the parallelogram, not the plane.

And I don't know what a rotor is.

But other than that, I'm doing great.

~~~
defen
Yes, when I said plane I really meant the parallelogram. By rotor I literally
just meant "a thing that spins" \- you could draw a circle on the
parallelogram with an embedded arrow describing the direction it is spinning -
that arrow could either be going clockwise or counterclockwise.

------
amai
This helped me a lot to understand quaternions using simple algebra:
[https://math.stackexchange.com/questions/147166/does-my-
defi...](https://math.stackexchange.com/questions/147166/does-my-definition-
of-double-complex-noncommutative-numbers-make-any-sense)

------
tnone
This is great insight, but it seems a bit silly to act like you don't need a
4D / hypersphere representation when the 4th one is hiding in plain sight. For
the not-quaternion to describe a rotation, it needs unit length in 4D, with
the two components scaled as a sine/cosine pair.

------
mwkaufma
Geometric algebra is "easier" to understand than plain-old imaginary numbers?
Pourquoi?

------
catnaroek
> OK so what is this Geometric Algebra? It’s an alternative to linear algebra.

No. Geometric algebra is a use case of linear algebra. How can it be an
alternative?

> Before I tell you how to actually evaluate the wedge product, I first have
> to tell you the properties that it has:

> 1\. It’s anti-commutative: a \wedge b = -b \wedge a

> 2\. The wedge product of a vector with itself is 0: a \wedge a = 0

Redundant information. The latter follows from the former.

~~~
klodolph
It's definitely an _alternative_ in the sense that it gives you an alternative
framework for concepts that are taught under the banner of linear algebra in
school. For example, it gives an alternative construction for quaternions as a
subalgebra, and it gives the exterior product as an alternative to the cross
product.

~~~
auggierose
I'd say alternative is an unlucky choice of words. I'd rather say geometric
algebra (GA) is an extension of linear algebra (LA). In order to really
understand GA you need first to firmly understand LA. Then it becomes clear
that all that GA does is to turn a Hilbert space into an algebra called a
Clifford algebra, and to examine the geometric semantics of the various
operations that pop up in the process.

Here are three great sources that helped me to understand GA:

1\. [https://www.amazon.co.uk/Geometric-Algebra-Computer-
Science-...](https://www.amazon.co.uk/Geometric-Algebra-Computer-Science-
Revised/dp/0123749425)

2\. [https://www.amazon.co.uk/Linear-Geometric-Algebra-Alan-
Macdo...](https://www.amazon.co.uk/Linear-Geometric-Algebra-Alan-
Macdonald/dp/1453854932)

3\. [https://www.amazon.co.uk/Algebra-Graduate-Texts-
Mathematics-...](https://www.amazon.co.uk/Algebra-Graduate-Texts-Mathematics-
Serge/dp/1461265517) , pages 749-752

The first source gives great motivation and intuition for GA and its various
products. Its mostly coordinate free approach is very refreshing and makes the
subject feel exciting and magical. This is also the problem of the book, it's
easy to end up confused and disoriented after working through it for a while.
The second source is great because it grounds GA firmly on LA, and makes
everything very clear and precise. The third source gives a short and concise
definition of what a Clifford algebra is.

~~~
klodolph
My personal recommendation for a book on geometric algebra is the one by
Hestenes, _New Foundations for Classical Mechanics_
([https://www.amazon.com/dp/0792355148/](https://www.amazon.com/dp/0792355148/)).
I was disappointed by _Geometric Algebra for Computer Science_ and I recently
got rid of my copy when I moved to a new apartment, but I have a mathematics
background and tend to prefer denser books.

I would say that "alternative" is a viable word here. Yes, you'll need a
foundation in linear algebra to understand geometric algebra, but our classes
and books on linear algebra go beyond what is necessary for understanding
geometric algebra and introduce concepts (like the cross product) which have
more natural equivalents in geometric algebra. I'm not even convinced that
it's necessary to have a good understanding of matrixes in order to work with
geometric algebra.

~~~
auggierose
I guess we have to agree to disagree. GA is not an alternative to LA, as LA is
the foundation of GA.

The main point of LA is not matrices, but linear operators, dimensionality,
linear independence, bases, etc. Matrices flow naturally from that. If all you
have been taught in LA is to manipulate matrices, then I can see why you feel
about the relationship between LA and GA the way you do.

~~~
klodolph
You're saying things that I agree with 100% which makes me think that there's
something missing from my explanation.

I'm not talking about linear algebra as a field of mathematics in some kind of
ideal sense here. Yes, obviously, it's a foundation for geometric algebra. You
don't need to convince me of that.

However, elementary linear algebra _classes_ don't teach you about linear
operators, they teach you about things like matrixes and cross products. In
these basic classes, a "vector" is a "thing with X, Y, and Z coordinates". So
when you get to physics, you use the cross product to write a formula for
magnetic field. You have to remember that the magnetic field is transformed
differently from other vectors according to some special rules. And engineers
call this stuff "linear algebra". Mathematicians agree that it's linear
algebra, but we know that there's a lot more to linear algebra that goes
beyond that.

Alternatively, they could calculate the magnetic field using geometric
algebra, and express it as a bivector, at which point all of those special
rules vanish.

That's why Hestenes's book is called "New Foundations for Classical
Mechanics". It's not that linear algebra is not the foundation for geometric
algebra. It's that _classes taught in colleges_ which are called "linear
algebra" teach you the concepts used by Gibbs and Wilson in the book _Vector
Analysis,_ and these concepts don't generalize to different numbers of
dimensions. GA does. Maybe the problem here is that we don't have a special
name for that field of study which uses cross products, if had a different
name for that stuff, say "vector analysis" after the book first appeared in,
we wouldn't have a problems saying that "geometric algebra is an alternative
to vector analysis".

GA is a nice alternative to the stuff they teach engineers scientists under
the "linear algebra" banner.

Another example… look at Stokes' Theorem. The version with differential forms
is a nice alternative to the version with just a cross product.

