Solve Triangles Using Law of Cosines Calculator
Calculate unknown sides and angles of any triangle with our Law of Cosines solver. Accurate, fast, and easy to use.
Triangle Law of Cosines Solver
Input two sides and the included angle (SAS), or all three sides (SSS), to find the remaining sides and angles.
Length of side opposite angle A.
Length of side opposite angle B.
Length of side opposite angle C.
Angle opposite side a.
Angle opposite side b.
Angle opposite side c.
Triangle Visualization
What is Solving Triangles Using the Law of Cosines?
Solving a triangle means finding the lengths of all three sides and the measures of all three angles. The Law of Cosines is a fundamental principle in trigonometry that allows us to do this when we have specific information about the triangle. It’s particularly useful when we encounter triangles that are not right-angled, as basic trigonometric ratios (SOH CAH TOA) only apply to right triangles.
This method is essential for:
- Determining unknown dimensions in geometric constructions.
- Calculating distances and bearings in surveying and navigation.
- Analyzing forces and vectors in physics.
- Solving problems in engineering and architecture where precise measurements are critical.
Who Should Use It?
Anyone dealing with geometric problems where right triangles aren’t guaranteed should be familiar with the Law of Cosines. This includes:
- High school and college students learning trigonometry.
- Surveyors and engineers mapping out land or designing structures.
- Navigators plotting courses across the globe.
- Physicists analyzing motion and forces.
- Architects and designers creating blueprints.
Common Misconceptions
A common misunderstanding is that the Law of Cosines is only for obtuse triangles. In reality, it works perfectly for acute triangles as well. Another misconception is that it’s overly complex; while it involves a few more steps than basic trig, it’s a direct application of a formula. Lastly, many forget that it requires either Side-Angle-Side (SAS) or Side-Side-Side (SSS) information to be applicable, and cannot solve triangles given only Angle-Angle-Side (AAS) or Angle-Side-Angle (ASA) directly (though the Law of Sines can be used in those cases, or after using Law of Cosines to find a missing side).
Law of Cosines Formula and Mathematical Explanation
The Law of Cosines provides a relationship between the three sides ($a$, $b$, $c$) of any triangle and one of its angles (e.g., $C$). It’s an extension of the Pythagorean theorem, making it applicable to non-right triangles.
The Formula
For a triangle with sides $a$, $b$, $c$, and opposite angles $A$, $B$, $C$ respectively, the Law of Cosines can be stated as:
- $c^2 = a^2 + b^2 – 2ab \cos(C)$
- $b^2 = a^2 + c^2 – 2ac \cos(B)$
- $a^2 = b^2 + c^2 – 2bc \cos(A)$
These can be rearranged to solve for the angles:
- $\cos(C) = \frac{a^2 + b^2 – c^2}{2ab}$
- $\cos(B) = \frac{a^2 + c^2 – b^2}{2ac}$
- $\cos(A) = \frac{b^2 + c^2 – a^2}{2bc}$
Derivation (Conceptual)
Imagine placing one vertex of the triangle at the origin (0,0) of a coordinate plane. Let side $b$ lie along the positive x-axis. The coordinates of the vertices would be $A=(0,0)$, $B=(c, 0)$, and $C=(a \cos(B), a \sin(B))$. Using the distance formula for the length of side $b$ between points $A$ and $C$, and substituting the coordinates, we arrive at the Law of Cosines. This derivation fundamentally relies on vector dot products or coordinate geometry and extends the Pythagorean theorem.
Variable Explanations
Here’s a breakdown of the variables used:
| Variable | Meaning | Unit | Typical Range |
|---|---|---|---|
| $a, b, c$ | Lengths of the sides of the triangle. | Units of length (e.g., meters, feet, cm, inches) | Positive real numbers ($> 0$) |
| $A, B, C$ | Measures of the interior angles of the triangle. | Degrees or Radians | $(0, 180^\circ)$ or $(0, \pi)$ radians for each angle. The sum of all angles must be $180^\circ$ or $\pi$ radians. |
| $\cos(C)$ | The cosine of angle C. | Unitless | $[-1, 1]$ |
Practical Examples (Real-World Use Cases)
The Law of Cosines is incredibly versatile. Here are a couple of examples illustrating its application:
Example 1: Calculating Distance Between Two Cities
Imagine you are at city A. City B is 200 miles east of A. City C is located such that the angle formed by the line segment AB and AC (Angle A) is 70 degrees, and the distance from B to C (side $a$) is 250 miles. You want to find the distance from A to C (side $b$).
- Given: Side $c$ (distance AB) = 200 miles, Side $a$ (distance BC) = 250 miles, Angle $A$ = 70°.
- We need to find Side $b$ (distance AC).
- Using the Law of Cosines: $a^2 = b^2 + c^2 – 2bc \cos(A)$
- Rearranging to solve for $b$: $b^2 = a^2 + c^2 – 2ac \cos(B)$ — Oops, this isn’t right. We are given angle A, so we use the formula involving cos(A).
- Correct formula application: $a^2 = b^2 + c^2 – 2bc \cos(A)$
- Wait, this formula gives us $a$ if we know $b, c, A$. We know $a, c, A$ and want $b$. The formula is derived as $a^2 = b^2 + c^2 – 2bc \cos(A)$. Let’s rearrange this. This requires solving a quadratic equation for $b$. This is not the standard SAS case.
- Let’s reframe: Suppose we know the distances from a central point (e.g., an airport) to two different cities, and the angle between those directions.
- Revised Example 1: Navigation Planning
- An aircraft flies 300 km from point P to point Q. It then changes course and flies 400 km to point R. The angle at point Q, formed by the path PQ and QR, is 110 degrees (Angle Q = 110°). We want to find the direct distance from P to R (side $q$).
- Inputs: Side $p$ (distance QR) = 400 km, Side $r$ (distance PQ) = 300 km, Angle $Q$ = 110°.
- Formula: $q^2 = p^2 + r^2 – 2pr \cos(Q)$
- Calculation:
$q^2 = 400^2 + 300^2 – 2(400)(300) \cos(110^\circ)$
$q^2 = 160000 + 90000 – 240000 \times (-0.3420)$
$q^2 = 250000 + 82080$
$q^2 = 332080$
$q = \sqrt{332080} \approx 576.26$ km - Result: The direct distance from P to R is approximately 576.26 km. This is useful for flight planning or estimating travel time.
Example 2: Surveying Land Boundaries
A surveyor is measuring a triangular plot of land. They measure two sides of the plot: 150 meters and 180 meters. The angle between these two measured sides (Angle C) is 85 degrees. They need to determine the length of the third side (side $c$) to complete the boundary description.
- Inputs: Side $a$ = 150 m, Side $b$ = 180 m, Angle $C$ = 85°.
- We need to find Side $c$.
- Formula: $c^2 = a^2 + b^2 – 2ab \cos(C)$
- Calculation:
$c^2 = 150^2 + 180^2 – 2(150)(180) \cos(85^\circ)$
$c^2 = 22500 + 32400 – 54000 \times (0.0872)$
$c^2 = 54900 – 4708.8$
$c^2 = 50191.2$
$c = \sqrt{50191.2} \approx 224.03$ m - Result: The third side of the land plot is approximately 224.03 meters. This value is crucial for property deeds and land management.
How to Use This Solve Triangles Using Law of Cosines Calculator
Our calculator is designed for ease of use, whether you’re a student, engineer, or hobbyist. Follow these simple steps:
- Identify Your Knowns: Determine which sides and angles of your triangle you know. The Law of Cosines is typically used in two scenarios:
- SAS (Side-Angle-Side): You know two sides and the angle *between* them.
- SSS (Side-Side-Side): You know the lengths of all three sides.
- Input Values:
- Enter the lengths of the known sides into the ‘Side a’, ‘Side b’, and ‘Side c’ fields.
- Enter the measure of the known angle (in degrees) into the ‘Angle A’, ‘Angle B’, or ‘Angle C’ fields.
- Important: For SAS cases, ensure the angle you input is the one *between* the two sides you entered. For SSS cases, you’ll typically enter all three side lengths and leave angles blank (the calculator will solve for them).
- If you know a value (e.g., side b), but not another (e.g., angle B), leave the unknown input blank or enter 0. The calculator will compute it.
- Validate Inputs: As you type, the calculator will perform real-time checks for valid numbers (positive lengths, angles between 0 and 180 degrees). Error messages will appear below any invalid input fields.
- Calculate: Click the ‘Calculate’ button.
- Interpret Results:
- The ‘Primary Result’ will highlight one of the calculated missing values (e.g., a side length or angle).
- The ‘Intermediate Results’ will show all calculated values, including any sides or angles that were initially unknown.
- The ‘Formula Used’ section clarifies which trigonometric laws were applied.
- The ‘Triangle Visualization’ chart provides a visual representation of your triangle.
- Copy Results: Use the ‘Copy Results’ button to copy all computed values to your clipboard for use elsewhere.
- Reset: Click ‘Reset’ to clear all fields and start over with default values.
Decision-Making Guidance
Knowing all sides and angles of a triangle is fundamental in many practical fields. For instance:
- Construction: Understanding the exact dimensions of roof trusses or building frames.
- Navigation: Calculating precise distances and headings between points.
- Engineering: Analyzing forces in structures or designing components.
The Law of Cosines calculator ensures accuracy, minimizing errors in calculations that could have significant real-world consequences.
Key Factors That Affect Solving Triangles Using the Law of Cosines
While the Law of Cosines itself is a fixed mathematical principle, the accuracy and interpretation of its results depend on several factors related to the input data and the context of the problem.
- Input Accuracy: The most critical factor. If the initial measurements of sides or angles are imprecise (due to measurement error, instrument limitations, or rounding), the calculated results will also be inaccurate. This is especially true for SSS cases where small measurement errors can lead to significant differences in calculated angles.
- Units of Measurement: Ensure consistency. If sides are measured in meters, the resulting side will also be in meters. Angles must be consistently used in degrees or radians. Our calculator assumes degrees for angle inputs.
- Triangle Inequality Theorem: For any valid triangle, the sum of the lengths of any two sides must be greater than the length of the third side. If the input sides violate this ($a+b \le c$, etc.), no such triangle exists, and the calculation might yield invalid results (e.g., trying to find the square root of a negative number when solving for an angle). Our calculator includes checks for this.
- Angle Range: Interior angles of a triangle must be greater than 0° and less than 180°. Inputs outside this range are invalid for a standard Euclidean triangle. The Law of Cosines formula for angles will naturally handle this, as the $\cos(\theta)$ value will dictate whether the angle is acute or obtuse.
- Ambiguous Case (Law of Sines vs. Cosines): The Law of Cosines (especially in SSS mode) does not suffer from the “ambiguous case” that the Law of Sines can present when solving for an angle given SSA (Side-Side-Angle). In SSA, there might be zero, one, or two possible triangles. The Law of Cosines, when given SSS or SAS, uniquely defines a triangle.
- Computational Precision: While digital calculators are generally precise, extremely large or small numbers, or calculations involving many steps, can introduce minor floating-point errors. For most practical geometry problems, standard double-precision calculations are sufficient.
- Real-World Constraints: Sometimes, theoretical calculations might not perfectly align with physical reality due to factors like terrain curvature (for very large distances), atmospheric refraction, or flexible materials. The interpretation of results must consider these practical limitations.
Frequently Asked Questions (FAQ)
Q1: When should I use the Law of Cosines instead of the Law of Sines?
Use the Law of Cosines when you have:
1. Side-Angle-Side (SAS): two sides and the included angle.
2. Side-Side-Side (SSS): all three sides.
Use the Law of Sines when you have:
1. Angle-Angle-Side (AAS): two angles and a non-included side.
2. Angle-Side-Angle (ASA): two angles and the included side.
The Law of Sines can also be used after the Law of Cosines in SAS or SSS cases to find the remaining angles more easily, but be mindful of the ambiguous case (SSA) if using Law of Sines for angles directly.
Q2: Can the Law of Cosines be used for right triangles?
Yes, absolutely. If you apply the Law of Cosines to a right triangle, it simplifies to the Pythagorean theorem ($c^2 = a^2 + b^2$). This happens because $\cos(90^\circ) = 0$, making the $-2ab \cos(C)$ term zero when $C=90^\circ$.
Q3: What does it mean if the Law of Cosines gives a negative value under the square root when solving for an angle?
This typically indicates that the input side lengths do not form a valid triangle according to the Triangle Inequality Theorem (the sum of any two sides must be greater than the third side). For example, if you input sides 1, 2, and 5, you cannot form a triangle. The formula $\cos(A) = \frac{b^2 + c^2 – a^2}{2bc}$ would lead to a value for $\cos(A)$ outside the range [-1, 1], or attempting to find a side length might involve taking the square root of a negative number.
Q4: How accurate are the results from this calculator?
The calculator uses standard JavaScript floating-point arithmetic, which provides high precision for most common applications. Results are typically accurate to several decimal places. However, be aware of the limitations of floating-point precision for extremely large or small numbers.
Q5: Can I use this calculator for triangles in 3D space?
No, this calculator is specifically designed for solving planar (2D) triangles using the Law of Cosines. Problems in 3D space require vector mathematics or other specialized techniques.
Q6: What if I input only two sides and want to find the third?
If you input only two sides (e.g., side a and side b) and leave the third side (c) and all angles blank or as 0, the calculator cannot solve for a unique triangle. You need either SAS (two sides and the included angle) or SSS (all three sides) information to uniquely determine a triangle using the Law of Cosines.
Q7: Do I need to worry about radians vs. degrees?
Yes. The Law of Cosines formula $\cos(C)$ expects the angle $C$ in radians if your cosine function expects radians, or in degrees if it expects degrees. This calculator specifically asks for angles in degrees and converts them internally for trigonometric calculations if needed, ensuring consistency.
Q8: What are the units for the sides?
The units for the sides are arbitrary but must be consistent. If you input sides in ‘meters’, the calculated third side will also be in ‘meters’. The calculator itself does not enforce specific units like feet or inches; it works with the numerical values you provide.
Related Tools and Internal Resources
-
Law of Sines Calculator
Instantly solve triangles when given two angles and one side (AAS or ASA), or when facing the ambiguous SSA case. -
Pythagorean Theorem Calculator
Calculate the hypotenuse or a leg of a right triangle using the fundamental a² + b² = c² formula. -
Area of a Triangle Calculator
Find the area of any triangle using various formulas, including base/height, Heron’s formula, and SAS/SSS trigonometric methods. -
Angle Conversion Tool
Easily convert angle measurements between degrees and radians, essential for trigonometric calculations. -
Trigonometry Basics Explained
A comprehensive guide to sine, cosine, tangent, and their applications in solving geometric problems. -
Geometry Formulas Cheat Sheet
A quick reference for essential formulas related to shapes, angles, and measurements in Euclidean geometry.