Skip to main content
trigonometrycalculatorguide

Law of Cosines Calculator: Formula, Steps, and Worked Examples

·9 min read·Solvify Team

A law of cosines calculator finds a missing side or angle in any triangle when the Law of Sines doesn't apply — specifically for SAS (two sides and the included angle) and SSS (three sides) cases where no pair of opposite side-angle values exists. This guide works through both formula directions by hand — solving for a missing side and solving for a missing angle — with full worked examples, an answer check for each, and the mistakes that most often break a law of cosines calculation.

What Is the Law of Cosines, and When Does a Law of Cosines Calculator Apply?

The Law of Cosines relates the three sides of a triangle to the cosine of one of its angles, extending the Pythagorean theorem to triangles that aren't right triangles. A law of cosines calculator is the right tool whenever you have two sides and the included angle (SAS) or all three sides (SSS) — the two triangle cases where the Law of Sines has no matching side-angle pair to start from. The side form of the formula is a² = b² + c² − 2bc cos A, where a is the side opposite angle A, and b and c are the other two sides. Set b = c and A = 90° and the −2bc cos A term drops to zero, leaving a² = b² + c² — the Pythagorean theorem is just the Law of Cosines at a right angle. Every worked example below builds on that same relationship.

a² = b² + c² − 2bc cos A — solve for a missing side when you know two sides and the included angle.

How Do You Rearrange the Law of Cosines to Solve for an Angle?

When all three sides are known but no angle is given (the SSS case), the side form of the Law of Cosines can be rearranged to solve directly for any angle instead.

1. Start from the side form

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

2. Isolate the cosine term

2bc cos A = b² + c² − a², obtained by adding 2bc cos A to both sides and subtracting a² from both sides.

3. Divide to solve for cos A

cos A = (b² + c² − a²) ÷ (2bc). Apply the inverse cosine (arccos) to this ratio to get angle A itself.

cos A = (b² + c² − a²) ÷ (2bc) — the angle form of the Law of Cosines, used whenever all three sides are known and an angle is missing.

How Do You Solve for a Missing Side Using the Law of Cosines?

Here's a complete SAS example: a triangle has side b = 8, side c = 10, and the included angle A = 60°. Find the missing side a.

1. Step 1 — Write the formula

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

2. Step 2 — Substitute the known values

a² = 8² + 10² − 2(8)(10) cos 60° = 64 + 100 − 160 cos 60°.

3. Step 3 — Evaluate the cosine and multiply

cos 60° = 0.5, so 160 × 0.5 = 80. That gives a² = 64 + 100 − 80 = 84.

4. Step 4 — Take the square root

a = √84 ≈ 9.17.

5. Step 5 — Check the answer

The side opposite the 60° angle should be shorter than the longer given side (10) but comparable in size to both — 9.17 fits that range. Plugging back in: 9.17² ≈ 84.09, close enough to 84 to confirm the arithmetic (the small gap is rounding from the square root).

b = 8, c = 10, A = 60° → a² = 64 + 100 − 80 = 84 → a ≈ 9.17.

How Do You Solve for a Missing Angle Using the Law of Cosines?

Here's a complete SSS example: a triangle has sides a = 7, b = 9, and c = 12. Find angle C, the angle opposite side c.

1. Step 1 — Write the angle form for C

cos C = (a² + b² − c²) ÷ (2ab). Notice C is opposite c, so c² is the term being subtracted.

2. Step 2 — Substitute the known values

cos C = (7² + 9² − 12²) ÷ (2 × 7 × 9) = (49 + 81 − 144) ÷ 126.

3. Step 3 — Simplify the numerator and denominator

49 + 81 − 144 = −14, so cos C = −14 ÷ 126 ≈ −0.1111.

4. Step 4 — Apply the inverse cosine

C = arccos(−0.1111) ≈ 96.38°.

5. Step 5 — Check the answer

Side c = 12 is the longest side of the triangle, so its opposite angle C must be the largest angle — and 96.38° being obtuse (just past 90°) matches that expectation. A negative cosine value always signals an obtuse angle before you even run arccos, which is a useful check in itself.

a = 7, b = 9, c = 12 → cos C = −14 ÷ 126 ≈ −0.1111 → C ≈ 96.38°.

How Do You Verify a Law of Cosines Calculator Result?

A law of cosines calculator result is only as trustworthy as the check behind it. Once you've found one missing angle with the Law of Cosines, the Law of Sines gives an independent way to check the remaining angles, since all three angles of any triangle must add up to exactly 180°. Continuing the SSS example above (a = 7, b = 9, c = 12, C ≈ 96.38°), use the Law of Sines to find angle A: sin A ÷ a = sin C ÷ c, so sin A = a × sin C ÷ c = 7 × sin(96.38°) ÷ 12 ≈ 7 × 0.9938 ÷ 12 ≈ 0.5797, giving A = arcsin(0.5797) ≈ 35.42°. Then B = 180° − 96.38° − 35.42° = 48.20°. Adding all three back up — 96.38° + 35.42° + 48.20° = 180.00° — confirms every angle was computed correctly.

