# Quaternion Calculator

Welcome to Omni's **quaternion calculator**, where we'll deal with this mysterious extension of *complex numbers*: **the quaternions**. In short, we represent them using four real values, each corresponding to one of the basic unity quaternions: $1$, $\text i$, $\text j$, and $\text k$. To some, they may seem like an artificial creation to make math even more tricky than it already is. To others, they are a useful tool in 3D geometry: mainly to study **quaternion rotation**. Unfortunately, this doesn't kill the "*tricky*" part, and, e.g., quaternion multiplication is not a straightforward operation.

But let's not get ahead of ourselves! We begin with where every math topic begins: **with an introduction**. In our case, it's the quaternion definition.

## The quaternion definition

**Quaternions** are an extension of complex numbers. They were first introduced by , who used them to describe several properties of the three-dimensional space (for more, see the dedicated section).

However, nowadays, most often, we introduce them **from the algebraic point of view**. Let's take a look at the formal quaternion definition.

💡 **Quaternions** are expressions of the form $q = a + b \,\text i + c \,\text j + d \, \text k$, where $a$, $b$, $c$, and $d$ are arbitrary real numbers and $\text i$, $\text j$, and $\text k$ are base elements sometimes called **the basic unity quaternions.**

By the above quaternion definition, we see that the space is spanned by **four base elements**: $1$, $\text i$, $\text j$, and $\text k$. The three letters don't stand for any particular value: they simply denote independent base vectors. Nevertheless, if $\text i$ seems familiar, **it well should!** In fact, if the coefficients of $\text j$ and $\text k$ (i.e., $c$ and $d$ in the above quaternion definition) are both zero, then we obtain the (well-known) complex numbers! As such, we indeed obtain their extension.

More or less, Hamilton's idea was to have **one expression whose individual parts** (i.e., the base elements' coefficients) **describe the distinct directions in a three-dimensional space**. From there, he only needed to introduce operations between these new thingies. On the one hand, we'd like them to satisfy some properties and form **a nice algebraic structure**. On the other, the operations should be usable and have **real-life explanations**. After all, quaternions originated from geometry — a very real-life area of mathematics.

Now that we know what a quaternion is, we can go further. The subsequent sections describe **the basic rules governing these numbers**. Note how Omni's quaternion calculator lets you **find all values and objects** we mention. For more information on how to use the tool, see the last section.

## Adding and subtracting quaternions

**This one's easy.** Recall from the above section that quaternions are spanned by four base elements: $1$, $\text i$