How to Graph a Linear Equation: Step-by-Step Guide with Examples
Knowing how to graph a linear equation is one of the most essential skills in algebra — once you can draw a straight line accurately from an equation, you can read off its slope, intercepts, and direction at a glance without solving separately for each feature. A linear equation in two variables always produces a perfectly straight line on the coordinate plane, and every point on that line is a solution to the equation. This guide walks through three complete methods for graphing a linear equation, covering slope-intercept form, standard form, and the two-point method, with fully worked examples, special-case rules, common mistakes, and practice problems with solutions.
Contents
- 01What Is a Linear Equation? Understanding the Straight-Line Graph
- 02The Three Forms of a Linear Equation and What Each Gives You
- 03How to Graph a Linear Equation in Slope-Intercept Form
- 04How to Graph a Linear Equation in Standard Form
- 05How to Graph a Linear Equation Using Two Points
- 06Special Cases: Horizontal and Vertical Lines
- 07Common Mistakes When Graphing a Linear Equation
- 08Practice Problems: Graph These Linear Equations
- 09FAQ: How to Graph a Linear Equation
What Is a Linear Equation? Understanding the Straight-Line Graph
A linear equation is any equation that can be written in the form ax + by = c, where a, b, and c are real-number constants and x and y are variables. When you graph a linear equation on a coordinate plane, you always get a perfectly straight line — that is where the name "linear" comes from. Unlike a quadratic equation, which curves into a U-shaped parabola, a linear equation produces a line with a constant slope from one end to the other. The slope tells you how steeply the line rises or falls: a positive slope goes up to the right, a negative slope goes down to the right, a slope of zero produces a flat horizontal line, and an undefined slope produces a vertical line. Every ordered pair (x, y) that satisfies the equation lies on the line, and every point on the line satisfies the equation — so graphing a linear equation is simply a visual way to display all infinitely many solutions at once. Understanding how to graph a linear equation is foundational because straight lines appear in nearly every branch of mathematics and science, from speed-distance relationships in physics to cost functions in economics and trend lines in statistics.
Every linear equation in two variables represents a straight line. Two points determine the line exactly — but plotting a third point lets you verify that you have not made an arithmetic error.
The Three Forms of a Linear Equation and What Each Gives You
Linear equations appear in three standard algebraic forms in algebra courses. Each form reveals different information directly, which helps you choose the fastest graphing method before you plot a single point. Being fluent in all three forms — and knowing when to convert between them — makes graphing faster and more reliable. Recognizing the form of a linear equation the moment you see it is a skill worth developing early.
1. Slope-intercept form: y = mx + b
This is the most common and convenient form for graphing a linear equation. The coefficient m is the slope (rise ÷ run), and b is the y-intercept — the y-value where the line crosses the y-axis. Example: y = 3x − 2 has slope m = 3 and y-intercept b = −2. You can begin plotting immediately by placing a point at (0, −2) and applying the slope 3 (go 1 unit right and 3 units up) to find the next point at (1, 1). No rearranging is needed — all graphing information is visible at once.
2. Standard form: Ax + By = C
Standard form is written as Ax + By = C, where A, B, and C are integers and A is non-negative. It does not hand you the slope or y-intercept directly, but it makes finding both intercepts very easy by substitution: set x = 0 to find the y-intercept and set y = 0 to find the x-intercept. Example: 4x + 2y = 8. Set x = 0: 2y = 8 → y = 4, so the y-intercept is (0, 4). Set y = 0: 4x = 8 → x = 2, so the x-intercept is (2, 0). Plot both intercepts and draw the line through them. This "intercept method" is the fastest approach for standard form.
3. Point-slope form: y − y₁ = m(x − x₁)
Point-slope form is used when you know a specific point (x₁, y₁) on the line and the slope m. It is the natural form to write first when a problem gives you two points or a point and a slope. Example: a line with slope −2 passing through (3, 1) is written as y − 1 = −2(x − 3). To graph it, start at the given point (3, 1) and use slope −2 (go 1 unit right, 2 units down) to find additional points. You can also convert to slope-intercept form: distribute to get y − 1 = −2x + 6, then y = −2x + 7. Both forms describe the same line.
Slope-intercept form y = mx + b: slope and y-intercept appear immediately — best for quick graphing. Standard form Ax + By = C: use the intercept method (set x = 0, then y = 0) — best when intercepts are whole numbers. Point-slope form: best when given a point and slope or two points.
How to Graph a Linear Equation in Slope-Intercept Form
Slope-intercept form y = mx + b is the most direct way to graph a linear equation. The method below shows each step in full detail, using y = (2/3)x + 1 as the worked example. This equation has a fractional slope, which is common on tests and homework — the process is identical to integer slopes, but reading the rise and run from a fraction takes one extra moment of attention.
1. Step 1: Identify the slope m and y-intercept b
Compare the equation y = (2/3)x + 1 with the template y = mx + b. Slope: m = 2/3. Y-intercept: b = 1. The slope 2/3 means rise = 2, run = 3 — for every 3 units you move to the right along the x-axis, the line rises 2 units along the y-axis. Since b = 1 is positive, the y-intercept is above the x-axis. Write these values down before you touch the graph to avoid confusion mid-problem.
2. Step 2: Plot the y-intercept at (0, b)
The y-intercept is always the point (0, b). For y = (2/3)x + 1, place a solid dot at (0, 1) on the y-axis. This is your anchor point — every other point on the line is found relative to this location. Label it (0, 1) so you remember which point you started from.
3. Step 3: Apply the slope to find a second point
From (0, 1), count the rise and run according to m = 2/3: move 3 units to the right (run) and 2 units up (rise). New x-coordinate: 0 + 3 = 3. New y-coordinate: 1 + 2 = 3. Second point: (3, 3). Verify with the equation: y = (2/3)(3) + 1 = 2 + 1 = 3 ✓. Mark this second point with a dot.
4. Step 4: Find a third point by applying the slope again (or going backwards)
To get a third point, apply the slope a second time from (3, 3): move 3 more units right and 2 more units up → point (6, 5). Verify: y = (2/3)(6) + 1 = 4 + 1 = 5 ✓. Alternatively, go backwards from the y-intercept — move 3 units left and 2 units down → point (−3, −1). Verify: y = (2/3)(−3) + 1 = −2 + 1 = −1 ✓. You now have three verified points: (−3, −1), (0, 1), and (3, 3).
5. Step 5: Draw the line through all three points
Use a ruler to draw a straight line through (−3, −1), (0, 1), and (3, 3). If all three points are collinear (the ruler touches all three), your arithmetic is correct. Extend the line beyond your outermost points and add arrows on both ends to show that the line continues infinitely in both directions. Label the line with its equation y = (2/3)x + 1. Your graph of this linear equation is complete.
The slope is rise ÷ run. A slope of 2/3 means move 3 right and 2 up. A slope of −5/2 means move 2 right and 5 down. Keep the run positive when moving right; reverse both signs if you prefer to move left.
How to Graph a Linear Equation in Standard Form
When a linear equation is given in standard form Ax + By = C, the fastest graphing method is the intercept method: find where the line crosses each axis and draw the line through those two points. No rearranging into slope-intercept form is required — just two substitutions. The worked example below uses 3x − 2y = 6, which has a = 3, b = −2, and c = 6.
1. Step 1: Find the y-intercept by setting x = 0
Substitute x = 0 into 3x − 2y = 6: 3(0) − 2y = 6 → −2y = 6 → y = −3. The y-intercept is the point (0, −3). Plot this point on the y-axis. This calculation is always fast because setting x = 0 eliminates the x-term, leaving a one-step equation for y.
2. Step 2: Find the x-intercept by setting y = 0
Substitute y = 0 into 3x − 2y = 6: 3x − 2(0) = 6 → 3x = 6 → x = 2. The x-intercept is the point (2, 0). Plot this point on the x-axis. Setting y = 0 eliminates the y-term for the same reason — the calculation is always simple.
3. Step 3: Find a third verification point
Choose any convenient x-value. Use x = 4: 3(4) − 2y = 6 → 12 − 2y = 6 → −2y = −6 → y = 3. Third point: (4, 3). If this point falls exactly on the line connecting (0, −3) and (2, 0), both intercept calculations were correct. If it does not fit the line, recheck each substitution.
4. Step 4: Draw the line and verify the slope
Draw a straight line through (0, −3), (2, 0), and (4, 3), extending with arrows in both directions. Label the line 3x − 2y = 6. To confirm the slope, rearrange: 3x − 2y = 6 → 2y = 3x − 6 → y = (3/2)x − 3. Slope = 3/2, y-intercept = −3 ✓. The rise from (0, −3) to (2, 0) is 0 − (−3) = 3 units, and the run is 2 − 0 = 2 units, so slope = 3/2 ✓ — consistent.
The intercept method for standard form Ax + By = C: set x = 0 to get the y-intercept, then set y = 0 to get the x-intercept. Two substitutions give you two points — enough to draw the line.
How to Graph a Linear Equation Using Two Points
When a problem provides two specific points rather than an equation, you find the slope from those points, determine the equation of the line, and then graph it. This approach combines the slope formula with the point-slope form and is essential for geometry and coordinate-plane word problems. The worked example below uses the points (−1, 4) and (3, −4).
1. Step 1: Calculate the slope using the slope formula
Slope formula: m = (y₂ − y₁) / (x₂ − x₁). Assign: (x₁, y₁) = (−1, 4) and (x₂, y₂) = (3, −4). Calculate: m = (−4 − 4) / (3 − (−1)) = −8 / 4 = −2. The slope is −2, meaning for every 1 unit you move to the right, the line drops 2 units. The line runs steeply downward from left to right.
2. Step 2: Plot both given points on the coordinate plane
Place dots at (−1, 4) and (3, −4). These two points fully determine the line — there is exactly one straight line that passes through any two distinct points. Check that the horizontal distance between them is 3 − (−1) = 4 and the vertical distance is −4 − 4 = −8. Slope = −8/4 = −2 ✓.
3. Step 3: Find the equation of the line to get a third point
Use point-slope form with m = −2 and point (3, −4): y − (−4) = −2(x − 3) → y + 4 = −2x + 6 → y = −2x + 2. The y-intercept is b = 2, so the point (0, 2) lies on the line. Verify: y = −2(0) + 2 = 2 ✓. Verify with the other original point: y = −2(−1) + 2 = 2 + 2 = 4 ✓. The equation y = −2x + 2 is confirmed.
4. Step 4: Plot the third point and draw the line
Plot the y-intercept (0, 2) as your third point. You now have three collinear points: (−1, 4), (0, 2), (3, −4). Draw a straight line through all three using a ruler, extend with arrows in both directions, and label the line y = −2x + 2. The steep negative slope (the line drops 4 units between x = −1 and x = 1) should be visually obvious — this is a useful sanity check before you hand in your work.
Slope formula: m = (y₂ − y₁) / (x₂ − x₁). Subtract y-coordinates on top and x-coordinates on the bottom, always in the same order. Swapping both subtraction orders gives the same slope — but swapping only one gives the wrong sign.
Special Cases: Horizontal and Vertical Lines
Two special cases of linear equations produce graphs that look nothing like a typical slanted line: horizontal lines (equation y = k) and vertical lines (equation x = h). These are tested frequently because students often confuse which is which, and because vertical lines are the only linear equations that cannot be written in slope-intercept form — their slope is undefined.
1. Horizontal lines: y = k (slope = 0)
The equation y = 3 means the y-coordinate equals 3 for every possible x-value. Points on this line include (−5, 3), (0, 3), (2, 3), and (100, 3). The graph is a flat horizontal line crossing the y-axis at (0, 3). Slope = 0 because no matter how far you move left or right (any run), the height never changes (rise = 0). Special note: y = 0 is the equation of the x-axis itself. In standard form, a horizontal line appears as 0·x + 1·y = k, simplified to y = k.
2. Vertical lines: x = h (slope = undefined)
The equation x = −2 means the x-coordinate equals −2 for every possible y-value. Points on this line include (−2, −5), (−2, 0), (−2, 3), and (−2, 100). The graph is a straight vertical line crossing the x-axis at (−2, 0). Slope is undefined because the run is always 0 — division by zero is undefined. Vertical lines are not functions because the input x = −2 is paired with infinitely many y-values. Special note: x = 0 is the equation of the y-axis itself.
3. How to tell which special case you have
When you see an equation with only one variable, identify it immediately: only y present → horizontal line parallel to the x-axis; only x present → vertical line parallel to the y-axis. In standard form Ax + By = C: if A = 0, the line is horizontal (rewrite as y = C/B); if B = 0, the line is vertical (rewrite as x = C/A). Example: 0x + 3y = 12 simplifies to y = 4 (horizontal); 5x + 0y = 15 simplifies to x = 3 (vertical). Spotting these in two seconds saves time that would otherwise be wasted trying to find a slope that does not exist.
Horizontal line y = k: slope is 0, crosses the y-axis at (0, k), runs left to right parallel to the x-axis. Vertical line x = h: slope is undefined, crosses the x-axis at (h, 0), runs up and down parallel to the y-axis.
Common Mistakes When Graphing a Linear Equation
Most graphing errors with linear equations come from a small number of predictable habits. Spotting these mistakes before they happen prevents losing easy points on tests and homework. Each mistake below is described with the specific arithmetic or reasoning error and how to correct it.
1. Applying a negative slope in the wrong direction
A slope of m = −3/4 means rise = −3 (down 3), run = 4 (right 4). A frequent error is to apply the negative sign to the run instead: going left 4 and up 3 — which traces the same line only when done symmetrically but produces wrong isolated points. The safest rule: the run is always positive when moving right. From any starting point, move 4 units right and 3 units down for m = −3/4. If you prefer moving left, reverse both signs: 4 left and 3 up — both give correct points.
2. Plotting b on the x-axis instead of the y-axis
In y = mx + b, the value b is the y-intercept — it is plotted on the y-axis at the point (0, b). Plotting b on the x-axis at (b, 0) is the x-intercept, which is a completely different point. For y = 2x − 5, the y-intercept is (0, −5) and the x-intercept (where y = 0) is x = 5/2 = 2.5, giving (2.5, 0). These are not the same point. Always ask: where does b go? On the y-axis.
3. Inverting the slope formula to Δx / Δy
The slope formula is m = Δy / Δx = (y₂ − y₁) / (x₂ − x₁) — change in y divided by change in x. Writing it upside down as Δx / Δy gives the reciprocal, which is the slope of a perpendicular line. For points (1, 2) and (5, 10): Δy = 8, Δx = 4, slope = 8/4 = 2. If you accidentally compute 4/8 = 1/2, you have drawn the perpendicular instead. Remember the mnemonic: "slope = y over x" (vertical change is the numerator).
4. Drawing a curved line through the points
A linear equation always produces a perfectly straight line — no bends, no curves at any point. If your three plotted points do not appear to be collinear (they form a curve), you have made an arithmetic error in at least one point, or you have confused a linear equation with a quadratic. Use a ruler for every linear graph, and always verify each plotted point by substituting its x-value into the original equation and confirming the y-value matches.
5. Skipping the third verification point
Two points always determine exactly one line, so two correctly calculated points will produce a correct graph — but one arithmetic mistake goes completely undetected with only two points. The minimum safe approach is to calculate three points and confirm they are collinear. If two points agree and the third does not lie on the line, there is an error in one of the three calculations. Finding and fixing that error takes less time than re-doing the problem after getting it wrong on a test.
Before handing in any linear graph, run this three-point check: (1) Does the y-intercept match the equation? (2) Do two other points satisfy the equation? (3) Do all three points lie on the same straight line?
Practice Problems: Graph These Linear Equations
Work through each problem on graph paper before reading the solution. For each equation, identify the form, extract the slope and intercepts, find at least three verified points, and draw the line with arrows at both ends. The four problems below increase in complexity from slope-intercept form to special cases.
1. Problem 1 — y = −3x + 5 (slope-intercept form)
Slope m = −3, y-intercept b = 5. Start at (0, 5). Apply slope −3 (right 1, down 3): second point (1, 2). Apply slope again: third point (2, −1). Verify all three: y = −3(0) + 5 = 5 ✓; y = −3(1) + 5 = 2 ✓; y = −3(2) + 5 = −1 ✓. X-intercept: set y = 0 → 0 = −3x + 5 → x = 5/3 ≈ 1.67. The line crosses the x-axis between x = 1 and x = 2, consistent with the graph showing y-values going from 2 (at x = 1) to −1 (at x = 2). Plot (0, 5), (1, 2), (2, −1) and draw the steep downward line.
2. Problem 2 — 2x + 5y = 10 (standard form, intercept method)
Y-intercept (set x = 0): 5y = 10 → y = 2. Point (0, 2). X-intercept (set y = 0): 2x = 10 → x = 5. Point (5, 0). Verification point (x = −5): 2(−5) + 5y = 10 → −10 + 5y = 10 → 5y = 20 → y = 4. Point (−5, 4). Check: 2(−5) + 5(4) = −10 + 20 = 10 ✓. Three confirmed points: (−5, 4), (0, 2), (5, 0). Slope check (rearrange): 5y = −2x + 10 → y = −(2/5)x + 2. Slope = −2/5 (gentle negative slope). From (0, 2) to (5, 0): rise = −2, run = 5, slope = −2/5 ✓.
3. Problem 3 — line through (−2, −3) and (4, 6)
Slope: m = (6 − (−3)) / (4 − (−2)) = 9/6 = 3/2. Use point (4, 6) in point-slope form: y − 6 = (3/2)(x − 4) → y = (3/2)x − 6 + 6 → y = (3/2)x. The line passes through the origin! Y-intercept: (0, 0). Third point at x = 2: y = (3/2)(2) = 3 → (2, 3). Verify all given points: y = (3/2)(−2) = −3 ✓; y = (3/2)(4) = 6 ✓. Three points: (−2, −3), (0, 0), (4, 6). The line runs through the origin with a moderately positive slope of 3/2.
4. Problem 4 — y = −2 and x = 4 (special cases)
y = −2: horizontal line. Every point on it has y-coordinate −2. Crosses the y-axis at (0, −2). Sample points: (−3, −2), (0, −2), (5, −2). Draw a flat horizontal line at height −2. Slope = 0. x = 4: vertical line. Every point on it has x-coordinate 4. Crosses the x-axis at (4, 0). Sample points: (4, −3), (4, 0), (4, 5). Draw a straight vertical line at x = 4. Slope = undefined. These two lines intersect at exactly one point: (4, −2) — the only ordered pair satisfying both equations simultaneously.
FAQ: How to Graph a Linear Equation
These are the questions students most frequently ask when learning how to graph a linear equation for the first time. Each answer includes an explanation of the underlying reason, not just the procedure.
1. How many points do I need to graph a linear equation?
The mathematical minimum is two points, since two distinct points define exactly one line. In practice, always calculate three points: the y-intercept, a second point found using the slope, and a third verification point. If all three satisfy the equation and are collinear (they line up), the graph is correct. Two points that are correct will produce a correct line — but without a third point you have no way to detect an arithmetic error. Three points catch almost every mistake.
2. What does the slope tell me about the line?
The slope m = rise / run describes the line's steepness and direction. A slope greater than 1 (m > 1) means the line is steeper than a 45° diagonal. A slope between 0 and 1 (0 < m < 1) means the line rises gently. A negative slope means the line falls from left to right. m = 0 is a horizontal line. The magnitude |m| tells you steepness — larger |m| means steeper. For example, m = 5 produces a nearly vertical line, while m = 0.1 is nearly flat. Two lines with the same slope are parallel; two lines whose slopes multiply to −1 are perpendicular (e.g., m₁ = 2 and m₂ = −1/2, because 2 × (−1/2) = −1).
3. How do I graph a linear equation if it has only one variable?
An equation with only x (like x = 5) describes a vertical line crossing the x-axis at (5, 0). Plot points (5, −3), (5, 0), (5, 4) and draw a vertical line through them. An equation with only y (like y = −2) describes a horizontal line at height −2. Plot (−3, −2), (0, −2), (4, −2) and draw a horizontal line through them. Neither of these follows the slope-intercept procedure — recognize them by their single-variable form and graph immediately.
4. How do I find the x-intercept and y-intercept from the equation?
Y-intercept: set x = 0 and solve for y. In slope-intercept form y = mx + b, the y-intercept is always b. In standard form Ax + By = C, substitute x = 0 to get By = C → y = C/B. X-intercept: set y = 0 and solve for x. In slope-intercept form: 0 = mx + b → x = −b/m. In standard form: substitute y = 0 to get Ax = C → x = C/A. For example, in 3x + 4y = 24: y-intercept is (0, 6) and x-intercept is (8, 0).
5. Can two different equations produce the same graph?
Yes. Two linear equations represent the same line if and only if one is a constant multiple of the other — meaning they have the same slope and the same y-intercept. For example, y = 2x + 4 and 2y = 4x + 8 produce identical graphs (dividing the second by 2 gives the first). Similarly, 3x + 6y = 12 and x + 2y = 4 are the same line. To check, convert both equations to slope-intercept form: identical m and b → same graph; same m but different b → parallel lines (no intersection); different m → lines intersect at exactly one point.
Related Articles
How to Find the Equation of a Line (Step-by-Step Guide)
Learn to write the equation of a line from slope and a point, from two points, or directly from a graph — the skill that comes right before graphing.
Linear Equation Practice Problems with Full Solutions
Work through 10 linear equation problems covering slope-intercept form, standard form, and word problems — all with step-by-step solutions.
How to Graph a Quadratic Equation: Step-by-Step Guide
Once you master graphing lines, step up to graphing parabolas — the natural next topic in algebra with a similar key-features approach.
Related Math Solvers
Step-by-Step Solutions
Get detailed explanations for every step, not just the final answer.
Smart Scan Solver
Snap a photo of any math problem and get an instant step-by-step solution.
Practice Mode
Generate similar problems to practice and build confidence.
Related Subjects
Solving Linear Equations
Master solving linear equations in one variable — the algebraic foundation you need before graphing two-variable equations.
How to Solve Inequalities with Fractions
Graphing linear inequalities on the coordinate plane builds directly on the line-graphing skills covered in this guide.
Geometry Word Problems
Coordinate geometry problems use slope and intercepts constantly — apply linear graphing skills to triangle, midpoint, and distance problems.
