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 ijk1 . Rather these are matrices that encode rotation.

i=(011 0)j=(i00i)k=(0ii0)

If you were to square the matrix, using matrix multiplication, you would obtain (1001)=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=aibjckd

Thus

qq=a2+b2+c2+d2=||q||2

Rotations

Let a u be a pure imaginary quaternion or vector where uH.
(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=uu=b2c2d2=1

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

We can represent a unit quaternion by

q=euθ

The inverse of q is

q1=euθ=cosθusinθ=q

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

v=q v q1