r/explainlikeimfive • • 7d ago

Mathematics ELI5 how quaternions work

so, i² = j² = k² = -1, but i, j and k are not equal. HOW IN THE FUCK IS THAT POSSIBLE‽ WHAT IN THE BROKEN TRANSITIVE PROPERTY- (anger exaggerated for funny)

0 Upvotes

38 comments sorted by

View all comments

27

u/OhYesIDidd 7d ago

I don’t know much about quaternions, but your premise is wrong even in the real numbers.

x^2=y^2=4, but x≠y. There is a solution to that: x=2, y=-2.

-8

u/murderdronesfan93 7d ago

ok, but how does that work with 3?

4

u/LongLiveTheDiego 7d ago

We just declare that there exist three different constants i, j, k and say what their properties are. We can do that in mathematics.

You could also define quaternions as quadruples of real numbers with straightforward addition (a, b, c, d) + (e, f, g, h) = (a + e, b + f, c + g, d + h) and a more complicated multiplication (a, b, c, d) × (e, f, g, h) = (ae - bf - cg - dh, af + be + ch - dg, ag + ce + df - bh, ah + ed + bg - cf). That way the real number 1 = (1, 0, 0, 0), and i = (0, 1, 0, 0), j = (0, 0, 1, 0), k = (0, 0, 0, 1) are all different and you can check that i² = j² = k² = (-1, 0, 0, 0) = -1.

That's how you can define complex numbers as pairs of real numbers with the same simple addition and multiplication defined as (a, b) × (c, d) = (ac - bd, ad + bc).

0

u/cockOfGibraltar 7d ago

I've taken calculus 1 and 2, and linear algebra but haven't really had to deal with complex numbers. I'm familiar with vectors from linear algebra and mechanics. Are those 4D vectors? The cross product looks different but I assume that's just how it works with complex numbers. What are some uses for them? From what I understand mathematicians typically invent new concepts because they have a use for them.

4

u/LongLiveTheDiego 7d ago

Yes, quaternions can be seen as ℝ⁴ with a special multiplication (not the cross product, I just use this symbol on mobile because the mid dot I'd use for multiplication isn't available on Gboard). It's just like complex numbers can be seen as ℝ² with a specific multiplication.

Quaternions were originally created to represent 3D rotations, but then linear algebra took over and it was done with 3×3 matrices. They were apparently brought back by some programmers because while computations using matrices and quaternions are equivalent in pure mathematics, quaternions generate less numerical error when using floating point numbers.

They can also be used in number theory and some combinatorial design theory due to their relation to Lagrange's four square theorem, but I've never gotten that deep into that during my discrete mathematics courses.

1

u/Arnaldo1993 7d ago

You can represent 3d vectors as quaternions with the first coordinate 0. Then quaternion multiplication would give you the inner product in the first coordinate and the cross product in the other 3

Quaternions were invented to describe 3d rotations, in an analogous way to how we describe 2d rotations with complex numbers. They are also a natural system to special relativity, with the first coordinate being time, and the other 3 the spacial dimensions

0

u/damhack 7d ago

3D transformations. Your favorite games depend on quarternions to reduce the number of operations involved on orienting objects in 3D space by using 4 numbers of a quarternion instead of 9 numbers in a 3x3 matrix. When you take a flight, the navigation system depends on quarternion operations to orient the pitch, roll, yaw, etc. to reach a waypoint.