If you want to know how I came up with the WHERE clause, it's from Pythagoras:

http://mathworld.wolfram.com/PythagoreanTheorem.html