Pythagorean Theorem Calculator

Enter any two sides of a right triangle to calculate the missing side, area, perimeter, and all angles. Includes a visual SVG diagram and step-by-step solution. Based on the formula a² + b² = c².

Enter exactly two of the three values. Leave one field empty and the calculator will solve for it.

Adjacent to right angle
Adjacent to right angle
Opposite the right angle
Side a
Side b
Side c (hypotenuse)
Area
Perimeter
Angles
a b c

Key Features

Solve for Any Missing Side

Enter any two of the three sides of a right triangle and the calculator instantly computes the missing one using the Pythagorean theorem. Whether you need the hypotenuse from two known legs, or a leg when the hypotenuse and one leg are given, the tool detects which value is missing and applies the correct formula. It handles both integer and decimal inputs with high precision, and warns you immediately if the input is geometrically impossible, such as a leg that is longer than the specified hypotenuse. The calculation runs entirely in your browser so results appear without any server delay.

Complete Triangle Properties

Beyond finding the missing side, every calculation also provides the triangle's area using the formula (a times b) divided by 2, the perimeter by summing all three sides, and both non-right angles computed via inverse trigonometric functions. Angle A is found using arctan(a/b) and Angle B using arctan(b/a), with results displayed in degrees for easy interpretation. These additional properties save you from having to perform separate calculations and give you a complete picture of the right triangle in a single step. All values are rounded to a sensible number of decimal places for clarity.

Visual SVG Triangle Diagram

A labeled SVG diagram updates in real time to reflect the calculated triangle. The diagram shows all three sides with their computed lengths and marks the right angle clearly, giving you a visual confirmation that the numbers make sense. The proportional rendering adjusts to the ratio of the sides so you can see at a glance whether the triangle is nearly isosceles or highly elongated. The SVG format ensures the diagram looks crisp on any screen resolution, from high-density mobile displays to large desktop monitors, and it loads instantly without any external image files.

Step-by-Step Solution

Every computation comes with a detailed walkthrough showing the exact formula used, the substitution of your values, the intermediate arithmetic, and the final answer. Whether you are solving for the hypotenuse or a leg, the steps clearly show how the Pythagorean equation is rearranged and evaluated. This breakdown is invaluable for students learning geometry, teachers preparing worked examples, and professionals who need to verify their calculations. The step display uses color highlighting on key values so you can quickly scan the solution and confirm each stage.

Step-by-Step Guide

  1. Enter two of the three values: side a, side b, or hypotenuse c. Leave the unknown field empty.
  2. Click the Calculate button to instantly see the missing side along with area, perimeter, and angles.
  3. Review the SVG triangle diagram, which updates to reflect the calculated values with labeled sides and the right angle marker.
  4. Expand the step-by-step solution below the results to see the full mathematical working, including the formula, substitution, and simplification.
  5. Click Clear to reset all fields and start a new calculation.
Pro Tip

Pythagorean triples like 3-4-5, 5-12-13, and 8-15-17 are integer solutions that appear frequently in real life. Construction workers use the 3-4-5 rule to verify right angles — measure 3 feet on one wall, 4 on the other, and the diagonal should be exactly 5 feet.

Common Mistake

Applying the Pythagorean theorem to non-right triangles. It only works when one angle is exactly 90 degrees. For other triangles, you need the Law of Cosines: c² = a² + b² − 2ab·cos(C).

Understanding the Pythagorean Theorem

The Pythagorean theorem is one of the most fundamental and widely recognized results in all of mathematics. It describes the relationship between the three sides of a right-angled triangle: the sum of the squares of the two shorter sides, known as legs, equals the square of the longest side, known as the hypotenuse. Written algebraically, this relationship is expressed as a² + b² = c², where a and b represent the legs and c represents the hypotenuse, which is always the side directly opposite the 90-degree angle.

Although the theorem carries the name of the ancient Greek mathematician Pythagoras, who lived around 570 to 495 BCE, the underlying principle was known to earlier civilizations. Babylonian clay tablets dating to approximately 1800 BCE contain lists of Pythagorean triples, indicating that Mesopotamian scribes understood the relationship long before the Greek formalization. Ancient Indian mathematicians documented the theorem in the Sulba Sutras, and Chinese mathematicians described it in texts associated with the Zhou Bi Suan Jing. The theorem has been independently discovered or rediscovered across multiple cultures, underscoring its universal mathematical significance.

Hundreds of distinct proofs of the Pythagorean theorem have been cataloged over the centuries, more than any other theorem in mathematics. Some of the most elegant include the geometric rearrangement proof, where four copies of the same right triangle are arranged inside a square to show that the areas match the algebraic identity. Euclid's own proof, found in Book I of the Elements, uses the construction of squares on each side and demonstrates equal areas through congruent triangles. Algebraic proofs, proofs by similar triangles, and even a proof contributed by the 20th president of the United States, James A. Garfield, all demonstrate the theorem's validity through different mathematical perspectives.

The real-world applications of the Pythagorean theorem are vast and span many fields. In construction and carpentry, builders use the 3-4-5 rule to verify that corners are perfectly square. Surveyors rely on the theorem to calculate distances across terrain that cannot be measured directly. Navigation systems, including GPS, apply the principle in distance computations. Computer graphics engines use it to calculate pixel distances and vector magnitudes. Architects, engineers, physicists, and game developers all use the theorem daily, making it one of the most practically useful results in mathematics. This calculator automates the process so you can focus on applying the result rather than performing the arithmetic by hand.

