# A casual intro to Geometric Algebra

*(casual but not informal, prerequisites are trigonometry, vectors, and complex numbers, subject as digested by a non-expert in an unrelated field of science)*

Some background
---------------

### How I got interested in geometric algebra

One evening I stayed after class to speak with my mechanics professor. He showed me a formulation of Maxwell's equations that looked like

$$
\nabla F = J
$$

$$"Wait, what? Aren't there supposed to be four equations?" is a question I should have asked, had I known what a Maxwell was. A year later I had forgotten the exchange, but I happened to come across a [swift introduction to geometric algebra](https://youtu.be/60z_hpEAtD8) on youtube. A comically dramatic flashback ensued and after a brief email correspondence, I ended up with Alan Macdonald's fantastic *Linear and Geometric Algebra*.

### Motivation: representing rotations.

*Hermione's hand shot up wildly from the desk right in front of her professor's.*

*"I know this! In Linearibus Essentia Mathematica by Grant Sanderson, chapter three, minute 3, second 48, he says that the ending coordinates of the basis vectors after a linear transformation uniquely describe the entire transformation! Put the coordinates of rotated basis vectors in a matrix, define the matrix product, and you're all set!"*

*Professor Vector smiled kindly, "That's spot on, Miss Granger. 10 points to Gryffindor! However, it is known that algorithmagically cheaper methods exist."*

*--*

By the end of high school, it had been essentially imprinted upon me that there were two flavours of rotation: rotation matrixes and complex numbers. 

Here's how to rotate the vector \[1, 0\] by 30° anti-clockwise using a matrix.

*   Notice the coordinates of the basis vectors (read vertically) after a rotation by $\theta$degrees must be

$$
\begin{bmatrix} \cos \theta&-\sin \theta\ \sin \theta& \cos \theta\end{bmatrix}
$$

*   Replace $\theta$ by 30° and perform matrix left-multiplication on the vector

$$
\begin{bmatrix} \sqrt3/2&-1/2 \ 1/2&\sqrt3/2 \end{bmatrix} \begin{bmatrix} 1\\0 \end{bmatrix} = \begin{bmatrix} \sqrt3/2\\1/2 \end{bmatrix}
$$

$$And here's the same rotation, now using complex numbers.

*   Throw the vector \[1, 0\] on the complex plane like so: $1 + 0i$
*   Multiply by $e^{i \pi / 6}$ like this :
    *   $$$e^{i \pi / 6}(1 + 0i) = e^{i \pi / 6} = \cos \pi / 6 + i \sin \pi / 6 = \sqrt3 / 2 + i / 2$
*   Hey presto, retrieve the vector $[\sqrt3/2, 1/2]$ from the complex plane

Looking back on these notations, I feel like they do not capture the essence of what it means to rotate a vector. Matrix notation is really more adapted for robots than for humans. The issue is that unless you sit down and draw the resulting positions of the resulting basis vectors, you cannot tell what kind of transformation is being performed by glancing at the matrix. Complex numbers are already more compact, but it's not so obvious what the imaginary unit has to do with rotation in the first place. 

Is there a better way?

Geometric Algebra
-----------------

The promise of geometric algebra is the encapsulation of elementary linear transformations on points, lines, planes, and more into a useful and transparent algebra*.*

What follows is a short introduction to the subject, following a selection of topics in *Linear and Geometric Algebra* by Alan Macdonald. We'll have a look at

1.  Oriented lengths, areas, and volumes in 3D
2.  The outer product and geometric product
3.  Generalizing complex numbers
4.  Doing rotations better

### 1\. Oriented lengths, areas, and volumes in 3D

An *oriented length* $\textbf{v}$, also called a vector, is an arrow. Its length, or *norm*, is some real number $|\textbf{v}|$. If we put two oriented lengths $\textbf{u}$ and $\textbf{v}$ head-to-tail, then we'll get a new oriented length $\textbf{u + v}$. We can also stretch it like this: $2\textbf{v}$, and flip it like this: $-\textbf{v}$

An *oriented area* $\textbf{B}$ is very similar to an oriented length. It's a segment of a plane but we decide that it has fingers and that it's pointing in one of two orientations, drawn as a swirly arrow, $\circlearrowleft$ or $\circlearrowright$. We denote $\textbf{B}$ 's area, which is called norm too, with $|\textbf{B}|$. Just like with oriented lengths, we can add two oriented areas $\textbf{A}$ and $\textbf{B}$ together: $\textbf{A} + \textbf{B}$, and scale them like so: $2\textbf{B}$. 

An *oriented volume* $\textbf{T}$ is a segment of space, or blob, with an orientation  $\circlearrowleft$ or $\circlearrowright$ and volume $|\textbf{T}|$. We can add blobs like $\textbf{T}_1 + \textbf{T}_2$, scale them like $a\textbf{T}$, Surprisingly, oriented volumes do not have a "direction" in 3D space. Even more surprisingly, they do in 4D. Why? *(Hint: does an oriented length have a direction independent from its orientation in 1D space? What about 2D space?)*

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/c855698bd9f181657449dad38011100cf3423b901be78447.png)

