Skip to ContentGo to accessibility pageKeyboard shortcuts menu
OpenStax Logo
Algebra 1

1.10.2 Graphing Equations in Context

Algebra 11.10.2 Graphing Equations in Context

Search for key terms or text.

Activity

Los Angeles county fair.

For numbers 1 – 7, use the equation x+y=20x+y=20 which represents the relationship between the number of games, xx, the number of rides, yy, and the dollar amount a student is spending on games and rides at an amusement park.

1.

What’s the number of rides the student could get on if they don’t play any games?

2.

What would the coordinate be on the graph to represent the answer to question 1?

3.

What’s the number of games the student could play if they don’t get on any rides?

4.

What would the coordinate be on the graph to represent the answer to question 3?

Self Check

Which of the following equations correctly solved  2 x + 4 y = 8 for y ?
  1. y = 1 2 x + 8
  2. y = 1 2 x + 2
  3. y = 2 x + 4
  4. y = 1 2 x + 2

Additional Resources

Find the Slope of a Line

When you graph linear equations, you may notice that some lines tilt up as they go from left to right and some lines tilt down. Some lines are very steep and some lines are flatter.

In mathematics, the measure of the steepness of a line is called the of slope the line. The concept of slope has many applications in the real world. In construction the pitch of a roof, the slant of the plumbing pipes, and the steepness of the stairs are all applications of slope. As you ski or jog down a hill, you definitely experience a slope. We can assign a numerical value to the slope of a line by finding the ratio of the rise and run. The rise is the amount the vertical distance changes while the run measures the horizontal change, as shown in this illustration. Slope is a rate of change.

A diagram with two arrows forming an L-shape: a vertical arrow labeled rise pointing up, and a horizontal arrow labeled run pointing right.

Slope of a Line

The slope of a line is m=riserunm=riserun. The rise measures the vertical change and the run measures the horizontal change. To find the slope of a line, we locate two points on the line whose coordinates are integers. Then we sketch a right triangle where the two points are vertices and one side is horizontal and one side is vertical. To find the slope of the line, we measure the vertical distance is called the rise and the horizontal distance is called the run.

How To Find the Slope from a Graph

Find the slope of a line from its graph using m=riserunm=riserun

Step 1 - Locate two points on the line whose coordinates are integers.

Step 2 - Starting with one point, sketch a right triangle, going from the first point to the second point.

Step 3 - Count the rise and the run on the legs of the triangle.

Step 4 - Take the ratio of rise to run to find the slope: m=riserunm=riserun.

Example 1

Find the slope of the line shown.

A graph with x and y axes showing a downward-sloping straight line passing through points (0, 6) and (8, 0) on a grid. The line has a negative slope.

Solution

Step 1 - Locate two points on the graph whose coordinates are integers.

(0,5)(0,5) and (3,3)(3,3)

Step 2 - Starting at (0,5)(0,5), sketch a right triangle to (3,3)(3,3) as shown in this graph.

A graph with x and y axes showing a downward-sloping straight line passing through points (0, 6) and (8, 0) on a grid. The line has a negative slope.

Step 3 - Count the rise(how many spaces up or down)— since it goes down, it is negative.

The rise is 22.

Step 4 - Count the run (how many spaces to the right or left).

The run is 3.

Step 5 - Use the slope formula.

m=riserunm=riserun

Step 6 - Substitute the values of the rise and run.

m=23m=23

Step 7 - Simplify.

m=23m=23

So yy decreases by 2 units as xx increases by 3 units.

Slopes of Horizontal and Vertical Lines

How do we find the slope of horizontal and vertical lines? To find the slope of the horizontal line, y=4y=4, we could graph the line, find two points on it, and count the rise and the run. Let’s see what happens when we do this, as shown in the graph below.

A graph with a horizontal arrowed line passing through points (0, 4) and (3, 4) on a grid. The x-axis ranges from -1 to 6, and the y-axis ranges from 0 to 8.

Step 1 - What is the rise?

The rise is 0.

Step 2 - What is the run?

The run is 3.

Step 3 - What is the slope?

m=riserunm=riserun

m=03m=03

m=0m=0

So The slope of the horizontal line y=4y=4 is 0.

Let's also consider a vertical line, the line x=3x=3, as shown in the graph below.

Vertical number line on a coordinate grid, spanning y-values from 1 to 3 at x=3, featuring arrows at both ends, indicating direction.

Step 1 - What is the rise?

The rise is 2.

Step 2 - What is the run?

The run is 0.

Step 3 - What is the slope?

m=riserunm=riserun

m=20m=20

