# Calculus/Graphing functions

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.

## 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
$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

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: $f(x)=-5x+8$. What does the number $-5$ mean?
   It means that when $x$ increases by 1, $f(x)$ decreases by 5.
   Using mathematical terms:
   $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 $f(x)$ over the corresponding change in $x$, we get the 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:
   ${\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}}}$
If two points $(x_{1},y_{1})$ and $(x_{2},y_{2})$ on a linear function, then the slope of the linear function is
    $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 $x$-axis, $\theta$. The relationship is:
   $m=\tan \theta$
It is an obvious relationship, but it can be ignored relatively easily.

### Slope-intercept form

When we see a function presented as
   $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, $m$ , and the $y$-intercept, $b$ .
Example 1: Graph the function $f(x)=3x+2$.
The slope of the function is 3, and it intercepts the $y$-axis at point $(0,2)$. In order to graph the function, we need another point. Since the slope of the function is 3, then
   $f(x+1)=f(x)+3$
   $f(1)=f(0+1)=f(0)+3=5$
Knowing that the function goes through points $(0,2){\text{ and }}(1,5)$, the function can be easily graphed.
$\blacksquare$
Example 2: Now, consider another unknown linear function that goes through points $(-3,-4){\text{ and }}(0,5)$. What is the equation for this function?
The slope can be calculate with the formula mentioned above.
   $m={\frac {y_{2}-y_{1}}{x_{2}-x_{1}}}={\frac {5-(-4)}{0-(-3)}}=3$
And since the $y$-axis interception is $(0,5)$, we can know that
   $b=5$
Thus, the equation of this linear function should be
   $g(x)=3x+5$
$\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 $(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)$. 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 $(3,-4){\text{ and }}(1,5)$, what is the equation for this function?
The slope is:
   $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
   $y+4=-{\frac {9}{2}}(x-3){\text{ or }}y-5=-{\frac {9}{2}}(x-1)$
$\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 $(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$. However, this expression is not widely used in mathematics because in most situations, $(x_{1},y_{1})$ and $(x_{2},y_{2})$ are known coordinates. It would be redundant to write down a bulky ${\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:
   ${\frac {x}{a}}+{\frac {y}{b}}=1$
By writing the function in the intercept form, we can quickly determine the $x,y$-axis intercepts.
   $x$-axis intercept: $(a,0)$
   $y$-axis intercept: $(0,b)$
When we discuss planes in 3D space, this form will be quite useful to determine the $x,y,z$-axis intercepts.

## Quadratic functions

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 $x$ with various numbers and calculate the output $f(x)$. After some substitutions, plot those $(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.6.

### Standard form

Quadratic functions are functions that look like this
   $y=f(x)=ax^{2}+bx+c$, where $a,b,c$ are constants
The constant $a$ determines the concavity of the function: if $a>0$, $f(x)$ concaves up; if $a<0$, $f(x)$ concaves down.
The constant $c$ is the $y$-coordinate of the $y$-axis interception. In other words, this function goes through point $(0,c)$.

### Vertex form

The vertex form has its advantages over the standard form. While the standard form can determine the concavity and the $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 $a>0$, the vertex is the lowest point on the graph; if $a<0$, the vertex is the highest point on the graph.
The vertex form looks like this:
   $y=f(x)=a(x-h)^{2}+k$, where $a,h,k$ are constants
The vertex of this function is $(h,k)$ because when $x=h$, $f(h)=k$. If $a>0$, $f(h)=k$ is the absolute minimum value that the function can achieve. If $a<0$, $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 $a,b,c$ looks like this
   $y=f(x)=a(x+{\frac {b}{2a}})^{2}+(c-{\frac {b^{2}}{4a}})$, where $a,b,c$ are constants in the standard form

### Factored form

The factored form can determine the $x$-axis intercepts because the factored form looks like this
   $y=f(x)=a(x-x_{1})(x-x_{2})$, where $x_{1},x_{2}$ are constants and are solutions for the equation $a(x-x_{1})(x-x_{2})=0$
Thus, it can be determined that the function passes through points $(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 $x$-axis intercept, it is impossible to write it in the factored form.
Example 1: What is the vertex of this function? $f(x)=x^{2}+2x+3$
The equation can be transformed into the vertex form very easily
   $x^{2}+2x+3=(x^{2}+2x+1)+2=(x+1)^{2}+2$
Thus, the vertex is $(-1,2)$.
$\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.
$y=ax^{2}+bx+c$
   This is the equation for the quadratic function. In this case, $a>0$, $c<0$.
   Since there are two $x$-axis intercepts, we can find that $\Delta =b^{2}-4ac>0$.
Points $({\frac {-b-{\sqrt {b^{2}-4ac}}}{2a}},0){\text{ and }}({\frac {-b+{\sqrt {b^{2}-4ac}}}{2a}},0)$
   These are the coordinates for the two $x$-axis intercepts.
   Knowing the coordinates, the function can be written in its factored form:
      $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 $\Delta$, see Quadratic function.
Point $(-{\frac {b}{2a}},-{\frac {b^{2}-4ac}{4a}})$
   This is the vertex for the quadratic function. Because $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:
      $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 $-{\frac {b^{2}-4ac}{4a}}=+c-{\frac {b^{2}}{4a}}$.
Line $x=-{\frac {b}{2a}}$
   The graph of the function is symmetric about this line. In other words,
   $f(-{\frac {b}{2a}}+x)=f(-{\frac {b}{2a}}-x)$
Point $(-{\frac {b}{2a}},{\frac {1-(b^{2}-4ac)}{4a}})$ and line $y={\frac {-1-(b^{2}-4ac)}{4a}}$ will be discussed in the next chapter (1.6). They are the focus and the directrix respectively.
$\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 $f(x)=a^{x}$ for example. The inverse function of $f(x)$, $f^{-1}(x)$, is
   $x=a^{f^{-1}(x)}$
   $\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 $y=x$, we only need to know how to graph one of those functions.
Navigation:
Main Page · Precalculus · Limits · Differentiation · Integration · Parametric and Polar Equations · Sequences and Series · Multivariable Calculus · Extensions · References