Law of Cosines
Calculate unknown side of any triangle using Law of Cosines formula (SAS). Compute all three angles, area and perimeter with this free online triangle solver.
About This Calculator
The Law of Cosines calculator helps you solve any triangle when you know two sides and the included angle (SAS). Also known as the cosine rule, this formula generalizes the Pythagorean theorem to work for all triangles, not just right-angled ones. Students, engineers, surveyors, and geometry enthusiasts use this tool to quickly find the unknown side, missing angles, area, and perimeter of any triangle.
The formula used is a^2 = b^2 + c^2 - 2bc·cos(A), where a is the unknown side opposite the given angle A, and b and c are the two known sides. After computing side a, the calculator applies the Law of Sines to find angle B (B = arcsin(b·sin(A)/a)) and determines angle C by subtracting A and B from 180 deg. The area is computed as 1/2·b·c·sin(A), and the perimeter is the sum of all three sides.
This triangle solver is ideal for trigonometry homework, architectural drafting, land surveying, navigation problems, and any application involving triangular geometry. Unlike the Law of Sines which handles AAS/ASA cases, this SAS calculator directly gives you the complete triangle solution from just two sides and one angle.
Frequently Asked Questions
How does the Law of Cosines work?
The Law of Cosines states that for any triangle, a^2 = b^2 + c^2 - 2bc·cos(A), where a is the side opposite angle A. This calculator uses this formula to compute the unknown side a when you provide sides b and c and the included angle A. It also calculates the remaining angles B and C, the area, and the perimeter of the triangle.
When should I use the Law of Cosines vs the Law of Sines?
Use the Law of Cosines when you know two sides and the included angle (SAS) or all three sides (SSS). Use the Law of Sines when you know two angles and one side (AAS or ASA) or two sides and a non-included angle (SSA). The Law of Cosines is a generalization of the Pythagorean theorem that works for any triangle, not just right triangles.
What inputs do I need for this triangle calculator?
This SAS (Side-Angle-Side) calculator requires two side lengths (b and c) and the measure of the included angle A in degrees. The included angle is the angle formed by the two given sides. All inputs must be positive numbers, and the angle must be between 0 and 180 degrees to form a valid triangle.
What results does this calculator provide?
The calculator computes the unknown side a opposite angle A, both remaining angles B and C, the total area of the triangle, and the perimeter. Angle C is computed as 180 deg - A - B since the three interior angles of any triangle always sum to 180 degrees.
Can the Law of Cosines be used for any triangle?
Yes, the Law of Cosines applies to all triangles: acute, right, and obtuse. It is a generalization of the Pythagorean theorem. When the included angle is 90 deg, cos(90 deg) = 0 and the formula reduces to a^2 = b^2 + c^2, which is the Pythagorean theorem for right triangles.
What happens if my inputs do not form a valid triangle?
If the given side lengths and angle cannot form a valid triangle, the calculator displays an error message. A valid triangle requires each side to be positive, the angle to be strictly between 0 and 180 degrees, and the computed value under the square root (the radicand b^2 + c^2 - 2bc·cos(A)) to be positive. If the radicand is zero or negative, the triangle is degenerate or impossible.
Does the Law of Cosines work for right triangles?
Absolutely. For a right triangle where angle A = 90 deg, cos(90 deg) = 0, so the Law of Cosines simplifies to a^2 = b^2 + c^2, which is the standard Pythagorean theorem. This makes the Law of Cosines a more general formula that works for every triangle, including right triangles.