The slope is undefined since division by zero is undefined. So we say that the slope of the vertical line is undefined.

  • All horizontal lines have slope 0. When the yy–coordinates are the same, the rise is 0.
  • The slope of any vertical line is undefined. When the xx–coordinates of a line are all the same, the run is 0.

Quick Guide to the Slopes of Lines

Positive slope with an upward arrow, negative slope with a downward arrow, zero slope with horizontal arrows, undefined slope with vertical arrows.

Sometimes we’ll need to find the slope of a line between two points when we don’t have a graph to count out the rise and the run. We could plot the points on grid paper, then count out the rise and the run, but as we’ll see, there is a way to find the slope without graphing. Before we get to it, we need to introduce some algebraic notation.

We have seen that an ordered pair (x,y)(x,y) gives the coordinates of a point. But when we work with slopes, we use two points. How can the same symbol (x,y)(x,y) be used to represent two different points? Mathematicians use subscripts to distinguish the points.

We will use (xx1 ,yy1) to identify the first point and (xx2,yy2) to identify the second point. Let’s see how the rise and run relate to the coordinates of the two points by taking another look at the slope of the line between the points (2,3)and (7,6), as shown in this graph.

Graph illustrating a line segment from point (2, 3) to (7, 6) with grid lines. Displays horizontal and vertical distances used to calculate slope.

Step 1 - Since we have two points, we will use subscript notation.

(x1,y12,3)(x1,y12,3)(x2,y27,6)(x2,y27,6)

Step 2 - What is the slope?

The rise is 3.

The run is 5.

Step 3 - What is the slope?

m=riserunm=riserun

On the graph, we counted the rise of 3 and the run of 5. m=35m=35

Notice that the rise of 3 can be found by subtracting the yy–coordinates, 6 and 3, and the run of 5 can be found by subtracting the xx–coordinates, 7 and 2.

Step 4 - We rewrite the rise and run by putting in the coordinates.

m=6372m=6372

But 6 is yy2, the yy–coordinate of the second point and 3 is yy1, the yy–coordinate of the first point. So we can rewrite the slope using subscript notation.

m=y2y172m=y2y172

Also, 7 is xx 2, the xx–coordinate of the second point and 2 is xx1, the xx–coordinate of the first point. So again, we rewrite the slope using subscript notation

m=y2y1x2x1m=y2y1x2x1

We’ve shown that m=y2y1x2x1m=y2y1x2x1 is really another version of m=riserunm=riserun. We can use this formula to find the slope of a line when we have two points on the line.

How to Find the Slope from Two Points

The slope of the line between two points (x1,y1)x1,y1) and (x2,y2x2,y2)  is: m=y2y1x2x1m=y2y1x2x1

Example 2

Step 1 - We’ll call (-2, -3) point #1 and (-7, 4) point #2.

(x1,y12,3)(x1,y12,3) (x2,y27,4)(x2,y27,4)

Step 2 - Use the slope formula.

m=y2y1x2x1m=y2y1x2x1

Step 3 - Substitute the values.

yy of the second point minus yy of the first point.

xx of the second point minus xx of the first point

m=4(3)7(2)m=4(3)7(2)

Step 4 - Simplify.

m=4+37+2m=4+37+2

m=75m=75

m=75m=75

Step 5 - Let's verify this slope on the graph shown.

m=y2y1x2x1m=y2y1x2x1

Graph showing a negative slope line on a grid, labeled with "rise" and "run." Line moves from point (-7, 4) to (2, -5), highlighting slope calculation.

Try it

Try It: Find the Slope of a Line

Find the slope of the line graph below.

Line graph on a coordinate plane showing a straight line passing through two points moving diagonally upward from left to right. The axes are labeled x and y, each ranging from -8 to 8.

Citation/Attribution

This book may not be used in the training of large language models or otherwise be ingested into large language models or generative AI offerings without OpenStax's permission.

Want to cite, share, or modify this book? This book uses the Creative Commons Attribution-NonCommercial-ShareAlike License and you must attribute OpenStax.

Attribution information
  • If you are redistributing all or part of this book in a print format, then you must include on every physical page the following attribution:

    Access for free at https://openstax.org/books/algebra-1/pages/about-this-course

  • If you are redistributing all or part of this book in a digital format, then you must include on every digital page view the following attribution:

    Access for free at https://openstax.org/books/algebra-1/pages/about-this-course

Citation information

© May 21, 2025 OpenStax. Textbook content produced by OpenStax is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike License . The OpenStax name, OpenStax logo, OpenStax book covers, OpenStax CNX name, and OpenStax CNX logo are not subject to the Creative Commons license and may not be reproduced without the prior and express written consent of Rice University.