Skip to main content

From Pythagoras to the imaginary!

$i$ demystifying 

Cover image generated with Bing's AI


My son Mats has just learned about the complex numbers in high school! 

I was myself 
flabbergasted when I encountered the imaginary number back in 1985. How could you possibly come up with a kind of number called $i$ that squares to minus one, so $i^2=-1$? 

At SIGGRAPH 2001 - a conference for professional computed graphics - I learned about Geometric Algebra.

This is an amazing forgotten framework from the 19th century, that is recently gaining in popularity again, because from a mathematical point of view, it is sheer beauty.  

It unifies so many seemingly different topics (vectors, points, lines, planes, volumes, circles, spheres, complex numbers, quaternions, dual quaternions, determinants, intersections, homogenous coordinates, space-time algebra, spinors, tensors, ...) in one coherent system

NVIDIA at SIGGRAPH 2022, showing virtual Jensen, my CEO


With this, we can actually construct the imaginary number, just by using Pythagoras' theorem (and some obvious axioms)! Maybe the amazing Greek could have invented this himself?

Pythagoras



The derivation is so simple that any undergraduate math student should be able to grasp it.

When I was lecturing applied math & physics at the video game university Digital Arts & Entertainment, I remember one student becoming very emotional after I showed this. Something I will remember forever!




Constructing $i$

Let's first introduce the preliminary knowledge that kids should already have seen at school, at least in Belgium for students age 16.

To make things simple, let's start with a 2D real coordinate space,
 $ \mathbb{R}^2 $

The elements in this space are called vectors, often written like $\vec{v}$

Every vector can be represented as a pair of coordinates $(x,y)$, where $x$ and $y$ are real numbers, so $x \in \mathbb{R}$ and $y \in \mathbb{R}$.


Coordinates are not required to construct $i$, but it's what kids learn at school.

Many students will have seen this as 2D column or row matrices; that's just another name for these things.

Operations on vectors

We can add vectors together.

If $\vec{v_1}=(x_1,y_1)$ and $\vec{v_2}=(x_2,y_2)$ then
$\vec{v_1}+\vec{v_2} = (x_1+x_2,y_1+y_2)$We can multiply a vector by some real factor.

If $\vec{v}=(x,y)$ and $\lambda \in \mathbb{R}$ then
$\vec{v} \lambda = \lambda \vec{v} = (\lambda x,\lambda y)$


Let's also add the ability to measure the length of a vector.

If $\vec{v}=(x,y)$ then
$|{\vec{v}}| = \sqrt{x^2 + y^2}$


Click here to play


This is called the Euclidean norm, named after Euclid, another great Greek fellow. His books were a standard reference for thousands of years, even in the 19th century!


Euclid's elements


That's what all math students learn, so far so good.

Where's the product on the vectors?

Students then typically learn the inner product (aka scalar or dot product) between vectors, and in 3D the cross product. We also learn that you can't divide vectors.

But let's think out of the box, and try to define a product on vectors that 
works mostly like the wonderful product on numbers

This product is called the geometric product, and was discovered in the 19th century, but forgotten due to several unfortunate circumstances.

Hermann Graßmann
Grassmann made the foundations

William Kingdon Clifford
Clifford refined it, but died very young

Axioms

For every vector $\vec{u}, \vec{v}, \vec{w} \in \mathbb{R}^2$, and $\lambda \in \mathbb{R}$, we want this product to have the following axioms:

Associative (axiom A)

$(\vec{u} \:\vec{v})\vec{w} = \vec{u} (\vec{v} \:\vec{w}) = \vec{u}\: \vec{v}\: \vec{w}$
 

Distributive (axiom D)

$(\vec{u} + \vec{v})\vec{w} = \vec{u}\: \vec{w} +\vec{v}\:  \vec{w}$
$\vec{w} (\vec{u} + \vec{v}) = \vec{w}\: \vec{u} +\vec{w}\:  \vec{v}$


Contraction (axiom C)

$\vec{v}^2 = |\vec{v}|^2$


Scaling (axiom S)

