Law of Cosines Calculator

Complete trigonometry guide • Step-by-step solutions

\( c^2 = a^2 + b^2 - 2ab\cos(C) \)

The Law of Cosines relates the lengths of the sides of a triangle to the cosine of one of its angles. It generalizes the Pythagorean theorem to any triangle, not just right triangles. This formula allows you to find the third side of a triangle when you know two sides and the included angle, or to find an angle when you know all three sides.

Key applications include:

  • Finding missing sides in oblique triangles
  • Determining angles in triangles
  • Solving navigation and surveying problems
  • Engineering and physics calculations

When angle C = 90°, cos(C) = 0, and the Law of Cosines reduces to the familiar Pythagorean theorem: c² = a² + b². This makes it a versatile tool for solving any triangle, whether acute, right, or obtuse.

Law of Cosines Explained

What is the Law of Cosines?

The Law of Cosines is a fundamental theorem in trigonometry that relates the lengths of the sides of a triangle to the cosine of one of its angles. Unlike the Pythagorean theorem, which only applies to right triangles, the Law of Cosines applies to any triangle. It's particularly useful for solving oblique triangles (triangles that are not right triangles) when you know certain combinations of sides and angles.

The Law of Cosines Formula

The Law of Cosines states that for any triangle with sides a, b, c and opposite angles A, B, C respectively:

\(c^2 = a^2 + b^2 - 2ab\cos(C)\)

Or equivalently:

  • \(a^2 = b^2 + c^2 - 2bc\cos(A)\)
  • \(b^2 = a^2 + c^2 - 2ac\cos(B)\)

When to Use the Law of Cosines
1
SAS (Side-Angle-Side): When you know two sides and the included angle.
2
SSS (Side-Side-Side): When you know all three sides of the triangle.
3
Alternative to Law of Sines: When the Law of Sines leads to ambiguous cases.
Triangle Properties

Key characteristics of triangles solved with the Law of Cosines:

  • Angle Sum: A + B + C = 180° for any triangle
  • Relationship: Larger sides are opposite larger angles
  • Special Case: When C = 90°, cos(C) = 0, reducing to Pythagorean theorem
  • Obtuse Triangles: When cos(C) is negative, angle C is obtuse
Solution Methods
  • Direct Application: Apply the formula when you have SAS or SSS
  • Rearrangement: Rearrange the formula to solve for angles: cos(C) = (a² + b² - c²) / (2ab)
  • Verification: Use the Law of Sines to verify calculated angles
  • Area Calculation: Use Heron's formula or area = ½ab sin(C)

Law of Cosines Fundamentals

Standard Form

c² = a² + b² - 2ab cos(C), where a, b, c are sides and C is the angle opposite side c.

Law of Cosines Formula

\(c^2 = a^2 + b^2 - 2ab\cos(C)\)

Where a, b, c = sides of triangle, C = angle opposite side c.

Key Rules:
  • Applies to any triangle
  • Requires 3 known elements
  • Works for SAS and SSS cases

Applications

Triangle Properties

Used for oblique triangles, navigation, surveying, and engineering problems.

Real-World Uses
  1. Surveying distances
  2. Navigation calculations
  3. Engineering structures
  4. Physics and astronomy
Considerations:
  • Angle must be between known sides
  • Always verify triangle inequality
  • Check for obtuse angles
  • Round appropriately for measurements

Law of Cosines Learning Quiz

Question 1: Multiple Choice - Basic Application

In triangle ABC, side a = 8, side b = 6, and angle C = 60°. What is the length of side c?

Solution:

Using the Law of Cosines: c² = a² + b² - 2ab cos(C)

Given: a = 8, b = 6, C = 60°

Step 1: Calculate cos(60°) = 0.5

Step 2: Substitute values: c² = 8² + 6² - 2(8)(6)cos(60°)

Step 3: c² = 64 + 36 - 96(0.5) = 100 - 48 = 52

Step 4: c = √52 ≈ 7.21

The answer is B) 7.21.

Pedagogical Explanation:

The Law of Cosines is particularly useful when we have two sides and the included angle (SAS case). This is exactly what we have here: sides a and b, and the angle C between them. The formula c² = a² + b² - 2ab cos(C) allows us to find the third side directly. Notice how the Law of Cosines generalizes the Pythagorean theorem: when angle C is 90°, cos(90°) = 0, and the formula reduces to c² = a² + b².

Key Definitions:

Law of Cosines: Relates sides and angles in any triangle

SAS Case: Two sides and included angle known

Included Angle: The angle between two known sides

Important Rules:

• c² = a² + b² - 2ab cos(C) (when C is between sides a and b)

• cos(60°) = 0.5

• Always take the positive square root for side length

Tips & Tricks:

• Remember: the angle in the formula is between the two known sides

