No history yet

Quaternions

Beyond Complex Numbers

Complex numbers, with their one real and one imaginary part, are great for describing rotations in a 2D plane. But what if we want to work in three dimensions? In the 19th century, Irish mathematician William Rowan Hamilton wrestled with this problem. His solution was a new number system: quaternions.

A quaternion is an extension of complex numbers. It has one real part and three distinct imaginary parts, denoted by ii, jj, and kk. The general form of a quaternion qq is:

q=a+bi+cj+dkq = a + bi + cj + dk

Here, aa, bb, cc, and dd are real numbers. The term aa is called the scalar part, and bi+cj+dkbi + cj + dk is the vector part.

quaternion

noun

A number system that extends the complex numbers, consisting of one real part and three imaginary parts.

The magic of quaternions comes from the rules governing how the imaginary units multiply. While i2=1i^2 = -1 is familiar from complex numbers, quaternions add a few more rules for jj and kk.

i2=j2=k2=ijk=1i^2 = j^2 = k^2 = ijk = -1

From this single identity, we can figure out the other multiplication rules. For instance, if ijk=1ijk = -1, we can multiply both sides by kk on the right:

ijk(k)=1(k)    ij(k2)=k    ij(1)=k    ij=kijk(k) = -1(k) \implies ij(k^2) = -k \implies ij(-1) = -k \implies ij = k

But what about jiji? It turns out that quaternion multiplication is not commutative. The order matters. Reversing the order of multiplication flips the sign.

ij=kij = k, but ji=kji = -k jk=ijk = i, but kj=ikj = -i ki=jki = j, but ik=jik = -j

Quaternion Operations

Working with quaternions involves a few basic operations. Addition is straightforward, while multiplication requires careful attention to the rules we just covered.

Addition To add two quaternions, you simply add their corresponding parts. It's just like adding vectors or complex numbers. If you have two quaternions:

q1=a1+b1i+c1j+d1kq_1 = a_1 + b_1i + c_1j + d_1k q2=a2+b2i+c2j+d2kq_2 = a_2 + b_2i + c_2j + d_2k

Their sum is:

q1+q2=(a1+a2)+(b1+b2)i+(c1+c2)j+(d1+d2)kq_1 + q_2 = (a_1+a_2) + (b_1+b_2)i + (c_1+c_2)j + (d_1+d_2)k

Multiplication Multiplying quaternions is more involved because you have to use the distributive property and apply the multiplication rules for i,j,i, j, and kk. This process reveals the non-commutative nature of quaternions. The full formula is quite long, but the key is to multiply each term in the first quaternion by each term in the second and then simplify.

Conjugation The conjugate of a quaternion, denoted as qq^*, is found by negating its vector part. If q=a+bi+cj+dkq = a + bi + cj + dk, its conjugate is:

q=abicjdkq^* = a - bi - cj - dk

Conjugation is useful for finding the magnitude of a quaternion and for calculating its inverse, which are important steps in using quaternions for rotations.

Quaternions and 3D Rotations

The most significant application of quaternions is representing rotations in 3D space. While rotation matrices can also do this, quaternions are more compact and computationally efficient. They avoid a problem known as "gimbal lock," a loss of one degree of rotational freedom that can plague other rotation systems.

To represent a rotation, we use a special type of quaternion called a unit quaternion, which has a magnitude of 1. A rotation of angle θ\theta around a unit vector axis u=(ux,uy,uz)\vec{u} = (u_x, u_y, u_z) is represented by the quaternion qq:

q=cos(θ2)+(uxi+uyj+uzk)sin(θ2)q = \cos(\frac{\theta}{2}) + (u_x i + u_y j + u_z k) \sin(\frac{\theta}{2})

To apply this rotation to a point PP in space, you represent the point as a "pure" quaternion p=0+Pxi+Pyj+Pzkp = 0 + P_x i + P_y j + P_z k. The rotated point PP' is then found by the following quaternion multiplication:

p=qpq1p' = q p q^{-1}

This calculation, known as a sandwich product, neatly applies the rotation. The result, pp', is another pure quaternion whose vector part gives the new coordinates of the rotated point. This elegant method is why quaternions are fundamental to 3D computer graphics, robotics, and aerospace engineering.

Quiz Questions 1/6

Who is credited with the invention of quaternions?

Quiz Questions 2/6

A quaternion qq is given by the general form a+bi+cj+dka + bi + cj + dk. What is the 'vector part' of this quaternion?

Quaternions offer a powerful way to think about numbers and geometry, connecting algebra directly to the rotations we see in the physical world.