$\lambda\vec{v} = \vec{v}\lambda$


Note that we don't have commutativity, that won't work out.
 

Properties

These axioms are mostly the same as those for the product on numbers, nothing special here.

Let's now explore some properties of this product.


First of all, every vector $\vec{v}$ now has an inverse:

$\vec{v}^{-1} = \frac{\vec{v}}{\vec{v}^2}$

You can easily verify that 

$\vec{v} \: \frac{\vec{v}}{\vec{v}^{-1}} = \frac{\vec{v}}{\vec{v}^{-1}} \: \vec{v} = \frac{\vec{v}^2}{\vec{v}^2} = 1$


Next, take two orthogonal unit vectors, i.e. vectors with length $1$ that form a right angle:

$\hat{a}=(1,0)$ and $\hat{b}=(0,1)$.

The hat is used instead of an arrow to indicate the length is $1$.

So $|\hat{a}|=|\hat{b}|=1$

From axiom C, we can conclude that:

$\hat{a}^2=\hat{b}^2=1$


Let's now define $\vec{c}=\hat{a}+\hat{b}=(1,1)$.

Since the vectors are orthogonal, this means that Pythagoras theorem must be true, so

$|\vec{c}|^2=|\hat{a}|^2+|\hat{b}|^2=1+1=2$

Again using axiom C, we can also write that as

$\vec{c}^2=\hat{a}^2+\hat{b}^2=2$


But using axiom D, we can expand $\vec{c}^2$ as

$\vec{c}^2=$
$(\hat{a}+\hat{b})^2=$
$(\hat{a}+\hat{b})(\hat{a}+\hat{b})=$
$\hat{a}^2+\hat{a}\hat{b}+\hat{b}\hat{a}+\hat{b}^2=$
$1+\hat{a}\hat{b}+\hat{b}\hat{a}+1=$
$2+\hat{a}\hat{b}+\hat{b}\hat{a}$


So combining

$\vec{c}^2=2$

and

$\vec{c}^2=2+\hat{a}\hat{b}+\hat{b}\hat{a}$

gives:

$2=2+\hat{a}\hat{b}+\hat{b}\hat{a} $
$\iff $
$0=\hat{a}\hat{b}+\hat{b}\hat{a} $
$\iff $
$\hat{a}\hat{b} = - \hat{b}\hat{a} $

For orthogonal unit vectors atl least, it seems the product is anti-commutative.

Or, you might conclude that $\hat{a}\hat{b} = \hat{b}\hat{a} = 0$. This reasoning would lead to the inner product, but that's not associative, so violates our axiom A.

So what kind of geometric entity is this product? We don't know, but we can apply the axioms again to explore it's properties.

For example, let's square $\hat{a}\hat{b}$. Using axiom A and S and the anti-commutative property we derived above, we get

$(\hat{a}\hat{b})^2= $
$(\hat{a}\hat{b})(\hat{a}\hat{b})= $
$(-\hat{b}\hat{a})(\hat{a}\hat{b})= $
$-\hat{b}(\hat{a}\hat{a})\hat{b}= $
$-\hat{b}(1)\hat{b}= $
$-\hat{b}\hat{b}= $
$-1$

So here you have it:

$i^2=-1$

with $i=\hat{a}\hat{b}$

The imaginary number requires no imagination, just 4 axioms for a product and Pythagoras!


Wouldn’t it be fantastic if a similar derivation would be included in every undergraduate math textbook?

What's next?

We could now continue exploring the many beautiful properties of this product, but then this blog post would become a book. 

We already have great resources for learning geometric algebra, like bivector.net

One last thing we want to show, is that the geometric product of any two orthogonal unit vectors in the 2D plane will result in the same imaginary number.


Take two vectors

$\vec{v_1}=(x_1,y_1)$
$\vec{v_2}=(x_2,y_2)$

We can write these as a linear combination of our orthogonal unit vectors:

$\vec{v_1}=x_1 \hat{a} + y_1 \hat{b}$
$\vec{v_2}=x_2 \hat{a} + y_2 \hat{b}$

