Lesson goal: The Pythagorean Theorem

Previous: Square roots and the distance formula | Home | Next: Finding Pythagorean Triples

A use of the square root in math is in the Pythagorean theorm, which allows you to find the length of a side of a right triangle, if you know the length of the other two sides. The theorem states that $$c^2=a^2+b^2$$ given that $c$ is the side of the right triangle opposite to the right angle. The other two sides, $a$ and $b$ are the "legs" of the right triangle.

In this lesson, we'll see if you can program in the pythagorean theorem and have the computer calculate the length of the hypotenuse of a right triangle, given that you know the other two sides.

Now you try. Use the print statement to find the length of hypotenuse of other right triangles.

Type your code here:

See your results here:

Do you agree that the default code here will find the hypotenuse given two legs of length 5 and 3? Try finding the length of the hypotenuse for a variety of right triangle legs. Dismiss.
Show a friend, family member, or teacher what you've done!

Here is a share link to your code:

Does your code work? Want to run it on your iPhone?

Here's your code:

  1. Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.

  2. Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into this page

  3. Then click the "Use on iPhone" button that you'll see.