Sub topic 8
Graphing a Line from Its Equation
Assume you can plot ordered pairs, work with signed numbers and fractions, and solve simple linear equations. You should also know that the slope of a line measures vertical change divided by horizontal change.
Read the equation first
A line in slope-intercept form is written as
\[ y = mx + b \]
The variable \(m\) is the slope. The value \(b\) is the \(y\)-intercept, the point where the line crosses the \(y\)-axis.
For example:
\[ y = \frac{2}{3}x - 1 \]
Here:
- The slope is \(m=\frac{2}{3}\).
- The \(y\)-intercept is \(b=-1\), so the line crosses the \(y\)-axis at \((0,-1)\).
The slope tells you how to move from one point on the line to another. A slope of \(\frac{2}{3}\) means rise 2 units and run 3 units. A slope of \(-\frac{2}{3}\) means fall 2 units and run 3 units.
Plot a line step by step
To graph \(y=mx+b\):
- Identify \(m\) and \(b\).
- Plot the \(y\)-intercept \((0,b)\).
- Rewrite the slope as rise over run.
- Starting at the intercept, move vertically by the rise and horizontally by the run.
- Plot the new point.
- Draw a straight line through the points and extend it in both directions.
Consider:
\[ y = -\frac{1}{2}x + 3 \]
The \(y\)-intercept is \((0,3)\). Plot that point. The slope is \(-\frac{1}{2}\), so move down 1 and right 2. This gives \((2,2)\). Repeating the movement gives \((4,1)\).
| Equation feature | Meaning | Example |
|---|---|---|
| \(m\) | Change in \(y\) for each unit of \(x\) | \(-\frac{1}{2}\) |
| \(b\) | \(y\)-value when \(x=0\) | \(3\) |
| \((0,b)\) | \(y\)-intercept point | \((0,3)\) |
def points_from_line(m, b, x_values):
"""Return points on y = mx + b."""
return [(x, m * x + b) for x in x_values]
points = points_from_line(-0.5, 3, [-4, -2, 0, 2, 4])
for point in points:
print(point)The output points can help you check a hand-drawn graph. They do not replace choosing a useful scale and drawing the line on a coordinate plane.
Check the graph with substitution
For \(y=-\frac{1}{2}x+3\), test \(x=2\):
\[ y=-\frac{1}{2}(2)+3=-1+3=2 \]
Therefore, \((2,2)\) lies on the line. Test another point, such as \((4,1)\):
\[ y=-\frac{1}{2}(4)+3=-2+3=1 \]
Both points satisfy the equation, so they are good points to use when drawing the line.
Special cases
A horizontal line has slope \(0\). Its equation looks like \(y=b\), such as \(y=4\). Every point on this line has the same \(y\)-value.
A vertical line cannot be written in slope-intercept form because its slope is undefined. Its equation looks like \(x=a\), such as \(x=-2\). Every point on this line has the same \(x\)-value.
Exercise
Graph y = 3/4 x - 2. What are the first two points you should plot?
Show answer
Plot the y-intercept (0, -2). Then use rise 3 and run 4 to plot (4, 1).