The quaternion is a rank 4 complex number system that consists of a real and three complex(vector) parts. The vector component is an extension from the basic complex or imaginary number system, $\hat{i}$. The basic properties of the complex components of a quaternion are listed:
$$ \hat{i}^2 = \hat{j}^2 = \hat{k}^2 = \hat{i}\hat{j}\hat{k} = -1 $$
Clockwise multiplication around the circle results in positive values, while counter-clockwise multiplication results in negative values.
$$ \hat{i}\hat{j} = \phantom{-}\hat{k} \qquad \hat{j}\hat{k} = \phantom{-}\hat{i} \qquad \hat{k}\hat{i} = \phantom{-}\hat{j} $$
$$ \hat{j}\hat{i} = -\hat{k} \qquad \hat{k}\hat{j} = -\hat{i} \qquad \hat{i}\hat{k} = -\hat{j} $$
The basic forms of a Quaternion are shown below:
$$ \boldsymbol{q} = q_0 + q_1 \hat{i} + q_2 \hat{j} + q_3 \hat{k} = \begin{bmatrix} \phantom{-}q_0 & \phantom{-}q_1 & \phantom{-}q_2 & \phantom{-}q_3 \\ \end{bmatrix}^T = \begin{bmatrix} \phantom{}q_0 \\ \boldsymbol{q}_v \end{bmatrix} $$
In the quaternion, $q_0$ represents the scalar part, while $q_1$, $q_2$, and $q_3$ represent the vector parts of the quaternion, also written as $\boldsymbol{q}_v$. The quaternion can also be re-written as:
$$ \boldsymbol{q} = \cos \left( \frac{\theta}{2} \right) + \boldsymbol{v} \sin \left( \frac{\theta}{2} \right) = \begin{bmatrix} q_0 \\ q_1 \\ q_2 \\ q_3 \end{bmatrix} = \begin{bmatrix} \cos\left(\frac{\theta}{2}\right) \\[0.5em] \sin\left(\frac{\theta}{2}\right) \\[0.5em] \sin\left(\frac{\theta}{2}\right) \\[0.5em] \sin\left(\frac{\theta}{2}\right) \\[0.5em] \end{bmatrix} $$
Where $\boldsymbol{v}$ represents the rotation axis, and must be a unit vector, and $\theta$ is the angle of rotation, which is similar to roll in the Euler-space.
The conjugate of the quaternion is defined as:
$$ \boldsymbol{q}^* = q_0 -q_1\hat{i} - q_2\hat{j} - q_3\hat{k} = \begin{bmatrix} \phantom{-}q_0 & -q_1 & -q_2 & -q_3 \end{bmatrix}^T = \begin{bmatrix} \phantom{-}q_0 \\ - \boldsymbol{q}_v \end{bmatrix} $$
The magnitude of a quaternion is defined by: $$ \Vert \boldsymbol{q} \Vert = \sqrt{q^2_0 + q^2_1 + q^2_2 + q^2_3} $$
The inverse of a quaternion is defined: $$ \boldsymbol{q}^\mathrm{-1} = \frac{\boldsymbol{q}^*}{\Vert \boldsymbol{q} \Vert} $$
The inverse of a Rotation quaternion is equal to the conjugate of the quaternion: $$ \boldsymbol{q}^\mathrm{-1} = \boldsymbol{q}^* $$
The inverse, or conjugate, of a Rotation quaternion causes the axis of rotation to be rotated to the complete opposite direction from the initial quaternion.