http://www.fredonia.edu/faculty/math/JonathanCox/math/SumOfSquares/SumOfSquares.html