Skip to content
Graph Linear Equations in Two Variables

Graph Linear Equations in Two Variables

By the end of this section, you will be able to: plot points in a rectangular coordinate system, graph a linear equation by plotting points, graph vertical and horizontal lines, find the xx- and yy-intercepts, and graph a line using the intercepts.

Plot points in a rectangular coordinate system

Just like maps use a grid system to identify locations, a grid system is used in algebra to show a relationship between two variables in a rectangular coordinate system. The rectangular coordinate system is also called the xyxy-plane or the “coordinate plane.”

The rectangular coordinate system is formed by two intersecting number lines, one horizontal and one vertical. The horizontal number line is called the xx-axis. The vertical number line is called the yy-axis. These axes divide a plane into four regions, called quadrants. The quadrants are identified by Roman numerals, beginning on the upper right and proceeding counterclockwise.

xyIIIIIIIV

In the rectangular coordinate system, every point is represented by an ordered pair. The first number in the ordered pair is the xx-coordinate of the point, and the second number is the yy-coordinate of the point. The phrase “ordered pair” means that the order is important.

Ordered pair. An ordered pair (x,y)(x,y) gives the coordinates of a point in a rectangular coordinate system. The first number is the xx-coordinate. The second number is the yy-coordinate.

What is the ordered pair of the point where the axes cross? At that point both coordinates are zero, so its ordered pair is (0,0)(0,0). The point (0,0)(0,0) has a special name. It is called the origin.

The origin. The point (0,0)(0,0) is called the origin. It is the point where the xx-axis and yy-axis intersect.

We use the coordinates to locate a point on the xyxy-plane. Let’s plot the point (1,3)(1,3) as an example. First, locate 11 on the xx-axis and lightly sketch a vertical line through x=1x=1. Then, locate 33 on the yy-axis and sketch a horizontal line through y=3y=3. Now, find the point where these two lines meet—that is the point with coordinates (1,3)(1,3).

xy(1, 3)

Notice that the vertical line through x=1x=1 and the horizontal line through y=3y=3 are not part of the graph. We just used them to help us locate the point (1,3)(1,3).

When one of the coordinates is zero, the point lies on one of the axes. The point (0,4)(0,4) is on the yy-axis and the point (2,0)(-2,0) is on the xx-axis.

xy(0, 4)(−2, 0)
Points on the axes. Points with a yy-coordinate equal to 00 are on the xx-axis, and have coordinates (a,0)(a,0). Points with an xx-coordinate equal to 00 are on the yy-axis, and have coordinates (0,b)(0,b).

Example. Plot each point in the rectangular coordinate system and identify the quadrant in which the point is located: (a) (5,4)(-5,4) (b) (3,4)(-3,-4) (c) (2,3)(2,-3) (d) (0,1)(0,-1) (e) (3,52)\left(3,\tfrac{5}{2}\right).

The first number of the coordinate pair is the xx-coordinate, and the second number is the yy-coordinate. To plot each point, sketch a vertical line through the xx-coordinate and a horizontal line through the yy-coordinate. Their intersection is the point.

(a) Since x=5x=-5, the point is to the left of the yy-axis. Also, since y=4y=4, the point is above the xx-axis. The point (5,4)(-5,4) is in Quadrant II.

(b) Since x=3x=-3, the point is to the left of the yy-axis. Also, since y=4y=-4, the point is below the xx-axis. The point (3,4)(-3,-4) is in Quadrant III.

(c) Since x=2x=2, the point is to the right of the yy-axis. Since y=3y=-3, the point is below the xx-axis. The point (2,3)(2,-3) is in Quadrant IV.

(d) Since x=0x=0, the point whose coordinates are (0,1)(0,-1) is on the yy-axis.

(e) Since x=3x=3, the point is to the right of the yy-axis. Since y=52y=\tfrac{5}{2}, the point is above the xx-axis. (It may be helpful to write 52\tfrac{5}{2} as a mixed number or decimal.) The point (3,52)\left(3,\tfrac{5}{2}\right) is in Quadrant I.

xy(−5, 4)(−3, −4)(2, −3)(0, −1)(3, 2.5)

