How to solve slope with two points

Slope, sometimes referred to as gradient in mathematics, is a number that measures the steepness and direction of a line, or a section of a line connecting two points, and is usually denoted by m. Generally, a line's steepness is measured by the absolute value of its slope, m. The larger the value is, the steeper the line. Given m, it is possible to determine the direction of the line that m describes based on its sign and value:

  • A line is increasing, and goes upwards from left to right when m > 0
  • A line is decreasing, and goes downwards from left to right when m < 0
  • A line has a constant slope, and is horizontal when m = 0
  • A vertical line has an undefined slope, since it would result in a fraction with 0 as the denominator. Refer to the equation provided below.

Slope is essentially the change in height over the change in horizontal distance, and is often referred to as "rise over run." It has applications in gradients in geography as well as civil engineering, such as the building of roads. In the case of a road, the "rise" is the change in altitude, while the "run" is the difference in distance between two fixed points, as long as the distance for the measurement is not large enough that the earth's curvature should be considered as a factor. The slope is represented mathematically as:

In the equation above, y2 - y1 = Δy, or vertical change, while x2 - x1 = Δx, or horizontal change, as shown in the graph provided. It can also be seen that Δx and Δy are line segments that form a right triangle with hypotenuse d, with d being the distance between the points (x1, y1) and (x2, y2). Since Δx and Δy form a right triangle, it is possible to calculate d using the Pythagorean theorem. Refer to the Triangle Calculator for more detail on the Pythagorean theorem as well as how to calculate the angle of incline θ provided in the calculator above. Briefly:

d = √(x2 - x1)2 + (y2 - y1)2

The above equation is the Pythagorean theorem at its root, where the hypotenuse d has already been solved for, and the other two sides of the triangle are determined by subtracting the two x and y values given by two points. Given two points, it is possible to find θ using the following equation:

m = tan(θ)

Given the points (3,4) and (6,8) find the slope of the line, the distance between the two points, and the angle of incline:

d = √(6 - 3)2 + (8 - 4)2 = 5

While this is beyond the scope of this calculator, aside from its basic linear use, the concept of a slope is important in differential calculus. For non-linear functions, the rate of change of a curve varies, and the derivative of a function at a given point is the rate of change of the function, represented by the slope of the line tangent to the curve at that point.

The following video will teach how to find the equation of a line, given any two points on that line.

Video Source (7:13 mins) | Transcript

Steps to find the equation of a line from two points:

  1. Find the slope using the slope formula
    • \({\text{Slope}}={\text{m}}=\frac{\text{rise}}{\text{run}}=\frac{{\text{y}}_2-{\text{y}}_1}{{\text{x}}_2-{\text{x}}_1}\)
    • \(\text{Point 1 or P}_{1}=(\text{x}_{1}, \text{y}_{1})\)
    • \(\text{Point 2 or P}_{2}=(\text{x}_{2}, \text{y}_{2})\)
  2. Use the slope and one of the points to solve for the y-intercept (b).
    • One of your points can replace the x and y, and the slope you just calculated replaces the m of your equation y = mx + b. Then b is the only variable left. Use the tools you know for solving for a variable to solve for b.
  3. Once you know the value for m and the value for b, you can plug these into the slope-intercept form of a line (y = mx + b) to get the equation for the line.

Additional Resources

  • Khan Academy: Slope-Intercept Equation from Two Points (06:41 mins, Transcript)
  • Khan Academy: Slope-Intercept Form Problems (14:57 mins, Transcript)

Practice Problems

For each of the following problems, find the equation of the line that passes through the following two points:

  1. \(\left ( -5,10 \right )\) and \(\left ( -3,4 \right )\)
  2. \(\left ( -5,-26 \right )\) and \(\left ( -2,-8 \right )\)
  3. \(\left ( -4,-22 \right )\) and \(\left ( -6,-34 \right )\)
  4. \(\left ( 3,1 \right )\) and \(\left ( -6,-2 \right )\)
  5. \(\left ( 4,-6 \right )\) and \(\left ( 6,3 \right )\)
  6. \(\left ( 5,5 \right )\) and \(\left ( 3,2 \right )\)
View Solutions

Solutions

  1. \({\text{y}}=-3{\text{x}}-5\) (Written Solution)

    Step 1: Find the slope using the formula:

    \({\text{Slope}}={\text{m}}=\frac{\text{rise}}{\text{run}}=\frac{{\text{y}}_2-{\text{y}}_1}{{\text{x}}_2-{\text{x}}_1}\)

    We have two points,\(\left ( -5,10 \right )\) and \(\left ( -3,4 \right )\). We will choose \(\left ({\color{Red} -5},{\color{Red} 10} \right )\) as point one and \(\left ({\color{Blue} -3},{\color{Blue} 4} \right )\) as point two. (It does not matter which is point one and which is point two as long as we stay consistent throughout our calculations.) Now we can plug the points into our formula for slope:

    \(\frac{{\text{y}}_2-{\text{y}}_1}{{\text{x}}_2-{\text{x}}_1}=\frac{{\color{Blue}4}-{\color{Red}10}}{{\color{Blue}-3}-({\color{Red}-5})}\)

    Now we can simplify: \(\frac{4-10}{-3-(-5)}=\frac{4-10}{-3+5}=\frac{-6}{2}=-3\)

    The slope of the line is \({\color{Blue} -3}\), so the m in y=mx+b is \({\color{Blue} -3}\).

    Step 2: Use the slope and one of the points to find the y-intercept b:

    It doesn’t matter which point we use. They will both give us the same value for b since they are on the same line. We choose the point \(\left ({\color{Green} -4}, {\color{Magenta} -22} \right )\). Now we will plug the slope, 6, and the point into y=mx+b to get the equation of the line.