• Double-check your cosine value (especially for common angles)

• The result should make sense compared to the known sides

Common Mistakes:

• Using the wrong angle in the formula (not the included angle)

• Forgetting to subtract 2ab cos(C) instead of adding

• Using the Law of Sines instead of Cosines when you have SAS

Question 2: Finding an Angle

A triangle has sides of length 7, 10, and 12. Find the measure of the angle opposite the side of length 12. Round to the nearest tenth of a degree.

Solution:

We'll use the rearranged Law of Cosines to find an angle: cos(C) = (a² + b² - c²) / (2ab)

Given: a = 7, b = 10, c = 12 (where C is opposite side c)

Step 1: Substitute values: cos(C) = (7² + 10² - 12²) / (2×7×10)

Step 2: cos(C) = (49 + 100 - 144) / 140 = 5 / 140 = 1/28

Step 3: C = arccos(1/28) ≈ 87.9°

Therefore, the angle opposite the side of length 12 is approximately 87.9°.

Pedagogical Explanation:

When we know all three sides of a triangle (SSS case), we can use the Law of Cosines to find any angle. We rearrange the formula to solve for the cosine of the angle: cos(C) = (a² + b² - c²) / (2ab). This version is particularly useful because it allows us to find an angle when all sides are known. The angle found is always the one opposite to the side whose length appears in the numerator as the subtracted term.

Key Definitions:

SSS Case: All three sides of a triangle are known

Opposite Side: The side across from a given angle

Arccosine: The inverse cosine function (cos⁻¹)

Important Rules:

• cos(C) = (a² + b² - c²) / (2ab) when C is opposite side c

• Always check that the angle is between 0° and 180°

• The largest angle is opposite the longest side

Tips & Tricks:

• Remember: the angle you're finding is opposite the side in the denominator

• Double-check your arithmetic when calculating (a² + b² - c²)

• Use a calculator for the arccosine function

Common Mistakes:

• Mixing up the order of sides in the formula

• Forgetting to divide by 2ab in the denominator

• Getting a domain error because of incorrect arithmetic

Question 3: Word Problem - Navigation

A ship travels 15 km east, then turns and travels 20 km in a direction that forms a 120° angle with its original course. How far is the ship from its starting point? Round to the nearest tenth of a kilometer.

Solution:

Step 1: Model as a triangle with sides a = 15 km, b = 20 km, and included angle C = 120°

Step 2: Use Law of Cosines: c² = a² + b² - 2ab cos(C)

Step 3: Calculate cos(120°) = -0.5

Step 4: Substitute: c² = 15² + 20² - 2(15)(20)cos(120°)

Step 5: c² = 225 + 400 - 600(-0.5) = 625 + 300 = 925

Step 6: c = √925 ≈ 30.4 km

Therefore, the ship is approximately 30.4 km from its starting point.

Pedagogical Explanation:

This is a classic navigation problem that demonstrates the practical application of the Law of Cosines. The ship's journey forms a triangle where we know two sides (the distances traveled) and the angle between them. The key insight is recognizing that the angle of 120° is the interior angle of the triangle formed by the ship's path. When dealing with obtuse angles (like 120°), remember that cos(120°) is negative, which adds to the sum of squares rather than subtracting.

Key Definitions:

Navigation Problem: Real-world scenario involving distances and directions

Interior Angle: The angle inside the triangle formed by the paths

Obtuse Angle: An angle greater than 90° but less than 180°

Important Rules:

• cos(120°) = -0.5 (negative for obtuse angles)

• When cos(C) is negative, 2ab cos(C) becomes addition

• The Law of Cosines works for any angle between 0° and 180°

Tips & Tricks:

• Draw a diagram to visualize the triangle formed by the paths

• Pay attention to whether the angle is acute or obtuse

• Remember that cos(angle) is negative for obtuse angles

Common Mistakes:

• Forgetting that cos(120°) is negative

• Adding instead of subtracting 2ab cos(C) when cos(C) is negative

• Misidentifying the angle between the two known sides

Question 4: Application-Based Problem - Structural Engineering

An engineer needs to determine the length of a support beam for a triangular roof truss. Two sides of the triangle measure 12 feet and 16 feet, and the angle between them is 75°. Calculate the length of the third side (the support beam). Also determine if this angle makes the triangle acute, right, or obtuse.

Solution:

Using the Law of Cosines with a = 12, b = 16, and C = 75°:

Step 1: Calculate cos(75°) ≈ 0.2588

Step 2: Apply formula: c² = 12² + 16² - 2(12)(16)cos(75°)

Step 3: c² = 144 + 256 - 384(0.2588) = 400 - 99.38 ≈ 300.62

Step 4: c = √300.62 ≈ 17.34 feet

