Law of Cosines
Law of Cosines
An equation relating the cosine of an interior angle and the lengths of the sides of a triangle.
Note: The Pythagorean theorem is a corollary of the law of cosines.

See also
Key Formula
c2=a2+b2−2abcos(C)
Where:
- a = Length of one side of the triangle
- b = Length of another side of the triangle
- c = Length of the side opposite angle C
- C = The interior angle between sides a and b
Worked Example
Problem: In triangle ABC, side a = 5, side b = 7, and the included angle C = 60°. Find the length of side c.
Step 1: Write down the Law of Cosines with the known values substituted in.
c2=52+72−2(5)(7)cos(60°)
Step 2: Compute the squares and the product. Recall that cos(60°) = 0.5.
c2=25+49−2(5)(7)(0.5)
Step 3: Simplify the right-hand side. The product 2 × 5 × 7 × 0.5 equals 35.
c2=74−35=39
Step 4: Take the square root to find c.
c=39≈6.24
Answer: Side c ≈ 6.24 units.
Another Example
This example uses the Law of Cosines in reverse—finding an unknown angle instead of an unknown side. It also illustrates the connection to the Pythagorean theorem: when the angle is 90°, the cosine term vanishes and the formula reduces to a² + b² = c².
Problem: A triangle has sides a = 8, b = 6, and c = 10. Find angle C (the angle opposite the side of length 10).
Step 1: Start with the Law of Cosines and solve for cos(C).
c2=a2+b2−2abcos(C)⟹cos(C)=2aba2+b2−c2
Step 2: Substitute the known side lengths.
cos(C)=2(8)(6)82+62−102=9664+36−100
Step 3: Simplify the numerator and the fraction.
cos(C)=960=0
Step 4: Find the angle whose cosine is 0.
C=cos−1(0)=90°
Answer: Angle C = 90°. This confirms the triangle is a right triangle (since 6² + 8² = 10²).
Frequently Asked Questions
When do you use the Law of Cosines instead of the Law of Sines?
Use the Law of Cosines when you know two sides and the included angle (SAS) or all three sides (SSS). The Law of Sines is better suited for situations where you know two angles and a side (AAS or ASA) or two sides and a non-included angle (SSA). If you try to use the Law of Sines in an SAS or SSS case, you won't have enough information to set up the proportion.
How is the Law of Cosines related to the Pythagorean theorem?
The Pythagorean theorem is a special case of the Law of Cosines. When angle C equals 90°, cos(90°) = 0, so the term −2ab cos(C) disappears entirely. The formula then simplifies to c² = a² + b², which is exactly the Pythagorean theorem. This is why the Pythagorean theorem is called a corollary of the Law of Cosines.
Can the Law of Cosines give a negative value for cos(C)?
Yes. If the angle C is obtuse (greater than 90°), then cos(C) is negative. This makes the −2ab cos(C) term positive, which increases c². A negative cosine value simply means the angle opposite that side is obtuse, and the formula handles it correctly without any special adjustments.
Law of Cosines vs. Law of Sines
| Law of Cosines | Law of Sines | |
|---|---|---|
| Formula | c² = a² + b² − 2ab cos(C) | a/sin(A) = b/sin(B) = c/sin(C) |
| Use when you know | Two sides and the included angle (SAS), or all three sides (SSS) | Two angles and a side (AAS/ASA), or two sides and a non-included angle (SSA) |
| What it finds | A missing side or any angle | A missing side or a missing angle |
| Ambiguous case? | No — always gives a unique answer | Yes — the SSA case can produce 0, 1, or 2 valid triangles |
| Special case connection | Reduces to the Pythagorean theorem when the angle is 90° | No direct connection to the Pythagorean theorem |
Why It Matters
The Law of Cosines appears throughout trigonometry, precalculus, and physics courses whenever you need to solve oblique (non-right) triangles. It is essential in navigation, surveying, and engineering for calculating distances and angles that cannot be measured directly. Many standardized tests—including the SAT and ACT—include problems that require the Law of Cosines, especially in SAS and SSS triangle scenarios.
Common Mistakes
Mistake: Placing the cosine term on the wrong angle. For example, writing c² = a² + b² − 2ab cos(A) instead of cos(C).
Correction: The angle inside the cosine must always be the angle opposite the side you are solving for (or the side on the left of the equation). Side c is opposite angle C, side a is opposite angle A, and so on.
Mistake: Forgetting to subtract the 2ab cos(C) term — accidentally adding it instead.
Correction: The formula has a minus sign: c² = a² + b² − 2ab cos(C). If the angle is obtuse, cos(C) is already negative, and the double negative will increase c² automatically. Do not change the sign yourself.
Related Terms
- Pythagorean Theorem — Special case when the angle is 90°
- Law of Sines — Alternative rule for solving triangles
- Cosine — Trigonometric function used in the formula
- Triangle — The geometric figure the law applies to
- Interior Angle — The angle variable C in the formula
- Side of a Polygon — The side lengths a, b, c in the formula
- Equation — The law is expressed as an equation
- Corollary — Pythagorean theorem is a corollary of this law