Let’s calculate the geometric product:

$\vec{v_1}\vec{v_2}=$

$(x_1 \hat{a} + y_1 \hat{b})(x_2 \hat{a} + y_2 \hat{b})=$

$x_1 x_2\hat{a}^2+ x_1 y_2 \hat{a} \hat{b} + y_1 x_2 \hat{b} \hat{a} + y_1 y_2 \hat{b}^2$

We already know that $\hat{a}^2=\hat{b}^2=1$ and $\hat{a}\hat{b}=-\hat{b}\hat{a}$, so

$x_1 x_2\hat{a}^2+ x_1 y_2 \hat{a} \hat{b} + y_1 x_2 \hat{b} \hat{a} + y_1 y_2 \hat{b}^2=$

$x_1 x_2 + x_1 y_2 \hat{a} \hat{b} - y_1 x_2 \hat{a} \hat{b} + y_1 y_2=$

$(x_1 x_2 + y_1 y_2 ) + (x_1 y_2  - y_1 x_2 )\hat{a} \hat{b}=$

$(x_1 x_2 + y_1 y_2 ) + i \: (x_1 y_2  - y_1 x_2 )$

The first term

$x_1 x_2 + y_1 y_2 $ 

is the well known inner product, often written as 

$\vec{v_1} \cdot \vec{v_2}$

We know this is equal to 

$|\vec{v_1}||\vec{v_2}|\cos\theta$

with $\theta$ the angle between the vectors

The second term 

$i \:(x_1 y_2  - y_1 x_2$)

is the signed area of the parallelogram spanned by the two vectors multiplied by $i$, and is equal to

$i \: |\vec{v_1}||\vec{v_2}|\sin\theta$

This is also equal to $i$ times the determinant of the two vectors:

$i\:\begin{vmatrix}x_1&y_1\\x_2&y_2\end{vmatrix}$

We don”t have a name for this in classical algebra, but in geometric algebra this is called the outer product (aka wedge or exterior product), and it is written as

$\vec{v_1} \wedge \vec{v_2}$

$\vec{v_1} \wedge \vec{v_2}$ is called a bi-vector.


If you interpret a vector as an oriented line segment, then a bi-vector can be seen as an oriented plane segment

Wikipedia


With these, we can now write the geometric product simply as

$\vec{v_1} \: \vec{v_2} = \vec{v_1} \cdot \vec{v_2} + \vec{v_1} \wedge \vec{v_2}=|\vec{v_1}||\vec{v_2}|(\cos\theta + i\:\sin\theta)$

If we now pick any two orthogonal unit vectors for $\hat{v_1}$ and $\hat{v_2}$, we get 

$|\hat{v_1}|=1$
$|\hat{v_2}|=1$
$\theta=\frac{\pi}{2}$
$\cos\theta = 0$
$\sin\theta=1$

Using these, our product simplifies to

$\hat{v_1}\:\hat{v_2}= 0 + i\:1 =i $

This means that the geometric product between any two orthogonal unit vectors results in $i$

There is only one $i$ per 2D plane, but in Euclidean 3D space, we have an infinite  amount of imaginary numbers. We will usually pick 3 of them, corresponding to 3 basis unit bi-vectors, for the XY, YZ, and ZX planes. The quaternions just roll out if you continue down that road. 

Btw quaternions are just double reflections; they are easy, no magical 4D unit sphere required!

If you want projective geometry, then the Project Geometric Algebra (PGA) gives you a very powerful toolbox, unifying rotation and translation, just using reflections, easy equations for intersections, and much more.

If you want to unify spheres with planes, then the Conformal geometric algebra (CGA) is the way to go.

Oh, and it simplifies almost all equations in physics. Here are the famous Maxwell equations for electromagnetic fields. Well, in Geometric Algebra, it really simplifies to a single equation!

Maxwell’s equations expressed with Geometric Algebra.

Disclaimer

I'm a senior software engineer at NVIDIA corporation, but this blog is purely personal, and does not necessarily reflect the opinions of my employer.




Comments