Plot the point (-2, 1). In which quadrant is it located? Enter the quadrant number.

The signs of the xx-coordinate and yy-coordinate affect the location of the points. We can summarize sign patterns of the quadrants in this way:

Quadrant IQuadrant IIQuadrant IIIQuadrant IV
(+,+)(+,+)(,+)(-,+)(,)(-,-)(+,)(+,-)

Up to now, all the equations you have solved were equations with just one variable. In almost every case, when you solved the equation you got exactly one solution. But equations can have more than one variable. Equations with two variables may be of the form Ax+By=CAx+By=C. An equation of this form is called a linear equation in two variables.

Linear equation. An equation of the form Ax+By=CAx+By=C, where AA and BB are not both zero, is called a linear equation in two variables.

Here is an example of a linear equation in two variables, xx and yy:

4x+y=8A=4, B=1, C=84x+y=8 \qquad A=4,\ B=1,\ C=8

The equation y=3x+5y=-3x+5 is also a linear equation. But it does not appear to be in the form Ax+By=CAx+By=C. We can use the Addition Property of Equality and rewrite it in Ax+By=CAx+By=C form.

y=3x+5Add 3x to both sides.y+3x=3x+5+3xSimplify.y+3x=5Use the Commutative Property.3x+y=5 \begin{array}{lrcl} &y&=&-3x+5\\[4pt] \text{Add }3x\text{ to both sides.}&y+3x&=&-3x+5+3x\\[4pt] \text{Simplify.}&y+3x&=&5\\[4pt] \text{Use the Commutative Property.}&3x+y&=&5 \end{array}

By rewriting y=3x+5y=-3x+5 as 3x+y=53x+y=5, we can easily see that it is a linear equation in two variables because it is of the form Ax+By=CAx+By=C. When an equation is in the form Ax+By=CAx+By=C, we say it is in standard form.

Standard form of a linear equation. A linear equation is in standard form when it is written Ax+By=CAx+By=C.

Most people prefer to have AA, BB, and CC be integers and A0A\geq0 when writing a linear equation in standard form, although it is not strictly necessary.

Linear equations have infinitely many solutions. For every number that is substituted for xx there is a corresponding yy value. This pair of values is a solution to the linear equation and is represented by the ordered pair (x,y)(x,y). When we substitute these values of xx and yy into the equation, the result is a true statement, because the value on the left side is equal to the value on the right side.

Solution of a linear equation in two variables. An ordered pair (x,y)(x,y) is a solution of the linear equation Ax+By=CAx+By=C if the equation is a true statement when the xx- and yy-values of the ordered pair are substituted into the equation.

Linear equations have infinitely many solutions. We can plot these solutions in the rectangular coordinate system. The points will line up perfectly in a straight line. We connect the points with a straight line to get the graph of the equation. We put arrows on the ends of each side of the line to indicate that the line continues in both directions.

A graph is a visual representation of all the solutions of the equation. It is an example of the saying, “A picture is worth a thousand words.” The line shows you all the solutions to that equation. Every point on the line is a solution of the equation. And, every solution of this equation is on this line. This line is called the graph of the equation. Points not on the line are not solutions!

Graph of a linear equation. The graph of a linear equation Ax+By=CAx+By=C is a straight line.

  • Every point on the line is a solution of the equation.
  • Every solution of this equation is a point on this line.

Example. The graph of y=2x3y=2x-3 is shown. For each ordered pair, decide: (a) Is the ordered pair a solution to the equation? (b) Is the point on the line? A: (0,3)(0,-3); B: (3,3)(3,3); C: (2,3)(2,-3); D: (1,5)(-1,-5).

Substitute the xx- and yy-values into the equation to check if the ordered pair is a solution to the equation.

PointSubstitution and decision
A: (0,3)(0,-3)3=2(0)3=3-3=2(0)-3=-3; (0,3)(0,-3) is a solution.
B: (3,3)(3,3)3=2(3)3=33=2(3)-3=3; (3,3)(3,3) is a solution.
C: (2,3)(2,-3)32(2)3=1-3\ne2(2)-3=1; (2,3)(2,-3) is not a solution.
D: (1,5)(-1,-5)5=2(1)3=5-5=2(-1)-3=-5; (1,5)(-1,-5) is a solution.
xy(0, −3)(3, 3)(2, −3)(−1, −5)y = 2x − 3