Practical Applications

General Contractor

A contractor verifies that foundation corners are perfectly square using the 3-4-5 rule. Measuring 3 feet along one wall, 4 feet along the adjacent wall, and confirming the diagonal is exactly 5 feet ensures the building will be structurally sound.

Land Surveyor

A surveyor calculates the straight-line distance between two elevation points on a hillside. Knowing the horizontal distance and vertical rise, the Pythagorean theorem gives the actual slope distance needed for property boundary records.

High School Geometry Student

A student solving homework problems uses the step-by-step breakdown to understand how to find the hypotenuse and verify their manual calculations. The visual triangle diagram reinforces the geometric relationship between the three sides.

Frequently Asked Questions

What is the Pythagorean theorem?

The Pythagorean theorem states that in any right triangle, the square of the hypotenuse (the side opposite the right angle) equals the sum of the squares of the other two sides. The formula is a² + b² = c², where c is the hypotenuse and a and b are the two legs. This relationship allows you to find any missing side when the other two are known. For example, if a = 3 and b = 4, then c = √(9 + 16) = √25 = 5. The theorem is named after the Greek mathematician Pythagoras, though evidence shows the concept was understood by Babylonian, Indian, and Chinese mathematicians centuries earlier. It is a cornerstone of Euclidean geometry and forms the basis for distance calculations in coordinate systems, trigonometric identities, and many engineering formulas.

Does the Pythagorean theorem only work for right triangles?

Yes, the standard Pythagorean theorem (a² + b² = c²) applies exclusively to right triangles, which are triangles containing exactly one 90-degree angle. For triangles that are not right-angled, you need the Law of Cosines, a generalized version of the theorem: c² = a² + b² − 2ab cos(C), where C is the angle opposite side c. When C is exactly 90 degrees, cos(C) equals zero, and the Law of Cosines reduces to the Pythagorean theorem. If C is less than 90 degrees (acute triangle), c² is less than a² + b². If C is greater than 90 degrees (obtuse triangle), c² is greater than a² + b². So the Pythagorean theorem can also be used as a test: if a² + b² equals c², the triangle is right-angled.

What are Pythagorean triples?

Pythagorean triples are sets of three positive integers (a, b, c) that exactly satisfy a² + b² = c². The smallest and most famous triple is (3, 4, 5), since 9 + 16 = 25. Other common examples include (5, 12, 13), (8, 15, 17), (7, 24, 25), and (20, 21, 29). Any integer multiple of a Pythagorean triple is itself a valid triple, so (6, 8, 10) and (9, 12, 15) also work. Primitive triples, where the three numbers share no common factor greater than one, can be generated using the formula a = m² − n², b = 2mn, c = m² + n², where m and n are positive integers with m greater than n. Pythagorean triples are used in number theory, cryptography, and practical construction because they guarantee exact right angles without requiring irrational numbers.

How is the Pythagorean theorem related to the distance formula?

The distance formula used in coordinate geometry is a direct application of the Pythagorean theorem. To find the distance between two points (x1, y1) and (x2, y2) on a plane, you form a right triangle where the horizontal leg has length |x2 − x1| and the vertical leg has length |y2 − y1|. The straight-line distance between the two points is the hypotenuse of this right triangle, calculated as d = √((x2 − x1)² + (y2 − y1)²). This formula is fundamental to analytic geometry, computer graphics, and geographic information systems. Every time a mapping application calculates the straight-line distance between two locations, it is essentially applying the Pythagorean theorem to coordinate differences.

Can the Pythagorean theorem be extended to three dimensions?

Yes, the three-dimensional extension calculates the diagonal of a rectangular box or the distance between two points in 3D space. The formula becomes d = √(a² + b² + c²), where a, b, and c are the lengths along the three perpendicular axes. Conceptually, you apply the Pythagorean theorem twice: first compute the diagonal of the base rectangle using two dimensions, then treat that diagonal as one leg and the height as the other leg to find the space diagonal. For two points (x1, y1, z1) and (x2, y2, z2), the distance is d = √((x2−x1)² + (y2−y1)² + (z2−z1)²). This principle extends to any number of dimensions and forms the basis of Euclidean distance in higher-dimensional mathematics, machine learning, and physics.

How do you find the angles of a right triangle from the sides?

Once all three sides of a right triangle are known, the two non-right angles can be calculated using inverse trigonometric functions. One angle is always 90 degrees by definition. For angle A, which is opposite side a, you can use A = arctan(a / b), or equivalently A = arcsin(a / c). For angle B, opposite side b, use B = arctan(b / a) or B = arcsin(b / c). The two non-right angles always sum to exactly 90 degrees because the interior angles of any triangle add up to 180 degrees. This calculator automatically computes both angles in degrees whenever a valid right triangle is determined, so you get the complete geometric description without needing to perform the inverse trig calculations yourself.

Is this Pythagorean theorem calculator free to use?

Yes, this calculator is completely free, requires no registration or login, and imposes no usage limits. Every calculation runs entirely in your browser using JavaScript, meaning no data is sent to any server and your inputs remain private on your device. The tool works on desktops, laptops, tablets, and smartphones with any modern web browser. You can bookmark this page for instant access whenever you need to solve right triangle problems for homework, construction projects, surveying, engineering, or any other purpose. After the initial page load, the calculator functions offline since all computations are performed locally.

Related Tools

Sources & References