EN

Solve Any Triangle (Law of Sines & Cosines)

To solve a triangle means finding all three sides and all three angles from three sufficient known values. The method depends on what is known: the law of cosines when an angle is flanked by two known sides, the law of sines when a side is flanked by two known angles. The "two sides and a non-included angle" case is special: depending on the values, it can have no triangle, exactly one, or two — the page detects and shows this ambiguous case automatically.

What is known about the triangle

Three known sides

Known data

Two sides and the angle between them

Known data

Two angles and the included side

Known data

Two sides and a non-included angle (ambiguous case)

Known data
ABCcab
Sample diagram (demonstration values). It redraws with the triangle entered after the calculation.

Technical terms marked with an asterisk are collected in the glossary.

SSS: three sides, law of cosines first

To solve a triangle* is to recover every side and every angle from three independent pieces of data. Three sides — SSS — are enough, provided they satisfy the triangle inequality: each side strictly shorter than the sum of the other two. 2, 3 and 10 never close. 5, 6 and 7 do.

The law of cosines* turns the three lengths into angles:

cos A = (b² + c² − a²) / (2bc)

Then A = arccos(…). Repeat at B. Angle C is 180° − A − B, which also checks the arithmetic. A cosine that comes out negative is an obtuse angle; the formula does not mind. This page clamps the argument of arccos into [−1, 1] so rounding cannot invent a cosine of 1.0002 on a flat-looking triangle.

Area is not required to solve SSS, but it comes free: Heron’s formula from the three sides, or ½ab sin C once an angle is known. The triangle area and perimeter calculator is built around that first route.

SAS: two sides and the included angle

Two sides and the angle sitting between them: SAS. The law of cosines gives the third side at once.

a² = b² + c² − 2bc · cos A

A is the included angle, the one at the vertex where b and c meet. After a is known, the configuration is SSS and the remaining angles follow as above. Starting with the law of sines here is possible but clumsier: the angle opposite a known side is not yet known.

If A = 90°, cos A = 0 and the line collapses to Pythagoras. SAS is therefore the general case of “two legs and the corner between them,” right-angled or not. An included angle of 180° or 0° is not a triangle; the form rejects those.

ASA and AAS: two angles and a side

Two angles determine the third, because A + B + C = 180°. A side anywhere then scales the triangle. ASA puts the known side between the two known angles; AAS puts it opposite one of them. Both are solved by the law of sines*:

a / sin A = b / sin B = c / sin C

On this page the ASA tab asks for A, B and the included side c. Side a is c · sin A / sin C, and likewise for b. There is no ambiguity: two angles fix the shape, the side fixes the size, and a second triangle does not hide in the data.

AAA, by contrast, does not solve a triangle. Three angles determine similarity, not congruence. Infinitely many sizes share the same corners. The form does not offer that tab, on purpose.

SSA: the ambiguous case

Two sides and a non-included angle — the angle opposite one of those sides — is the awkward configuration. US textbooks call it the ambiguous case*. Zero, one, or two triangles can match the same numbers.

Fix angle A and side b (the adjacent side). Side a is the swinging radius from the far vertex. Depending on how a compares with the altitude h = b sin A:

  • a < h — the swinging side never meets the other ray. No triangle.
  • a = h — one right triangle.
  • h < a < b, with A acute — two intersections, two triangles. One has angle B acute, the other has B′ = 180° − B.
  • a ≥ b — one triangle (the obtuse candidate at B would make A + B exceed 180°).

The law of sines produces sin B = b sin A / a. If that value exceeds 1, there is no angle B. If it equals 1, B = 90°. If it sits in (0, 1), both B and 180° − B are candidates; each is kept only when the remaining angle C stays positive. This page lists both survivors when there are two. The diagram shows the first; the table holds the second.

That is the only standard case that is not unique. SSS, SAS, ASA, AAS each give one triangle or none. SSA is the exception, and it is not rare in surveying: a measured length to an inaccessible point, plus an angle at the station, is often SSA.

Law of sines via the circumcircle

The law of sines is not a coincidence of sines. In the circumcircle of triangle ABC, of radius R, the side a subtends a central angle 2A. A chord of length a then satisfies a = 2R sin A, hence

a / sin A = 2R

The same 2R sits on the other two sides, so the three ratios are equal. That is why the law of sines also computes the circumradius once any side-angle pair is known: R = a / (2 sin A). The incircle and circumcircle page places those two circles on a drawing; the 2R relation is the same number.

An inscribed angle subtending the same arc is half the central angle, which is the geometric fact behind a = 2R sin A. Obtuse A still works: sin A is positive up to 180°, and the circumcentre then sits outside the triangle.

Law of cosines as Pythagoras with a correction

Place A at the origin and side AC along the x-axis. Then C is (b, 0) and B is (c cos A, c sin A). The distance BC is side a:

a² = (b − c cos A)² + (c sin A)² = b² + c² − 2bc cos A

because cos² A + sin² A = 1. If A = 90°, the cosine term drops and Pythagoras remains. If A is acute, cos A > 0 and a² is smaller than b² + c²: the third side is shorter than the right-angled guess. If A is obtuse, cos A < 0, the minus sign flips, and a² is larger than b² + c².

