Finding Sides Of A Triangle Using Law Of Cosines Calculator






Law of Cosines Calculator – Find Triangle Sides


Law of Cosines Calculator

Easily find the missing side of any triangle given two sides and their included angle.

Calculate a Triangle Side

Enter the lengths of two sides (a and b) and the angle (C) between them to find the length of the third side (c). This tool is a powerful law of cosines calculator for any SAS (Side-Angle-Side) triangle problem.


The length of the first known side.
Please enter a valid, positive number.


The length of the second known side.
Please enter a valid, positive number.


The angle between sides ‘a’ and ‘b’. Must be between 0 and 180 degrees.
Please enter a valid angle between 0 and 180.


Length of Side ‘c’

Formula Used: c² = a² + b² – 2ab * cos(C)

Intermediate Values:

  • Angle C in Radians:
  • cos(C):
  • c² (Result before square root):

Calculation Breakdown and Visualization


Component Variable Value Contribution to c²

This table breaks down the components of the law of cosines formula.

A dynamic visualization of the triangle based on your inputs. Our law of cosines calculator generates this chart in real-time.

What is the Law of Cosines?

The Law of Cosines, also known as the cosine rule or cosine formula, 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 is a generalization of the Pythagorean theorem, which only applies to right-angled triangles. The law of cosines works for any triangle, regardless of its shape or size. Our law of cosines calculator is the perfect tool for applying this rule quickly and accurately.

This rule is particularly useful in two main scenarios: when you know two sides and the included angle (SAS) and want to find the third side, or when you know all three sides (SSS) and want to find any of the angles. A common misconception is that it’s interchangeable with the Law of Sines; however, the Law of Cosines is necessary when you don’t have a known side opposite a known angle, which is required for the Law of Sines.

Law of Cosines Formula and Mathematical Explanation

The primary formula used by our law of cosines calculator is for finding a side when you have a Side-Angle-Side (SAS) configuration. Given a triangle with sides labeled ‘a’, ‘b’, and ‘c’, and angles ‘A’, ‘B’, and ‘C’ opposite those sides respectively, the formula is:

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

Here’s a step-by-step explanation:

  1. Square the lengths of the two known sides (a² and b²).
  2. Multiply the lengths of those two sides by each other and then by 2 (2ab).
  3. Find the cosine of the angle ‘C’ that is between sides ‘a’ and ‘b’.
  4. Multiply the result from step 2 by the result from step 3 (2ab * cos(C)).
  5. Subtract the result from step 4 from the sum of the squares in step 1.
  6. Finally, take the square root of the result to find the length of side ‘c’.
Variable Explanations for the Law of Cosines Calculator
Variable Meaning Unit Typical Range
a, b Known side lengths Any unit of length (e.g., meters, feet) Positive numbers
C The known angle included between sides ‘a’ and ‘b’ Degrees 0° to 180°
c The unknown side opposite angle ‘C’ Same unit as a and b Positive number
cos(C) The cosine of angle C Dimensionless -1 to 1

Practical Examples (Real-World Use Cases)

Using a law of cosines calculator is essential in many fields. Here are two practical examples:

Example 1: Land Surveying

A surveyor needs to determine the length of a property line across a pond. They measure the distance from a point on one side of the pond to both ends of the property line. The distances are 120 meters (side ‘a’) and 150 meters (side ‘b’), and the angle between these two lines is 75° (angle ‘C’).

  • Inputs: a = 120, b = 150, C = 75°
  • Calculation: c² = 120² + 150² – 2(120)(150)cos(75°)
  • Output: The calculator finds that c ≈ 166.3 meters. This is the length of the property line across the pond.

Example 2: Aviation Navigation

A pilot flies 200 miles, makes a 135° turn, and then flies another 300 miles. To find the direct distance back to the starting point, the pilot needs to calculate the third side of the triangle formed by their flight path. The included angle inside the triangle is 180° – 135° = 45°.

  • Inputs: a = 200, b = 300, C = 45°
  • Calculation: c² = 200² + 300² – 2(200)(300)cos(45°)
  • Output: A law of cosines calculator would show the direct distance ‘c’ is approximately 212.5 miles. For more navigation tools, check out our unit converter.

How to Use This Law of Cosines Calculator