The three angles of any triangle always sum to 180° — use that fact to cross-check every Law of Cosines answer.

What Mistakes Should You Avoid When Using the Law of Cosines?

A handful of errors account for most incorrect law-of-cosines results, whether computed by hand or checked against a calculator.

1. Mistake 1 — Using the Law of Cosines when the Law of Sines is faster

If you have two angles and any side (AAS or ASA), or two sides and a non-included angle (SSA), the Law of Sines is the correct starting formula — the Law of Cosines is built for SAS and SSS cases specifically.

2. Mistake 2 — Forgetting the minus sign in the side formula

a² = b² + c² − 2bc cos A has a subtraction, not an addition. Adding 2bc cos A instead of subtracting it produces a completely wrong side length.

3. Mistake 3 — Matching the wrong angle to the wrong side in the angle formula

When solving cos C = (a² + b² − c²) ÷ (2ab), the letter being subtracted (c) must match the angle being solved for (C) and must be excluded from the denominator. Mixing this up gives an angle for the wrong vertex.

4. Mistake 4 — Mixing up degree and radian mode

cos 60° = 0.5, but cos of 60 radians is a completely different number. Always confirm the calculator's angle mode before evaluating any cosine or inverse cosine.

5. Mistake 5 — Not checking that cos A stays between −1 and 1

If a computed cosine value falls outside the range −1 to 1, the three given side lengths can't actually form a triangle — recheck the values before applying arccos, since arccos of an out-of-range number has no real solution.

cos A = (b² + c² − a²) ÷ (2bc) must land between −1 and 1 — if it doesn't, the triangle as given can't exist.

Practice Problems: Can You Solve These Law of Cosines Triangles?

Try each problem by hand using the appropriate form of the Law of Cosines before checking the answer.

1. Problem 1 — SAS, solve for the missing side

A triangle has b = 5, c = 7, and included angle A = 45°. Find side a. Answer: a² = 25 + 49 − 2(5)(7) cos 45° = 74 − 70(0.7071) ≈ 74 − 49.50 = 24.50, so a = √24.50 ≈ 4.95.

2. Problem 2 — SSS, solve for the largest angle

A triangle has sides a = 4, b = 6, c = 9. Find angle C (opposite the longest side). Answer: cos C = (16 + 36 − 81) ÷ (2 × 4 × 6) = −29 ÷ 48 ≈ −0.6042, so C = arccos(−0.6042) ≈ 127.16°.

3. Problem 3 — SAS with a right-angle sanity check

A triangle has b = 6, c = 8, and included angle A = 90°. Find side a. Answer: a² = 36 + 64 − 2(6)(8) cos 90° = 100 − 96(0) = 100, so a = 10 — matching the familiar 6-8-10 right triangle, since cos 90° = 0 reduces the formula to the Pythagorean theorem.

Every one of these problems reduces to the same two moves: pick the side form or angle form of the Law of Cosines, then substitute and simplify carefully.

Where Is the Law of Cosines Used in Real Problems?

The Law of Cosines isn't just a trigonometry exercise — it shows up anywhere a triangle's third side or angle needs to be found from incomplete information. Surveyors use it to calculate distances across terrain that can't be measured directly, by combining two measured distances and the angle between them. Navigation and flight planning use it to find the resulting distance and bearing when two legs of a journey are known but the direct path isn't. In physics, the same formula computes the magnitude of a resultant vector — such as combined forces or velocities — when the two component vectors and the angle between them are known, since a vector triangle obeys the exact same relationship as a geometric one.

Surveying, navigation, and vector addition in physics all rely on the same a² = b² + c² − 2bc cos A relationship covered in this guide.

How Can Solvify Help You Verify a Law of Cosines Calculation?

Once you understand the side and angle forms in this guide, Solvify's AI-powered solver can take a photo of a triangle problem — from a homework set, textbook, or trigonometry exam review — and walk through the same substitution and inverse cosine steps, so you can compare its work against your own by-hand result and catch a sign or arithmetic slip before it ends up on a graded submission.

The fastest way to build confidence with the Law of Cosines is to solve one triangle by hand and use a calculator only to verify it — not the other way around.
태그:
trigonometrycalculatorguide

지금 숙제 도움 받기

수백만 명의 학생들과 함께 AI 수학 풀이 도구를 사용하여 숙제 도움을 받으세요. 수학 문제에 대한 즉각적인 해결책, 단계별 설명 및 24/7 숙제 지원을 받으세요.

iOS 및 Android 기기에서 사용 가능