Oriented lengths, areas, and volumes 

Importantly, oriented areas and volumes don't have a shape because all we know is their orientation, direction, and norm. Therefore, in a given plane, any square is equal to any circle of the same norm. This point may seem confusing at first, but we can see it as an extension of the definition "a vector is an equivalence class under equipollence of unordered pairs of points". 

### 2\. The outer product and geometric product

Take two vectors $\textbf{u}$ and $\textbf{v}$. Their *outer* product $\textbf{u} \wedge \textbf{v}$ is the oriented area generated if the two vectors formed the sides of a parallelogram in the unique plane containing  $\textbf{u}$ and $\textbf{v}$. Its orientation is the opposite of the orientation of $\textbf{v} \wedge \textbf{u}$. 

There's a deep relationship between the cross $\times$ and outer $\wedge$ products, in that the cross product is the vector orthogonal to the oriented area generated by the outer product.

Let's turn our attention to the shiny new *geometric* product of two vectors $\textbf{u}$ and $\textbf{v}$:

$$
\textbf{u}\textbf{v}= \textbf{u} \cdot \textbf{v} + \textbf{u} \wedge \textbf{v}
$$

We define it as the sum of the inner and outer products of two vectors. Ok, so as an example, let's consider vectors as members of $\mathbb{R}^2$ and see what these three products mean component-wise.

The inner product of two vectors is the familiar dot product which yields a scalar.

$$
\textbf{e}_1 \cdot \textbf{e}_2 =\begin{bmatrix} 1\ 0\ \end{bmatrix} \cdot \begin{bmatrix} 0\ 1\ \end{bmatrix} = 1 \cdot 0 + 0 \cdot 1 = 0
$$

The outer product of two vectors will yield a *bivector* which is just an oriented area. The bivector below is an oriented area of norm 1 in  the plane spanned by the two standard basis vectors.

$$
\textbf{e}_1 \wedge \textbf{e}_2 = \begin{bmatrix} 1\ 0\ \end{bmatrix} \wedge \begin{bmatrix} 0\ 1\ \end{bmatrix}
$$

Finally, the geometric product is the sum of the above. This sum yields a *multivector*, which is like a Halloween candy bag of different dimensional objects.

$$
\textbf{e}_1\textbf{e}_2 = 0 + \begin{bmatrix} 1\ 0\ \end{bmatrix} \wedge \begin{bmatrix} 0\ 1\ \end{bmatrix}
$$

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/52e16ffffce0f88b5eb6007a2f14286ebe8cdaf67008cfc0.png)

Inner, outer and geometric products

Let $\theta$ be the smaller angle between $\textbf{u}$ and $\textbf{v}$, so $\theta \in [-\pi, \pi]$ and let's use the figure above to motivate the actual definitions of the inner and outer products.

The *inner product* of two vectors gives a scalar that is largest when the two vectors are pointing in the same direction ($\theta=0$), zero when they're orthogonal ($\theta=\pi/2$ or $-\pi/2$) to each other, and smallest when they're pointing in opposite directions ($\theta=\pi$). 

$$
\textbf{u} \cdot \textbf{v} = |\textbf{u}||\textbf{v}| \cos \theta
$$

$$The *outer product* of two vectors returns an oriented area, so in some sense, it is proportional to the bivector $\textbf{e}_1 \wedge \textbf{e}_2$. When the two vectors are pointing in the same or opposite directions, the area spanned is zero. When they're orthogonal to each other, the norm is maximal. The orientation is decided by how the area is swept, which is the information we can retrieve from the **sign** of $\theta$. So we have

$$
\textbf{u}\wedge\textbf{v}=|\textbf{u}||\textbf{v}|\sin\theta(\textbf{e}_1 \wedge \textbf{e}_2 )
$$

