Connect via MCP →

Enter Calculation

Enter two sides (a, b) and the angle C between them to find the third side c, plus the remaining angles.

Formula

Show calculation steps (3)
  1. Triangle Area

    Triangle Area: Cosine Rule Triangle Calculator

    Area from two sides and the included angle C

  2. Remaining Angles

    Remaining Angles: Cosine Rule Triangle Calculator

    Angles A and B recovered via the Law of Cosines once c is known

  3. Perimeter

    Perimeter: Cosine Rule Triangle Calculator

    Sum of all three sides

Advertisement

Results

Third Side (c)
6.245
opposite angle C
Angle A (degrees) 43.9
Angle B (degrees) 76.1
Angle C (degrees) 60
Perimeter 18.245
Area 15.1554

What Is the Law of Cosines?

The law of cosines (also called the cosine rule) generalises the Pythagorean theorem to any triangle. It links the three side lengths to the cosine of one of the angles, so it works even when the triangle has no right angle. This calculator uses it in the common "SAS" case: you supply two sides and the angle wedged between them, and it returns the missing side along with the other two angles, the perimeter, and the area.

Triangle with sides a, b, c and included angle C at the opposite vertex
Standard triangle labeling: side c is opposite angle C, with C the angle included between sides a and b.

How to Use It

Enter side a, side b, and the included angle C in degrees (the angle that sits between sides a and b). Press calculate. The tool first finds the third side c, then uses the rearranged cosine rule to compute angles A and B. Because the three angles always add to 180°, you can quickly sanity-check the output.

The Formula Explained

To find the side opposite the known angle: $$c^{2} = a^{2} + b^{2} - 2ab\cos(C)$$ Notice that when \(C = 90^\circ\), \(\cos(C) = 0\) and the expression collapses to the familiar \(c^{2} = a^{2} + b^{2}\). To work backwards from three known sides to an angle, rearrange to $$C = \cos^{-1}\!\left(\frac{a^{2} + b^{2} - c^{2}}{2ab}\right)$$ The triangle area is computed as \(\tfrac{1}{2}\cdot a\cdot b\cdot\sin(C)\).

Advertisement
Right triangle versus general triangle illustrating the cosine correction term
The law of cosines generalizes the Pythagorean theorem; the \(-2ab\cos(C)\) term vanishes when C is a right angle.

Worked Example

Let \(a = 5\), \(b = 7\), and \(C = 60^\circ\). Then $$c^{2} = 25 + 49 - 2\cdot 5\cdot 7\cdot\cos(60^\circ) = 74 - 70\cdot 0.5 = 39$$ so \(c = \sqrt{39} \approx 6.245\). Angle $$A = \cos^{-1}\!\left(\frac{49 + 39 - 25}{2\cdot 7\cdot 6.245}\right) \approx 43.9^\circ$$ and angle \(B \approx 76.1^\circ\). The three angles \(43.9 + 76.1 + 60 = 180^\circ\) ✓. \(\text{Area} = \tfrac{1}{2}\cdot 5\cdot 7\cdot\sin(60^\circ) \approx 15.16\).

FAQ

What if I only know three sides? Use the second formula to find any angle directly from the side lengths.

Does this work for obtuse triangles? Yes. The cosine of an angle above 90° is negative, which the formula handles automatically.

What units does it use? Sides are unit-free (use any consistent unit), and angles are entered and returned in degrees.

Last updated: