If you are a game developer then you probably use the dot product every day. It seems to be the one tool that solves nearly every problem.
This post isn’t to tell you what the dot product is or why and when you should use it in a video game (there must be 1000’s of tutorials online if you don’t know about it), but to show something that can be overlooked (or completely ignored) when using it.
Pythagoras theorem and the dot product are the same thing.
We all know that…
a2 + b2 = c2
when a our triangle is a right triangle, and we all know that…
x1 * x2 + y2 * y2 = 0
when our 2 vectors are perpendicular.
But if we re-state Pythagoras in vector form and do a little math then we find that our 2 equations are the same.
So there it is, it was sitting right there all along. Did you know? Was it obvious? I certainly don’t have all that algebra in my head when i’m using the dot product. I don’t believe i’ve ever seen any game development books or tutorials or state the dot product in this way (or even mention that it is related). They blurb it out and tell you to use it and it’s so ubiquitous that you don’t give a second thought to how it arrived.
In fact, here are the first 5 hits from google about “the dot product”
None of these links make mention of Pythagoras theorem. They all have reasonable explainations but this fact seems to be overlooked. So whether you think about the dot product as the projection of 2 vectors, the multiplication of 2 vectors or the cosine of an angle of 2 vectors, keep in mind what it really is.
The inspiration from this post comes from a video by Norman Wildberger video on Linear Algebra. His videos provide a fresh look at some old maths and are all well worth watching, check them out.