Home › Calculators › Law of Sines and Cosines Calculator

Law of Sines and Cosines Calculator

Solve any triangle from three known values. Pick SSS, SAS, ASA, AAS or SSA, enter your sides and angles, and get every missing side and angle with the law of sines or cosines worked out step by step, including both triangles in the ambiguous SSA case.

Last updated:

What do you know?
Enter your values to see the result.
Advertisement
Advertisement

How to use the Law of Sines and Cosines Calculator

  1. Choose what you know: three sides, two sides and an angle, or two angles and a side.
  2. Enter the values. Side a is opposite angle A, b opposite B and c opposite C.
  3. Press Solve triangle to get the missing sides and angles.
  4. For SSA, check the number of solutions: the tool shows both triangles when two fit.
  5. Review the steps, drawing and full property table, or download it as CSV.

Laws of sines and cosines

LawFormulaUse it for
Law of cosines (side)c² = a² + b² − 2ab·cos CSAS: find the third side
Law of cosines (angle)cos A = (b² + c² − a²) / (2bc)SSS: find each angle
Law of sinesa / sin A = b / sin B = c / sin C = 2RASA, AAS, SSA
Angle sumA + B + C = 180°Third angle from two
AreaK = ½·a·b·sin CAny case once solved
Inradius / circumradiusr = K / s, R = a / (2 sin A)s = (a + b + c) / 2

The five cases at a glance

CaseYou knowSolution pathNumber of triangles
SSSa, b, cCosines for A and B, then C = 180° − A − B1 (if triangle inequality holds)
SASa, b and included CCosines for c, then cosines for AAlways 1
ASAA, B and included cC = 180° − A − B, then sines1 (if A + B < 180°)
AASA, B and aC = 180° − A − B, then sines1 (if A + B < 180°)
SSAa, b and Asin B = b·sin A / a, check both B and 180° − B0, 1 or 2

Working through the ambiguous case

With a = 7, b = 10 and A = 40°, the height is h = 10 × sin 40° ≈ 6.428. Because 6.428 < 7 < 10, side a can swing to meet the base in two places. The law of sines gives sin B ≈ 0.9183, so B ≈ 66.67° or B ≈ 113.33°. That produces two valid triangles with C ≈ 73.33° (c ≈ 10.432) or C ≈ 26.67° (c ≈ 4.889). If a were 4, shorter than h, no triangle could be formed at all.

Frequently asked questions

When do I use the law of cosines and when the law of sines?

Use the law of cosines, c² = a² + b² − 2ab·cos C, when you know three sides (SSS) or two sides and the angle between them (SAS). Use the law of sines, a / sin A = b / sin B = c / sin C, when you know two angles and a side (ASA, AAS) or two sides and a non-included angle (SSA).

What is the ambiguous case (SSA)?

When you know sides a and b and angle A opposite a, there can be no triangle, one, or two. Compute the height h = b·sin A. If a < h there is no triangle; if a = h there is one right triangle; if h < a < b there are two triangles; if a ≥ b there is one.

Why is there no triangle for my values?

For three sides, the longest side must be shorter than the sum of the other two (triangle inequality). For angles, the given angles must add up to less than 180°. In the SSA case, side a must be at least the height b·sin A.

How is the area calculated?

The calculator uses K = ½·a·b·sin C, which works for any triangle once two sides and the included angle are known. For three sides it gives the same result as Heron's formula, √(s(s − a)(s − b)(s − c)) with s the semi-perimeter.

Does the law of cosines work for right triangles?

Yes. When C = 90°, cos C = 0, so the law of cosines c² = a² + b² − 2ab·cos C reduces to the Pythagorean theorem c² = a² + b².

Which side is a, b and c?

By convention each side is named after the opposite angle: side a is across from angle A, b across from B and c across from C. Label your triangle that way before entering values, or the results will belong to a different triangle.

Can I enter angles in radians?

