Pythagorean Theorem & Distance
I have a deep fondness for math; something that I remember so well from Geometry class in High School was the Pythagorean Theorem. This thing has been one of the most useful tools I’ve learned in my math toolbox and solved countless problems over the years. When I started programming (especially games) it became more useful than I thought. It was all the sudden easy to find distances between two tanks fighting each other, detecting if two circles or spheres have collided, and so much more. I thought that since it was so useful I’d just stick something about it here.
Pythagorean Theorem
This theorem is probably one of the most famous theorems that many children learn in school due to its very simple almost elementary song sounding formula.
The way that we prove this formula is to take 3 geometric squares and then place them to form a right triangle. First let’s take 2 of the squares and place them touching each other at the corner forming a right angle (90° angle). Now for the 3rd square you will notice that it must be a very specific size to fit connecting the other two corners of the squares together. This square will produce the hypotenuse of the right triangle. The length of the side of this square must be the sum of the squares that make up the other two sides. The following diagram may look complex with all the lines and points, but the main thing to notice is that there are 3 squares formed from each side of the right triangle. The square that is diagonal in the image is the square that makes up the hypotenuse and is the c variable in the above equation. The other 2 sides of the triangle are not explicit for which is a and which is b so you can interchange them and produce the same result due to the commutative property of addition.

Distance formula
The distance formula is a way for you to take two points and find the distance between the two points.
Now the question will be, how and why does this work? Let’s imagine that we have two points <2,3> and <6,6>, and we were to plot those onto a graph. Notice that these points are now floating around on this graph, but something you may not easily be able to notice about them is that these two points can form a right triangle. If we connect the points, we will have the hypotenuse of the right triangle. Now if we draw a line straight down the y-axis for the point <6,6> and then a line straight to the right on the x-axis for point <2,3>; the two lines will intercept and form a right triangle. Now using the Pythagorean Theorem, we could find the length of the hypotenuse (the distance between the two points). However, first we need to find the ∆s between the points. To find the delta of any value such as time, length, etc. We take the second value and subtract it from the first value. So, if I started at 2 on the x-axis and ended at 6 on the x-axis then we find the delta with 6-2(x2 - x1), which will produce the value of 4. So now we know that the length of the side of the triangle on the bottom along the x-axis is 4. If we do the same thing for the y-axis change (y2 – y1) we will get the value 3 which is the length of the side of the triangle on the side along the y-axis. Now it is a simple matter of plugging our sides a and b into the Pythagorean Theorem to find the distance between the two points. Notice that when we execute each of these steps, we can deduce the distance formula from them. That is, the square root of the sum of the sides squared (the change in x2 plus the change in y2) will equal the distance between the two points.