HOME Mathematics Computer Science
Pythagorean Theorem
Pythagorean Theorem

Right Triangles
  • A right triangle, or right-angled triangle, is a triangle in which one of the corners has an angle of 90o
  • For example:
  • To show that it is a 90o angle we add a little square in the corner:
    This is also called a 'right angle'
  • The longest side of the triangle is always the one opposite the right angle. This side is called the 'hypotinuse':
Pythagorean theorem
  • The pythagorean theorem can be used to find the length of the hypotinuse given the length of the other two sides.
  • if a, b, and c are the length of the three sides:
  • The pythagorean theorem states that:
    c2 = a2 + b2
Example
  • if a = 4 and b = 3, calculate the length of c
  • Using the pythagorean theorem, we know that:
  • Now we just solve for c:
Finding other sides
  • We can also use the pythagorean theorem to find the length of any side, given that we know the other two.
  • For example: if a = 8 and c = 10, calculate the length of b
  • Using the pythagorean theorem, we know that:
  • Now we solve for b:
Code
import math

a = 4
b = 3
c = math.hypot(a, b)

print(c) # prints: 5
Related