### 3\. Generalizing complex numbers

The algebraic properties of complex numbers (and much more) are subsumed by geometric algebra. How? Let's look at complex numbers by trying to rebuild the imaginary unit $i$ from the tools that we've discovered so far. We'll need two properties of the geometric product for this. 

First, watch what happens when you swap the terms of a geometric product of two basis vectors.

$$
\textbf{e}_1\textbf{e}_2 = 0 + \begin{bmatrix} 1\ 0\ \end{bmatrix} \wedge \begin{bmatrix} 0\ 1\ \end{bmatrix} =-0-\begin{bmatrix} 0\ 1\ \end{bmatrix} \wedge \begin{bmatrix} 1\ 0\ \end{bmatrix}=-\textbf{e}_2\textbf{e}_1
$$

Second, the geometric product of a basis vector with itself will yield 1.

$$
\textbf{e}_1\textbf{e}_1=\begin{bmatrix} 1\ 0\ \end{bmatrix} \cdot \begin{bmatrix} 1\ 0\ \end{bmatrix}+ \begin{bmatrix} 1\ 0\ \end{bmatrix} \wedge \begin{bmatrix} 1\ 0\ \end{bmatrix}=1+0=1
$$

And now, interpreting exponentiation as repeated geometric products, *this* falls out.

$$
(\textbf{e}_1\textbf{e}_2)^2 = \textbf{e}_1\textbf{e}_2\textbf{e}_1\textbf{e}_2 = -\textbf{e}_1\textbf{e}_1\textbf{e}_2\textbf{e}_2 = -1 = \textbf{i}^2
$$

$$Behold, the unit imaginary (now in **bold**). From this point onwards, anything you'd like to do with complex numbers could be done with real vectors, which is excellent. What's more, the unit imaginary now represents an oriented area which, we'll see, is a direct answer to our original question of what $i$ is doing in rotation.

So in particular, this Euler identity holds :

$$
e^{\textbf{i}\pi}=\cos\pi + \textbf{i}\sin\pi=-1+0\textbf{i}=-1
$$

And it turns out that the geometric product of two vectors even has a polar form

$$
\textbf{u}\textbf{v}=|\textbf{u}||\textbf{v}| \cos\theta + |\textbf{u}||\textbf{v}|\sin\theta(\textbf{e}_1 \wedge \textbf{e}_2 )=|\textbf{u}||\textbf{v}|(\cos\theta+\textbf{i}\sin\theta)=re^{\textbf{i}\theta}
$$

### 4\. Doing rotations better

So you'd like to rotate a vector. The first question to be asked is *around what?*

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/35f878ee0761a787f1cfec327ce6ad5ab8451bc0b6330b6c.png)

The plane versus the axis of rotation

Let's consider the 2D case where some vector $\textbf{u}$ is lying in the plane $\textbf{i} =\textbf{e}_1\textbf{e}_2$ and is being rotated around the origin counter-clockwise $\theta$ degrees to become the vector $\textbf{v}$. What is the axis of rotation? 

Well, it's hard to say! We could argue that $\textbf{u}$ is rotating around some third axis poking through the center of the page, but the problem is that our space is 2-dimensional. To avoid any philosophy, let's just rotate *the plane* instead.

First, write down the polar form of $\textbf{u}\textbf{v}$ and then solve for $\textbf{v}$, knowing that $|\textbf{u}|=|\textbf{v}|$

$$
\begin{align} \textbf{u}\textbf{v}=|\textbf{u}||\textbf{v}|e^{\textbf{i}\theta}&\iff\textbf{u}^2\textbf{v}=\textbf{u}|\textbf{u}||\textbf{v}|e^{\textbf{i}\theta}\ &\iff|\textbf{u}|^2\textbf{v}=|\textbf{u}|^2\textbf{u}e^{\textbf{i}\theta}\&\iff\textbf{v}=\textbf{u}e^{\textbf{i}\theta} \end{align}
$$

$$Nice. Multiplying a vector in the plane $\textbf{i}$ on the right by $e^{\textbf{i}\theta}$ is the action of rotating by $\theta$ degrees, turning $\textbf{u}$ into $\textbf{v}$. You can check that multiplying on the left by $e^{-\textbf{i}\theta}$ does the same thing. So what about doing the same in 3D? What about rotating in some other arbitrary plane? Isn't this what we've all been waiting for?

Absolutely! We'll have to get our hands dirty for a moment, but we'll emerge on the other side with the *most compact known algebraic representation* *of rotations in 3D*. 