For the classification: Since C = 75° < 90°, this is an acute angle. To confirm the entire triangle is acute, we'd need to check all angles, but knowing one angle is acute doesn't guarantee the triangle is acute.

The support beam should be approximately 17.34 feet long.

Pedagogical Explanation:

This engineering application shows how the Law of Cosines is used in construction and structural design. When designing triangular supports, engineers often know two sides and the angle between them, making the Law of Cosines the perfect tool. The classification of triangles as acute, right, or obtuse is important for structural integrity. A triangle is acute if all angles are less than 90°, right if one angle is exactly 90°, and obtuse if one angle is greater than 90°.

Key Definitions:

Roof Truss: Framework of beams supporting a roof structure

Support Beam: Structural element providing support in a framework

Acute Triangle: All angles are less than 90°

Important Rules:

• cos(75°) ≈ 0.2588 (positive for acute angles)

• Triangle classifications depend on all angles

• The Law of Cosines is essential in structural engineering

Tips & Tricks:

• For common angles like 75°, use calculator for precise cosine value

• In engineering, always round to appropriate precision for construction

• Consider safety factors in real-world applications

Common Mistakes:

• Using the wrong angle in the formula (not the included angle)

• Approximating cosine values too roughly for precision work

• Confusing triangle classification with individual angle classification

Question 5: Multiple Choice - Triangle Classification

In triangle ABC, side lengths are a = 7, b = 10, and c = 12. Which of the following statements about angle C (opposite to side c) is correct?

Solution:

Using the Law of Cosines rearranged to find the angle: cos(C) = (a² + b² - c²) / (2ab)

Given: a = 7, b = 10, c = 12

Step 1: cos(C) = (7² + 10² - 12²) / (2×7×10) = (49 + 100 - 144) / 140 = 5/140 = 1/28

Step 2: cos(C) = 1/28 ≈ 0.0357

Step 3: Since cos(C) > 0, angle C is acute (less than 90°)

Step 4: C = arccos(1/28) ≈ 87.9°

The answer is A) C is acute, measuring less than 90°.

Pedagogical Explanation:

We can determine if an angle is acute, right, or obtuse by examining the sign of its cosine value. If cos(C) > 0, then C is acute (between 0° and 90°). If cos(C) = 0, then C is right (exactly 90°). If cos(C) < 0, then C is obtuse (between 90° and 180°). In this case, since we got cos(C) = 1/28 ≈ 0.0357 > 0, the angle is acute. This is consistent with the fact that in any triangle, the largest angle is opposite the longest side, but as long as the triangle inequality holds, all angles can be acute.

Key Definitions:

Acute Angle: An angle less than 90°

Right Angle: An angle exactly 90°

Obtuse Angle: An angle greater than 90° but less than 180°

Important Rules:

• cos(C) > 0 → C is acute

• cos(C) = 0 → C is right

• cos(C) < 0 → C is obtuse

Tips & Tricks:

• Just by comparing cos(C) to 0, you can classify the angle

• The longest side is always opposite the largest angle

• Use the rearranged Law of Cosines to find angles efficiently

Common Mistakes:

• Confusing the sign of cosine with angle classification

• Forgetting that cos(90°) = 0

• Making calculation errors in the numerator (a² + b² - c²)

FAQ

Q: When should I use the Law of Cosines instead of the Law of Sines?

A: The Law of Cosines is preferred in two specific scenarios:

1. SAS (Side-Angle-Side): When you know two sides and the included angle (the angle between those sides). For example, if you know sides a and b, and the angle C between them, use: c² = a² + b² - 2ab cos(C).

2. SSS (Side-Side-Side): When you know all three sides of the triangle and want to find an angle. In this case, rearrange the formula: cos(C) = (a² + b² - c²) / (2ab).

The Law of Sines works best for ASA (Angle-Side-Angle) or AAS (Angle-Angle-Side) situations. The Law of Cosines is also preferred when you encounter the ambiguous case (SSA) with the Law of Sines, as it provides a definitive answer.

Q: How does the Law of Cosines relate to the Pythagorean theorem?

A: The Law of Cosines is actually a generalization of the Pythagorean theorem. When we examine the Law of Cosines formula:

c² = a² + b² - 2ab cos(C)

In a right triangle where angle C = 90°, we know that cos(90°) = 0. Substituting this into the formula:

c² = a² + b² - 2ab cos(90°)

c² = a² + b² - 2ab × 0

c² = a² + b²

This is precisely the Pythagorean theorem! So the Law of Cosines extends the Pythagorean theorem to work with any triangle, not just right triangles. The term "-2ab cos(C)" acts as a correction factor that adjusts for the deviation from a right angle.

About

Math Team
This calculator was created with AI and may make errors. Consider checking important information. Updated: Jan 2026.