So the law of cosines is Pythagoras plus a signed correction 2bc cos A. That is the useful mental picture: not a different theorem, an extra term that knows whether the included angle is sharp or blunt.

Area from two sides and the included angle

Half base times height, with the height equal to c sin A when the base is b:

Area = ½ · b · c · sin A

A has to be the included angle. A different corner gives a different product. At 90° the sine is 1 and the right-triangle rule ½bc is recovered. This page prints that area for every solved triangle, using two sides and the angle between them after the missing pieces have been filled in.

Two vectors with an angle between them are the same formula. The magnitude of the cross product in the plane is bc sin A; half of that is the triangle they span. SAS is therefore the natural input for an area, just as SSS is the natural input for Heron.

Right triangles as a shortcut, not a different geometry

A right triangle is SAS or SSS with one angle already 90°. The shortcuts are the definitions:

  • sin θ = opposite / hypotenuse
  • cos θ = adjacent / hypotenuse
  • tan θ = opposite / adjacent

Pythagoras gives the third side if two sides are known. The two acute angles add to 90°, so one of them determines the other. None of that contradicts the general laws: the law of sines becomes a / 1 = hypotenuse, because sin 90° = 1, and the law of cosines at the right angle is Pythagoras. The special case is faster by hand. It is not a second theory.

On this solver, feeding a right angle as the included angle in SAS is enough. The remaining output will show 90° at that vertex and the two acute complements.

Surveying, navigation, and triangulation

Triangulation is the law of sines in the field: two angles measured from the ends of a baseline of known length, then the distances to an inaccessible point. That is ASA. A third station checks the closing angle.

A surveyor who tapes two sides and the included corner is doing SAS and the law of cosines. A navigator who has two distances (say from two radio beacons) and an angle at the ship that is not between those two lines may be in SSA, and should expect a second possible position until another observation kills one of them.

Great-circle work on the great-circle distance page is spherical trigonometry, a cousin rather than a substitute. Plane triangle solving is the local chart: a few kilometres of ground, a building site, a small harbour. The trigonometry hub gathers both.

Mixing up included versus opposite

The usual mix-up is to feed SSA data into a SAS formula, or the reverse. The law of cosines wants the angle between the two sides that appear in 2bc cos A. The law of sines pairs each angle with the side opposite it. Labelling the triangle — a opposite A, b opposite B — is not pedantry; it is the whole notation.

Degrees versus radians is the other regular fault. This form converts through the unit selector. A calculator left in radian mode, fed 45, treats 45 rad, not 45°. The sine of 45 rad is not √2/2. The angle sum 180° is a check: three angles that add to 3.14 were probably in radians and then labelled as degrees, or the other way around.

For SSA, skipping the second candidate is the remaining trap. sin B = 0.5 yields 30° and also 150°. Both may be legal. Listing only 30° is an unfinished solution.

AAA does not pin down a unique triangle

Similar triangles share angles. They do not share size. A 30-60-90 triangle of hypotenuse 2 and another of hypotenuse 200 have the same corners and different sides. Three angles, with no length, leave a free scale factor. That is why the solver never offers AAA as a tab, and why a drawing labelled only with angles cannot yield a unique perimeter.

Given two angles, the third is known, and the shape is known. One side is then enough — which is exactly ASA or AAS. The missing ingredient in AAA is that one length.

Rounding angles that should sum to 180°

Displayed angles of 44.42°, 57.12° and 78.46° add to 180°. Displayed angles of 44.4°, 57.1° and 78.5° add to 180.0° after ordinary rounding, or 180.0° with a 0.1° wobble if each was rounded independently the wrong way. A sum of 179.8° or 180.2° on a three-decimal printout is almost always that wobble, not a broken identity.

This page computes C as π − A − B in radians, so the internal sum is exact up to floating point. The displayed values are rounded for reading. Re-adding the printed figures is a check of the display, not of the solver. When a hand calculation disagrees in the second decimal of an angle, the usual cause is an intermediate cosine rounded too early, before arccos.

Sides have the same issue at a smaller scale. SSS input 5, 6, 7 produces angles that, converted back through the law of sines, recover those sides to the displayed precision. A millimetre tape and a half-degree theodolite will not close as tightly; the geometry is still the same pair of laws.

Glossary

Solve a triangle
Find all three sides and all three angles from three sufficient known values. The standard congruent cases are SSS, SAS, ASA and AAS. SSA may yield zero, one, or two triangles.
Law of cosines
a² = b² + c² − 2bc cos A, and the two cyclic versions. It generalizes Pythagoras (recovered when A = 90°) and is the natural first step for SSS and SAS.
Law of sines
a / sin A = b / sin B = c / sin C = 2R, where R is the circumradius. Natural first step for ASA, AAS, and SSA.
Ambiguous case (SSA)
Two sides and a non-included angle. Because sine is not one-to-one on (0°, 180°), an acute supplementary angle may produce a second legal triangle. The page lists both when both exist.

Related calculators