Engineering

Pythagorean Theorem to Law of Sines and Cosines: Solving Any Triangle

The Pythagorean theorem only works on right triangles. The law of cosines works on any triangle — and collapses into the Pythagorean theorem exactly at 90°.

Pythagorean Theorem to Law of Sines and Cosines: Solving Any Triangle

Pythagorean Theorem to Law of Sines and Cosines: Solving Any Triangle

The Pythagorean theorem is often taught as one fact and the law of cosines as an entirely different one. They’re not separate — the law of cosines is the general case, and the Pythagorean theorem is exactly what it reduces to the moment one angle happens to be 90°. Here’s the full relationship, plus the one genuinely tricky case worth knowing about before you trust an answer.

The Pythagorean Theorem: Right Triangles Only

a² + b² = c² relates the two legs and hypotenuse of a right triangle — and only a right triangle. It’s one of the oldest documented mathematical relationships: the Old Babylonian tablet known as Plimpton 322 (circa 1900–1600 BCE) already records Pythagorean triples over a thousand years before Pythagoras himself was born. Solve for the hypotenuse or either leg, with steps, area, and a diagram, using the Pythagorean Theorem Calculator.

The Law of Cosines: The General Version

c² = a² + b² − 2ab·cos(C) works for any triangle, right or not. Set the angle C to exactly 90°, and cos(90°) = 0 — the entire last term vanishes, and the formula collapses precisely into the Pythagorean theorem. It’s not a coincidence or an approximation; the Pythagorean theorem is simply the special case of the law of cosines at a right angle.

C = 90°: a²+b²=c² C≠90°: c²=a²+b²-2ab·cosC

The right triangle isn't a special formula — it's the law of cosines with the last term erased

The history spans centuries: geometric propositions equivalent to the law of cosines already appear in Euclid’s Elements (circa 300 BCE), covering both acute and obtuse triangles, though without trigonometric notation. The first explicit trigonometric statement came from Persian mathematician Jamshīd al-Kāshī in his 1427 treatise The Key to Arithmetic — which is why some traditions still refer to it as al-Kāshī’s theorem. Solve any triangle — from SSS, SAS, ASA, AAS, or SSA input — with the Law of Sines & Cosines Calculator.

The Law of Sines: For When You Have Angles

a/sin(A) = b/sin(B) = c/sin(C) relates every side to the sine of its opposite angle. It’s generally the faster tool when you already know two angles and a side (ASA or AAS), rather than two sides and an included angle.

The Ambiguous Case (SSA): Where Things Get Tricky

Give the law of sines two sides and a non-included angle (SSA), and something genuinely different happens: the same input can produce zero, one, or two valid triangles. The cause is a basic trig fact — sin(θ) = sin(180° − θ) — so solving for an angle via the law of sines can have both an acute and an obtuse solution that satisfy the same equation equally well.

SOLUTION 1 SOLUTION 2 Same given side and angle, two valid triangles

If the computed sine falls outside [-1, 1], zero triangles exist instead

Practically: if the required sine value falls outside the range [−1, 1], no triangle exists at all. Otherwise, you may need to check both the acute angle and its obtuse supplement to see whether each produces a valid, consistent triangle. This is exactly why the Law of Sines & Cosines Calculator includes explicit ambiguous-case detection rather than silently returning just one answer.

Choosing the Right Method

Given Information Best Method
Right triangle, two sides known Pythagorean theorem
Two sides + included angle (SAS), or all three sides (SSS) Law of Cosines
Two angles + any side (ASA or AAS) Law of Sines
Two sides + a non-included angle (SSA) Law of Sines — check the ambiguous case

For a uniquely determined triangle from SSS, SAS, ASA, or AAS input, the Triangle Calculator solves all sides, angles, area, and perimeter directly with a labeled diagram.

Beyond the Triangle Itself

Solving a triangle usually rests on more basic relationships too: complementary, supplementary, and vertical angles, handled by the Angle Calculator. When a triangle’s vertices are given as coordinates rather than sides and angles, compute distance, midpoint, and slope directly with the Coordinate Geometry Calculator. Once a triangle (or any 2D shape) is fully solved, get its area and perimeter with the Area and Perimeter Calculator.

Frequently Asked Questions

When can I use the Pythagorean theorem instead of the law of cosines?
Only when the triangle has a genuine right angle — the Pythagorean theorem is exactly the law of cosines with its correction term removed at 90°, so it doesn’t apply to any other angle.

Why does SSA sometimes give two answers?
Because sin(θ) equals sin(180° − θ), solving for an angle from a side-side-angle setup can satisfy both an acute and an obtuse solution, and both may correspond to a genuinely valid triangle.

Is the law of cosines really a generalization of the Pythagorean theorem?
Yes, exactly — setting the angle to 90° in the law of cosines makes the −2ab·cos(C) term vanish entirely, leaving exactly a² + b² = c².

Who actually discovered the Pythagorean relationship first?
The Old Babylonian tablet Plimpton 322 (circa 1900–1600 BCE) already records Pythagorean triples more than a thousand years before Pythagoras was born, though the theorem carries his name in Western tradition.

When should I use the law of sines instead of the law of cosines?
Use the law of sines when you have two angles and a side (ASA or AAS); use the law of cosines when you have two sides and the included angle (SAS) or all three sides (SSS).

Start with the Pythagorean Theorem Calculator for right triangles, and the Law of Sines & Cosines Calculator or Triangle Calculator for any other case. Handle basic angle relationships with the Angle Calculator, work from coordinates with the Coordinate Geometry Calculator, and finish with the Area and Perimeter Calculator.

External Resources