The law of cosines includes −2ab cos(C) because the two sides do not usually meet at a right angle. Their shared direction changes the distance between their endpoints. The subtraction term accounts for that alignment. When the included angle is 90°, its cosine is zero and the formula becomes the Pythagorean theorem.
This lesson explains where the correction comes from rather than asking you to memorize it. We will place a triangle on a coordinate grid, expand its distance formula, and interpret the result for acute and obtuse angles. The geometry and trigonometry hub connects the reasoning with related triangle tools.
Which Angle Belongs In The Law Of Cosines?
The angle C is the included angle between sides a and b, and side c lies opposite it. These labels work together. If you change which side is unknown, you must also identify the angle opposite that side and the two sides meeting at that angle.
Imagine two rigid segments attached at one endpoint. One has length a and the other length b. The third side connects their free endpoints. Opening or closing the angle between the attached segments changes the third side even though a and b remain fixed.
OpenStax states the law of cosines for non-right triangles as the squared-side relationship used here. Positive side lengths and a nondegenerate triangle are required. In the included-angle setup, that means 0° < C < 180°.
The formula’s arrangement is not tied to particular letters printed in a diagram. You may rotate the triangle or rename its vertices. What matters is preserving the relationship: the angle between two known sides belongs with the unknown side opposite it.
How Can Coordinates Show The Triangle’s Geometry?
Place the shared endpoint O at (0, 0), then place the endpoint A of side a at (a, 0). The endpoint B of side b has coordinates (b cos(C), b sin(C)). Its horizontal component is b cos(C), and its vertical component is b sin(C).
This placement does not restrict the triangle’s shape. You can move and rotate a triangle without changing its side lengths or angles. Putting one side on the horizontal axis simply makes the distance between the other endpoints easier to write.
Side c connects A and B. The horizontal difference between them is a − b cos(C), and the vertical difference has magnitude b sin(C). Squaring those components avoids any need to guess a correction from the appearance of a sketch.
For an obtuse C, the horizontal coordinate of B is negative. The point then lies to the left of O. The expressions still work because cosine carries that sign. We do not need a separate formula for the obtuse case.
Where Does The Subtraction Term Come From?
The term −2ab cos(C) appears when you square the horizontal difference a − b cos(C). The distance formula gives c² = (a − b cos(C))² + (b sin(C))². Expanding the first square produces a cross term, and that cross term is the law’s correction.
- Expand the horizontal square: a² − 2ab cos(C) + b² cos²(C).
- Add the vertical square: b² sin²(C).
- Group the b² terms: b²[cos²(C) + sin²(C)].
- Use cos²(C) + sin²(C) = 1.
- Obtain c² = a² + b² − 2ab cos(C).
Nothing was added to repair an incorrect Pythagorean calculation. We used the Pythagorean distance formula on perpendicular coordinate components from the start. The correction appears because the horizontal component is a difference involving the projection of side b.
A common expansion error is writing (u − v)² as u² − v². The correct expansion is u² − 2uv + v². Losing the middle term would erase the angle information and make every triangle behave as though its included angle were a right angle.
Why Does The Correction Change With The Angle?
The correction changes because cosine describes how much the sides point in a shared horizontal direction. For an acute angle, cos(C) is positive and the formula subtracts a positive quantity. For an obtuse angle, cos(C) is negative, so subtracting the correction adds a positive quantity.
At a right angle, cos(90°) = 0. The entire correction vanishes, leaving c² = a² + b². This connects the general law directly with the Pythagorean theorem proof, rather than treating the two formulas as unrelated rules.
A larger included angle spreads the free endpoints farther apart. The opposite side grows as C moves from 0° toward 180°, with a and b fixed. The formula expresses that geometric change through cosine instead of through a separate case-by-case measurement.
How Do Acute And Obtuse Examples Compare?
Keep a = 5 and b = 7, then compare included angles of 60°, 90°, and 120°. This isolates the angle’s effect. The squared side sum remains 25 + 49 = 74, while 2ab = 70. Only the cosine factor changes across the three examples.
An Acute Included Angle
For C = 60°, cos(C) = 1/2. Thus c² = 74 − 70(1/2) = 39. The side is c = √39, approximately 6.245. The positive cosine reduces the squared distance below 74, as the geometric interpretation predicts.
A Right Included Angle
For C = 90°, c² = 74 because the cosine term is zero. Therefore, c = √74, approximately 8.602. This is the familiar right-triangle result for perpendicular sides of lengths 5 and 7.
An Obtuse Included Angle
For C = 120°, cos(C) = −1/2. Therefore, c² = 74 − 70(−1/2) = 109. The side is c = √109, approximately 10.440. Subtracting a negative quantity increases the squared distance, matching the wider opening.
The law of cosines calculator can check these calculations. Keep the square roots as exact answers when appropriate, then round the displayed side lengths at the end. A rounded cosine used too early can slightly change the result.
What Limits Must The Opposite Side Satisfy?
For positive sides a and b and an included angle strictly between 0° and 180°, the opposite side satisfies |a − b| < c < a + b. The endpoints correspond to flattened, degenerate arrangements rather than ordinary triangles. The law of cosines is consistent with these geometric limits.
As C approaches 0°, cosine approaches 1, and c² approaches (a − b)². As C approaches 180°, cosine approaches −1, and c² approaches (a + b)². With sides 5 and 7, every valid result must therefore lie strictly between 2 and 12.
The three calculated lengths satisfy that check. If your result were 15, you would know something was wrong before inspecting each arithmetic step. The triangle inequality lesson explains the side-length requirement as its own geometric question.
How Can You Find An Angle From Three Sides?
Rearrange the same law to obtain cos(C) = (a² + b² − c²)/(2ab), then use inverse cosine to find C. First check that the three positive side lengths form a triangle. A calculator’s inverse function does not turn an impossible side set into valid geometry.
For a = 5, b = 7, and c = √39, the quotient is (25 + 49 − 39)/70 = 1/2. Inverse cosine gives 60°. The angle is opposite c and between a and b, so the recovered result matches the original setup.
The inverse-cosine input must lie between −1 and 1. Do not silently replace an invalid quotient with a boundary value to hide impossible measurements. A tiny rounding issue in otherwise valid data is different from sides that fail the triangle inequality.
For example, sides 5, 7, and 15 cannot form a triangle because 5 + 7 is less than 15. The proposed cosine would be (25 + 49 − 225)/70 = −151/70, below −1. This is a warning about the input geometry, not a request to use a more advanced calculator.
You can also check an angle’s type without calculating its exact degree measure. The denominator 2ab is positive, so the sign of a² + b² − c² determines the sign of cosine. A positive numerator means an acute opposite angle, zero means a right angle, and a negative numerator means an obtuse opposite angle, provided the sides form a valid triangle.
Which Setup Errors Should You Check First?
Check the included angle and calculator angle mode before troubleshooting the arithmetic. If C is written in degrees, use degree mode or convert it correctly to radians. Entering 60 as radians does not represent a 60° angle, even though the calculator can evaluate its cosine.
Two sides and their included angle provide the side-angle-side setup used above. Three valid sides provide the side-side-side setup for the inverse formula. Two sides with a nonincluded angle do not automatically give a unique triangle; do not relabel that angle just to fit the expression.
Finally, take the positive square root when solving for a length and retain the correct units. The proof’s key idea is the shared projection: subtracting its cross term accounts for the angle between the sides. That is why the law works beyond right triangles.