# Calculus/Graphing functions

 ← Trigonometry Calculus Conic sections → Graphing 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 ${\displaystyle (x,y)}$ indicates that ${\displaystyle f(x)=y}$ . In other words, a graph uses the position of a point in one direction (the vertical-axis or ${\displaystyle y}$-axis) to indicate the value of ${\displaystyle f}$ for a position of the point in the other direction (the horizontal-axis or ${\displaystyle x}$-axis).

Functions may be graphed by finding the value of ${\displaystyle f}$ for various ${\displaystyle x}$ and plotting the points ${\displaystyle (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.

## Linear functions

Graphing linear functions are easy to understand and do. Because we know that two points can form a line, only two points are needed for us to graph a linear function if those two points are on the function. Oppositely, we can write down the equation of a linear function if we only know two points that are on the function.

The following section mainly talks about different forms of linear function notations so that you can easily identify or graph the function.

### Introduction

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

${\displaystyle f(x)=3x+2}$

The graph of ${\displaystyle f}$ is a single line, passing through the point ${\displaystyle (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

The slope is the backbone of linear functions because it shows how much the output of a function changes when the input changes. For example, if the slope of a function is 2, then it means when the input of a function increases by 1 unit, the output of the function increases by 2 units. Now, let's look at a more mathematical example.

Consider this function: ${\displaystyle f(x)=-5x+8}$. What does the number ${\displaystyle -5}$ mean?

It means that when ${\displaystyle x}$ increases by 1, ${\displaystyle f(x)}$ decreases by 5.

Using mathematical terms:

${\displaystyle f(x+1)-f(x)=(-5(x+1)+8)-(-5x+8)=-5}$

It is easy to calculate the slope because the slope is like the speed of a vehicle. If we divide the change in distance and the corresponding change in time, we get the speed. Similarly, if we divide the change in ${\displaystyle f(x)}$ over the corresponding change in ${\displaystyle x}$, we get the slope. If given two points, ${\displaystyle (x_{1},y_{1})}$ and ${\displaystyle (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 ${\displaystyle y}$-values divided by the change in ${\displaystyle x}$-values. In symbols:

${\displaystyle {\text{slope}}~={\frac {{\text{change in }}y}{{\text{change in }}x}}={\frac {\Delta y}{\Delta x}}={\frac {y_{2}-y_{1}}{x_{2}-x_{1}}}}$

Slope in a linear function

If two points ${\displaystyle (x_{1},y_{1})}$ and ${\displaystyle (x_{2},y_{2})}$ on a linear function, then the slope of the linear function is

${\displaystyle m={\frac {y_{2}-y_{1}}{x_{2}-x_{1}}}}$

Interestingly, there is a subtle relationship between the slope and the angle between the graph of the function and the positive ${\displaystyle x}$-axis, ${\displaystyle \theta }$. The relationship is:

${\displaystyle m=\tan \theta }$

It is an obvious relationship, but it can be ignored relatively easily.

### Slope-intercept form

This is a linear function notated in the slope-intercept form. The slope here is ${\displaystyle a}$ instead of ${\displaystyle m}$.

When we see a function presented as

${\displaystyle y=f(x)=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, ${\displaystyle m}$ , and the ${\displaystyle y}$-intercept, ${\displaystyle b}$ .

Example 1: Graph the function ${\displaystyle f(x)=3x+2}$.

The slope of the function is 3, and it intercepts the ${\displaystyle y}$-axis at point ${\displaystyle (0,2)}$. In order to graph the function, we need another point. Since the slope of the function is 3, then

${\displaystyle f(x+1)=f(x)+3}$

${\displaystyle f(1)=f(0+1)=f(0)+3=5}$

Knowing that the function goes through points ${\displaystyle (0,2){\text{ and }}(1,5)}$, the function can be easily graphed.

${\displaystyle \blacksquare }$

Example 2: Now, consider another unknown linear function that goes through points ${\displaystyle (-3,-4){\text{ and }}(0,5)}$. What is the equation for this function?

The slope can be calculate with the formula mentioned above.

${\displaystyle m={\frac {y_{2}-y_{1}}{x_{2}-x_{1}}}={\frac {5-(-4)}{0-(-3)}}=3}$

And since the ${\displaystyle y}$-axis interception is ${\displaystyle (0,5)}$, we can know that

${\displaystyle b=5}$

Thus, the equation of this linear function should be

${\displaystyle g(x)=3x+5}$

${\displaystyle \blacksquare }$

### 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 ${\displaystyle (x_{0},y_{0})}$ and a slope ${\displaystyle m}$ , we present the graph as

${\displaystyle 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 ${\displaystyle y}$-intercept, that is the point ${\displaystyle (0,b)}$. The point-slope form is very important. Although it is not used as frequently as its counterpart the slope-intercept form, the concept of knowing a point and drawing the line in the direction of the slope will be encountered when we go into vector equations for lines and planes in future chapters.

Example 1: If a linear function goes through points ${\displaystyle (3,-4){\text{ and }}(1,5)}$, what is the equation for this function?

The slope is:

${\displaystyle m={\frac {y_{2}-y_{1}}{x_{2}-x_{1}}}={\frac {5-(-4)}{1-3}}=-{\frac {9}{2}}}$

Since we know two points, the following answers are all correct

${\displaystyle y+4=-{\frac {9}{2}}(x-3){\text{ or }}y-5=-{\frac {9}{2}}(x-1)}$

${\displaystyle \blacksquare }$

The two-point form is another form to write the equation for a linear function. It is similar to the point-slope form. Given points ${\displaystyle (x_{1},y_{1})}$ and ${\displaystyle (x_{2},y_{2})}$ , we have the equation

${\displaystyle 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 ${\displaystyle {\frac {y_{2}-y_{1}}{x_{2}-x_{1}}}}$ for ${\displaystyle m}$. However, this expression is not widely used in mathematics because in most situations, ${\displaystyle (x_{1},y_{1})}$ and ${\displaystyle (x_{2},y_{2})}$ are known coordinates. It would be redundant to write down a bulky ${\displaystyle {\frac {y_{2}-y_{1}}{x_{2}-x_{1}}}}$ instead of a simple expression of the slope.

### Intercept form

The intercept form looks like this:

${\displaystyle {\frac {x}{a}}+{\frac {y}{b}}=1}$

By writing the function in the intercept form, we can quickly determine the ${\displaystyle x,y}$-axis intercepts.

${\displaystyle x}$-axis intercept: ${\displaystyle (a,0)}$

${\displaystyle y}$-axis intercept: ${\displaystyle (0,b)}$

When we discuss planes in 3D space, this form will be quite useful to determine the ${\displaystyle x,y,z}$-axis intercepts.

To graph a quadratic function, there is the simple but work-heavy way, and there is the complicated but clever way. The simple way is to substitute the independent variable ${\displaystyle x}$ with various numbers and calculate the output ${\displaystyle f(x)}$. After some substitutions, plot those ${\displaystyle (x,f(x))}$ and connect those points with a curve. The complicated way is to find special points, such as intercepts and the vertex, and plot it out. The following section is a guide to find those special points, which will be useful in later chapters.

Actually, there is a third way, which we will discuss in Chapter 1.5.

### Standard form

Quadratic functions are functions that look like this

${\displaystyle y=f(x)=ax^{2}+bx+c}$, where ${\displaystyle a,b,c}$ are constants

The constant ${\displaystyle a}$ determines the concavity of the function: if ${\displaystyle a>0}$, ${\displaystyle f(x)}$ concaves up; if ${\displaystyle a<0}$, ${\displaystyle f(x)}$ concaves down.

The constant ${\displaystyle c}$ is the ${\displaystyle y}$-coordinate of the ${\displaystyle y}$-axis interception. In other words, this function goes through point ${\displaystyle (0,c)}$.

### Vertex form

The vertex form has its advantages over the standard form. While the standard form can determine the concavity and the ${\displaystyle y}$-axis interception, the vertex form can, as the name suggests, determine the vertex of the function. The vertex of a quadratic function is the highest/lowest point on the graph of a function, depending on the concavity. If ${\displaystyle a>0}$, the vertex is the lowest point on the graph; if ${\displaystyle a<0}$, the vertex is the highest point on the graph.

The vertex form looks like this:

${\displaystyle y=f(x)=a(x-h)^{2}+k}$, where ${\displaystyle a,h,k}$ are constants

The vertex of this function is ${\displaystyle (h,k)}$ because when ${\displaystyle x=h}$, ${\displaystyle f(h)=k}$. If ${\displaystyle a>0}$, ${\displaystyle f(h)=k}$ is the absolute minimum value that the function can achieve. If ${\displaystyle a<0}$, ${\displaystyle f(h)=k}$ is the absolute maximum value that the function can achieve. Any standard form can be converted into the vertex form. The vertex form with constants ${\displaystyle a,b,c}$ looks like this

${\displaystyle y=f(x)=a(x+{\frac {b}{2a}})^{2}+(c-{\frac {b^{2}}{4a}})}$, where ${\displaystyle a,b,c}$ are constants in the standard form

### Factored form

The factored form can determine the ${\displaystyle x}$-axis intercepts because the factored form looks like this

${\displaystyle y=f(x)=a(x-x_{1})(x-x_{2})}$, where ${\displaystyle x_{1},x_{2}}$ are constants and are solutions for the equation ${\displaystyle a(x-x_{1})(x-x_{2})=0}$

Thus, it can be determined that the function passes through points ${\displaystyle (x_{1},0){\text{ and }}(x_{2},0)}$.

However, only certain functions can be written in this form. If the quadratic function does not have ${\displaystyle x}$-axis intercept, it is impossible to write it in the factored form.

Example 1: What is the vertex of this function? ${\displaystyle f(x)=x^{2}+2x+3}$

The equation can be transformed into the vertex form very easily

${\displaystyle x^{2}+2x+3=(x^{2}+2x+1)+2=(x+1)^{2}+2}$

Thus, the vertex is ${\displaystyle (-1,2)}$.

${\displaystyle \blacksquare }$

Example 2: The image on the right is a quadratic function. Describe the meaning of the colored texts, which are important properties of a quadratic function.

${\displaystyle y=ax^{2}+bx+c}$

This is the equation for the quadratic function. In this case, ${\displaystyle a>0}$, ${\displaystyle c<0}$. Since there are two ${\displaystyle x}$-axis intercepts, we can find that ${\displaystyle \Delta =b^{2}-4ac>0}$.

Points ${\displaystyle ({\frac {-b-{\sqrt {b^{2}-4ac}}}{2a}},0){\text{ and }}({\frac {-b+{\sqrt {b^{2}-4ac}}}{2a}},0)}$

This is an image of a quadratic function ${\displaystyle y=ax^{2}+bx+c}$ with key values.

These are the coordinates for the two ${\displaystyle x}$-axis intercepts. Knowing the coordinates, the function can be written in its factored form:

${\displaystyle y=a(x-{\frac {-b-{\sqrt {b^{2}-4ac}}}{2a}})(x-{\frac {-b+{\sqrt {b^{2}-4ac}}}{2a}})}$

If you have difficulties deriving the quadratic formula or understanding the expression ${\displaystyle \Delta }$, see Quadratic function.

Point ${\displaystyle (-{\frac {b}{2a}},-{\frac {b^{2}-4ac}{4a}})}$

This is the vertex for the quadratic function. Because ${\displaystyle a>0}$, the vertex is the lowest point on the graph. Since the vertex is known, we can write the function in the vertex form:

${\displaystyle y=a(x+{\frac {b}{2a}})^{2}-{\frac {b^{2}-4ac}{4a}}}$

Although this does not look like the equation we've just discussed earlier, note that ${\displaystyle -{\frac {b^{2}-4ac}{4a}}=+c-{\frac {b^{2}}{4a}}}$.

Line ${\displaystyle x=-{\frac {b}{2a}}}$

The graph of the function is symmetric about this line. In other words, ${\displaystyle f(-{\frac {b}{2a}}+x)=f(-{\frac {b}{2a}}-x)}$

Point ${\displaystyle (-{\frac {b}{2a}},{\frac {1-(b^{2}-4ac)}{4a}})}$ and line ${\displaystyle y={\frac {-1-(b^{2}-4ac)}{4a}}}$ will be discussed in the next chapter (1.5). They are the focus and the directrix respectively.

${\displaystyle \blacksquare }$

If you can skillfully and quickly determine those special points, graphing quadratic functions will be less torturing.

## Exponential and Logarithmic functions

Exponential and logarithmic functions are inverse functions with each other. Take the exponential function ${\displaystyle f(x)=a^{x}}$ for example. The inverse function of ${\displaystyle f(x)}$, ${\displaystyle f^{-1}(x)}$, is

${\displaystyle x=a^{f^{-1}(x)}}$

${\displaystyle \Leftrightarrow f^{-1}(x)=\log _{a}x}$

which is a logarithmic function.

Since geometrically, the graph of the inverse function is flipping the graph of the original function over line ${\displaystyle y=x}$, we only need to know how to graph one of those functions.

 ← Functions Calculus Precalculus/Exercises → Graphing functions