The points (0,3)(0,-3), (3,3)(3,3), and (1,5)(-1,-5) are on the line y=2x3y=2x-3, and the point (2,3)(2,-3) is not on the line. The points that are solutions to y=2x3y=2x-3 are on the line, but the point that is not a solution is not on the line.

For y=3x1y=3x-1, is (2,5)(2,5) a solution? Enter 1 for yes or 0 for no.

Graph a linear equation by plotting points

There are several methods that can be used to graph a linear equation. The first method we will use is called plotting points, or the Point-Plotting Method. We find three points whose coordinates are solutions to the equation and then plot them in a rectangular coordinate system. By connecting these points in a line, we have the graph of the linear equation.

Example. How to graph a linear equation by plotting points. Graph the equation y=2x+1y=2x+1 by plotting points.

Step 1. Find three points whose coordinates are solutions to the equation. You can choose any values for xx or yy. In this case, since yy is isolated on the left side of the equation, it is easier to choose values for xx.

x=0y=2(0)+1=1x=1y=2(1)+1=3x=2y=2(2)+1=3 \begin{array}{lrcl} x=0&y&=&2(0)+1=1\\[4pt] x=1&y&=&2(1)+1=3\\[4pt] x=-2&y&=&2(-2)+1=-3 \end{array}

Organize the solutions in a table.

xxyy(x,y)(x,y)
0011(0,1)(0,1)
1133(1,3)(1,3)
2-23-3(2,3)(-2,-3)

Step 2. Plot the points in a rectangular coordinate system. Check that the points line up. If they do not, carefully check your work.

Step 3. Draw the line through the three points. Extend the line to fill the grid and put arrows on both ends of the line. This line is the graph of y=2x+1y=2x+1.

xy(0, 1)(1, 3)(−2, −3)y = 2x + 1

Graph a linear equation by plotting points.

  1. Find three points whose coordinates are solutions to the equation. Organize them in a table.
  2. Plot the points in a rectangular coordinate system. Check that the points line up. If they do not, carefully check your work.
  3. Draw the line through the three points. Extend the line to fill the grid and put arrows on both ends of the line.

It is true that it only takes two points to determine a line, but it is a good habit to use three points. If you only plot two points and one of them is incorrect, you can still draw a line but it will not represent the solutions to the equation. It will be the wrong line. If you use three points, and one is incorrect, the points will not line up. This tells you something is wrong and you need to check your work.

When an equation includes a fraction as the coefficient of xx, we can still substitute any numbers for xx. But the arithmetic is easier if we make “good” choices for the values of xx. This way we will avoid fractional answers, which are hard to graph precisely.

Example. Graph the equation y=12x+3y=\tfrac12x+3.

Find three points that are solutions to the equation. Since this equation has the fraction 12\tfrac12 as a coefficient of xx, we will choose values of xx carefully. We will use zero as one choice and multiples of 22 for the other choices. Why are multiples of two a good choice for values of xx? By choosing multiples of 22 the multiplication by 12\tfrac12 simplifies to a whole number.

x=0y=12(0)+3=3x=2y=12(2)+3=4x=4y=12(4)+3=5 \begin{array}{lrcl} x=0&y&=&\tfrac12(0)+3=3\\[4pt] x=2&y&=&\tfrac12(2)+3=4\\[4pt] x=4&y&=&\tfrac12(4)+3=5 \end{array}
xxyy(x,y)(x,y)
0033(0,3)(0,3)
2244(2,4)(2,4)
4455(4,5)(4,5)

Plot the points, check that they line up, and draw the line.

xy(0, 3)(2, 4)(4, 5)y = 1/2 x + 3

For the equation y=2x3y=2x-3, find y when x = 0.

For the equation y=2x+4y=-2x+4, find y when x = 1.

