*Edited by Maryam Kamal.*

Quaternions - something so complex yet so beautiful.

To wrap our heads around quaternions, let’s begin by talking about number systems beyond the standard numerical number system. We cannot evaluate the square root of -1 (√-1) with the conventional number system. Hence, the complex numbers system was invented by mathematician Gerolamo Cardano in 1545¹. The complex number system states that the square root of -1 is the imaginary unit ‘*i*’ (-1=i). A complex number is a number expressed in the form : a+bi, where a and b are real numbers that exist in the conventional number system.²

As mathematicians are curious and are always striving to discover new discoveries, Irish mathematician Sir Williams Rowan Hamilton invented quaternions in 1843.³ The quaternions number system is an extension of complex numbers and it is a four-dimensional vector space that can be used to model rotations in the three-dimensional space. A quaternion contains four components and it is expressed in the form: a+bi+cj+dk, where a, b, c, and d are real numbers, while i, j, and k are unconventional imaginary units (or the quaternion units). Quaternions behave like coordinates in a 4-D space, and are useful in multiple occasions that will be mentioned below.

The quaternion units have an interesting mathematical property - they have a cyclic pattern, whereby the units repeat with some regularity after a few mathematical operations.⁴ In a cyclic pattern of i-->j-->k-->i-->j-->k-->...., multiplying neighbouring units along the arrow results in a positive answer (e.g. i*j=k). On the other hand, multiplying neighbouring units against the arrow results in a negative answer (e.g. j*i=-k). The importance lies in the graphical representation of the 90º rotation multiplication of quaternion units. Multiplying along or against the cyclic pattern arrow results in either a clockwise 90º or an anticlockwise 90º rotation respectively.

Why do we need quaternions? There surely must be another number system that could model a 3-D rotation? Those are perfectly reasonable questions with the answer being that there is an angle system called the Euler angle. It is applied to the conventional x-, y-, and z-axes which represent a 3D space. Euler angle works by rotating certain axes of an object in certain angles to rotate the object as a whole. This way, Euler angles can therefore represent a three dimensional rotation by applying operations to the three independent axes to perform rotations. With that being said, a critical problem with the Euler angle is that it will cause gimbal lock. Gimbal lock occurs when one axis of an object aligns with another axis of an object, and rotating either seemingly independent axis will instead cause the object to rotate on the same axis. This causes the loss of one degree of freedom as the ability to rotate on a certain axis is lost. Therefore, quaternions are useful as the three quaternion units rotate about their own arbitrary axis, and can uniquely identify a rotation. Whereas converting to euler rotation will lose one degree of freedom of rotation.

Quaternions are used in various situations. Quaternions are not only used in control systems to guide aircraft and rockets in order to change their orientations, they are also used in other domains. One area that you might have not thought of is they are also used in video games and computer graphics to rotate 3D characters. Quaternions are useful in these cases to allow an object to rotate about multiple axes simultaneously whilst avoiding gimbal lock.

Mathematics is a beautiful and precise language that describes the world and is still evolving. Mathematicians will always discover new concepts and improve the efficiency of current ones. There is no end for mathematics as mathematics is a never-ending loop that shapes the way we understand our world.

**References:**

Sage Tutorial for the first course: Complex numbers. (2022). Brown.edu.

__https://www.cfm.brown.edu/people/dobrush/am33/sage/intro/complex0.htm__Complex numbers | Algebra (all content) | Math | Khan Academy. (2022). Khan Academy.

__https://www.khanacademy.org/math/algebra-home/alg-complex-numbers__quaternion | mathematics | Britannica. (2022). In Encyclopædia Britannica.

__https://www.britannica.com/science/quaternion__The Peculiar Math That Could Underlie the Laws of Nature | Quanta Magazine. (2018, July 20). Quanta Magazine.

__https://www.quantamagazine.org/the-octonion-math-that-could-underpin-physics-20180720/__Euler Angles. (2022). Wolfram.com; Wolfram Research, Inc.

__https://mathworld.wolfram.com/EulerAngles.html__ResearchGate. (2019, June 21). Figure 9 illustrates the principle of gimbal lock. The outer blue frame... ResearchGate; ResearchGate.

__https://www.researchgate.net/figure/llustrates-the-principle-of-gimbal-lock-The-outer-blue-frame-represents-the-x-axis-the_fig4_338835648__

## Comments