Law of Cosines Calculator
Enter two sides and the included angle to find the third side, the remaining angles and the area.
Result
How it is calculated
You give two sides a and b (any length unit) and the angle C between them in degrees, strictly between 0 and 180. The tool computes c = √(a² + b² − 2ab·cos C) and the area ½·a·b·sin C in the square of whatever length unit you used. Angle A comes from the law of cosines again, cos A = (b² + c² − a²) ÷ (2bc), so an obtuse A is reported correctly, and then B = 180° − C − A. The side and area are shown to four decimals, the angles to two. Sides must be above zero. A side of 0, or an angle of 0 or 180 or more, shows no result.
Worked example
Let a = 9, b = 4 and the included angle C = 30°. Then c² = 81 + 16 − 2·9·4·cos 30° = 97 − 72 × 0.8660 = 34.646, so c = 5.8861. Area = ½ × 9 × 4 × sin 30° = 18 × 0.5 = 9.0000 sq units. Angle A: cos A = (16 + 34.646 − 81) ÷ (2 × 4 × 5.8861) = −0.6446, so A = 130.14°, an obtuse angle. Then B = 180 − 30 − 130.14 = 19.86°. For comparison, a = 7, b = 9 and C = 50° gives c = 7.0006 and A = 49.99°, B = 80.01°.
Common mistakes
- Entering an angle that is not between the two known sides. This tool is for two sides and their included angle (SAS); an angle opposite one of the sides gives the wrong third side.
- Typing the angle in radians. The tool reads degrees, so 0.87 is read as less than one degree and the result is a nearly flat triangle.
- Entering a right or 180° angle and expecting a result. C must be strictly between 0 and 180, and a straight 180° angle is not a triangle.
- Mixing units for a and b, such as one side in metres and the other in centimetres. The area is in the square of the same unit, so both sides must match.
- Assuming A and B must be acute. If the longer side faces a large angle, A can be obtuse, as in the example where A = 130.14°.
About this calculator
The law of cosines, c² = a² + b² − 2ab·cos(C), generalizes the Pythagorean theorem to any triangle by relating the length of one side to the other two sides and the angle between them. Given two sides and the included angle (the SAS case), this calculator solves directly for the third side, then finds a second angle with another application of the law of cosines (which, unlike the law of sines, also gives obtuse angles correctly) and the third from the 180° angle sum and computes the triangle's area from two sides and the included angle: Area = ½ab·sin(C).
Because it works for any triangle — not just right triangles — the law of cosines is a core tool in surveying (triangulating distances from measured angles), navigation (dead-reckoning position from bearing and distance), structural and truss analysis, and any physics problem involving vector addition where the angle between two vectors is known but their resultant isn't.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
Angles are usually the shakiest measurement in field work, so see how much a one-degree error costs. Sides 5 and 7 with a 60 degree angle give a third side of 6.2450, and at 61 degrees it is 6.3296, a shift of about 0.085 from a single degree. Longer sides magnify that error. As a quick plausibility test, the third side must stay between the difference and the sum of the other two. Which measurement do you trust least in your setup?