Lines
Lines are the simplest graphs, and they appear everywhere: a steady speed, a fixed price per item, a temperature scale. This page shows how to measure how steep a line is, and how to write its equation.
Slope
The slope of a line measures how steep it is. Pick two points on the line. The rise is the change in ${y}$, and the run is the change in ${x}$. The slope ${m}$ is the rise divided by the run:
$m=\dfrac{\text{rise}}{\text{run}}=\dfrac{y_2-y_1}{x_2-x_1}$
A line has the same slope everywhere, so it does not matter which two points you choose. Here is what the slope tells us:
- Positive slope: the line rises from left to right.
- Negative slope: the line falls from left to right.
- Zero slope: the line is horizontal. The rise is ${0}$.
- Undefined slope: the line is vertical. The run is ${0}$, and we cannot divide by ${0}$.
Watch out: a horizontal line has slope ${0}$, but a vertical line has no slope. Zero slope and undefined slope are different.
Example 1: Find the slope of the line through ${(-1,4)}$ and ${(3,-2)}$.
Solution:
Subtract in the same order on the top and the bottom:
$\begin{align*}&m\\&=\dfrac{-2-4}{3-(-1)}\\&=\dfrac{-6}{4}=-\dfrac{3}{2}\end{align*}$
The slope is negative, so the line falls. For every ${2}$ units to the right, it goes down ${3}$.
Equations of lines
Point-slope form
Suppose a line has slope ${m}$ and passes through a point ${(x_1,y_1)}$. For any other point ${(x,y)}$ on the line, the slope is ${\dfrac{y-y_1}{x-x_1}=m}$. Multiply both sides by ${x-x_1}$ to get the point-slope form:
${y-y_1=m(x-x_1)}$
Use it when you know a point and the slope.
Slope-intercept form
If you solve for ${y}$, you get the slope-intercept form:
${y=mx+b}$
Here ${m}$ is the slope, and ${b}$ is the ${y}$-intercept: the line crosses the ${y}$-axis at ${(0,b)}$. This form is the easiest one to graph.
Example 2: Find the equation of the line through ${(2,-1)}$ with slope ${3}$. Write it in slope-intercept form.
Solution:
Use the point-slope form with ${x_1=2}$, ${y_1=-1}$, and ${m=3}$. Then solve for ${y}$:
$\begin{align*}y-(-1)&=3(x-2)\\y+1&=3x-6\\y&=3x-7\end{align*}$
Example 3: Graph ${y=-\dfrac{2}{3}x+4}$.
Solution:
The ${y}$-intercept is ${4}$, so start at ${(0,4)}$. The slope is ${-\dfrac{2}{3}}$: a run of ${3}$ and a rise of ${-2}$. So from ${(0,4)}$, go ${3}$ to the right and ${2}$ down, to ${(3,2)}$. Draw the line through the two points.
Horizontal and vertical lines
- A horizontal line through ${(a,b)}$ has slope ${0}$. Its equation is ${y=b}$: every point on it has the same ${y}$-coordinate.
- A vertical line through ${(a,b)}$ has no slope. Its equation is ${x=a}$: every point on it has the same ${x}$-coordinate. It cannot be written as ${y=mx+b}$.
General form
Every line can be written in the general form ${Ax+By=C}$, where ${A}$ and ${B}$ are not both ${0}$. To find the slope, solve for ${y}$.
Example 4: Find the slope and the intercepts of the line ${3x-4y=12}$.
Solution:
Solve for ${y}$. Subtract ${3x}$ from both sides, then divide by ${-4}$:
$\begin{align*}-4y&=-3x+12\\y&=\dfrac{3}{4}x-3\end{align*}$
So the slope is ${\dfrac{3}{4}}$, and the ${y}$-intercept is ${-3}$.
For the ${x}$-intercept, set ${y=0}$ in the original equation: ${3x=12}$, so ${x=4}$.
Parallel and perpendicular lines
Two lines are parallel if they never meet. Two lines are perpendicular if they meet at a right angle. Their slopes tell us which:
Parallel: ${m_1=m_2}$
Perpendicular: ${m_1m_2=-1}$, that is, ${m_2=-\dfrac{1}{m_1}}$
So perpendicular slopes are negative reciprocals of each other: flip the fraction, and change the sign. For example, the negative reciprocal of ${\dfrac{2}{3}}$ is ${-\dfrac{3}{2}}$. (These rules are for lines that are not vertical.)
Example 5: Find the equation of the line through ${(3,1)}$ that is
(a) parallel to the line ${2x+y=5}$
(b) perpendicular to the line ${2x+y=5}$
Solution:
First find the slope of the given line. Solve for ${y}$: ${y=-2x+5}$. So its slope is ${-2}$.
(a) A parallel line has the same slope, ${-2}$. Use the point-slope form:
$\begin{align*}y-1&=-2(x-3)\\y-1&=-2x+6\\y&=-2x+7\end{align*}$
(b) A perpendicular line has slope ${-\dfrac{1}{-2}=\dfrac{1}{2}}$. Use the point-slope form:
$\begin{align*}y-1&=\dfrac{1}{2}(x-3)\\y&=\dfrac{1}{2}x-\dfrac{3}{2}+1\\y&=\dfrac{1}{2}x-\dfrac{1}{2}\end{align*}$
An application
Example 6: Water freezes at ${0^\circ}$C, which is ${32^\circ}$F. It boils at ${100^\circ}$C, which is ${212^\circ}$F. The Fahrenheit temperature ${F}$ is a linear function of the Celsius temperature ${C}$. Find the equation, and use it to convert ${25^\circ}$C to Fahrenheit.
Solution:
Think of ${C}$ as ${x}$ and ${F}$ as ${y}$. We know two points on the line: ${(0,32)}$ and ${(100,212)}$. The slope is
$m=\dfrac{212-32}{100-0}=\dfrac{180}{100}=\dfrac{9}{5}$
The slope has a meaning: each degree Celsius equals ${\dfrac{9}{5}=1.8}$ degrees Fahrenheit. The ${F}$-intercept is ${32}$, from the point ${(0,32)}$. So
${F=\dfrac{9}{5}C+32}$
At ${25^\circ}$C:
${F=\dfrac{9}{5}(25)+32=45+32=77}$
So ${25^\circ}$C is ${77^\circ}$F, a warm day.
Summary
- Slope: ${m=\dfrac{y_2-y_1}{x_2-x_1}}$. Positive rises, negative falls, zero is horizontal, and vertical lines have no slope.
- Point-slope form: ${y-y_1=m(x-x_1)}$. Slope-intercept form: ${y=mx+b}$.
- Horizontal line: ${y=b}$. Vertical line: ${x=a}$.
- Parallel lines have equal slopes. Perpendicular slopes are negative reciprocals: ${m_1m_2=-1}$.
- In applications, the slope is a rate of change, such as degrees Fahrenheit per degree Celsius.