Our triangle side calculator is designed for simplicity and accuracy. Follow these steps to find the side of your triangle:

  1. Enter Side ‘a’: Input the length of the first known side into the ‘Length of Side a’ field.
  2. Enter Side ‘b’: Input the length of the second known side into the ‘Length of Side b’ field.
  3. Enter Angle ‘C’: Input the angle in degrees that is between sides ‘a’ and ‘b’.
  4. Read the Results: The calculator automatically updates in real time. The primary result, ‘Length of Side c’, is displayed prominently. You can also see intermediate values and a visual representation in the chart.
  5. Decision-Making: This result gives you the precise length of the missing side, useful for construction, surveying, or academic problems. If you need to solve a triangle differently, consider our law of sines calculator.

Key Factors That Affect Law of Cosines Results

The output of a law of cosines calculator is sensitive to several key factors. Understanding them ensures accurate results.

  • Length of Known Sides (a, b): The most direct influence. Longer sides will naturally result in a longer third side, holding the angle constant.
  • Magnitude of the Included Angle (C): This is a critical factor. As the angle ‘C’ approaches 180°, the value of cos(C) approaches -1, making the `2ab*cos(C)` term positive and large, thus increasing the length of side ‘c’. Conversely, as the angle approaches 0°, cos(C) approaches 1, and side ‘c’ becomes smaller.
  • Acute vs. Obtuse Angles: If angle C is acute (< 90°), cos(C) is positive, and the term `2ab*cos(C)` is subtracted, making c² smaller than a² + b². If C is obtuse (> 90°), cos(C) is negative, effectively adding `2ab*|cos(C)|` and making c² larger than a² + b². This is a core concept that any good law of cosines calculator must handle.
  • Unit Consistency: You must use the same units for both side ‘a’ and side ‘b’. If one is in feet and the other in inches, you must convert them before using the calculator.
  • Measurement Precision: The accuracy of your input values directly impacts the output. Small errors in measuring sides or the angle can lead to significant deviations in the calculated result.
  • Rounding Errors: While our law of cosines calculator uses high precision, manual calculations can introduce rounding errors, especially when rounding the cosine value too early.

Frequently Asked Questions (FAQ)

1. When should I use the Law of Sines vs. the Law of Cosines?

Use the Law of Cosines when you have Side-Angle-Side (SAS) or Side-Side-Side (SSS) information. Use the Law of Sines for Angle-Side-Angle (ASA) or Angle-Angle-Side (AAS). Using the wrong rule will leave you with too many unknowns. A good law of cosines calculator is ideal for SAS and SSS cases.

2. Can I use this calculator for a right-angled triangle?

Yes. If you enter 90 degrees for the angle ‘C’, cos(90°) is 0. The formula simplifies to c² = a² + b², which is the Pythagorean theorem. You can also use our dedicated Pythagorean theorem calculator for this.

3. What happens if my angle is 0 or 180 degrees?

If the angle is 0°, the sides are collinear, and c = |a – b|. If the angle is 180°, they are also collinear but pointed opposite, and c = a + b. Our law of cosines calculator handles these edge cases correctly.

4. Why is the law of cosines sometimes called the ‘cosine rule’?

“Law of Cosines” and “Cosine Rule” are interchangeable terms for the same trigonometric principle. “Cosine Rule” is more common in British English.

5. How does this law relate to the Pythagorean theorem?

The Law of Cosines is a generalized version of the Pythagorean theorem. The term `-2ab cos(C)` is the “correction factor” that accounts for the triangle not being a right triangle. When C=90°, this term becomes zero.

6. Can I find angles with this formula?

Yes, the formula can be rearranged to find an angle if you know all three sides (SSS). The rearranged formula is: C = arccos((a² + b² – c²) / 2ab). While this law of cosines calculator is set up for finding a side, the principle is the same.

7. What units can I use in the law of cosines calculator?

You can use any unit of length (feet, meters, inches, etc.), as long as you are consistent for both side inputs. The output for the third side will be in the same unit.

8. Does the calculator handle obtuse angles?

Absolutely. The cosine function correctly handles obtuse angles (greater than 90°), which results in a negative value that increases the calculated side length, as expected for a wide-angled triangle.

Related Tools and Internal Resources

Expand your knowledge and solve more geometry problems with these related calculators and resources.

© 2026 Date-Related Web Developer Inc. All Rights Reserved. Use our law of cosines calculator for accurate and fast results.


Leave a Reply

Your email address will not be published. Required fields are marked *