Yes. Switch Angles in to Radians; every angle you enter and every angle in the results then uses radians. π radians equals 180°.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Triangle CalculatorSolve any triangle from SSS, SAS, ASA, AAS or right-triangle values: sides, angles, area, type.Trigonometry CalculatorSin, cos, tan, csc, sec, cot and inverses in degrees or radians, with exact values.Pythagorean Theorem CalculatorSolve for the hypotenuse or a missing leg of a right triangle, with a diagram and steps.Ellipse CalculatorArea, perimeter (Ramanujan), eccentricity, foci and equation of an ellipse from its axes.Degrees Minutes Seconds ConverterConvert decimal degrees to DMS and back for angles and GPS coordinates, with N/S/E/W.Inverse Trig Calculatorarcsin, arccos, arctan, arcsec, arccsc and arccot in degrees and radians, with exact values.Roofing Calculator (Roof Squares)Estimate roof area, squares, shingle bundles and cost from pitch.Square Root CalculatorFind square, cube and nth roots with simplified radical form and steps.Body Surface Area CalculatorCalculate body surface area in m² with the Du Bois, Mosteller, Haycock and other formulas.Area CalculatorFind the area of squares, rectangles, triangles, circles, trapezoids, ellipses and sectors.Volume CalculatorVolume of a cube, box, cylinder, sphere, cone, pyramid or capsule, in liters and gallons too.Surface Area CalculatorSurface area of a cube, box, cylinder, sphere, cone or pyramid, with lateral and base areas.Circle CalculatorEnter a circle's radius, diameter, circumference or area and get all the others.Slope CalculatorSlope, angle, line equation y = mx + b and distance from two points, with a graph.Midpoint CalculatorFind the midpoint of two points in 2D or 3D, or the missing endpoint from a midpoint.Distance Formula CalculatorDistance between two points in 2D or 3D with step-by-step work and an exact radical answer.Vector Calculator2D and 3D vectors: add, subtract, dot and cross product, magnitude, angle, unit vector, projection.Pascal's Triangle GeneratorGenerate Pascal's triangle up to row 30, highlight a row and expand (ax + by)ⁿ.Arc Length CalculatorArc length, sector area and chord from radius and angle, or solve for the radius or angle.Cylinder Volume CalculatorCylinder volume in liters, gallons and cubic units from radius or diameter, plus surface area.Regular Polygon CalculatorArea, perimeter, apothem, radius and angles of a regular polygon from any one measurement.Aquarium Volume CalculatorFish tank gallons, liters and water weight: rectangle, cylinder, bow-front and hexagon tanks.Tank Volume CalculatorTotal and filled volume of cylinder, rectangular and capsule tanks in gallons and liters.Circle Skirt CalculatorWaist radius, fabric yardage and cutting layout for full, half or quarter circle skirts.Camera Field of View CalculatorAngle of view and frame size from focal length, sensor size and subject distance.Miter Angle CalculatorMiter saw angle for any polygon or corner, plus crown molding miter and bevel settings.Simplify Square Root CalculatorSimplify square, cube and nth roots to simplest radical form a√b, with steps.Interactive Unit CircleDrag an angle on the unit circle to see degrees, radians and exact sin, cos and tan. Printable chart.Cone Volume CalculatorVolume, slant height and surface area of a right cone from its radius and height.Perimeter CalculatorPerimeter of a square, rectangle, triangle, circle, trapezoid, polygon or sector, with a diagram.Point Slope Form CalculatorLine equation in point-slope form from a point and slope or two points, plus y = mx + b.Polar to Cartesian ConverterConvert polar coordinates (r, θ) to rectangular (x, y) with steps, a plot and bulk lists.Right Triangle CalculatorSolve a right triangle from any two values: sides, angles, area, perimeter and altitude.Slope Intercept Form CalculatorGet y = mx + b from two points, a point and slope, or standard form, with steps and a graph.Sphere Volume CalculatorVolume and surface area of a sphere from radius, diameter or circumference, or the reverse.Trapezoid Area CalculatorArea, perimeter, median and missing base or height of a trapezoid, with a diagram.30-60-90 Triangle CalculatorEnter one side of a 30-60-90 triangle to get the other sides, area and perimeter in exact radical form.45-45-90 Triangle CalculatorSolve an isosceles right triangle from a leg or hypotenuse, with sides in exact √2 form.Coordinate Plane PlotterPlot points, segments and polygons on an interactive coordinate grid, or print blank planes.Coterminal Angle CalculatorList positive and negative coterminal angles and the principal angle, in degrees and radians.Heron's Formula CalculatorFind a triangle's area from its three sides with Heron's formula, semi-perimeter and steps.Implicit Differentiation CalculatorFind dy/dx for any equation in x and y with steps, plus the slope and tangent at a point.Polygon Area from CoordinatesArea, perimeter and centroid of any polygon from its vertex coordinates (shoelace formula).Reference Angle CalculatorFind the reference angle and quadrant of any angle in degrees or radians, with a unit circle sketch.Tangent Line CalculatorFind the tangent and normal line to f(x) at a point, with the derivative, slope and a graph.Complementary and Supplementary Angle CalculatorComplement, supplement and explement of any angle in degrees or radians, with diagrams.
See all 46 Geometry & Trigonometry Calculators →