# How are quaternions used

## What are quaternions and how are they used to represent spacecraft dynamics?

What are quaternions and how are they used in spacecraft dynamics?

### background

Newtonian mechanics says we live in a universe with three spatial dimensions and a universal time, which is the independent variable in which we can describe translation and rotation. The theory of relativity says that we live in a universe with three space-like dimensions and one temporal dimension that are interwoven. This answer ignores relativistic aspects.

With this assumption, the description of the translation is simple, at least in comparison to the rotation. An object's center of mass has a position in a frame of reference (preferably inertia) that changes over time. Gravitation, drag and other interactions such as the firing of the translational thruster change this value as a function of time. Simulate these interactions and you have a 3DOF (Three Freedom of Freedom) simulation.

What makes 3DOF modeling so easy is that it is a commutative space. If you walk ten meters north and then five meters east, you will come to a certain point. Alternatively, if you walk five meters east and ten meters north, you will get to the same place. The translation in Euclidean space commutes. The rotation in three-dimensional space is not commutative. Take a book and rotate it around an axis parallel to the spine of the book. Then rotate the book about an axis perpendicular to the book face. Do these actions differently (rotate them first about an axis perpendicular to the face of the book and then around the spine of the book) and you will get a different end result.

### Rotations in three-dimensional space

Since rotations do not oscillate in three-dimensional space, they are not vectors. Commutativity is an essential property of being a vector. How can rotations not represent vectors? It turns out that there are many different ways to represent rotations in three-dimensional space. Euler was one of the first to investigate this problem and implement a number of key concepts. On the one hand, a rigid body that rotates in three-dimensional space can always be described as instantaneously rotating around a single axis. This concept only applies to 3D space and is also decisive for why quaternions (unit quaternions) are useful for describing rotations. I'll address that a little later.

He also realized that the orientation of a planet or a rigid body can generally be described by three revolutions. Euler used a sequence of three revolutions: one revolution around the Z-axis, then another around the once-rotated X-axis and another around the twice-rotated Z-axis. There is nothing special about this canonical Z-X'-Z '' sequence. All that is needed is that the first and third revolutions are approximately the same body axis and that the middle element is approximately one body axis that is orthogonal to the other axis. A related sequence is to use three orthogonal body-fixed axes. This selection leads (for example) to a roll-pitch-yaw sequence. There are six classic Euler sequences (e.g. Z-X'-Z '') and six Tait-Bryan sequences (e.g. roll-pitch-yaw). Another variation on this theme is to rotate around a fixed set of axes. This leads to the extrinsic Euler sequences. There are a total of 24 different things that can be called Euler rotation sequences.

Another way to represent rotations is to use a suitable orthogonal matrix. An orthogonal matrix is an NxN matrix in which each row (or column) is a unit vector and is orthogonal to all other rows (or columns). This representation is generic; it applies to every N-dimensional Cartesian space. The 3x3 representation is of particular interest because we live in a 3D universe. A major problem with an NxN matrix used to represent orientation is that there are rotations in N-dimensional space (N.2-N.) / 2 degrees of freedom, while the matrix has N.2 elements. Over half of the elements of the matrix are redundant. (This redundancy problem also applies to quaternions. Rotations in 3D space have three degrees of freedom. Quaternions have four elements.)

Another way of displaying orientation / rotation in 3D space is Euler's set of single axes. No matter how strangely a rigid body is oriented, there is always an axis that is combined with a rotation of an angle about that axis and that can represent the orientation of the body in question with respect to a particular frame of reference. This axis / angle representation comes very close to a quaternionic representation. Given a unit vector u ^ and an angle θ, the quaternion, whose scalar part is cos (θ / 2) and whose vector part is either u ^ sin (θ / 2) or -u ^ sin (θ / 2) Captures all information, required to represent alignment, while completely avoiding the singularity problems associated with Euler sequences and almost the over-specification problem associated with matrices.

### WTF are quaternions?

The above begs the question. I wrote about quaternions before discussing what quaternions are. William Rowan Hamilton tried to find an extension of the complex numbers where i = -1- - - -√. When he was walking his wife, he finally got a glimpse and invented the quaternions. To make sure he doesn't forget this incredible insight, he has carved some graffiti on a bridge:

- What is your hometown famous for?
- Bombshell blew up Fox News
- How are Indian students doing at INMO
- What do elders mean in life
- Can an au pair study abroad
- How much do advanced EMTs earn
- Why do toddlers bite
- What has been your best experience with software outsourcing
- What's the saddest thing in your life
- Can I buy a taken back car?
- I love Cersei Lannister, I'm crazy
- What is life without someone I need
- Which emotion is the strongest
- Can learn a 4-year-old calculus
- Spotify is owned by Google
- Love or arrange marriage 1
- Why do you like Bob's Burgers
- How is life in Kyrgyzstan
- What is the difference between LNG and CNG
- How many Chinese have you met
- Why do Americans call British Europeans
- How to make soap powder
- What is IPHO age limit
- What is industrial metal music