## Pythagoras’ Theorem

Pythagoras’ a Greek and he’s a brilliant mathematician (more of a philosopher back then) who arrived at a theorem shown as below.

The diagonal side (aka hypothenus) power 2 is the sum of horizontal and vertical side, each power by 2.

Ok, so let’s make use of it. Here’s a question. Get the length of line in image. We know the two bounding coordinates.

So its a trivial question. So here’s the answer.

This problem is frequently met so you are advised to program it into a class file for quick reference. It’s applied when we’d like to get the magnitude of a vector. Given a case where we have the following information, we should know to quickly remember Pythagoras.

Another application of it leads to collision detection. Once you have understood this fundamental, you’ve got Pythagoras!