← 고급 및 일반 /

코사인 법칙 계산기

코사인 법칙을 사용하여 삼각형을 풀어보세요. 사인 법칙이 실패하는 SSS 및 SAS 경우에 작동합니다.

[email protected], Geometry Calculator Developer & Online Math Educator 검수 마지막 업데이트 April 24, 2026

코사인 법칙 계산기

코사인 법칙 계산기에서 사용된 공식

c² = a² + b² − 2ab·cos(C)
cos(C) = (a² + b² − c²) / (2ab)

In-Depth Tutorial: 코사인 법칙 계산기

The Law of Cosines is the second of the two universal triangle-solving tools — partnered with the Law of Sines. Where the Law of Sines works for AAS, ASA, and SSA cases (you have a matched side-angle pair), the Law of Cosines works for the cases where you don't: SSS (three sides) and SAS (two sides + included angle). It also reduces to the Pythagorean theorem when the included angle is 90° — making it the Pythagorean theorem's natural generalization to all triangles. This tutorial walks through the statement, the proof, when to use it vs the Law of Sines, and worked examples for the SSS and SAS cases.

The Law of Cosines stated

For any triangle with sides a, b, c and the angle C opposite side c:

c² = a² + b² − 2ab · cos(C)

By symmetry, the same relation holds for the other two angles by relabeling:

  • a² = b² + c² − 2bc · cos(A)
  • b² = a² + c² − 2ac · cos(B)
  • c² = a² + b² − 2ab · cos(C)

For finding an angle from three sides, rearrange to solve for cos(C):

cos(C) = (a² + b² − c²) / (2ab)

The Pythagorean theorem connection

When C = 90°, cos(C) = 0, and the formula reduces to:

c² = a² + b² − 2ab · 0 = a² + b²

That's the Pythagorean theorem. So the Law of Cosines is a strict generalization — it works for ANY triangle, with the −2ab·cos(C) term being a "correction" that vanishes when the triangle is right.

The sign of the correction also tells you about the triangle:

  • cos(C) > 0 (C is acute, < 90°): the correction term is positive, so c² < a² + b² (c is shorter than the Pythagorean would predict). The triangle is acute at C.
  • cos(C) = 0 (C is exactly 90°): correction vanishes. Right triangle at C.
  • cos(C) < 0 (C is obtuse, > 90°): correction is negative, so c² > a² + b² (c is longer than Pythagorean would predict). Obtuse at C.

This is the converse Pythagorean test in disguise.

Proof from coordinates

Place a triangle on the coordinate plane: put vertex A at the origin, side AB along the positive x-axis with length c, and let vertex B = (c, 0). Place C somewhere above the x-axis.

From angle A and side b (length from A to C), the coordinates of C are:

C = (b · cos(A), b · sin(A))

The third side a goes from B = (c, 0) to C = (b·cos(A), b·sin(A)). Apply the distance formula:

a² = (b·cos(A) − c)² + (b·sin(A))²
= b²cos²(A) − 2bc·cos(A) + c² + b²sin²(A)
= b²(cos²(A) + sin²(A)) − 2bc·cos(A) + c²
= b² + c² − 2bc·cos(A)

The middle line used the Pythagorean identity cos² + sin² = 1. The result is the Law of Cosines.

When to use Law of Cosines vs Law of Sines

You knowUse
SSS (3 sides)Law of Cosines (to find any angle)
SAS (2 sides + included angle)Law of Cosines (to find the third side)
ASA (2 angles + included side)Law of Sines (after computing third angle)
AAS (2 angles + non-included side)Law of Sines (after computing third angle)
SSA (2 sides + non-included angle)Law of Sines — beware ambiguous case

Mnemonic: Use Law of Cosines when no matched side-angle pair is yet known. Then if needed, switch to Law of Sines once you have one.

Worked example — SSS

Triangle with sides a = 5, b = 7, c = 9. Find all three angles.

Start with C (the angle opposite the longest side, often safest):

cos(C) = (5² + 7² − 9²) / (2 · 5 · 7) = (25 + 49 − 81) / 70 = −7/70 = −0.1

C = arccos(−0.1) ≈ 95.74° (obtuse, as expected from c² > a² + b²).

Next find A:

cos(A) = (7² + 9² − 5²) / (2 · 7 · 9) = (49 + 81 − 25) / 126 = 105/126 ≈ 0.8333

A = arccos(0.8333) ≈ 33.56°.

Third angle: B = 180° − 95.74° − 33.56° = 50.70°. (Verified by Law of Cosines on B, but the sum-to-180° check is faster.)

Worked example — SAS

Triangle with a = 8, b = 10, and included angle C = 60°. Find side c.

c² = 8² + 10² − 2(8)(10)cos(60°) = 64 + 100 − 160(0.5) = 164 − 80 = 84

c = √84 ≈ 9.17.

Then to find the other angles, switch to Law of Sines:

sin(A) / 8 = sin(60°) / 9.17

sin(A) = 8 · sin(60°) / 9.17 ≈ 8 · 0.866 / 9.17 ≈ 0.755

A = arcsin(0.755) ≈ 49.11°.

B = 180° − 60° − 49.11° = 70.89°.

Why Law of Cosines doesn't have an "ambiguous case"

For SSS, the three sides uniquely determine the triangle (up to congruence). The Law of Cosines computes cos(C) directly, and arccos returns a unique angle in (0°, 180°). No ambiguity.

For SAS, the angle is given, so the third side is uniquely determined. Again no ambiguity.

Contrast SSA (handled by Law of Sines): arcsin returns either of two supplementary angles, and you need to manually choose which is valid. The Law of Cosines avoids this by working with arccos, which is single-valued in the relevant range.

The vector-form generalization

The Law of Cosines is also the geometric statement of the dot product. For two vectors u and v with angle θ between them:

u · v = |u| · |v| · cos(θ)

Expand and rearrange: if u and v are two sides of a triangle meeting at angle θ, the third side w = v − u satisfies |w|² = |v|² + |u|² − 2|u||v|cos(θ) — exactly the Law of Cosines.

This is why the Law of Cosines extends naturally to higher-dimensional geometry: it is the dot-product formula in disguise.

Common mistakes

  • Sign error on the −2ab·cos(C) term. Some students write +2ab·cos(C). The formula has a MINUS sign in front of the 2ab·cos(C) term — confirmed by the Pythagorean reduction (when C = 90°, cos(C) = 0 and the term vanishes; if the sign were +, the formula would not reduce correctly).
  • Using a sin/cos table only for acute angles. The Law of Cosines applies to any triangle, including obtuse ones. cos of an obtuse angle is negative; arccos of a negative value returns an angle in (90°, 180°). The formula handles this automatically.
  • Mixing up which side is c. The formula c² = a² + b² − 2ab·cos(C) requires that C is the angle OPPOSITE c, and a/b are the two sides adjacent to C. Get this matching wrong and the formula gives nonsense.
  • Forgetting to take the square root for c. The formula gives c², not c. Apply √ at the end.

자주 묻는 질문 – 코사인 법칙 계산기

SSS(3변의 길이를 알고 각을 구하는 경우)와 SAS(2변과 그 사이각을 알고 나머지 한 변을 구하는 경우)에 사용하십시오. 사인 법칙이 모호한 경우에도 처리할 수 있습니다.

c² = a² + b² − 2ab·cos(C). 각을 구하려면: cos(C) = (a² + b² − c²) / (2ab).

C = 90°일 때, cos(C) = 0이 되어 공식은 c² = a² + b²로 단순화되며, 이는 고전적인 피타고라스 정리에 해당합니다.

네 — 무료이며 무제한입니다.