(Math) Beating Pythagoras...
I have watched countless YouTubers and their science videos. One thing they all have in common is the word they keep throwing at their audience:
"Albert Einstein".
It is a free word to use, but it somehow bring in revenues.
In mathematics, we have a similar word: "Pythagoras". Remember him from preschool math? He figured out some great geometry calculations. The most known, and extremely useful, is the Pythagorean theorem.
It goes something like this:
A right-angled triangle's longest side (called the hypotenuse) length times itself, equals the length of the other two sides of that same triangle times themselves, added together.
Longest side * Longest side = First side * First side + Second side * Second side
Pretty clever stuff that YouTubers and school teachers love to teach. But what if you one day say you have beaten that equation? What if you stand up to history, and all those revenues, and simply call your equation something silly, like, I don't know.... Dot? Yea, let's go with Dot.
Pythagorean theorem is a special case in a much larger (and way more powerful) algorithm, that works in any dimension. It is called: Dot product.
A silly name, not having as much punch to it to get you anywhere on YouTube.
Let's just see why we need Pythagorean theorem first, so we understand why it is so important. Units and ratios.
You know that a unit is simply, a thing. You can have this many units of "something". In math, we can say that 1 times "something" is one unit. Or maybe 1 "something". Once we have that defined, we can scale it to any quantity of something by multiply it by that number of quantity.
1 * 5 = 5.
1 "something" * 5 = 5 "something".
You can even go so far to divide one using with a completely different unit, and get a new unit:
1 kilometer / 1 hour = 1 kilometer/hour (a unit called kilometer per hour, which acts as a derived unit for both speed and velocity).
Pythagorean theorem is used to find the length of a distance. That distance, divided by its length becomes a unit of that very distance. It is a distance that has a direction, and is scalable to any distance!
For example, if you have a distance of 5. And the length of that distance is also 5, you will get 1 if you take 5 divided by 5. 1 is in this instance the unit! Sound stupid? Yes, but imagine if you have a distance of 10, and the length of it is....... 5? Well, you will know that the unit is 2. Imagine that the unit's name for 1 is bananas and the unit's name for 2 is oranges. Well, you can scale those units up by the numbers you want! If you want 300 oranges, well, 2 * 300 will give you 300 oranges. With distances, they sure have more than just a length. They have a direction! And it is not so easy to find the unit of a direction, so we can figure out the direction itself.
We need to use a mathematical function called the Square Root together with Pythagorean theorem, to find the length like that. I will get into that later.
But then we have ratios. When you start dividing one side of a right-angled triangle with another side, you will get a ratio. If you for example, take the horizontal (adjacent) side of a right-angled triangle and divide it by the hypotenuse (the longest side), you will get a ratio, which is called the Cosine. There is also a mathematical function called the Cosine of an Angle.
We all know Angles. We use them all the time. So is Angle a unit or a ratio? I know that Angles are dimensionless. In daily tasks you measure angles using degrees, but in the real world, mathematicians use a unit called Radians. I won't use Radians, or even angles, so don't worry!
Anyways, let's get back to the main problem at hand. We have a 4-dimensional world, and we need to measure the distance between two objects in that world. What do we do?
Well, if it was a 2-dimensional world, we could use Pythagorean theorem? But we don't. We live in a 3-dimensional world, and so did Pythagoras. However, what about our 4-dimensional world? We need that distance!
Let's use Cartesian coordinate system: X is the horizontal axis. Y is perpendicular to X (vertical axis). Z is perpendicular to both X and Y. Now we just need a 4th dimension, and let's just say it is called W. So W is perpendicular to all X, Y, and Z. This is outside what our reality can see, and thus, you will never ever be able to imagine it, no matter how hard you try.
Dot product solves our problem, for any dimensions, even the ones we can't imagine. That's how complicated it is. It is the most difficult equation you will ever read about.
Nah, just kidding. It is very simple:
Dot product = X * X + Y * Y + Z * Z + W * W.
That is it. To make it more readable:
Dot product = (X * X) + (Y * Y) + (Z * Z) + (W * W).
That is for any dimension, so for 2-dimensions, you have:
Dot product = (X * X) + (Y * Y).
Doesn't it look a lot like Pythagorean theorem? One side times itself plus the other side times itself? And since X is perpendicular to Y, it is basically a right-angled triangle.
Of by the way, before we move on, let's just talk a short moment about vectors. A vector is a direction and a length, in any dimension. Fine? It is important to understand that a vector is a value for each dimension, to make up the direction and length combined. In 2-dimensions, you could see the hypotenuse as an angle for its direction, and the length being its length. But as a vector, we don't need that angle at all! We just say that X is that many units away from origin, and Y is that many units away from origin, and origin is the start position for that vector. We then have the length and direction all covered!
So what is Dot product, and what can we use it for? Well, except for finding the length of the hypotenuse of a right-angled triangle, we can find the length of any distance in any dimension. Sound good right?
First, let's explain what Dot product is. It is not a unit! It is a "scalar". It is like that thing you multiply with a unit to get units. Like 1 "something" times 5..... The 5 in this case is a scalar.
It is a scalar of exactly 2 vectors! One vector Dot another vector. Both vectors must have the same number of dimensions!
The result for Dot Product is: The length of the first vector times, the length of the second vector times, the Cosine of the Angle between them.
This is extremely powerful, since the answer is the length of both vectors (something we don't know!), and the cosine ratio of the angle between them (which we also don't know!), and by that, also the angle (magical!).
Dot product gives us the answers to 3 (or 4) things, with just very fast multiplications and additions calculations that anyone can do! If you ever wonder why Matrix-math seems so similar to this, then you know that Dot product is involved there as well!
So back to Pythagoras. What he couldn't see was that his complex ideas that took him his own life time to figure out, only got 1 answer out of Dot Product's 3. And only for 2-dimensions in a 3-dimensional world. Kinda sad when you think about it? Imagine the day when Albert Einstein gets beaten by something as simple, and with a simple name as well? All those poor YouTubers, I feel for them!
So the special case of Pythagorean theorem. Since he is using the same vector twice, he will get the answer from Dot product: The length of the first vector times, the length of that same vector, times the Cosine of the Angle between them which is 1 since the angle of two equal vectors is 0.
The answer is then, the length times the length times 1. You need a way to find the length, so you must divide the product with 1 (for the Cosine part) which does nothing, and then divide that product with the length of the first vector (which you don't know, but you know it is the square) so you will use Square Root to get the answer.
An example:
A 1-dimensional vector's real length = 5, and the Cosine of the Angle between that same vector is 1:
5 * 5 * 1 = 25.
You want to know that 5 is the length, but how do you get 5 from 25? Look up Square Root if you don't know what it is. Pythagoras used Square Root as well.
So, Dot product works very well for many thing. Such as finding if a vector is intersecting another vector and at what distance (the intersection point), and if a vector is facing another vector or not by just looking at the sign from the result of the Cosine. Also, Cosine in itself is directly useful for calculating how much light is reflected off of a surface, if you know the light's vector, and the normal (perpendicular vector) of the surface. If you want the angles, you need to use the ArcCosine math function which translates the ratio back to the angle in Radians, and you can translate Radians into Degrees.
Dot product is also used for projection. You can project a 2D shadow from a 3D object. If you want to project a vector onto another vector, you just need to find the length of the first vector (using Dot product on itself and Square Root the result, divide that result off every dimension for that vector), which makes it a unit vector, and then Dot product that unit vector with the other vector to project it along that vector's direction directly. At least that's how much I can store in my head right now.
Dot product is not completely alone in this world. There is another important one called Cross product, which results in a perpendicular vector, which is required to find those normals I was talking about in the section above. Cross product is almost too magical to imagine, so let's not. Cross product doesn't work in 2-dimensions so Pythagoras didn't stand a chance!
And that's a story you can tell your math teacher! "How I beat Pythagoras". YouTube video pending since I mentioned Einstein twice, money!!
- 4
5 Comments
Recommended Comments
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Join the herd!Sign in
Already have an account? Sign in here.
Sign In Now