Quaternions

Quaternions provide a clever way to encode a 3d rotation about a particular axis in 3d space. It is widely used in game mechanics and 3d computer aided designs.

A Quaternion is represented by 4 numbers (4 dimensions) which encodes a 3d rotation in 3d space.

q=a+ib+jc+dk

Imaginary Numbers??? Or vectors?

Recall how an imaginary number encodes a rotation. Let's define i, j, k axis. Where i represents a 90∘ rotation about the i axis and so on. Rotation is defined using the right hand rule, with the thumb pointing in the direction of the vector.

IMG_1157.jpeg| 300

Let's define multiplication as such.

ij=k

This means applying a rotation i on vector j. Using your right hand, position the thumb in the direction of i, and curl your fingers. j will rotate according to the direction of the curl to become k.

Doing so, you can derive other sets of expression. Like

ij=kik=−j

Suppose we multiply i on the left side of ij

iij=ik=−j

Thus

i2=−1

We can also prove that

i2=j2=k2=ijk=−1

IMG_1158.jpeg

These are all imaginary numbers! What?? Note that i≠j≠k≠−1 . Rather these are matrices that encode rotation.

i=(0−11 0)j=(i00−i)k=(0ii0)

If you were to square the matrix, using matrix multiplication, you would obtain (−100−1)=−i=−1.

Why four dimensional space?

First of all, why would you introduce 4 dimensions, why can't a quaternion just be q=a+ib+jc?? See below.
Proof for 3d contradiction (Quaternions)

Conjugate

The conjugate of a quaternion is as such

q∗=a−ib−jc−kd

Thus

q⋅q∗=a2+b2+c2+d2=||q||2

Rotations

Let a u be a pure imaginary quaternion or vector where u∈H.
(u is a quaternion).

u=ib+jc+kd=(bcd)

Where b2+c2+d2=1.

A unit Quaternion existing on the surface of a hypersphere where ||q||=1, can encode a rotation of θ about unit vector u.

q=cos⁡θ+usin⁡θ

Where qq∗=||q||2=cos2⁡θ−(u2)sin2⁡θ. Think of u now as a vector

u2=u⋅u=−b2−c2−d2=−1

Thus ||q||2=cos2⁡θ+sin2⁡θ=1.

We can represent a unit quaternion by

q=eu⋅θ

The inverse of q is

q−1=e−u⋅θ=cos⁡θ−usin⁡θ=q∗

To rotate a vector v about u by 2θ degrees.

v′=q v q−1