David Terr
Ph.D. Math, UC Berkeley


Home >> Pre-Calculus >> 1. Graphs, Functions, and Models

<< 1.1. Graphs and Graphing Utilities

>> 1.3. Distance and Midpoint Formulas


1.2. Lines and Slopes

Lines are among the simplest graphs. There are two commonly used forms for the equation of a line. The first is y = mx + b, where m and b are constants. The second is Ax + By = C, where A, B, and C are constants. For now, we will concentrate on the first form. This form is very useful because the constants m and b have simple interpretations. The first constant, m, is called the slope of the line and the second constant, b, is known as the y-intercept, which is the value of y at which the line intersects the y-axis. The slope is a measure of how steep the line is and whether it is rising or falling. To understand the meaning of slope, take two distinct points, P1 = (x1, y1) and P2 = (x2, y2) on the line. The slope is then defind as the following ratio:

  • (1.2.1) m = (y2 - y1) / (x2 - x1).

The remarkable thing about this formula is that it does not depend on which two points on the line we choose; we always get the same value of m. The quantity y2 - y1 is known as the rise going from P1 to P2 and x2 - x1 is known as the run. Thus, slope is commonly defined as rise over run.

It should be noted that slope cannot be defined for all lines. In particular, vertical lines do not have a slope, though all other lines do. Thus, the second form of the equation of a line, Ax + By = C, while not as easy to interpret geometrically, is more general than the other form, y = mx + b.

It is important to know how to graph a line given in the form y = mx + b or Ax + By = C. The simplest case to look at is the first.


Example 1: Graph the line y = 2x - 3.

Solution: The best way to graph a line given in slope form is to plug in various values of x and solve for y. In this way, we find several points on the line; then all we need to do is to plot and connect these points. Of course, it is only necessary to plot two points, but it is often nevertheless useful to plot more in order to obtain a more accurate graph and to verify that our calculations are correct. The following table lists various values of y corresponding to some small values of x.

x y

We then plot these points and join them with a line as shown:

line graph

Example 2: Graph the line 2x + 3y = 6.

Solution: The best way to graph a line given in the form Ax + By = C is to compute the x and y-intercepts. This is done by plugging in x=0 and y=0. When x = 0, we have 3y = 6, implying y = 2. Thus, the line contains the point (0,2). When y=0, we have 2x = 6, implying x = 3. Thus, the line also contains the point (3,0). We thus plot these two points as well as the line connecting them.

line graph 2


It is well-known that a line is uniquely defined by two points. In other words, given any two points, P1 = (x1, y1) and P2 = (x2, y2), there is a unique line L containing the points P1 and P2. How does one find the equation of L? As long as x1 and x2 are different, we can write L in the form y = mx + b. The first step is to compute m. As we have seen, the slope m is given by formula (1.1). What about the y-intercept, b? Once we have computed m, we can compute b by plugging in either one of the points and computing b = yi - mxi, where i=1 or 2. Specifically we have

  • (1.2.2) b = y1 - mx1 = y2 - mx2.

On the other hand, if x1 = x 2, then the equation of L is x=x1.

Although not generally used, it is nevertheless useful to compute a formula for the y-intercept b of a non-vertical line in terms of the coordinates of P1 and P2. Sparing the details of the calculation, which are straightforward but somewhat tedious, the result is

  • (1.2.3) b = (x2y1 - x1y2) / (x2 - x1).

We leave the derivation of (1.2.3) as an exercise.


The following example shows how to find the equation of a line passing through two given points:


Example 2: Find the equation of the line passing through the points P1=(3,2) and P2=(5,8).

Solution: By formula (1.2.1), we find the slope of the line is equal to m = (8 - 2) / (5 - 3) = 6 / 2 = 3. Next we use (1.2.2) to compute b. We have b = y1 - mx1 = 2 - (3)(3) = 2 - 9 = -7. Thus, the equation of the line is y = 3x - 7. As always, we should check the result. Plugging in 3 for x, corresponding to P1, we find y = 3(3) - 7 = 9 - 7 = 2. Substuting 5 for x, corresponding to P2, we find y = 3(5) - 7 = 15 - 7 = 8.


Home >> Pre-Calculus >> 1. Graphs, Functions, and Models

<< 1.1. Graphs and Graphing Utilities

>> 1.3. Distance and Midpoint Formulas