In mathematics, the Pythagorean theorem or Pythagoras' theorem is a relation in Euclidean geometry among the three sides of a right triangle. The theorem is named after the Greek mathematician Pythagoras, who by tradition is credited with its discovery and proof, although knowledge of the theorem almost certainly predates him. The theorem is known in China as the "Gougu theorem" (勾股定理) for the (3, 4, 5) triangle.
In any right triangle, the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (the two sides other than the hypotenuse).
If we let c be the length of the hypotenuse and a and b be the lengths of the other two sides, the theorem can be expressed as the equation
This equation provides a simple relation among the three sides of a right triangle so that if the lengths of any two sides are known, the length of the third side can be found. A generalization of this theorem is the law of cosines, which allows the computation of the length of the third side of any triangle, given the lengths of two sides and the size of the angle between them. If the angle between the sides is a right angle it reduces to the Pythagorean theorem.