Skip to main content
Mathematics LibreTexts

3.5: The Pythagorean Theorem, Distance Formula, and Midpoint Formula

  • Page ID
    190948
  • \( \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}\)

    Definitions and Theorems

    The Pythagorean Theorem describes the fundamental relationship among the three sides of a right triangle. Applied to points in the coordinate plane, it yields two of the most frequently used tools in coordinate geometry: the distance formula and the midpoint formula.

    Theorem: Pythagorean Theorem

    In a right triangle, if \(c\) is the length of the hypotenuse, and the lengths of the two legs are denoted by \(a\) and \(b\) (as shown in the figure below), then\[a^2 + b^2 = c^2. \nonumber \]

    Illustration of a right triangle with sides labeled a, b, and hypotenuse c in pink outline.
    Caution

    The Pythagorean Theorem applies only to right triangles, and \(c\) must always be the hypotenuse—the side opposite the right angle, which is also the longest side.

    Definition: Pythagorean Triple

    A Pythagorean triple consists of three positive integers \(a\), \(b\), and \(c\), such that \(a^2 + b^2 = c^2\).

    Definition: Pythagorean Triangle

    A right triangle whose sides form a Pythagorean triple is called a Pythagorean triangle.

    Theorem: Distance Formula

    The distance \(d\) between two points \(P_1\left(x_1, y_1\right)\) and \(P_2\left(x_2, y_2\right)\) is\[d=\sqrt{\left(x_2-x_1\right)^2+\left(y_2-y_1\right)^2}. \nonumber\]

    Where the Distance Formula Comes From

    The distance formula is the Pythagorean Theorem applied to the horizontal change \(x_2 - x_1\) and the vertical change \(y_2 - y_1\) between the two points, which serve as the legs of a right triangle whose hypotenuse is the segment connecting the points. Because each difference is squared, the order in which you subtract does not matter; you may label either point as \((x_1, y_1)\).

    Definition: Midpoint

    The midpoint of a line segment is the point on the segment that is equidistant from its two endpoints. Equivalently, it is the point that divides the segment into two equal parts.

    Theorem: Midpoint Formula

    The midpoint \(M\) of the line segment with endpoints \(A = (x_1, y_1)\) and \(B = (x_2, y_2)\) is\[M = \left( \dfrac{x_1 + x_2}{2}, \dfrac{y_1 + y_2}{2} \right).\nonumber\]That is, each coordinate of the midpoint is the average of the corresponding coordinates of the endpoints.

    Examples

    Example \(\PageIndex{1}\): Finding the Hypotenuse

    A right triangle has legs of length \(8\) and \(15\). Find the length of the hypotenuse.

    Solution
    The legs have lengths \(a = 8\) and \(b = 15\), and the hypotenuse has unknown length \(c\). By the Pythagorean Theorem,\[c^2 = a^2 + b^2 = 8^2 + 15^2 = 64 + 225 = 289.\nonumber\]Taking the positive square root, since a length cannot be negative, gives \(c = \sqrt{289} = 17\).
    Example \(\PageIndex{2}\): Finding a Leg

    A right triangle has a hypotenuse of length \(13\) and one leg of length \(5\). Find the length of the other leg.

    Solution
    The hypotenuse has length \(c = 13\) and one leg has length \(a = 5\); the other leg has unknown length \(b\). Rearranging the Pythagorean Theorem to isolate the unknown leg,\[b^2 = c^2 - a^2 = 13^2 - 5^2 = 169 - 25 = 144.\nonumber\]Thus \(b = \sqrt{144} = 12\).
    Example \(\PageIndex{3}\): Distance Between Two Points

    Find the distance between the points \(A = (1, 2)\) and \(B = (4, 6)\).

    Solution
    Apply the Distance Formula, substituting the coordinates of \(A\) and \(B\):\[d = \sqrt{(4 - 1)^2 + (6 - 2)^2} = \sqrt{3^2 + 4^2} = \sqrt{9 + 16} = \sqrt{25} = 5.\nonumber\]The distance between the two points is \(5\).
    Example \(\PageIndex{4}\): A Distance Requiring Simplification

    Find the distance between the points \(A = (-3, 2)\) and \(B = (3, -4)\).

    Solution
    Substitute the coordinates into the Distance Formula, taking care with the signs:\[d = \sqrt{(3 - (-3))^2 + (-4 - 2)^2} = \sqrt{6^2 + (-6)^2} = \sqrt{36 + 36} = \sqrt{72}.\nonumber\]Simplify the radical by factoring out the largest perfect square, \(36\):\[\sqrt{72} = \sqrt{36 \cdot 2} = 6\sqrt{2}.\nonumber\]The distance between the two points is \(6\sqrt{2}\).
    Example \(\PageIndex{5}\): Finding a Midpoint

    Find the midpoint of the line segment with endpoints \(A = (-5, 7)\) and \(B = (3, -1)\).

    Solution
    Average the coordinates of the endpoints using the Midpoint Formula:\[M = \left( \dfrac{-5 + 3}{2}, \dfrac{7 + (-1)}{2} \right) = \left( \dfrac{-2}{2}, \dfrac{6}{2} \right) = (-1, 3).\nonumber\]The midpoint is \((-1, 3)\).
    Example \(\PageIndex{6}\): Finding an Unknown Endpoint

    The midpoint of a line segment is \(M = (5, 1)\), and one endpoint is \(A = (2, -4)\). Find the other endpoint.

    Solution
    Let the unknown endpoint be \(B = (x, y)\). Because each coordinate of the midpoint is the average of the corresponding coordinates of the endpoints, the Midpoint Formula produces one equation per coordinate:\[\dfrac{2 + x}{2} = 5 \qquad \text{and} \qquad \dfrac{-4 + y}{2} = 1.\nonumber\]Solving the first equation, \(2 + x = 10\), so \(x = 8\). Solving the second, \(-4 + y = 2\), so \(y = 6\). The other endpoint is \(B = (8, 6)\).

    Sources

    Several parts of this text use modifications from the following sources:

    All of these sources are released under the Creative Commons Attribution-Share-Alike License 4.0.


    This page titled 3.5: The Pythagorean Theorem, Distance Formula, and Midpoint Formula was last modified on Sat, 11 Jul 2026 16:15:12 GMT and is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Roy Simpson, Cosumnes River College.

    • Was this article helpful?