Quaternions appear in domains that involve 3d rotations, such as computer vision, graphics, robotics, physics, and others. Even though quaternions were the original source of the 3d vector operations that are generally taught first, the dot and cross products, they unfortunately remain an enigma to many. 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!

Some aspects of the common story may seem a bit fishy:
- Why do quaternions have 4 variables when we can picture something rotating in 3d space just fine?
- Why do rotation quaternions, "versors", use half the rotation angle?
- Supposing vector and matrix operations are better, why do we still use quaternions in actual practice?
- If there are no good intuitions for how they work, how could Hamilton have conceived of them while out on a walk, before the standard vector operations?
Hopefully I can help illuminate these questions and more. I'd like to present a mathematical story about a way that quaternions could have been motivated and discovered. We'll start in 0 dimensions and work our way up. At each level we'll look at points within the space and operations on them, before coming to focus on rotations and then 3d rotations in particular. At the end we'll look forward toward what's called the Clifford or geometric algebra, which further builds on the geometric ideas presented here.
Although I've attempted to make this article as self-contained as possible and to build quaternions "from scratch", my main objectives are to clarify why quaternions work the way they do and to build deeper intuitions about them. 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 have found useful both for my own intuition building about the mathematics 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!