Graph vertical and horizontal lines

Some linear equations have only one variable. They may have just xx and no yy, or just yy without an xx. This changes how we make a table of values to get the points to plot.

Let’s consider the equation x=3x=-3. This equation has only one variable, xx. The equation says that xx is always equal to 3-3, so its value does not depend on yy. No matter what is the value of yy, the value of xx is always 3-3. So to make a table of values, write 3-3 in for all the xx-values. Then choose any values for yy. Since xx does not depend on yy, you can choose any numbers you like. But to fit the points on our coordinate graph, we’ll use 11, 22, and 33 for the yy-coordinates.

xxyy(x,y)(x,y)
3-311(3,1)(-3,1)
3-322(3,2)(-3,2)
3-333(3,3)(-3,3)

Plot the points from the table and connect them with a straight line. Notice that we have graphed a vertical line.

xy(−3, 1)(−3, 2)(−3, 3)x = −3

What if the equation has yy but no xx? Let’s graph the equation y=4y=4. This time the yy-value is a constant, so in this equation, yy does not depend on xx. Fill in 44 for all the yy’s and then choose any values for xx. We’ll use 00, 22, and 44 for the xx-coordinates.

xxyy(x,y)(x,y)
0044(0,4)(0,4)
2244(2,4)(2,4)
4444(4,4)(4,4)

In this figure, we have graphed a horizontal line passing through the yy-axis at 44.

xy(0, 4)(2, 4)(4, 4)y = 4
Vertical and horizontal lines. A vertical line is the graph of an equation of the form x=ax=a. The line passes through the xx-axis at (a,0)(a,0). A horizontal line is the graph of an equation of the form y=by=b. The line passes through the yy-axis at (0,b)(0,b).

Example. Graph: (a) x=2x=2 (b) y=1y=-1.

(a) The equation has only one variable, xx, and xx is always equal to 22. We create a table where xx is always 22 and then put in any values for yy. The graph is a vertical line passing through the xx-axis at 22.

(b) Similarly, the equation y=1y=-1 has only one variable, yy. The value of yy is constant. All the ordered pairs have the same yy-coordinate. The graph is a horizontal line passing through the yy-axis at 1-1.

xyx = 2y = −1

For the vertical line x=5x=5, what is the x-coordinate of every point?

What is the difference between the equations y=4xy=4x and y=4y=4? The equation y=4xy=4x has both xx and yy. The value of yy depends on the value of xx, so the yy-coordinate changes according to the value of xx. The equation y=4y=4 has only one variable. The value of yy is constant, it does not depend on the value of xx, so the yy-coordinate is always 44.

xyy = 4xy = 4

Example. Graph y=3xy=-3x and y=3y=-3 in the same rectangular coordinate system. We notice that the first equation has the variable xx, while the second does not. We make a table of points for each equation and then graph the lines.

y=3xy=-3xy=3y=-3
xxyy(x,y)(x,y)xxyy(x,y)(x,y)
0000(0,0)(0,0)003-3(0,3)(0,-3)
113-3(1,3)(1,-3)113-3(1,3)(1,-3)
226-6(2,6)(2,-6)223-3(2,3)(2,-3)
xyy = −3xy = −3

For the horizontal line y=3y=3, what is the y-coordinate of every point?

Find xx- and yy-intercepts

Every linear equation can be represented by a unique line that shows all the solutions of the equation. We have seen that when graphing a line by plotting points, you can use any three solutions to graph. This means that two people graphing the line might use different sets of three points.

At first glance, their two lines might not appear to be the same, since they would have different points labeled. But if all the work was done correctly, the lines should be exactly the same. One way to recognize that they are indeed the same line is to look at where the line crosses the xx-axis and the yy-axis. These points are called the intercepts of a line.

Intercepts of a line. The points where a line crosses the xx-axis and the yy-axis are called the intercepts of the line.

For each line, the yy-coordinate of the point where the line crosses the xx-axis is zero. The point where the line crosses the xx-axis has the form (a,0)(a,0) and is called the xx-intercept of the line. The xx-intercept occurs when yy is zero. In each line, the xx-coordinate of the point where the line crosses the yy-axis is zero. The point where the line crosses the yy-axis has the form (0,b)(0,b) and is called the yy-intercept of the line. The yy-intercept occurs when xx is zero.

