Quaternions are like complex numbers.

The number of dimensions in a quaternion number is 4.

Multiplication over quaternions is NOT commutative.

Multiplication over quaternions is associative.

Representation for example:

q=a+b⋅i+c⋅j+d⋅k

Where i is the complex root, j is another basis root and k is yet another basis root.

Rotations

If we have an axis angle representation consisting of an angle and an axis represented by a vector (a_x,a_y,a_z) of unit length, the equivilant quaternion representation is:

\cos(÷{φ}{2})+i⋅a_x⋅\sin(÷{φ}{2})+j⋅a_y⋅\sin(÷{φ}{2})+k⋅a_z⋅\sin(÷{φ}{2})

where the axis is normalized so that a_x²+a_y²+a_z²=1.

where the quaternion is normalised so that (\cos(÷{φ}{2}))²+a_x²⋅(\sin(÷{φ}{2}))²+a_y²⋅(\sin(÷{φ}{2}))²+a_z²⋅(\sin(÷{φ}{2}))²=1.

let's say that is: q_w²+q_x²+q_y²+q_z²=1.

Then follows by taking the square root:

q_w=\cos(÷{φ}{2})
q_x=a_x⋅\sin(÷{φ}{2})
q_y=a_y⋅\sin(÷{φ}{2})
q_z=a_z⋅\sin(÷{φ}{2})

Apply rotation to a point

To apply rotation to a point, represent the point as i, j and k factors (the real part is 0), then the new point P is, given the old point p and a rotation quaternion q:

P=q⋅p⋅\conj{q}

... where conj is the conjugate operator, flipping the signs of all the non-real components of the quaternion.