Skip to main content
Statistics LibreTexts

8.4: Find the Equation of a Line Given its Graph

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

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

    \( \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{\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}\)

    Learning Outcomes

    1. Find the slope of a line given its graph.
    2. Find the y-intercept of a line given its graph.
    3. Find the equation of a line given its graph.

    There are two main ways of representing a line: the first is with its graph, and the second is with its equation. In this section, we will practice how to find the equation of the line if we are given the graph of the line. The two key numbers in the equation of a line are the slope and the \(y\)-intercept. Thus the main steps in finding the equation of a line are finding the slope and finding the y-intercept. In statistics we are often presented with a scatter plot where we can eyeball the line. Once we have the graph of the line, getting the equation is helpful for making predictions based on the line.

    Finding the Slope of a Line Given Its Graph

    The steps to follow to find the slope of the line given its graph are the following.

    Step 1: Identify two points on the line. Any two points will do, but it is recommended to find points with nice \(x\) and \(y\) coordinates.

    Step 2: The slope is the rise over the run. Thus if the points have coordinates \(\left(x_1,y_1\right)\) and \(\left(x_2,\:y_2\right)\), then the slope is:

    \[Slope\:=\:\frac{Rise}{Run}=\frac{y_2-y_1}{x_2-x_1}\nonumber \]

    Example \(\PageIndex{1}\)

    Find the slope of the line shown below.

    Graph of line through (0,-4) and (2,2)

    Solution

    First, we locate points on the line that are as easy as possible to work with. The points with integer coordinates are (0, -4) and (2, 2).

    Next, we use the rise over run formula to find the slope of the line.

    \[Slope\:=\:\frac{y_2-y_1}{x_2-x_1}=\frac{2-\left(-4\right)}{2-0}=\frac{6}{2}=3\nonumber \]

    Finding the y-intercept from the graph

    If the portion of the graph that is in view includes the \(y\)-axis, then the \(y\)-intercept is very easy to spot. You just see where it crosses the \(y\)-axis. On the other hand, if the portion of the graph in view does not contain the \(y\)-axis, then it is best to first find the equation of the line and then use the equation to find the \(y\)-intercept.

    Example \(\PageIndex{2}\)

    Find the \(y\)-intercept of the line shown below.

    line that crosses the y-axis at y = 1.

    Solution

    We just look at the line and notice that it crosses the \(y\)-axis at \(y=1\). Therefore, the \(y\)-intercept is 1 or (0, 1).

    Finding the equation of the line given its graph

    If you are given the graph of a line and want to find its equation, then you first find the slope as in Example \(\PageIndex{1}\). Then you use \(y\)-intercept, which is \(b\), and the slope, \(m\), and put it into the slope-intercept equation:

    \[y =mx + b \nonumber \]

    Example \(\PageIndex{3}\)

    Find the equation of the line shown below.

    line through (0,-1) and (3,1)

    Solution

    First we find the slope by identifying two nice points. Notice that the line passes through (0, -1) and (3, 1). Now compute the slope using the rise over run formula:

    \[Slope\:=\frac{\:rise}{run}=\frac{1-\left(-1\right)}{3-0}=\frac{2}{3}\nonumber \]

    We can easily see that the \(y\)-intercept is (0, -1). Thus, \(b\) = -1.

    Next use the slope-intercept equation with \(m = \dfrac{2}{3}\) and \(b = -1\).

    \[y=\frac{2}{3}x-1\nonumber \]

    Try It

    Find the equation of this line in slope-intercept form.

    The line passes through (0, 2) and (1, -1).

    Answer

    \(y = -3x + 2\)

    Additional video resources: 

    Ex 1: Find the Equation of a Line in Slope Intercept Form Given the Graph of a Line

    Finding the Equation of a Line Given Its Graph


    This page titled 8.4: Find the Equation of a Line Given its Graph is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by Nancy Ikeda.

    • Was this article helpful?