Where was the Pythagorean theorem first used?

The Pythagorean theorem was first used by the ancient Greeks in the 6th century BC. It was used to calculate the lengths of the sides of right triangles.