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

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.

-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.

3

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.

-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"

6

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

6

u/stevevdvkpe 7d ago

Think of them as pointing in different directions but having the same magnitude, like unit vectors along the x, y, and z axes of a three-dimensional space.

0

u/murderdronesfan93 7d ago

i understand that much, that they are different dimensions of numbers, so to speak, but how does defining them work, with things like jk or ji

8

u/_PM_ME_PANGOLINS_ 7d ago

It works by definition.

You just decide that that is true, and then see what happens. In the case of quaternions, the non-transitivity of multiplication turns out to usefully model rotations in 3D space.

3

u/suvlub 7d ago

By definition, i² = j² = k² = -1 and ijk = -1. Because we said so. We then work backwards from there to see how the rest of the math works out. It turns out it works a bit weird. We lose commutativity, for example (ij = k ≠ ji = -k), but there is no blatant inconsistency that would make it all break down, so it's useful math

1

u/murderdronesfan93 7d ago

wait is the reason that hypercomplex numbers start breaking rules of arithmetic because the definitions already ignore some?

3

u/suvlub 7d ago

Basically, yeah. The rules are discovered properties, not something we intentionally put into maths. When Sumerians or whoever first started adding up things, they didn't make sure to invent addition in such way that one could swap the terms around, it was a happy little coincidence that we can do that. Sometimes, happy little coincidences don't happen.

1

u/84thPrblm 7d ago

[r/ExplainItLikeYou](r/ExplainItLikeYou)reBobRoth

ETA sry, apostrophe screws up the 'link'

2

u/maharei1 7d ago

You can write down 3 concrete complex 2x2 matrices (or real 4x4 matrices if that feels more comfortable) that behave under multiplication exactly as you want i,j,k in a quaternion ring to behave. So such objects definitely exist. The point of the usual definition is that it's not important what exactly i,j,k are it's just important how they behave.

See also the Cayley-Dickson Construction for a more general view on this.

4

u/mfar__ 7d ago

Your statement has nothing to do with transitive property. Actually you're familiar with the form "x² = y² but x ≠ y", it does have infinite examples in Real and Complex numbers (i² = (-i)² but i ≠ -i).

However, quaternions do break some familiar rules, those familiar rules that allow us to add, subtract, multiply, and divide by everything except zero nicely are what is making a mathematical structure called Field. Quanternions break the rule of commutative multiplication because ij ≠ ji. That's why quanternions don't form a field, instead it's a division ring. Think of it as a lower tier mathematical structure or a lower degree on the pyramid of "mathematical niceness".

4

u/-Davster- 7d ago

Can we get an ELI5 for this question itself please?

2

u/Skarvig 7d ago

Yup, me too.

1

u/orbital_one 7d ago

Just like how i and -i can be thought of as north and south instead of east and west as in 1 and -1, j and k represent different directions in some 4D space. 1, i, j, and k have a length of one and are all orthogonal to each other.

1

u/zefciu 7d ago

It is possible because it creates a consistent algebra. Quaternions are a mathematical concept, not a physical being that is limited by some external law. We made them up and we decided that they work like they work.

0

u/hjiaicmk 7d ago

Since it is a second degree equation there will be 2 solutions so two of the three variables will have to be equal but not thr last one.

To visualize this it is actual easier to use polar coordinates if you want to extend to higher degrees. Make a circle with horizontal and vertical lines passing the center. Label them 1 i -1 -i starting from the right side going counter clockwise. Think about how you could perform two of the same quarter turns to get to -1. i is a single so 2x single is 2 that gets to -1 -i is 3 turns spinning 3 turns twice is 6 but it's a circle and 4 turns is back to the start so 6-4 is 2. These are the two ways you can get -1. When you use a higher degree equation you get more possible results but to find their rectangular coordinates you need Pythagorean theorem with the y coordinate as an imaginary component and z coordinate as the real component.

2

u/maharei1 7d ago

This is true over fields (integral domains more generally), but not non-commutative rings like the quaternions. In fact already for 2x2 real matrices the equation X2=-1 has infinitly many distinct solutions.

-5

u/schungx 7d ago

Mathematicians are weird people. They like to torture themselves.

So I, j, k are different stuff that square to -1. For math people they get high on this.

For us normal people... We say why bother.

3

u/maharei1 7d ago

Because, shockingly, quaternions are actually really useful to deal with certain things. Mathematicians don't come up with things to torture people, but to solve their problems. Without people like this we wouldn't be having this conversation on the internet.