xx-intercept and yy-intercept of a line. The xx-intercept is the point (a,0)(a,0) where the line crosses the xx-axis. The yy-intercept is the point (0,b)(0,b) where the line crosses the yy-axis.

  • The xx-intercept occurs when yy is zero.
  • The yy-intercept occurs when xx is zero.

Example. Find the xx- and yy-intercepts on each graph shown.

a)xy(4, 0)(0, 2)
b)xy(2, 0)(0, −6)
c)xy(−5, 0)(0, −5)

(a) The graph crosses the xx-axis at the point (4,0)(4,0). The xx-intercept is (4,0)(4,0). The graph crosses the yy-axis at the point (0,2)(0,2). The yy-intercept is (0,2)(0,2).

(b) The graph crosses the xx-axis at the point (2,0)(2,0). The xx-intercept is (2,0)(2,0). The graph crosses the yy-axis at the point (0,6)(0,-6). The yy-intercept is (0,6)(0,-6).

(c) The graph crosses the xx-axis at the point (5,0)(-5,0). The xx-intercept is (5,0)(-5,0). The graph crosses the yy-axis at the point (0,5)(0,-5). The yy-intercept is (0,5)(0,-5).

A graph crosses the x-axis at (2, 0). What is its x-intercept?

Recognizing that the xx-intercept occurs when yy is zero and that the yy-intercept occurs when xx is zero, gives us a method to find the intercepts of a line from its equation. To find the xx-intercept, let y=0y=0 and solve for xx. To find the yy-intercept, let x=0x=0 and solve for yy.

Find the xx- and yy-intercepts from the equation of a line. Use the equation of the line. To find:

  • the xx-intercept of the line, let y=0y=0 and solve for xx.
  • the yy-intercept of the line, let x=0x=0 and solve for yy.

Example. Find the intercepts of 2x+y=82x+y=8.

We will let y=0y=0 to find the xx-intercept, and let x=0x=0 to find the yy-intercept. We will fill in a table, which reminds us of what we need to find.

To find the x-intercept, let y=0.2x+y=82x+0=8Simplify.2x=8x=4 \begin{array}{lrcl} \text{To find the }x\text{-intercept, let }y=0.&2x+y&=&8\\[4pt] &2x+0&=&8\\[4pt] \text{Simplify.}&2x&=&8\\[4pt] &x&=&4 \end{array}

The xx-intercept is (4,0)(4,0).

To find the y-intercept, let x=0.2x+y=82(0)+y=8Simplify.y=8 \begin{array}{lrcl} \text{To find the }y\text{-intercept, let }x=0.&2x+y&=&8\\[4pt] &2(0)+y&=&8\\[4pt] \text{Simplify.}&y&=&8 \end{array}

The yy-intercept is (0,8)(0,8). The intercepts are the points (4,0)(4,0) and (0,8)(0,8).

Find the x-intercept of 3x+y=123x+y=12.

Find the y-intercept of x+4y=8x+4y=8.

Graph a line using the intercepts

To graph a linear equation by plotting points, you need to find three points whose coordinates are solutions to the equation. You can use the xx- and yy-intercepts as two of your three points. Find the intercepts, and then find a third point to ensure accuracy. Make sure the points line up—then draw the line. This method is often the quickest way to graph a line.

Example. How to graph a line using the intercepts. Graph x+2y=6-x+2y=6 using the intercepts.

Step 1. Find the xx- and yy-intercepts of the line. Let y=0y=0 and solve for xx; let x=0x=0 and solve for yy.

x+2(0)=6x=6x=60+2y=62y=6y=3 \begin{array}{rcl} -x+2(0)&=&6\\[4pt] -x&=&6\\[4pt] x&=&-6 \end{array} \qquad \begin{array}{rcl} -0+2y&=&6\\[4pt] 2y&=&6\\[4pt] y&=&3 \end{array}

