What are quaternions?
To explain it well, we need to start at what are complex numbers.
The regular numbers, that everyone is used to, are the real numbers. But they have a drawback - there are equations that don't have solutions in real numbers, like x^2=-1. There is no real number that squared gives -1. That's why people invented complex numbers. A number that when squared gives -1 is i, called an imaginary unit.
A complex number is a number like a+bi, where a and b are real. They have many great properties, but this is not the matter of this tutorial. To give you a quick feel how calculations on complex numbers work, here are a few examples:
Assume we have two complex numbers, z = a+bi and w = c+di (a, b, c, d are real). Then:
- z+w = a+bi + c+di = (a+c) + (b+d)i
- z*w = (a+bi)(c+di) = ac + adi + bic + bidi = ac + adi + bci - bd = (ac-bd)+(ad+bc)i
- z/w = (a+bi)/(c+di) = [(a+bi)(c-di)]/[(c+di)(c-di)] = [(ac+bd)+(bc-ad)i]/[(cc+dd)+(cd-cd)i] = [(ac+bd)+(bc-ad)i]/(c^2+d^2)
Bookmarks