# Calculus/Graphing linear functions

 ← Functions Calculus Precalculus/Exercises → Graphing linear functions
Graph of y=2x

It is sometimes difficult to understand the behavior of a function given only its definition; a visual representation or graph can be very helpful. A graph is a set of points in the Cartesian plane, where each point ($x$,$y$) indicates that $f(x)=y$. In other words, a graph uses the position of a point in one direction (the vertical-axis or y-axis) to indicate the value of $f$ for a position of the point in the other direction (the horizontal-axis or x-axis).

Functions may be graphed by finding the value of $f$ for various $x$ and plotting the points ($x$, $f(x)$) in a Cartesian plane. For the functions that you will deal with, the parts of the function between the points can generally be approximated by drawing a line or curve between the points. Extending the function beyond the set of points is also possible, but becomes increasingly inaccurate.

## Example

Plotting points like this is laborious. Fortunately, many functions' graphs fall into general patterns. For a simple case, consider functions of the form

$f(x)=3x + 2\,\!$

The graph of $f$ is a single line, passing through the point $(0,2)$ with slope 3. Thus, after plotting the point, a straightedge may be used to draw the graph. This type of function is called linear and there are a few different ways to present a function of this type.

## Slope-intercept form

When we see a function presented as

$y = mx + b \,\!$

we call this presentation the slope-intercept form. This is because, not surprisingly, this way of writing a linear function involves the slope, m, and the y-intercept, b.

## Point-slope form

If someone walks up to you and gives you one point and a slope, you can draw one line and only one line that goes through that point and has that slope. Said differently, a point and a slope uniquely determine a line. So, if given a point $(x_0,y_0)$ and a slope m, we present the graph as

$y - y_0 = m(x - x_0). \,\!$

We call this presentation the point-slope form. The point-slope and slope-intercept form are essentially the same. In the point-slope form we can use any point the graph passes through. Where as, in the slope-intercept form, we use the y-intercept, that is the point (0,b).

## Calculating slope

If given two points, $(x_1,y_1)$ and $(x_2,y_2)$, we may then compute the slope of the line that passes through these two points. Remember, the slope is determined as "rise over run." That is, the slope is the change in y-values divided by the change in x-values. In symbols,

$\mbox{slope}~ = \frac{\mbox{change in}~y}{\mbox{change in}~x} = \frac{\Delta y}{\Delta x}.$

So now the question is, "what's $\Delta y$ and $\Delta x$?" We have that $\Delta y = y_2-y_1$ and $\Delta x = x_2 - x_1$. Thus,

$\mbox{slope}~ = \frac{y_2-y_1}{x_2-x_1}.$

## Two-point form

Two points also uniquely determine a line. Given points $(x_1,y_1)$ and $(x_2,y_2)$, we have the equation

$y - y_1 = \frac{y_2-y_1}{x_2-x_1}(x-x_1).$

This presentation is in the two-point form. It is essentially the same as the point-slope form except we substitute the expression $\frac{y_2-y_1}{x_2-x_1}$ for m.

 ← Functions Calculus Precalculus/Exercises → Graphing linear functions