First, let's generalize $\textbf{i}\theta$ to be *any* bivector of area $\theta$, and call it an *angle*. Think of it like an oriented slice of pizza with the pointy end stuck at the origin. Here are some concrete examples.

$$
\textbf{e}_3\textbf{e}_130°,\space\textbf{e}_1(\textbf{e}_2+\textbf{e}_3)\pi,\space(\textbf{e}_1-\textbf{e}_2)\pi/4
$$

In a general rotation of a vector $\textbf{u}$ about the origin, the vector may not even live on the plane of rotation. Like olives on a pizza, there's some bit of $\textbf{u}$ that's stuck on the cheese and some bit that has leaped away. Geometrically, $\textbf{u}$ can be written as the sum of its *projection* and *rejection* onto the angle $\textbf{i}$.

$$
\textbf{u}=\textbf{u}_\parallel+\textbf{u}_\perp
$$

We're going to introduce some small changes to the previous rotation identity. First, we'll have to consider the two components of $\textbf{u}$ separately and then, bare with me, split the exponential into two halves. Also, the rejection of $\textbf{u}$ will be left totally unaffected because it's in line with the rotation's axis.

$$
\begin{align}    \textbf{v} &= \textbf{u}_\parallel e^{\textbf{i}\theta}+\textbf{u}_\perp\ &= \textbf{u}_\parallel e^{\textbf{i}\theta/2}e^{\textbf{i}\theta/2}+\textbf{u}_\perp e^{-\textbf{i}\theta/2}e^{\textbf{i}\theta/2} \end{align}
$$

We would like to send one of those halves to the other side of $\textbf{u}$ so that we can recombine $\textbf{u}_\parallel$ and $\textbf{u}_\perp$. Luckily, $\textbf{u}_\parallel$ is in the same plane as $\textbf{i}$ so $\textbf{u}_\parallel e^{\textbf{i}\theta/2}=e^{-\textbf{i}\theta/2}\textbf{u}_\parallel$ 

$$
\begin{align}    \textbf{v} &= e^{-\textbf{i}\theta/2}\textbf{u}_\parallel e^{\textbf{i}\theta/2}+e^{-\textbf{i}\theta/2}\textbf{u}_\perp e^{\textbf{i}\theta/2}\ &=e^{-\textbf{i}\theta/2}\textbf{u} e^{\textbf{i}\theta/2} \end{align}
$$

That's it! Rotation by half-pizza slices on each side of $\textbf{u}$. Here's how to rotate $\textbf{e}_1$ by the angle $\textbf{e}_1\textbf{e}_3 \pi/2$, a quarter-turn in the $\textbf{e}_1\textbf{e}_3$ plane.

$$
\begin{align} \textbf{v}&=e^{-\textbf{e}_1\textbf{e}_3\pi/4}\textbf{e}_1e^{\textbf{e}_1\textbf{e}_3\pi/4}\ &=(\cos\pi/4 +\sin\pi/4(\textbf{e}_3\textbf{e}_1))\textbf{e}_1(\cos\pi/4 +\sin\pi/4(\textbf{e}_1\textbf{e}_3))\ &=(\textbf{e}_1/\sqrt2 +\textbf{e}_3/\sqrt2)(1/\sqrt2 +\textbf{e}_1\textbf{e}_3/\sqrt2)\ &=\textbf{e}_1/2+\textbf{e}_3/2+\textbf{e}_3/2-\textbf{e}_1/2\ &=\textbf{e}_3 \end{align}
$$

Closing thoughts
----------------

1.  Vectors $\textbf{u}$ such that $\textbf{u}^2 \neq 0$ have multiplicative inverses in the geometric algebra over a vector space. Yes, you read that right. Also, I haven't found something that hasn't been made instantly easier using geometric algebra, it's great.
2.  A strong opinion, lightly held, of mine, as a non-physicist, is that physics should always be taught using the most appropriate relevant notation. Therefore, I believe that cross-products in classical mechanics should be disposed of.
3.  David Hestenes' project of Geometric Algebra is a Theory of Instruction, as outlined in his article [Reforming the Mathematical Language of Physics](http://geocalc.clas.asu.edu/html/Overview.html). I intend to read and get familiar with these tools.
4.  I found Alan McDonald's book to be a great read, and I enjoyed the problems, so I recommend it to anyone who's interested in learning geometric algebra as a natural extension of linear algebra.