yCalculator

Law of Cosines Calculator

Last updated: June 2026

Side a

5

Side b

7

Side c

6.245

Angle A

43.8979 deg

Angle B

76.1021 deg

Angle C

60 deg

Perimeter

18.245

Area

15.1554

Step-by-step working

  1. Use c^2 = a^2 + b^2 - 2ab cos(C).
  2. c = sqrt(5^2 + 7^2 - 2 x 5 x 7 x cos(60)) = 6.245

Triangle diagram

ABCbca

About this calculator

The Law of Cosines Calculator applies the cosine rule to find a missing side from two sides and the included angle, or an angle from three known sides. It is useful for non-right triangles where Pythagoras does not apply.

law of cosines calculator method

The cosine rule generalises Pythagoras. For side c, the formula is c^2 = a^2 + b^2 - 2ab cos(C). Rearranged, it can also find angle C when all three sides are known.

  • c^2 = a^2 + b^2 - 2ab cos(C)
  • c = sqrt(a^2 + b^2 - 2ab cos(C))
  • cos(C) = (a^2 + b^2 - c^2) / 2ab
  • C = cos^-1((a^2 + b^2 - c^2) / 2ab)

How to use the law of cosines calculator

  1. Choose whether to find a side or an angle.
  2. For side mode, enter sides a and b plus included angle C.
  3. For angle mode, enter sides a, b, and c.
  4. Substitute values into the cosine rule.
  5. Take the square root for a side, or inverse cosine for an angle.
  6. Calculate remaining angles and area for context.

Worked examples

Find side c

Input: a = 5, b = 7, C = 60 degrees

Calculation: c = sqrt(5^2 + 7^2 - 2 x 5 x 7 x cos(60))

Result: c about 6.24

Find angle C

Input: a = 5, b = 7, c = 6

Calculation: C = cos^-1((5^2 + 7^2 - 6^2) / (2 x 5 x 7))

Result: C about 55.15 degrees

Cosine rule vs Pythagoras

If C is 90 degrees, cos(C) is zero and the cosine rule becomes a^2 + b^2 = c^2. That is why Pythagoras is a special case of the cosine rule.

Common mistakes to avoid

Using the wrong side label
Triangle formulas depend on matching sides with their opposite angles or with the correct right-triangle role. If a result looks impossible, recheck the labels before changing the formula.
Forgetting triangle validity
Not every set of side lengths can form a triangle. The longest side must be shorter than the sum of the other two sides.
Rounding too early
Keep extra decimal places while calculating, especially when using square roots, sine, cosine, or inverse trig. Round the final answer to the precision required.

Edge cases

  • A right triangle must have one angle of exactly 90 degrees.
  • The hypotenuse must be the longest side in a right triangle.
  • Special triangle ratios only apply to exact 30-60-90 and 45-45-90 triangles.
  • The sine rule can produce an ambiguous SSA case where two triangles are possible.

Limitations

This calculator is for educational maths support. It uses standard geometry and trigonometry formulas with decimal approximations. For exams, coursework, engineering, surveying, or construction, follow the required method, units, tolerances, and checking process.

Frequently asked questions

Which triangle calculator should I use?

Use Pythagoras or the right triangle calculator for right-angled triangles, special triangle calculators for exact 30-60-90 or 45-45-90 triangles, and the sine or cosine law calculators for non-right triangles.

What do sides a, b, and c mean?

In general triangle notation, side a is opposite angle A, side b is opposite angle B, and side c is opposite angle C. Some right-triangle pages also label c as the hypotenuse.

Why do triangle angles add to 180 degrees?

In ordinary flat Euclidean geometry, the interior angles of a triangle always add to 180 degrees. That rule is used throughout these calculators.

Can the calculator handle any units?

Yes for lengths, as long as all side inputs use the same unit. Area results are in square units based on the unit entered.

Why is my result impossible?

The inputs may not form a valid triangle, the hypotenuse may not be the longest side, or a side may have been paired with the wrong angle.

Related calculators

  • Law of Sines Calculator
  • Triangle Calculator
  • Trigonometry Calculator

What does this mean?

This calculator is designed to help you understand the likely number before you make a decision or start an application.

Your result should be checked against official UK guidance, especially if your circumstances include dependants, exemptions, prior leave, or a complex immigration history.

Treat the figure as a planning tool rather than legal advice. Where the answer affects an application deadline or major payment, speak to an authorised adviser.

Related Math calculators

math calculators

Triangle Calculator

Solve any triangle using SSS, SAS, ASA, AAS, SSA, right triangle, and Pythagorean theorem modes

Calculate ->

math calculators

Area Calculator

Calculate the area of common 2D shapes with formula substitutions and unit conversions

Calculate ->

math calculators

Volume Calculator

Calculate the volume and surface area of common 3D shapes with full working and practical litre conversions

Calculate ->

You might also need

math calculators

Law of Sines Calculator

Apply the sine rule to find missing sides and angles in non-right triangles

Calculate ->

math calculators

Triangle Calculator

Solve any triangle using SSS, SAS, ASA, AAS, SSA, right triangle, and Pythagorean theorem modes

Calculate ->

math calculators

Trigonometry Calculator

Calculate sine, cosine, tangent, and inverse trig values in degrees or radians

Calculate ->