## Quaternion Math- At first there were numbers, they were used to count objects like stones or apples or whatever (~ 9000 b.c.)
- Then people thought, that there must be some "nothing", so clever people invented the most important number, called "zero"
- After that people played around and asked whether there could be numbers smaller than 0, and they invented negative numbers.
- Then the communists came and wanted to divide everything, and that's how rational numbers were invented (
**a/b**,**a**and**b**numbers.) - Then some mathematics asked for the solution of x*x=2. He did not find a number, he found only an approximation (1.41...), so the clever guy just wrote sqrt(2), and voila! The irrational numbers were invented.
- Ok, so far so good. All numbers were invented. All numbers? No! We forgot the mathematicians! They searched and searched, and suddenly somebody asked why there should not be a solution to x*x=-1. They told the number to be written as
**i**, and so the complex numbers were invented. Unfortunately the good old number line was dense (i.e. full), there was no place for these strange "complex" numbers (just as the name implies ). So they placed them below and above the real numbers: And even nowadays they form the complex number plane, each complex number consistring of a real part and an imaginary part. - And then, as if this were not enough, in 1843 Sir William R. Hamilton was trying to find a way to rotate a 3D vector by multiplying it with another one.
After 15 years of hard work, he stumbled upon the idea of using a 4D notation. He called these numbers
**quaternions**.
A Quaternion q is a quadruple of real numbers and can be defined as q=[s,v] where s is a scalar and v is a 3D vector.One can express the vector v in terms of its components: q = [s + xi + vj + zk], where s is a real number called the scalar part. The three imaginary parts are xi, yj, zk. The coefficients x, y, z in the imaginary terms are the real numbers. Now how are the rules for mathematical operations with quaternion numbers? - Two Quaternions are equal if and only if their corresponding terms are equal.
- The following rules apply when multiplying Quaternions:
- i
^{2}= j^{2}= k^{2}= -1 - ij = k = -ji [i.e. Quaternion multiplication is
**not**commutative!]
it therefore follows that - jk = i = -kj, ki = -ik = j,
- ji = -ij = -k, kj = -1, ik = -j
- i
Given two Quaternions q q q The product of q q Fortunately this can be written using dot and cross products q For any Quaternion q = [s + xi + yj + zk] = (s,v): The inverse Quaternion is: q Where |q| is the magnitude or modulus of q given by: |q| = sqrt(s Also, |q| |