Functions and Graphs

A function is a rule which assigns a unique output to each input.


Example. In mathematics, functions are often denoted using notation like the following:

$$f(x) = x^2.$$

This says that the name of the function is f, and x denotes a typical input. The right side tells how to produce an output from the input: Square it. Thus,

$$f(1) = 1^2 = 1, \quad f(5) = 5^2 = 25, \quad\hbox{but note that} f(-5) = (-5)^2 = 25 \quad\hbox{as well}.$$

Thus, different inputs can produce the same output.

Here is a table of some values of f:

$$\vbox{\offinterlineskip \halign{& \vrule # & \strut \hfil \quad # \quad \hfil \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & & \omit & & \omit & \cr & x & & 0 & & 2.1 & & -3 & & $\dfrac{1}{2}$ & & $\pi$ & \cr height2pt & \omit & & \omit & & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} height2pt & \omit & & \omit & & \omit & & \omit & & \omit & & \omit & \cr & $f(x)$ & & 0 & & 4.41 & & 9 & & $\dfrac{1}{4}$ & & $\pi^2$ & \cr height2pt & \omit & & \omit & & \omit & & \omit & & \omit & & \omit & \cr \noalign{\hrule} }} $$

Similarly,

$$f(x + 1) = (x + 1)^2, \quad\quad\hbox{and}\quad\quad f(a + b) = (a + b)^2.$$

Likewise, suppose $g(x) = \dfrac{1}{x +
   3}$ . Then

$$g(2) = \dfrac{1}{5}, \quad g(-17) = -\dfrac{1}{14}, \quad\hbox{but}\quad g(-3) \quad\hbox{is undefined}.$$

Moreover,

$$g(x^2) = \dfrac{1}{x^2 + 3}, \quad\quad\hbox{and}\quad\quad g(x - 1) = \dfrac{1}{(x - 1) + 3} = \dfrac{1}{x + 2}.\quad\halmos$$


The domain of a function is the set of allowable inputs.


Example. Suppose $g(x) = \dfrac{1}{x + 3}$ . I can't plug in $x = -3$ , as I saw above. Any other number may be plugged in for x. The domain consists of all x except $x = 3$ --- sometimes I'll get lazy and write this as "$x \ne 3$ " for short.


Example. Suppose $h(x) = \dfrac{x}{x^2 - x - 2}$ . Then

$$h(x) = \dfrac{x}{x^2 - x - 2} = \dfrac{x}{(x - 2)(x + 1)}.$$

Plugging in $x = 2$ or $x = -1$ would cause division by 0; other values of x are okay. Hence, the domain consists of all real numbers except for 2 and -1.


You can graph a function by making a table of some function values, then plotting the points.


Example. Here's the graph of $f(x) = x + 3$ :

$$\hbox{\epsfysize=2in \epsffile{function1.eps}}$$

Here's the graph of $y = |x|$ :

$$\hbox{\epsfysize=2in \epsffile{function2.eps}}$$

Here's the graph of $x = y^2$ :

$$\hbox{\epsfysize=2in \epsffile{function3.eps}}$$

$x = y^2$ is not a function, since some inputs produce more than one output. For example, $x = 1$ gives $y = 1$ or $y = -1$ .

A graph represents a function if and only if every vertical line hits the graph at most once.

Here's the graph of $x^2 + y^2 = 1$ :

$$\hbox{\epsfysize=2in \epsffile{function4.eps}}$$

This is also not the graph of a function.

Finally, let

$$h(x) = \cases{-x & if $x \le 0$ \cr 2 - x & if $x > 0$ \cr}.$$

The graph of h looks like this:

$$\hbox{\epsfysize=2in \epsffile{function5.eps}}\quad\halmos$$


The range of a function $y = f(x)$ is the set of possible outputs (y-values, or heights).


Example. Consider the function $f(x) = x^2$ .

$$\hbox{\epsfysize=1.75in \epsffile{function6.eps}}$$

The graph attains every y-value greater than or equal to 0. Therefore, the range is $y \ge 0$ .


Example. Consider the function

$$f(x) = \cases{x^2 & if $x \ge 0$ \cr -2 & if $x < 0$ \cr}.$$

$$\hbox{\epsfysize=1.75in \epsffile{function7.eps}}$$

The graph attains every y-value greater than or equal to 0 together with $y = -2$ . The range is $y \ge
   0$ and $y = 2$ .


Example. Consider the function whose entire graph is shown below.

$$\hbox{\epsfysize=1.75in \epsffile{function8.eps}}$$

The function attains every y-value between -1 and 3. It attains $y = 3$ --- the circle at $(3,3)$ is filled in, so there is a point there. However, it does not attain the value -1, since the circle at $(0,-1)$ is open, meaning that the point is missing. The range is $-1 < y \le 3$ .


A graph is increasing if it goes up from left to right; it is decreasing if it goes down from left to right.


Example. Consider the function whose entire graph is shown below.

$$\hbox{\epsfysize=1.75in \epsffile{function9.eps}}$$

The function increases on the intervals $-3 \le x \le -1$ and on $1 \le x \le 3$ . It decreases on the interval $-1 \le x \le 1$ .


If f and g are functions, their composite is

$$(f \circ g)(x) = f(g(x)).$$

The $\circ$ does not mean multiplication; it means that g is "inside" of f, or that the output of g is fed into f.

$$\hbox{\epsfysize=2.5in \epsffile{function10.eps}}$$


Example. Let $f(x) = x^3$ and let $g(x) = \dfrac{x}{x + 1}$ . Find $(f\circ g)(x)$ , $(g\circ f)(x)$ , $(f\circ f)(x)$ , and $(g\circ g)(x)$ .

$$(f\circ g)(x) = f(g(x)) = f\left(\dfrac{x}{x + 1}\right) = \left(\dfrac{x}{x + 1}\right)^3.$$

$$(g\circ f)(x) = g(f(x)) = g(x^3) = \dfrac{x^3}{x^3 + 1}.$$

$$(f\circ f)(x) = f(f(x)) = f(x^3) = (x^3)^3 = x^9.$$

$$(g\circ g)(x) = g\left(\dfrac{x}{x + 1}\right) = \dfrac{\dfrac{x}{x + 1}}{\dfrac{x}{x + 1} + 1}.$$

Notice that $(f\circ g)(x)$ is not the same as $(g\circ f)(x)$ .


Example. Let $f(x) = x + 2$ and let $g(x) = 3x$ . Find $f(g(5))$ , $g(f(5))$ , $f(g(x))$ , and $g(f(x))$ .

$$f(g(5)) = f(3\cdot 5) = f(15) = 15 + 2 = 17.$$

$$g(f(5)) = g(5 + 2) = g(7) = 3\cdot 7 = 21.$$

$$f(g(x)) = f(3x) = 3x + 2.$$

$$g(f(x)) = g(x + 2) = 3(x + 2).$$

Notice that $f(g(x))$ is not the same as $g(f(x))$ .


Contact information

Bruce Ikenaga's Home Page

Copyright 2008 by Bruce Ikenaga