In lecture, we saw that we could represent rotations as rotation matrices, or other angles in the axis angle representation. In this segment, we'll discuss a final method of representation for rotations, namely using quaternions. A quaternion is a fourtuple. This set of numbers is often interpreted as a constant component q zero, and a three-dimensional vector component q. We can use this representation for defining common operations on quaternions. To add or subtract two quaternions p and q, we simply add or subtract the corresponding components. Quaternion multiplication is defined by the following equation: the inverse of a quaternion is a quaternion where the constant component q zero remains unchanged, but the vector component is negated. Quaternions can be used to represent rigid-body rotations. In particular, we can easily convert and axis-angle representation of a rotation to its quaternion representation. Recall that in the axis-angle representation, we found an angle of rotation phi and an axis of rotation u. The equivalent quaternion in terms of these two parameters can be found using the following equation: given a quarternion q, we can also find the equivalent axis-angle representation. We can find the angle of rotation using the constant component, q zero. The axis of rotation is a function of all four components. How do we actually use these quarternions? Suppose we want to rotate a vector p in R3 by the quarternion q. To do this, we first turn the vector p into a quaternion that has zero as a constant component, and p as a vector component. To perform the rotation, we premultiply by q, and postmutiply by q inverse. The resulting quaternion will still have zero as its constant component. The vector component is a vector that results after rotating p. Here, we are taking the quaternion product. It is also easy to compose rotations in the quaternion representation. A rotation of q1, followed by the second rotation q2, is represented by the quaternion q=q2q1. We're again, we're taking the quaternion product of q2 and q1. Like the axis angle representation, there are two quaternion representations for each rotation, q and negative q represent the same rotation. There are a number of advantages to the quaternion representation. A quaternion only has 4 parameters, making it a more compact representation than rotation matrices. Furthermore, the Quaternion representation contains no singularities. The Quaternion product, is also often more numerically stable than Matrix multiplication, making it a common choice when working with rotations and software.