The xx-intercept is (6,0)(-6,0) and the yy-intercept is (0,3)(0,3).

Step 2. Find another solution to the equation. We’ll use x=2x=2.

2+2y=6,2y=8,y=4-2+2y=6,\quad 2y=8,\quad y=4

A third point is (2,4)(2,4).

Step 3. Plot the three points. Check that the points line up.

xxyy(x,y)(x,y)
6-600(6,0)(-6,0)
0033(0,3)(0,3)
2244(2,4)(2,4)

Step 4. Draw the line.

xy(−6, 0)(0, 3)(2, 4)

Graph a linear equation using the intercepts.

  1. Find the xx- and yy-intercepts of the line.
    • Let y=0y=0 and solve for xx.
    • Let x=0x=0 and solve for yy.
  2. Find a third solution to the equation.
  3. Plot the three points and check that they line up.
  4. Draw the line.

Example. Graph 4x3y=124x-3y=12 using the intercepts.

Find the intercepts and a third point.

x-intercept, let y=0y-intercept, let x=0third point, let y=44x3(0)=124(0)3y=124x3(4)=124x=123y=124x12=12x=3y=44x=24x=6 \begin{array}{lll} x\text{-intercept, let }y=0 & y\text{-intercept, let }x=0 & \text{third point, let }y=4\\[4pt] 4x-3(0)=12 & 4(0)-3y=12 & 4x-3(4)=12\\[4pt] 4x=12 & -3y=12 & 4x-12=12\\[4pt] x=3 & y=-4 & 4x=24\\[4pt] &&x=6 \end{array}

We list the points in the table and show the graph.

xxyy(x,y)(x,y)
3300(3,0)(3,0)
004-4(0,4)(0,-4)
6644(6,4)(6,4)
xy(3, 0)(0, −4)(6, 4)

For 5x2y=105x-2y=10, find the x-intercept.

Example. Graph y=5xy=5x using the intercepts.

Let y=0y=0: 0=5x0=5x, so 0=x0=x. Let x=0x=0: y=50y=5\cdot0, so y=0y=0. The xx-intercept and the yy-intercept are both (0,0)(0,0). This line has only one intercept. It is the point (0,0)(0,0).

To ensure accuracy, we need to plot three points. Since the xx- and yy-intercepts are the same point, we need two more points to graph the line. Let x=1x=1, so y=5(1)=5y=5(1)=5. Let x=1x=-1, so y=5(1)=5y=5(-1)=-5.

xxyy(x,y)(x,y)
0000(0,0)(0,0)
1155(1,5)(1,5)
1-15-5(1,5)(-1,-5)

Plot the three points, check that they line up, and draw the line.

xy(0, 0)(1, 5)(−1, −5)y = 5x

For y=4xy=4x, use x = 1 to find a second point on the line.

Key terms

rectangular coordinate system — a grid formed by the xx-axis and yy-axis. quadrants — the four regions into which the axes divide the plane. ordered pair(x,y)(x,y), the coordinates of a point. origin — the point (0,0)(0,0). linear equation in two variables — an equation of the form Ax+By=CAx+By=C, where AA and BB are not both zero. standard form — the form Ax+By=CAx+By=C. solution of a linear equation in two variables — an ordered pair that makes the equation true. graph of a linear equation — the straight line made up of all its solutions. vertical line — the graph of x=ax=a. horizontal line — the graph of y=by=b. intercepts of a line — the points where a line crosses the axes. xx-intercept(a,0)(a,0), where a line crosses the xx-axis. yy-intercept(0,b)(0,b), where a line crosses the yy-axis.


This section is adapted from Intermediate Algebra 2e, Section 3.1: Graph Linear Equations in Two Variables by Lynn Marecek and Andrea Honeycutt Mathis, © OpenStax, licensed under CC BY-NC-SA 4.0. Access the original for free at openstax.org. Changes: recreated the coordinate-plane figures as accessible interactive graphs and the solution tables as markdown tables; omitted the Be Prepared quiz, Self Check checklist, and end-of-section exercises; and converted the practice problems (“Try Its”) into interactive exercises with instant feedback.