Unit vectors and quaternions This might be a dumb question but recently I came to know about the quaternion number system.
I can't stop wondering, "Are they related to unit vectors in any way? They have similar notations and both seem to be related to Spatial dimensions."
 A: As Don Thousand explains, you do need a bit of Linear Algebra/Abstract Algebra to fully appreciate the relationships. I would also add some elementary Complex Analysis (just the operations and basics) to also appreciate/understand. But for an application of quaternions and their vector connections, with a bit of the Math thrown in, I really do not think you can do better (at an elementary level) than the videos by 3Brown1Blue:
Visualizing quaternions (4d numbers) with stereographic projection
Quaternions and 3d rotation, explained interactively
A: Multiplication of real quaternions can be expressed in terms of multiplication of real numbers and scalar, dot and cross-multiplicaion of real 3-dimensionalvectors; thus for two real quaternions
$$(a+b\mathbf i+c\mathbf j+d\mathbf k)(a'+b'\mathbf i+c'\mathbf j+d'\mathbf k)$$ $$=aa'-(b\mathbf i+c\mathbf j+d\mathbf k)\bullet(b'\mathbf i+c'\mathbf j+d'\mathbf k)$$ $$+a(b'\mathbf i+c'\mathbf j+d'\mathbf k)+a'(b\mathbf i+c\mathbf j+d\mathbf k)$$ $$+(b\mathbf i+c\mathbf j+d\mathbf k) \mathbf x (b'\mathbf i+c'\mathbf j+d'\mathbf k)$$
A: Vectors have magnitude and direction. Their sizes can be rescaled (real scalar multiplication) and vectors can be added together (draw a parallelogram!). The dot product folds together the notions of size and direction into a symmetric operation satisfying the distributive property, $\mathbf{a}\cdot\mathbf{b}=\|\mathbf{a}\|\|\mathbf{b}\|\cos\theta$. (Here, $\|\mathbf{a}\|$ means the size of a vector $\mathbf{a}$, and $\theta$ is the angle between the directions $\mathbf{a}$ and $\mathbf{b}$ point.) Geometrically, it can be motivated using projections: $\mathrm{proj}_{\mathbf{b}}(\mathbf{a})=\|\mathbf{a}\|\hat{\mathbf{b}}\cos\theta$, where $\hat{\mathbf{b}}:=\mathbf{b}/\|\mathbf{b}\|$ is the unit vector pointing in the direction of $\mathbf{b}$, is a linear function of $\mathbf{a}$ and can be made symmetric by multiplying by $\|\mathbf{b}\|$.
Three dimensions is a special situation; in 3D there is another binary operation satisfying the distributive property, it turns two vectors into another vector called the cross product $\mathbf{a}\times\mathbf{b}$ of $\mathbf{a}$ and $\mathbf{b}$. The cross product $\mathbf{a}\times\mathbf{b}$ is a vector which points in the direction perpendicular to the plane that $\mathbf{a}$ and $\mathbf{b}$ span (according to the "right-hand rule"), and whose magnitude is given by $\|\mathbf{a}\times\mathbf{b}\|=\|\mathbf{a}\|\|\mathbf{b}\|\sin\theta$.
Scalar multiplication is only "sort-of" a multiplication operation - it takes a scalar and a vector and spits out a vector; it does not multiply two vectors together. Same with the dot product - it takes two vectors and spits out a scalar. The cross product does take two vectors and spit out another vector, however it is different from what you might want to call a multiplicaiton operation because (a) there is no "identity element" that functions the way $1$ does in a number system and (b) it is anticommutative, i.e. switching the order of operation changes signs: $\mathbf{b}\times\mathbf{a}=-\mathbf{a}\times\mathbf{b}$, and indeed (c) it's not even associative. (Although it does satisfy the so-called Jacobi identity, which basically means applying $\mathbf{a}\times$ to the vector $\mathbf{b}$ functions algebraically, and in a loose sense geometrically, like differentiation of functions.)
The quaternions are a number system (called $\mathbb{H}$, named after discoverer and greatest evangelist, Hamilton), like the complex number $\mathbb{C}$, except $\mathbb{H}$ is not commutative. It blends together scalars and 3D vectors along with the dot product and cross products. A quaternion, the way I think about them, is a "pretend" (aka "formal") sum of a scalar and a vector, $a+\mathbf{u}$. (You can call the scalar/vector parts the real/imaginary parts in analogy with $\mathbb{C}$.) To multiply two of them, you can use the distributive property ("FOIL"):
$$ (a+\mathbf{u})(b+\mathbf{v})=ab+a\mathbf{v}+b\mathbf{u}+\mathbf{uv}. $$
This leaves open the question of what $\mathbf{uv}$ (the quaternion product of two 3D vectors) is:
$$ \mathbf{uv}=\underbrace{-\mathbf{u}\cdot\mathbf{v}}_{\textrm{scalar}}+\underbrace{\mathbf{u}\times\mathbf{v}}_{\textrm{vector}} $$
If you use $\mathbf{i},\mathbf{j},\mathbf{k}$ as a basis for 3D vectors, you can write a quaternion as
$$ a+\mathbf{u}=a+b\mathbf{i}+c\mathbf{j}+d\mathbf{k}. $$
Multiplying two quaternions then involves using the relations $ \mathbf{i}^2=\mathbf{j}^2=\mathbf{k}^2=-1 $ and
$$
 \mathbf{ij}=\phantom{-}\mathbf{k}, ~ \mathbf{jk}=\phantom{-}\mathbf{i}, ~ \mathbf{ki}=\phantom{-}\mathbf{j}, \\
\mathbf{ji}=-\mathbf{k}, ~ \mathbf{kj}=-\mathbf{i}, ~ \mathbf{ik}=-\mathbf{j}.  $$
This is typically abbreviated with a cycle mnemonic:
$\hskip 0.5in$ 
All three of the orthogonal unit vectors $\mathbf{i},\mathbf{j},\mathbf{k}$ are square roots of $-1$, and if you multiply two different ones along the direction of the cycle above you get the third one, if it goes the opposite direction you get the opposite. Hamilton famously wrote this all as
$$ \mathbf{i}^2=\mathbf{j}^2=\mathbf{k}^2=\mathbf{ijk}=-1. $$
With the associative property, this is equivalent to all of the previous equations combined. We can extend the norm of a 3D vector to a norm of a quaternion in an obvious way:
$$ |a+b\mathbf{i}+c\mathbf{j}+d\mathbf{k}|^2=a^2+b^2+c^2+d^2. $$
(Just like for complex numbers $|a+bi|^2=a^2+b^2$, now with four components.)
The only square roots of $1$ are $\pm1$, and the square roots of $-1$ are precisely all of the unit vectors (not just $\mathbf{i},\mathbf{j},\mathbf{k}$!). Euler's formula $\exp(\theta\mathbf{u})=\cos(\theta)+\sin(\theta)\mathbf{u}$ holds for unit vectors $\mathbf{u}$. Every quaternion $q$ has a polar form $q=r\exp(\theta\mathbf{u})$ where $r=|q|$ and $\mathbf{u}$ is $q$'s vector part normalized.
Just as you can use complex numbers to model 2D rotations, you can use quaternions to model 3D (and even 4D!) rotations. This is the original application Hamilton (and company) sought. Indeed, originally Hamilton expected there to be a 3D number system involving numbers of the form $a+b\mathbf{i}+c\mathbf{j}$ that did the trick, but he eventually had a "Eureka!" moment that all his algebra that didn't work out miraculously resolved itself if he assumed a third direction $\mathbf{k}$ perpendicular to the first two $\mathbf{i},\mathbf{j}$.
