Quaternions From Scratch

Quaternions are central to subjects involving 3D rotations, such as computer vision, graphics, robotics, and physics. Even though quaternions were the original source of the 3D vector operations that most people are familiar with, the dot and cross products, they all too often remain shrouded in mystery. There is a common misconception that understanding these complex algebraic objects requires a special capacity to imagine non-intuitive 4-dimensional spaces, but I am here to tell you that this is not the case!

Quaternion multiplication contains the dot and cross products.

Some aspects of quaternions may seem a bit mysterious:

  • Why do quaternions require 4 variables to rotate a point in 3d?
  • Why do quaternions use only half of the intended rotation angle?
  • How could Hamilton have conceived of quaternions before the standard vector operations were invented?

Hopefully I can help illuminate these questions and more. I'd like to present a story about how quaternions can be motivated and "discovered". We'll start in 0 dimensions and work our way up, looking at operations on points within each level, before coming to focus on rotations in 2D and 3D. At the end we'll look forward toward what's called the Clifford algebras, which further clarify and build on what's presented here.

Although I've attempted to work "from scratch" and make this article as self-contained as possible, my main objectives are to clarify and build intuitions about how and why quaternions work the way they do. If this is your first introduction to the topic, expect to require other materials to be able to follow through the whole thing! This is intended to be a supplement, rather than a replacement. I've tried to emphasize algebraic and geometric perspectives that I've found useful both for my own mathematical intuition building and for working with 3d software tools and libraries, but I hope this article can be enjoyed by anyone interested in quaternions for whatever reason!