The Law of Cosines is genuinely best understood as a direct generalization of the Pythagorean theorem, extending that famous right-triangle-only relationship to work for any triangle at all — and seeing exactly how the extra term appears, and why it vanishes precisely in the right-triangle case, clarifies why the two formulas are so closely related rather than being separate, unrelated facts to memorize independently.
The Law of Cosines states c² = a² + b² - 2ab·cos(C), where C is the angle included between sides a and b, and c is the side opposite that angle. Compare this directly to the Pythagorean theorem's a² + b² = c² — the Law of Cosines is identical, with one additional term: -2ab·cos(C). This extra term is exactly what accounts for the included angle not necessarily being a right angle. When C is exactly 90°, cos(90°) equals exactly zero, making that entire extra term vanish, and the Law of Cosines collapses precisely into the ordinary Pythagorean theorem — not an approximation or a coincidental match, but an exact, guaranteed reduction, confirming the Law of Cosines is genuinely the more general relationship, with the Pythagorean theorem as its special case.
Understanding what happens for angles other than 90° reveals why the correction term has the specific sign and behavior it does. For an acute included angle (less than 90°), cosine is positive, making the -2ab·cos(C) term subtract from a²+b² — meaning the resulting side c comes out shorter than the Pythagorean-theorem prediction would give for the same a and b, which makes geometric sense: a triangle 'pinched' at a sharper-than-90° angle has its opposite side pulled in shorter than the right-angle case. For an obtuse included angle (greater than 90°), cosine is negative, making that same term effectively add to a²+b² instead — the opposite side stretches out longer than the right-angle case would predict, again matching the geometric intuition that a wider, more 'open' included angle pushes the opposite side further away.
The Law of Cosines is one of two classical tools (alongside the Law of Sines) that together let you solve for any missing side or angle in any triangle, given enough known information — collectively called 'solving a triangle.' The Law of Cosines specifically handles two genuinely important cases: finding a third side given two sides and their included angle (exactly what this calculator does), and finding any angle given all three sides (a related rearrangement of the same formula, solving for cos(C) instead of c directly). The Law of Sines, by contrast, is generally the more convenient tool when you know a side and its opposite angle together with one other piece of information — the two laws complement each other, covering different starting-information scenarios rather than being redundant alternatives.
Practically, the Law of Cosines shows up constantly in navigation, surveying, and engineering contexts specifically because real-world triangular measurement problems very often don't hand you a convenient right angle to work with. A surveyor measuring two known distances from a fixed point to two separate landmarks, along with the angle between those two sightlines (measured directly with an instrument), can find the direct distance between the two landmarks using exactly this formula, without needing either landmark to be positioned at a right angle from the surveyor's position — a genuinely common, practical scenario the Pythagorean theorem alone simply couldn't handle, precisely because most real-world triangular measurement setups aren't conveniently right triangles to begin with.



