Cosine Rule Calculator
The Cosine Rule, also known as the Law of Cosines, is a fundamental formula 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.
This calculator can help you solve for an unknown side or an unknown angle in any triangle, given sufficient information.
When to Use the Cosine Rule:
- To find an unknown side (SAS – Side-Angle-Side): If you know the lengths of two sides of a triangle and the measure of the included angle (the angle between those two sides), you can use the Cosine Rule to find the length of the third side.
- To find an unknown angle (SSS – Side-Side-Side): If you know the lengths of all three sides of a triangle, you can use the Cosine Rule to find the measure of any of the triangle's angles.
Formulas:
Let a, b, and c be the lengths of the sides of a triangle, and let A, B, and C be the angles opposite those sides, respectively.
To find a side (e.g., side c):
c² = a² + b² - 2ab cos(C)
This can be rearranged to find 'a' or 'b' similarly:
a² = b² + c² - 2bc cos(A)b² = a² + c² - 2ac cos(B)
To find an angle (e.g., angle C):
cos(C) = (a² + b² - c²) / (2ab)
This can be rearranged to find 'A' or 'B' similarly:
cos(A) = (b² + c² - a²) / (2bc)cos(B) = (a² + c² - b²) / (2ac)
Calculate a Side (SAS)
Enter the lengths of two sides and the included angle to find the third side.
Calculate an Angle (SSS)
Enter the lengths of all three sides to find the angle opposite side 'c'.
Calculated Side \'c\':
' + c.toFixed(4) + "; } function calculateAngleC() { var a = parseFloat(document.getElementById('sideA_sss').value); var b = parseFloat(document.getElementById('sideB_sss').value); var c = parseFloat(document.getElementById('sideC_sss').value); var resultDiv = document.getElementById('resultAngleC'); if (isNaN(a) || isNaN(b) || isNaN(c) || a <= 0 || b <= 0 || c c) && (a + c > b) && (b + c > a))) { resultDiv.innerHTML = 'These side lengths do not form a valid triangle (Triangle Inequality Theorem).'; return; } var cosC = ((a * a) + (b * b) – (c * c)) / (2 * a * b); // Ensure cosC is within valid range [-1, 1] due to floating point inaccuracies if (cosC > 1) cosC = 1; if (cosC < -1) cosC = -1; var angleC_rad = Math.acos(cosC); var angleC_deg = angleC_rad * 180 / Math.PI; resultDiv.innerHTML = 'Calculated Angle \'C\':
' + angleC_deg.toFixed(4) + ' degrees'; }Understanding the Results:
The calculator provides the length of the unknown side or the measure of the unknown angle based on your inputs. The units for the side lengths will be the same as the units you entered (e.g., if you enter meters, the result will be in meters). Angles are always given in degrees.
Example Scenarios:
Example 1: Finding a Side (SAS)
Imagine you have a triangle where:
- Side 'a' = 10 units
- Side 'b' = 12 units
- Included Angle 'C' = 60 degrees
Using the formula c² = a² + b² - 2ab cos(C):
c² = 10² + 12² - 2 * 10 * 12 * cos(60°)
c² = 100 + 144 - 240 * 0.5
c² = 244 - 120
c² = 124
c = √124 ≈ 11.1355 units
You can verify this by entering these values into the "Calculate a Side (SAS)" section above.
Example 2: Finding an Angle (SSS)
Consider a triangle with the following side lengths:
- Side 'a' = 7 units
- Side 'b' = 8 units
- Side 'c' = 13 units
To find Angle 'C' (opposite side 'c'), use the formula cos(C) = (a² + b² - c²) / (2ab):
cos(C) = (7² + 8² - 13²) / (2 * 7 * 8)
cos(C) = (49 + 64 - 169) / (112)
cos(C) = (113 - 169) / 112
cos(C) = -56 / 112
cos(C) = -0.5
C = arccos(-0.5) = 120 degrees
You can verify this by entering these values into the "Calculate an Angle (SSS)" section above.
The Cosine Rule is an indispensable tool in various fields, including engineering, architecture, surveying, and even computer graphics, for solving problems involving non-right-angled triangles.