Law of Cosines Calculator
The Law of Cosines is an indispensable tool in trigonometry that extends our ability to solve triangles beyond the limitations of right-triangle trigonometry. Its applications span numerous fields, from basic geometry to advanced engineering and scientific calculations.
Choose Calculation Method
Try These Examples:
Triangle Solution
Triangle Visualization
Law of Cosines Formulas
Finding a Side (SAS)
c² = a² + b² - 2ab cos(C)
When you know two sides and the included angle, you can find the third side.
Finding an Angle (SSS)
cos(C) = (a² + b² - c²) / (2ab)
When you know all three sides, you can find any angle.
General Form
a² = b² + c² - 2bc cos(A)
b² = a² + c² - 2ac cos(B)
The law applies to any triangle, not just right triangles.
Special Case
When C = 90°, cos(C) = 0, so:
c² = a² + b²
This reduces to the Pythagorean theorem for right triangles.
Complete Guide to the Law of Cosines
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. It's a generalization of the Pythagorean theorem that works for all triangles, not just right triangles. This powerful tool allows us to solve triangles when we know either three sides or two sides and the included angle.
The Law of Cosines Formula
For any triangle with sides a, b, c and angles A, B, C opposite to those sides respectively:
c² = a² + b² - 2ab cos(C)
Similarly:
a² = b² + c² - 2bc cos(A)
b² = a² + c² - 2ac cos(B)
Historical Background
The Law of Cosines has ancient roots, with early forms appearing in Euclid's "Elements" around 300 BCE. However, it wasn't expressed in its modern trigonometric form until the development of trigonometry in the medieval period. The law was known to ancient Greek mathematicians as a geometric relationship, but the algebraic formulation we use today emerged with the work of mathematicians like François Viète in the 16th century.
When to Use the Law of Cosines
Case 1: SSS (Side-Side-Side)
When you know all three sides of a triangle and need to find an angle:
- Use the rearranged formula: cos(C) = (a² + b² - c²) / (2ab)
- Take the inverse cosine to find the angle
- This method works for finding any of the three angles
SSS Example
Given: Triangle with sides a = 5, b = 7, c = 9
Find: Angle C
Solution:
cos(C) = (5² + 7² - 9²) / (2 × 5 × 7)
cos(C) = (25 + 49 - 81) / 70 = -7/70 = -0.1
C = arccos(-0.1) ≈ 95.74°
Case 2: SAS (Side-Angle-Side)
When you know two sides and the included angle and need to find the third side:
- Use the direct formula: c² = a² + b² - 2ab cos(C)
- Take the square root to find the missing side
- The angle must be between the two known sides
SAS Example
Given: Triangle with sides a = 6, b = 8, and included angle C = 60°
Find: Side c
Solution:
c² = 6² + 8² - 2(6)(8)cos(60°)
c² = 36 + 64 - 96(0.5) = 100 - 48 = 52
c = √52 ≈ 7.21
Relationship to Other Theorems
Connection to the Pythagorean Theorem
The Law of Cosines is a generalization of the Pythagorean theorem. When angle C is 90°, cos(C) = cos(90°) = 0, and the formula becomes:
c² = a² + b² - 2ab(0) = a² + b²
This is exactly the Pythagorean theorem, showing that the Law of Cosines encompasses right triangles as a special case.
Relationship to the Law of Sines
While the Law of Cosines is used for SSS and SAS cases, the Law of Sines is typically used for ASA (Angle-Side-Angle) and AAS (Angle-Angle-Side) cases. Together, these laws allow us to solve any triangle given sufficient information.
Step-by-Step Solution Methods
Method 1: Finding an Angle (SSS)
- Identify the known sides: Label them as a, b, and c
- Choose which angle to find: Usually start with the largest angle (opposite the longest side)
- Rearrange the formula: cos(C) = (a² + b² - c²) / (2ab)
- Substitute values: Plug in the known side lengths
- Calculate: Compute the cosine value
- Find the angle: Use inverse cosine (arccos) to get the angle
- Find remaining angles: Use the fact that angles sum to 180°
Method 2: Finding a Side (SAS)
- Identify known information: Two sides and the included angle
- Apply the formula: c² = a² + b² - 2ab cos(C)
- Substitute values: Replace variables with known measurements
- Calculate the cosine: Find cos(C) using a calculator
- Solve for c²: Complete the arithmetic
- Take the square root: c = √(result)
- Find remaining angles: Use Law of Sines or Law of Cosines
Common Applications
Navigation and Surveying
The Law of Cosines is essential in navigation for determining distances and bearings:
- GPS calculations: Finding distances between points on Earth's surface
- Triangulation: Determining unknown positions using known reference points
- Marine navigation: Calculating course corrections and distances
- Aviation: Flight path planning and navigation
Engineering and Construction
- Structural analysis: Calculating forces in triangular trusses
- Architecture: Designing triangular elements and roof structures
- Mechanical engineering: Analyzing linkages and mechanisms
- Civil engineering: Bridge design and land surveying
Physics and Astronomy
- Vector analysis: Finding resultant forces and velocities
- Orbital mechanics: Calculating planetary positions and trajectories
- Optics: Analyzing light paths and reflections
- Crystallography: Determining crystal structure angles
Advanced Topics
Solving Ambiguous Cases
While the Law of Cosines generally gives unique solutions, it's important to understand when triangles might not exist:
- Triangle inequality: The sum of any two sides must be greater than the third side
- Angle constraints: All angles must be positive and sum to 180°
- Invalid cosine values: The cosine of an angle must be between -1 and 1
Numerical Considerations
When using the Law of Cosines in calculations:
- Precision: Use sufficient decimal places to avoid rounding errors
- Calculator mode: Ensure your calculator is in the correct angle mode (degrees vs. radians)
- Verification: Check that your results satisfy the triangle inequality
- Alternative methods: Consider using the Law of Sines for verification
Derivation of the Law of Cosines
Geometric Derivation
The Law of Cosines can be derived using coordinate geometry:
- Place the triangle in a coordinate system with C at the origin
- Position side b along the positive x-axis
- Use the distance formula to find the length of side c
- Apply trigonometric relationships to simplify
Vector Derivation
Using vector methods:
- Express the sides as vectors
- Use the relationship: c⃗ = a⃗ - b⃗
- Take the dot product: c⃗ · c⃗ = (a⃗ - b⃗) · (a⃗ - b⃗)
- Expand and simplify using dot product properties
Problem-Solving Strategies
Choosing the Right Approach
Decision Tree
- Known: 3 sides (SSS) → Use Law of Cosines to find angles
- Known: 2 sides + included angle (SAS) → Use Law of Cosines to find third side
- Known: 2 angles + 1 side (AAS/ASA) → Use Law of Sines
- Known: 2 sides + non-included angle (SSA) → Use Law of Sines (ambiguous case)
Verification Methods
Always verify your solutions:
- Angle sum: Check that A + B + C = 180°
- Triangle inequality: Verify a + b > c, b + c > a, a + c > b
- Alternative calculation: Use a different method to double-check
- Reasonableness: Ensure results make geometric sense
Common Mistakes and How to Avoid Them
Frequent Errors
- Wrong angle: Using a non-included angle in SAS problems
- Calculator mode: Forgetting to set degrees vs. radians
- Sign errors: Mistakes in arithmetic, especially with negative cosine values
- Square root: Forgetting to take the square root when finding a side
- Inverse function: Using cos instead of arccos when finding angles
Extensions and Related Topics
Spherical Trigonometry
The Law of Cosines extends to spherical triangles (triangles on the surface of a sphere):
cos(c) = cos(a)cos(b) + sin(a)sin(b)cos(C)
This is crucial for navigation on Earth's surface and astronomical calculations.
Higher Dimensions
The concept generalizes to higher dimensions through the dot product formula in vector spaces, forming the basis for many geometric calculations in computer graphics and physics.
Practice Problems
Problem 1: SSS Triangle
Given: A triangle with sides 8, 15, and 17
Find: All angles
Hint: Start with the largest angle (opposite the longest side)
Problem 2: SAS Triangle
Given: Two sides of 12 and 16 with an included angle of 75°
Find: The third side and remaining angles
Hint: Use the Law of Cosines first, then the Law of Sines
Problem 3: Real-World Application
Scenario: A surveyor needs to find the distance across a lake. From point A, the distances to points B and C are 200m and 150m respectively, with angle BAC = 110°.
Find: The distance BC across the lake
Conclusion
The Law of Cosines is an indispensable tool in trigonometry that extends our ability to solve triangles beyond the limitations of right-triangle trigonometry. Its applications span numerous fields, from basic geometry to advanced engineering and scientific calculations.
Understanding when and how to apply the Law of Cosines, along with its relationship to other trigonometric principles, provides a solid foundation for solving complex geometric problems. Whether you're calculating distances in navigation, analyzing forces in engineering, or solving mathematical puzzles, the Law of Cosines offers a reliable method for finding unknown sides and angles in any triangle.
The calculator above provides an interactive way to explore these concepts and verify your manual calculations. By practicing with different types of triangles and understanding the underlying mathematics, you'll develop confidence in applying this fundamental theorem to real-world problems.