# Graphs: lines

The key to understanding lines is the slope.
## Points and slopes

You'll want to remember (at least) these two formulas:
*m* =
(*y*_{2} − *y*_{1}) ÷
(*x*_{2} − *x*_{1});
*y* = *m**x* + *b*.

In the first formula, you start with two points,
whose coordinates
are (*x*_{1},*y*_{1})
and (*x*_{2},*y*_{2}).
The difference *y*_{2} − *y*_{1},
which is called the **rise**,
is how much you move *up* as you go from the first point to the second;
if you actually move *down*, then this is negative.
The difference *x*_{2} − *x*_{1},
which is called the **run**,
is how much you move to the *right*;
if you actually move to the *left*, then this is negative.
The rise and run vary depending on which points you look at,
but if you divide the rise by the run,
then you'll get the same result no matter which two points you choose,
as long as you pick two distinct points on the *same* line.

This number, which is usually denoted by *m*,
is the **slope**,
and it describes the directions in which you can travel along the line.
Lines with positive slope run up–right and down–left;
lines with negative slope run down–right and up–left.
Lines whose slope has a large absolute value are steep;
lines whose slope has a small absolute value are shallow.
Horizontal lines have a slope of exactly zero.
(For vertical lines, see below.)

The second formula tells you two things:
If you know the slope *m* of a line
and you know its *y*-intercept (0,*b*),
then by putting those numbers (*m* and *b*) into the second formula,
you get an equation (in *x* and *y*) for the line.
Even if you don't know the *y*-intercept,
as long as you know the slope,
then you can use the coordinates of any point to get an equation for *b*;
solve this, and now you can write down the equation for the line.

In the other direction, if you have an equation for the line,
then solve it for *y*.
By comparing this with the second formula above,
you now know what the slope and *y*-intercept are.
Once you have the slope and any point, it's easy to draw a graph.

## Vertical lines

If a line is vertical,
then the slope is undefined, because you must divide by zero in the formula.
You can also think of this as an infinite slope,
since a vertical line is infinitely steep.
The equation for a vertical line is always simply *x* = *a*
for some constant *a* (which is the *x*-coordinate of any point).
## Parallel and perpendicular lines

Since the slope of a line indicates its direction,
parallel lines always have the same slope.
In contrast, perpendicular lines have opposite reciprocal slopes.
- Parallel lines:
*m*_{1} = *m*_{2}.
- Perpendicular lines:
*m*_{1} = −1/*m*_{2}.

Go back to the course homepage.

This web page was written in 2010 by Toby Bartels,
last edited on 2010 October 11.
Toby reserves no legal rights to it.

The permanent URI of this web page
is
`http://tobybartels.name/MATH-1150/2010f/lines/`

.