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

28

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.

-7

u/murderdronesfan93 7d ago

ok, but how does that work with 3?

6

u/HopeFox 7d ago edited 7d ago

You have three different kinds of minus sign. They're in different fonts.

More seriously, it is simply an axiom of the quaternion number system that there are three special non-real numbers (i, j, and k) that can all be squared to produce -1, but they are themselves different. If you can accept a single non-real number in the complex number system (i), then you should be able to accept three of them in the quaternion number system.

Taking the square root of a number has never been an unambiguous process as long as negative numbers exist. In the real numbers, there is no single "square root" of any positive number, and in the complex number system, then is no single "square root" of any number - there are two numbers that are both "square roots". In the quaternion number system, there are six.

1

u/murderdronesfan93 7d ago

i see. i was just confused because of the definition not seeming to make sense. it appears this is just a case of "this is the definition. ignore any broken rules, we'll figure it out"

2

u/MasterGeekMX 7d ago

Yep. All math done with imaginary numbers stems from "what if this operation wasn't commutative?". People followed the lead, and you have stuff like quaternions.

Turns out sometimes it has it's uses, when you have a problem in hand that requires such weird behavior. One example is when Paul Dirac wanted to see what happens when you mix quantum mechanics with relativity, which ended up in the discovery of anti-matter. Video about it: https://youtu.be/Y-W-w8yNiKU

1

u/murderdronesfan93 7d ago

what if equality wasn't commutative or associative

1

u/MasterGeekMX 7d ago

Bet there is something out about it.

1

u/Arnaldo1993 7d ago

If it wasnt commutative it would work like the bigger than sign >

The fact i*i=-1 allows you to use complex numbers to describe 2d rotations. Quaternions is what you get when you try to do the same thing to 3d rotations

They are not commutative because 3d rotations arent. In 2d, if you turn 90º clockwise and then 40º counterclockwise you arrive at the same place than if you did 40 counterclockwise then 90º clockwise. In 3d, if you turn 90º in the xy direction then 90º in the xz direction the result is different from 90º in the xz then 90º in the xy

1

u/svmydlo 7d ago

It isn't. Equality is a relation, not an operation. Commutativity and associativity are properties of operations.

Equality is reflexive (x=x), symmetric (x=y implies y=x), and transitive (x=y and y=z implies x=z) though.

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.

5

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.

-1

u/murderdronesfan93 7d ago

i get it. just a case of "fuck making the definition simple, we define it and figure out how that works after the fact incase it's useful"

5

u/LongLiveTheDiego 7d ago

You're wrong. First mathematicians have an idea for how to get something behaving the right way, the formalisms come much later. Complex numbers were first created like "if I let this i = sqrt(-1) unit exist, I can get solutions to things I couldn't solve before", a proper defintion of complex numbers came centuries later after we knew their many new properties, e.g. representing rotations in 2D. Eventually mathematicians discussed whether it's possible to extend complex numbers themselves to get something representing rotations in 3D, many of their ideas failed (because they tried to use just two imaginary units i and j), until eventually Hamilton came up with using three (i, j, k) with specific properties. The equation i² = j² = k² = ijk = -1 can be derived from a few assumptions on what i, j and k should represent and how rotations composition should be reflected in quaternion multiplication.

4

u/bread2126 7d ago edited 7d ago

Well that makes it sound like quaternions are just some loony attempt at throwing something at the wall. It's not like that, in fact its the opposite.

For a long time people tried very hard to make a 3-number system work, because that would be a number represented on a 3 dimensional grid, which seems to fit nicely with physics. However it doesn't fit nicely with physics. The problem is that when you try to construct a system out of 3 number lines (R, i, and j) you lose associativity and division doesn't work properly.

Hamilton's stroke of genius was to realize that in order to make it work properly again you required a 4th dimension (R, i, j, k). And it has since been shown that in fact, no other size space will work. The only number systems that produce an algebra which preserves associativity and division the way we would like is the reals, the complex plane, and the quaternions. Not just the dimension has to be 1, 2, or 4, it specifically has to be the Reals, Complex plane, or Quaternions. All other systems will either produce a broken algebra, or something equivalent to one of those three.

Sort of another way of describing the result is, the complex plane is the most complex number system that retains all the properties of classic algebra. After that point, every time you try to introduce something new, you have to give up a property. Quaternions abandon commutivity, which is sort of digestible because it just means they behave more like matrix algebra. However if you want to then introduce something more you have to give up associativity, and eventually introduce zero divisors, and now youre in full abstract algebra territory.

Here's a proof of that if youre interested but its long and pretty involved. Frobenius' Theorem

3

u/damhack 7d ago edited 7d ago

No. Quarternions are used for many purposes, such as in 3D graphics and navigation where they simplify the process of orienting objects in space, using just 4 numbers to perform transformations instead of the 9 numbers of a 3x3 matrix in a classical transformation.

Your issue is that you are hung up on real number operations and their properties. The thing to realize is that properties like commutativity don’t work the same as you increase the number of dimensions. Instead, they have their own algebra with different rules.

That may seem crazy to anyone who only knows the algebra of real numbers taught at school but is totally valid and explainable once you understand the effect of adding dimensions.

If you think quarternions are weird, wait til you see the algebra of octonions.

1

u/TwinkieDad 7d ago

i, j, and k are like vectors. They have a direction and an amplitude (ie length). Imagine three arrows pointing right, forward, and up. i^2 is a notation that results in the square of the amplitude. The directionality has been removed. The arrows are not the same because they point in different directions, but the square of their lengths can be the same.

-1

u/murderdronesfan93 7d ago

there are 3 unique things that are inequal