Skip to main content
Mathematics LibreTexts

11.2: The Law of Cosines

  • Page ID
    203502
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\dsum}{\displaystyle\sum\limits} \)

    \( \newcommand{\dint}{\displaystyle\int\limits} \)

    \( \newcommand{\dlim}{\displaystyle\lim\limits} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \(\newcommand{\longvect}{\overrightarrow}\)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    The Law of Cosines

    Theorem: Law of Cosines

    If the angles of a triangle are \(A\), \(B\), and \(C\), and the opposite sides are respectively \(a\), \(b\), and \(c\), then\[ \begin{array}{rcl}
    a^2 & = & b^2+c^2-2 b c \cos \left(A\right) \\[6pt] b^2 & = & a^2+c^2-2 a c \cos\left( B\right) \\[6pt] c^2 & = & a^2+b^2-2 a b \cos \left(C\right) \\[6pt] \end{array} \nonumber \]

    Proof

    Start with general triangles as seen in the figures below.

    Two general triangles, one acute (left) and one obtuse (right), with altitudes labeled as \( h \)
    8.2.2 Figure (Fixed).png

    We will perform the proof for the acute triangle (the proof associated with the obtuse triangle is similar).

    The acute triangle is comprised of two right triangles - \( \triangle ABD \) and \( \triangle BCD \). Let \( x \) be the length of the line segment \( \overline{AD} \). Then the length of the segment \( \overline{CD} \) is \( b - x \). We show these facts in the following figure, splitting the general right triangle into its two right triangle pieces.

    "Splitting" the acute triangle into two right triangles
    8.2.3 Figure.png

    With the leftmost triangle, we have the following:\[ \begin{array}{rrclcl}
    & \left( b - x \right)^2 + h^2 & = & a^2 & \quad & \left(\text{Pythagorean Theorem}\right) \\[6pt] \implies & b^2 - 2bx + x^2 + h^2 & = & a^2 & \quad & \left( \text{distributing} \right) \\[6pt] \end{array} \nonumber \]With the rightmost triangle, we have\[ x^2 + h^2 = c^2 \quad \left( \text{Pythagorean Theorem} \right) \nonumber \]Therefore,\[ b^2 - 2bx + x^2 + h^2 = a^2 \quad \text{and} \quad x^2 + h^2 = c^2. \nonumber \]Replace \( x^2 + h^2 \) in the first equation with \( c^2 \). Doing so yields the following:\[ b^2 - 2bx + c^2 = a^2 \implies b^2 + c^2 - 2bx = a^2. \nonumber \]From the rightmost triangle in the figure above, we see that \( \cos\left( A \right) = \frac{x}{c} \), and so \( c \, \cos\left( A \right) = x \). Hence, we have developed the following relationship between the sides of any triangle.\[ \begin{array}{rrclcl}
    & b^2 + c^2 - 2bx & = & a^2 & & \\[6pt] \implies & b^2 + c^2 - 2b\left( c \, \cos\left( A \right) \right) & = & a^2 & \quad & \left( \text{substitution} \right) \\[6pt] \implies & b^2 + c^2 - 2bc \, \cos\left( A \right) & = & a^2 & & \\[6pt] \end{array} \nonumber \]When \(A\) is a right angle, \(\cos\left( A \right) = \cos\left( 90^{\circ}\right)=0\), so the equation reduces to the Pythagorean Theorem.

    We can write similar equations involving the angles \(B\) or \(C\). In all cases, the angle within the cosine is opposite the side playing the role of the "hypotenuse" (really, a quasi-hypotenuse).

    Finding a Side

    Example \( \PageIndex{ 1 } \)

    In \(\triangle A B C\), \(a=11\), \(c=23\), and \(B=87^{\circ}\). Find \(b\), and round your answer to two decimal places.

    Finding an Angle

    Example \( \PageIndex{ 2 } \)

    In \(\triangle A B C\), \(a=5.3\), \(b=4.7\), and \(c=6.1\). Find angle \(B\), and round your answer to two decimal places.

    Applications Involving the Law of Cosines

    Example \( \PageIndex{3} \)

    The hour hand on Kim's antique clock is 4 inches long and the minute hand is 5.5 inches long. Find the distance between the ends of the hands when the clock reads four o’clock. Round your answer to the nearest hundredth of an inch.

    Revisiting Navigation Problems

    Example \( \PageIndex{ 4 } \)

    The sailing club leaves the marina on a heading of \(15^{\circ}\) and sails for 18 miles. They then change course, and after traveling for 12 miles on a heading of \(35^{\circ}\), they experience engine trouble and radio for help. The marina sends a speed boat to rescue them. How far should the speed boat go, and on what heading?


    This page titled 11.2: The Law of Cosines is shared under a CC BY-SA 12 license and was authored, remixed, and/or curated by Roy Simpson.

    • Was this article helpful?