This site is devoted to mathematics and its applications. Created and run by Peter Saveliev.

Operations on functions

From Mathematics Is A Science

Jump to: navigation, search


1 Operations on sets

Example. Recall the example from last chapter of five boys that form a set and another set is the set of these four balls:

Boys and balls.png

They are lists: $$\begin{array}{lll} X&=\{\text{ Tom }, \text{ Ken }, \text{ Sid }, \text{ Ned }, \text{ Ben }\},\\ Y&=\{\text{ basketball }, \text{ tennis }, \text{ baseball }, \text{ football }\}\\ \end{array}$$ without repetitions. We can form a new set that contains all the elements of the two sets.

Boys and balls -- union.png

$\square$

Definition. The union of any two sets $X$ and $Y$ is the set that consists of the elements that belong to either $X$ or $Y$. It is denoted by $X\cup Y$.

Example. We merge lists together and then carefully remove the “overlap”: $$\{1,2,3,4\}\cup\{3,4,5,6,7\}=\{1,2,3,4,\ 3,4,5,6,7\}=\{1,2,3,4,5,6,7\}.$$ $\square$

Example. We have also subsets of $X$ and $Y$. The unions of these will be subsets of the union of $X$ and $Y$: $$\begin{array}{lll} T=\{\text{ Tom }\},\quad A=\{\text{ Tom, Ken }\},\quad Q=\{\text{ Tom, Ken, Sid }\},\quad ...&\subset X;\\ B=\{\text{ basketball }\},\quad V=\{\text{ basketball, tennis }\},\quad U=\{\text{ basketball, tennis, baseball }\},\quad ...&\subset Y;\\ \Longrightarrow\\ \{\text{ Tom }\}\cup \{\text{ basketball }\}=\{\text{ Tom, basketball }\};\\ \{\text{ Tom, Ken }\}\cup \{\text{ basketball, tennis }\}=\{\text{ Tom, Ken, basketball, tennis }\}.\\ \end{array}$$ So, to find the union of two such sets, we just merge the lists. To find unions of subsets of $X\cup Y$, we merge the lists removing repetitions: $$\begin{array}{lll} \{\text{ tennis, Tom, Ken }\}\cup \{\text{ basketball, tennis, Tom }\}&=\{\text{ tennis, Tom, Ken, basketball, tennis, Tom }\}\\ &=\{\text{Tom, Ken, basketball, tennis }\}. \end{array}$$

We can also look for the “overlaps” of these subsets:

Boys and balls -- intersection.png

$\square$

Definition. The intersection of any two sets $X$ and $Y$ is the set that consists of all the elements that belong to both $X$ and $Y$. It is denoted by $X\cap Y$.

Example. Here is an example of such computation: $$\begin{array}{lll} \{\text{ tennis, Tom, Ken }\}\cap \{\text{ basketball, tennis, Tom }\}&=\{\text{ tennis, Tom }\}. \end{array}$$ $\square$

Example. Numerical sets are subsets of the real line ${\bf R}$. They may consist of just a few separate points:

Solutions of equations.png

Recall that these sets came from solving these equations: $$\begin{array}{l|ll} \text{equation }& \text{ solution set }& \text{ simplified }\\ \hline x+2=5 &\{x:\ x+2=5 \}&=\{3\} \\ 3x=15 &\{x:\ 3x=15 \}& =\{5\} \\ x^2-3x+2=0 &\{x:\ x^2-3x+2=0 \} & =\{1,2\} \\ x^2+1=0 &\{x:\ x^2+1=0 \}& = \{\quad\}=\emptyset \\ \end{array}$$ $\square$

Warning: don't confuse an element of a set and a one-element set.

Recall that the set-building notation is used to create a set by stating a condition these numbers are supposed to satisfy: $$Z=\{x:\ \text{ condition for } x\ \}.$$ Sometimes the condition that define the set splits into two conditions, $$Z=\{x:\ \text{ first condition for } x\texttt{ AND } \text{ second condition for } x\}.$$ The word “$\texttt{AND}$” is capitalized in order to emphasize that the set contains only those $x$'s that satisfy both conditions simultaneously. Then we can see also that there are two sets, $$P=\{x:\ \text{ first condition for } x\} \text{ and } Q=\{x:\ \text{ second condition for } x\},$$ one for either condition. We are interested in their intersection: $$Z=P\cap Q=\{x:\ \text{ first condition for } x\} \cap \{x:\ \text{ second condition for } x\}.$$

Example. In particular, when these two conditions are equations, there are two solution sets: $$\begin{array}{llcll} &\{x:\ x^2-3x+2=0 &\texttt{ AND }& x^2=1\}\\ =& \{x:\ x^2-3x+2=0\}&\cap&\{x:\ x^2=1\} \\ =& \{1,2\}&\cap&\{-1,1\}\\ =&\{1\}. \end{array}$$

These conditions can also be inequalities. They produce intervals:

Solutions of inequalities.png

These intervals are presented in the interval notation: $$\begin{array}{lll} \{x:\ x\ge 3 \}&=[3,\infty), \\ \{x:\ 1\le x\le 2 \}& =[1,2], \\ \{x:\ x\le 0 \} & = (-\infty,0], \\ \{x:\ 1\ge x\ge 2 \}& = \emptyset.\\ \end{array}$$ Similarly to the above, when there are two inequalities, there are two solution sets: $$\begin{array}{llcll} &\{x:\ 0\le x \le 3\}\\ =&\{x:\ x\ge 0 &\texttt{ AND }& x\le 4\}\\ =& \{x:\ x\ge 0\}&\cap&\{x:\ x\le 3\} \\ =& (-\infty,3]&\cap &[0,\infty)\\ =&[0,3]. \end{array}$$

Interval 0,3 as intersection.png

$\square$

Example. Furthermore, we now have another “big” set that produces examples of sets as its subsets; it's the Cartesian plane ${\bf R}^2$! For example, we can have a “sequence” of infinitely many points on the plane:

Euler's method for hyperbolas with Excel.png

It may not fit on the piece of paper, but they can also trend toward a particular point (as discussed in Chapter 4):

Topology convergent sequence.png

$\square$

Example. All the graphs (of both relations and functions) are subsets of ${\bf R}^2$.

Graphs.png

Suppose we have a relation $R$ between $X={\bf R}$ and $Y={\bf R}$. Then, the graph of $R$ is a subset of ${\bf R}^2$ that consists of all points $(x,y)$ that $x$ and $y$ are related via $R$. Just as in the last chapter, we test one point at a time ($x+y=2$):

X+y=2 as a relation.png

For a function $F:{\bf R}\to {\bf R}$, its graph is the following set given by the set-building notation: $$\{(x,y):\ y=F(x)\}.$$

Graph as a subset of the plane.png

Two especially important subsets of the plane are the two axes. Suppose $y=F(x)$ is a numerical function. Then the $x$-intercepts of $F$ are the elements of the intersection of the graph of $F$ with the $x$-axis. Meanwhile, the $y$-intercept of $F$ is the only element of the intersection of the graph of $F$ with the $y$-axis.

X- and y-intercepts.png

$\square$

Example. What if we have two graphs; what is the meaning of their intersection? For example, this is the intersection of the graphs of these two relations: $$x-2y=-2 \text{ and } x+y=2.$$

Intersection of two lines.png

So, the intersection is a point and this point $(x,y)$ is the solution of the system of equations formed by these two equations: $$\begin{cases} x&-&2y&=2,\\ x&+&y&=2. \end{cases}$$ Just as before, when there are two equations, there are two sets: $$\begin{array}{llcll} &\{(x,y):\ x-2y=2 &\texttt{ AND }&x+y=2\}\\ =& \{(x,y):\ x-2y=2\}&\cap&\{(x,y):\ x+y=2\}\\ =&\{(2,0)\}. \end{array}$$ The intersection is a single point. $\square$

Example. There are more examples of set building on the plane. The regions above and below the graph of a function $y=f(x)$ are given by, respectively: $$\{(x,y):\ y\ge f(x)\} \text{ and }\{(x,y):\ y\le f(x)\}.$$

Regions above or below graph.png

And this is the disk, i.e., the region inside the circle of radius $R$: $$\{(x,y):\ x^2+y^2\le R^2\} .$$

From circle to disk.png

More examples of these two operations for subsets of the plane:

Intersections and unions.png

These may also serve as illustrations of unions and intersections of “generic” sets. $\square$

2 Piece-wise defined functions

Suppose one person knows only the preferences of Tom, Ned, and Ben, i.e., function $F$, and suppose another person knows only the preferences of Ben, Ken, and Sid, i.e., function $G$. Can the two pool their knowledge together in a meaningful way? This amounts to building a new function from two old ones:

Boys and balls -- pointwise.png

Of course, this is only possible if the data of ones isn't in conflict with that of the other (that's Ben). Otherwise we would end up with two arrows originating from the same input; not a function!

So, we have two observations.

  • We define the new function the domain of which is the union of the domains of the two functions.
  • It is only possible as long as the values of the two functions on the intersection of their domains are the same.
Piecewise defined.png

The two domains become the two pieces of the domain of the new function.

Definition. Let $A,B$ be two subsets of a set $X$ such that $X = A \cup B$ and let $Y$ also be a set. Suppose $F: A \to Y,\ G:B\to Y$ are functions, and $$F(x)=G(x),\text{ for all } x \text{ in } A\cap B.$$ Then the values of the piece-wise defined function $f:X\to Y$ are given by:

  • $f(x)=F(x)$ if $x$ is in $A$,
  • $f(x)=G(x)$ if $x$ is in $B$.

Exercise. What if the codomains are also different?

We can just merge the tables of these functions:

Boys and balls -- pointwise -- tables.png

We can also superimpose the graphs of these functions:

Boys and balls -- pointwise -- graphs.png

The algebraic notation for this function puts the formulas before the conditions: $$f(x)=\begin{cases} F(x) & \text{ if } x\text{ in } A, \\ G(x) & \text{ if } x\text{ in } B. \end{cases}$$

In case of numerical functions, two functions can be “glued together” to create a new function, as follows.

Functions glued together.png

When there is no intersection of the domains, $$A\cap B=\emptyset,$$ there is no issue! Often however, we don't want to deal with the intersection and instead choose to glue together functions the domains of which has no intersection. It's especially true when there are more than two functions. We use the following notation: $$f(x)= \begin{cases} F_1(x) & \text{ if } x\text{ in } A_1, \\ F_2(x) & \text{ if } x\text{ in } A_2, \\ F_3(x) & \text{ if } x\text{ in } A_3,\\ ... &...\quad, \end{cases}$$ provided $A_i\cap A_j=\emptyset$ for $i\ne j$. Just as all algebraic formulas, it is to be read from inside out.

Example. Suppose, hypothetically, that the tax code says:

  • if your income is less than $\$ 10000$, there is no income tax;
  • if your income is between $\$ 10000$ and $\$ 20000 $, the tax rate is $10\%$;
  • if your income is over $\$ 20000$, the tax rate is $20\%$.

Let's build a function! Let $x$ be the input (the income) and $y=f(x)$ output (tax rate). Let the domain be $[0,+\infty)$. We choose the codomain to be $[0,1]$. We see these three “brackets” as three functions. Now, the values are all different, so we need to make sure that there is no overlap of their domains:

  • if $0\le x\le 10000$, then $y=0$;
  • if $10000< x\le 20000$, then $y=.10$;
  • if $20000< x$, then $y=.20$.

Let's build a flowchart. In contrast to all past examples, there is a fork on the road this time. Depending on how we answer these questions about $x$, we choose the right route for our computation: $$\begin{array}{cccccc} f(x):& x & \mapsto & \begin{array}{|c|}\hline &x& \begin{array}{ll} \nearrow_{\text{ if }x\le 10000} &x\mapsto \begin{array}{|c|}\hline\quad \text{ choose }0 \quad \\ \hline\end{array} & \mapsto & y & \searrow\\ \to_{\text{ if }10000< x\le 20000} &x\mapsto \begin{array}{|c|}\hline\quad \text{ choose }.10 \quad \\ \hline\end{array} & \mapsto & y & \to\\ \searrow_{\text{ if }20000< x} &x\mapsto \begin{array}{|c|}\hline\quad \text{ choose }.20 \quad \\ \hline\end{array} & \mapsto & y & \nearrow\\ \end{array}& y\\ \hline\end{array} & \mapsto & y \end{array}.$$

Tax rates and continuity.png

We also express the tax rate algebraically: $$f(x) = \begin{cases} 0 & \text{if } x \le 10000; \\ .10 & \text{if } 10000 < x \le 20000; \\ .20 & \text{if } 20000 <x. \end{cases}$$ This formula, however, cannot be applied directly to calculate your tax bill; indeed, if your income rises from $\$ 10,000$ to $\$ 10,001$, your tax bill would rise from $\$ 0$ to $\$ 1,000$. This is the issue of “discontinuity” discussed in Chapter 5. More realistically, the output of the formula represents a “marginal” tax rate: the rate you apply to that part of the income that lies within the bracket. These three numbers are then added together to produce your tax bill. $\square$

Exercise. Find the formula of the tax bill. Hint: its graph is shown above on right.

Some of very important functions are presented by several formulas at the same time.

The next function is meant to give the direction from the origin to the location given by the input number:

  • $3$ is to the right, so the direction is positive, and we say “$1$”;
  • $-5$ is to the left, so the direction is negative, and we say “$-1$”.
Sign function as direction.png

Definition. The sign function, which is denoted by $$y=\operatorname{sign}(x),$$ is defined as follows:

  • if $x<0$, then $y=-1$;
  • if $x=0$, then $y=0$;
  • if $x>0$, then $y=1$.

If we think of a function as a sequence of steps, this is the case when the sequence splits; this is its flowchart: $$\begin{array}{cccccc} y=\operatorname{sign}(x):& x & \mapsto & \begin{array}{|c|}\hline &x& \begin{array}{lllll} \nearrow_{\text{ if }x< 0} &x\mapsto \begin{array}{|c|}\hline\quad \text{ choose }-1 \quad \\ \hline\end{array} & \mapsto & y & \searrow\\ \to_{\text{ if }x=0} &x\mapsto \begin{array}{|c|}\hline\quad \text{ choose }0 \quad \\ \hline\end{array} & \mapsto & y & \to\\ \searrow_{\text{ if }x>0} &x\mapsto \begin{array}{|c|}\hline\quad \text{ choose }1 \quad \\ \hline\end{array} & \mapsto & y & \nearrow\\ \end{array}& y\\ \hline\end{array} & \mapsto & y \end{array}.$$ This is the algebraic formula: $$\operatorname{sign}(x)=\begin{cases} -1&\text{ if } x<0,\\ 0&\text{ if } x=0,\\ 1&\text{ if } x>0. \end{cases}$$ In other words, the function strips the input number off its magnitude and what's left is its sign, which is, in a way, its direction.

Note how in this example the only job of $x$ is to point us at the right door.

It is clear that the implied domain of this function is ${\bf R}=(-\infty,+\infty)$. Since the only possible values are listed in the description of the function, the range is them, $\{-1,0,1\}$. We see that also in the table of values of the sign function, the $y$-values: $$\begin{array}{c|ccc} x&-3&-2&-1&0&1&2&3\\ \hline y&-1&-1&-1&0&1&1&1 \end{array}$$ This is not enough, however, in order to see what the graph is around $0$:

Sign function plotted.png

We insert more points into the table: $$\begin{array}{c|ccc} x&-3&-2&-1&-.5&0&.5&1&2&3\\ \hline y&-1&-1&-1&-1&0&1&1&1&1 \end{array}$$ The outputs continue to be repeated! This is an indication that the graph is horizontal in those areas. As we plot those points, we realize that can't connect them into a “single curve”. This issue is discussed in Chapter 5.

The next function is meant to give the distance from the location given by the input number to the origin: both $3$ and $-3$ are $3$ units from the origin.

Absolute value as distance.png

The result is always positive (except for $0$ itself). One can say that “the minus sign is dropped”.

Warning: We can't “drop the sign” of $-x$ because $x$ itself might be negative.

How else do we make a negative number positive? We multiply it by $-1$!

Definition. The absolute value function, which is denoted by $$y = |x|,$$ is computed as follows:

  • if $x<0$, then $y=-x$;
  • if $x=0$, then $y=0$;
  • if $x>0$, then $y=x$.

This is its flowchart: $$\begin{array}{cccccc} y=|x|:& x & \mapsto & \begin{array}{|c|}\hline &x& \begin{array}{lllll} \nearrow_{\text{ if }x< 0} &x\mapsto \begin{array}{|c|}\hline\quad \text{ multiply by }-1 \quad \\ \hline\end{array} & \mapsto & y & \searrow\\ \to_{\text{ if }x=0} &x\mapsto \begin{array}{|c|}\hline\quad \text{ choose }0 \quad \\ \hline\end{array} & \mapsto & y & \to\\ \searrow_{\text{ if }x>0} &x\mapsto \begin{array}{|c|}\hline\quad \text{ pass it } \quad \\ \hline\end{array} & \mapsto & y & \nearrow\\ \end{array}& y\\ \hline\end{array} & \mapsto & y \end{array}.$$ This is the algebraic formula: $$\operatorname{sign}(x)=\begin{cases} -x&\text{ if } x<0,\\ 0&\text{ if } x=0,\\ x&\text{ if } x>0. \end{cases}$$ In other words, the function does the opposite of what the sign function does; it strips the input number off its sign, or direction, and what's left is its magnitude.

Exercise. Show that the two functions above are related by the following identity: $$|x|=\operatorname{sign}(x)\cdot x.$$

Example. An alternative method is as follows:

  • if $x \le 0$ then $y = - x$; and
  • if $x \ge 0$ then $y = x$.

It is produced according to the above definition from these two functions:

  • $F(x)=x$ defined on $A=[0,+\infty)$, and
  • $G(x)=-x$ defined on $B=(-\infty,0]$.

Since he formulas are different but the domains overlap, we make sure that the value is the same on the intersection (it's $0$ in either case). $\square$

Exercise. Present a flowchart for this definition.

It is clear that the domain of this function is ${\bf R}=(-\infty,+\infty)$. To find the range, we take into account these two facts:

  • the only possible values are non-negative (by design),
  • every non-negative number is its own absolute value.

Therefore, the range is the set of all non-negative numbers, $[0,+\infty)$. We see that also in the table of values of the absolute value function, the $y$-values: $$\begin{array}{c|ccc} x&-3&-2&-1&0&1&2&3\\ \hline y&3&2&1&0&1&2&3 \end{array}$$

Warning: The graph on the left is the complete graph of the function $f(x)=|x|$ with the domain taken to be the integers.

As we plot more and more of those points, we realize that -- in contrast to $y=\operatorname{sing}(x)$ -- we can connect them into a “single curve”.

Absolute value graph.png

However, this V-shaped curve is made of parts of two straight lines, $y=x$ and $y=-x$, without any “smoothing”. The change of direction is abrupt! This issue is discussed in Chapter 6.

Exercise. What symmetry do you see in the graph?

Another important piece-wise defined function is the following.

Definition. The integer value function, which is denoted by $$y = [x],$$ is defined as the largest integer $y$ less than or equal to $x$.

We always move towards the negative: $$[5]=5,\ [3.1]=[3.99]=3,\ [-4.1]=-5.$$

Given an input of $x$, let's describe a procedure for computing this function. We have for a given $x$:

  • Step 1: determine whether $x$ is integer or not.
  • Step 2: if $x$ is an integer, then set $y=x$; else decrease from $x$ until meet an integer, set $y$ equal that integer.

Exercise. Present a flowchart for this definition.

It is clear that the domain of this function is all reals ${\bf R}=(-\infty,+\infty)$. To find the range, we take into account these two facts:

  • the only possible values are integers (by design),
  • the integer value of every integer is that number.

Therefore, the range is the integers ${\bf Z}=\{...-3,-2,-1,0,1,2,3...\}$. We see that also in the table of values of this function, the $y$-values: $$\begin{array}{c|ccc} x&-3&-2&-1&0&1&2&3\\ \hline y&-3&-2&-1&0&1&2&3 \end{array}$$ This is not enough, however, in order to see what the graph is. All we see is just a sequence of points on the line $y=x$:

Integer value function.png

We insert more points: $$\begin{array}{c|ccc} x&-3&-2.5&-2&-1.5&-1&-.5&0&.5&1&1.5&2&2.5&3\\ \hline y&-3&-3&-2&-2&-1&-1&0&0&1&1&2&2&3 \end{array}$$ The outputs are repeated! This is an indication that the graph is horizontal in those areas. As we plot those points, we realize that can't connect them into a “single curve”.

Example. Note that -- generally -- the “pieces” of a piece-wise defined function don't have to fit together well:

Piece-wise graph.png

$\square$

Example. Plot the graph of the piece-wise defined function: $$f(x) = \begin{cases} 3 - \frac{1}{2}x & \text{ for } x \leq 2, \\ 2x - 5 & \text{ for } x > 2. \end{cases}$$ We follow these steps:

  • 1. plot $y=3 - \tfrac{1}{2} x$;
  • 2. plot $y=3 - \tfrac{1}{2}x$ with domain $x \leq 2$;
  • 3. plot $y=2x - 5$;
  • 4. plot $y=2x - 5$ with domain $x > 2$;
  • 5. combine the plots from 2) and 4).
Piecewise function.png

$\square$

Exercise. Plot the graph of the function $y=f(x)$, where $x$ is time in hours and $y=f(x)$ is the parking fee over $x$ hours, which is computed as follows: free for the first hour, then $\$1$ per every full hour for the next $3$ hours, and a flat fee of $\$5$ for anything longer.

Exercise. Make a hand-drawn sketch of the graph of the function: $$f(x)= \begin{cases} -3 &\text{ if } x<0,\\ x^2 &\text{ if } 0\le x<1,\\ x &\text{ if } x>1. \end{cases}$$

Example. The flowcharts also help to visualize what happens in the black box when we step outside the domain: $$\begin{array}{cccccc} y=1/x:& x & \mapsto & \begin{array}{|c|}\hline &x& \begin{array}{lllll} \nearrow_{\text{ if }x\ne 0} &x &\mapsto &\begin{array}{|c|}\hline\quad \text{ take its reciprocal } \quad \\ \hline\end{array} & \mapsto & y & \searrow\\ \\ \searrow_{\text{ if }x=0} & &x\mapsto &\begin{array}{|c|}\hline\quad \text{ STOP! } \quad \\ \hline\end{array} & & & \\ \end{array}& y\\ \hline\end{array} & \mapsto & y \end{array}$$ $\square$

Exercise. Make a flowchart as above for $f(x)=\sqrt{x}$.

Exercise. Provide a formula for the function $y=f(x)$ that represents a parking fee for a stay of $x$ hours. It is computed as follows: free for the first hour and $\$1$ per hour beyond.

3 Numerical functions are transformations of the real number line

...and vice versa.

When an abstract function $y=f(x)$ is given to us without any prior background, it may be a good idea to create a tangible representation for it. The two main ways we are familiar with are these:

  • 1. we think of the function as if it represents motion: $x$ time, $y$ location;
  • 2. we plot the graph of the function on a piece of paper.

Let's set these aside for now and imagine a third approach:

  • 3. we think of the function as a transformation of the real line.

First, we go back to representing a numerical function as correspondence between the $x$ and the $y$-axis:

Axes with arrows.png

As you can see, these are the same axes we use to plot the graph, but parallel instead of perpendicular to each other. The arrows tell us what happens to each number. But there is more to it: they also suggest what happens to the whole $x$-axis!

Let's consider something specific:

Axes with arrows -- shift.png

What happens to the $x$-axis?

Warning: Above you see two ways to interpret the function: (1) arrows are between the $x$-axis and the intact $y$-axis or (2) we move the $y$-axis so that $y=f(x)$ is aligned with $x$. The approaches give two different, even opposite, answers to the question. We will follow the former.

To make this more tangible, we will think as if the whole $x$-axis is drawn on a pencil:

Pencil as axis.png

A transformation we start is a shift. We simply slide the pencil horizontally. Furthermore, there is another pencil to be used for reference. The markings (i.e., its coordinate system) on the second pencil show the new locations of the points on the first. For example, a shift of $3$ units to the right is shown below:

Shift of axis.png

Generally,

  • when shifted $k>0$ units right, point $x$ becomes $x+k$.
Axis shifted along arrows.png

Warning: replace “right” with “up” if the axes are aligned vertically; it's the positive direction that matters.

In the meantime, what about shifting left? We have:

  • when shifted $k>0$ units left, point $x$ becomes $x-k$.

Of course, we can combine the two statements:

  • when shifted $k>0$ units right/left, point $x$ becomes $x\pm k$.

Instead, we should allow $k$ to be negative. Then we can interpret the former statement to include the latter if we understand “$k$ units left” as “$-k$ units right”. Here is a way describe it: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} x& \ra{ \text{ right } k}& x+k. \end{array}$$ Of course, $k=0$ means that there is no change. This is a function: $$y=f(x)=x+k.$$

Next, what kind of transformation is this: $$y=-x?$$ We plot the arrows:

Axis flipped along arrows.png

To understand what is happening, we can imagine that we grab the $x$-axis with at two spots with two hands and then bring those two points to the assigned locations on the $y$-axis. We can almost see how the $x$-axis is rotated into the $y$-axis! This is a different kind of transformation, a flip. We lift, then flip the pencil with $x$-axis on it, and place next to another such pencil. This flip is shown below:

Flip of axis.png

This is the algebraic interpretation: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} x& \ra{ \text{ flip } }& -x. \end{array}$$

The transformations that don't distort the line are called motions. Then, motions are the left shift and the right shift (the magnitude may vary) and the flip (the center may vary). Let's consider something else, how about a fold? The line isn't on a pencil anymore! It is a piece of wire:

Folding with arrows.png

We approach the same issue from the opposite direction: instead of asking what transformation this function represents, we ask what function represents this transformation? From the arrow diagram on right, we conclude that half of the $x$-axis flips and the other remains put. What is this? A function with ${\bf R}$ as the domain and $[0,+\infty)$ as the range? This is the absolute value function, $y=|x|$!

A new type of transformation is a stretch. The line isn't on a pencil or a wire anymore! It is a rubber string (with knots):

Axis as string.png

We grab it by the ends and pull them apart in such a way that the origin doesn't move. For example, a stretch by a factor of $2$ is shown below:

Stretch of axis.png

We, once again, can imagine that we grab the $x$-axis with at two spots and bring them to the assigned locations on the $y$-axis. This is indeed a uniform stretch because the distance between any two points doubles.

Stretch and shrink of axis with arrows.png

Exercise. What does $f(x)=-2x$ do to the $x$-axis?

Generally,

  • when the line is stretched by a factor $k>1$, point $x$ becomes $x\cdot k $.

In the meantime, what about a shrink? We have:

  • when the line is shrunk by a factor $k>1$, point $x$ becomes $x/k$.

Of course, in order to combine the two statements, we should allow $k$ to be less than $1$. Then we can interpret the former statement to include the latter if we understand “stretched by a factor $k$” as “shrunk by a factor $1/k$”. Here is a way describe it ($k>0$): $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} x& \ra{ \text{ stretch by } k}& x\cdot k. \end{array}$$ Of course, $k=1$ means that there is no change. This is the new kind of function we have discovered: $$y=f(x)=x\cdot k.$$

Except for the absolute value, all functions have been linear polynomials! In fact, the stretch/shrink factor $k$ of such a function is the slope of the line of its graph. Indeed, this is what happens to the distance between two points $u$ and $v$, which is $|v-u|$, after a linear function $f(x)=mx+b$ with $m>0$ is applied: $$|f(v)-f(u)|=|(mv+b)-(mu+b)|=|mv-mu|=m|v-u|.$$ The distance has increased by a factor of $m$ (we say that it has decreased by a factor of $m$ when $m<1$). This stretch/shrink factor is the same everywhere.

Exercise. What is the meaning of $b$ in the transformation given by $f(x)=mx+b$?

We will often color the numbers according to their values. This is the summary of the functions we have considered:

Transformations of the line.png

We also plot the graphs of these functions below:

Transformations of the line -- graphs.png

A very simple, but important, class of function is the constant functions, $f(x)=k$. What does this function do to the $x$-axis? There is only one output:

Collapse of axis with arrows.png

The real line is shrunk to a single point; we can call this transformation collapse.

It is, however, more typical to have a non-uniform stretching throughout the domain of a function because it is likely to be non-linear.

Example. Let's consider this function given by its values: $$\begin{array}{l|lllll} x&0&1&2&3&4&5&6&7&8&9&10\\ \hline y&0&2&5&7&8&8.5&8.5&8&7&4&2\\ \end{array}$$ We then assume that the function continues between these values in a linear fashion: the $1$-unit segments on the $x$-axis are stretched and shrunk at different rates, and the ones beyond $x=6$ are also flipped over:

Non-uniform stretch.png

We also plot the graph of this function on right. So, at its simplest, a non-linear function is a combination of linear patches. $\square$

The stretch/shrink rates can also change continuously. To illustrate these basic transformations, we can also use a color representation of the real line. We can color locations at random; this is a combination of shifting, stretching, and shrinking:

Rubber band stretched.png

Among all this complexity, the point marked with star is fixed.


The most common way to visualize a function remains its graph. Let's combine the two approaches. The picture below shows how the two approaches come together. The transformation of the domain into the codomain performed by the function can be seen in what happens to its graph:

Transformation seen in the graph.png

First, we take the $x$-axis as if it is a (colored) rope and lift it vertically (with some inevitable stretching) to the graph of the function and, second, we push it horizontally to the $y$-axis. At the end, we can see what has happened: stretching at the ends and shrinking in the middle. The transformation in the next example does more:

Transformation seen in the graph 2.png

There is also a flip in the middle (and a fold).

Of course, a transformation can tear this rope.

Transformations of the line -- tear.png

The issue of “continuity” is addressed in Chapter 5.

The last example is that of the sign function; it collapses the $x$-axis to three different points on the $y$-axis:

Sign function with arrows.png

Exercise. What does the integer value function do to the $x$-axis?

4 Functions with regularities: one-to-one and onto

Recall our original example of a function that assigns to each boy a ball to play with:

Boys and balls -- function.png

In order for this to be a function, the table of this relation must have exactly one mark in each row:

Boys and balls -- function table.png

It does but if we further study this function, we notice different but related “irregularities”.

First, no-one seems to like baseball! There is no arrow ending at the baseball and its column has no marks.

Let's modify the function slightly: Ken changes his preference from football to baseball. Then, there is an arrow for each ball and all columns in the table have marks.

Boys and balls -- onto function.png

In the graph, there is a dot corresponding to each horizontal line.

Definition. A function $F:X\to Y$ is called onto when there is an $x$ for each $y$ with $F(x)=y$.

The opposite is the sign that a potential output is “wasted”; some $y$ belongs to the codomain but not the range.

Below, the reason for this terminology is explained:

Explanation of onto function.png

We start with an element of $X$ and bring it -- along the arrow -- to the corresponding element of $Y$. The function is onto if all elements of $Y$ are covered.

Second, both Tom and Ben prefer basketball! The two arrows converge on it and also we can see that its column has two marks. We note the same about football.

The above function is modified: Tom and Ben have left. Then, no two arrows converge on one ball and no column has more than one mark.

Boys and balls -- 1-1 function.png

In the graph, there can be only one, or none, dot corresponding to each horizontal line.

Definition. A function $F:X\to Y$ is called one-to-one when there is at most one $x$ for each $y$ with $F(x)=y$.

Below, the reason for this terminology is explained:

Explanation of 1-1 function.png

We start with an element of $X$ and bring it -- along the arrow -- to the corresponding element of $Y$. The function is one-to-one if every element of $Y$ paired up only once, at most.

In summary, the two concepts are not about how many arrows originate each $x$ -- it's always one -- but about how many arrows arrive at each $y$.

Now numerical functions. These functions are represented by their transformations and by their graphs. These two concepts will reveal whether the function is a kind we have discussed. We will we assume that

  • the codomain the set of all reals ${\bf R}$.

Example. The $x$-axis, $X$, is transformed and then placed on top of the $y$-axis, $Y$.

Transformations of the line -- 1-1 and onto.png

The questions we ask are:

  • does $X$ cover the whole $Y$?
  • does $X$ cover any location on $Y$ more than once?

Let's consider the transformations from the last section. Their descriptions -- and illustrations -- tell the whole story.

Transformations of the line.png

The left and right shifts, the flip, stretch, and the shrink -- are all both one-to-one and onto. What would make a transformation of an interval in the real line to be not one-to-one? Any folding present a visible problem:

Folding with arrows.png

And so does collapsing:

Collapse of axis with arrows.png

$\square$

Example. What about graphs? Let's start with this case: the domain is the interval $X=[-4,6]$, while the codomain is the non-negative reals, $Y=[0,\infty)$. If the graph of a function $f:X\to Y$ is given, can we determine whether this function is one-to-one or onto by just examining the graph? The idea is to “sample” the function and see how the arrows behave:

Onto and 1-1 for graphs.png

If we notice that there are arrows with the same end-point, we know that this function isn't one-to-one. If we notice that there are no arrows arriving to any location in $Y$, we know that this function isn't onto. $\square$

Example. Suppose this time the domain and the codomain are the reals, $X=Y={\bf R}$. Then the function $f(x)=x^{2}$ is not onto but $g(x)=x^{3}$ is. It is easy to see the problem with the former: $x^2\ne -1$.

Square and cubic -- onto.png

There can be no arrows that end at $y=-1$! Similarly, $f(x)=|x|$ isn't onto. We can make both one-to-one if we choose the codomain to be $[0,+\infty)$. $\square$

What makes a difference? The graph doesn't progress below a certain line! The following is a useful observation:

  • a function is onto if and only if its graph and any horizontal line have at least one point in common.

Example. The function $f(x)=x^{2}$ is not one-to-one but $g(x)=x^{3}$ is. It is easy to see the problem with the former: $1^2=(-1)^2=1$.

Square and cubic -- one-to-one.png

There are literally two arrows that have the same end-point! Similarly, $f(x)=|x|$ isn't one-to-one. $\square$

Exercise. How can we make $x^{2}$ and $|x|$ one-to-one?

What makes a difference? Two points on the graph have the same height above the $x$-axis! The following is a useful observation:

  • function is one-to-one if and only if the intersection of its graph and any horizontal line contains at most one point.

Notice the connection with the Vertical Line Test (for function) from the last chapter:

Horizontal Line Test.png

Example. Linear polynomials, $$F(x)=mx+b,\ m\ne 0,$$ are easy to characterize this way.

Slopes.png

They are all both one-to-one and onto. $\square$

Example. Quadratic polynomials, $$F(x)=ax^2+bx+c,\ a\ne 0,$$ are neither one-to-one nor onto.

Parabolas.png

$\square$

Exercise. Classify all power functions according to these two definitions.

Exercise. Prove algebraically that $f(x)=1/x$ is one-to-one but not onto.

Graph of 1x final.png

Exercise. Classify the function $f(x)=x^3-x$. Prove algebraically.

Exercise. Identify and classify the functions below:

Employees.png

Exercise. Function $y=f(x)$ is given below by a list of some of its values. Add missing values in such a way that the function is one-to one. $$\begin{array}{r|l|l|l|l|l}x&-1 &0 &1 &2 &3 &4 &5\\ \hline y=f(x)&-1 & &4 &5 & &2 \end{array}$$

We summarize the results of this section in the following important theorem.

Theorem (Horizontal Line Test).

  • (1) A function is onto if and only if its graph and any horizontal line have at least one point in common.
  • (2) A function is one-to-one if and only if its graph and any horizontal line have at most one point in common.

In light of the theorem, we redo the table presented earlier by counting the number of intersections of horizontal lines with the graph:

One-to-one and onto table.png

In each cell of the table, we see an example of how -- in a simplest possible way -- these two conditions can be violated.

Theorem. (a) A function $F:X\to Y$ is onto if and only if its image is the whole codomain, $Y$. (b) A function $F:X\to Y$ is on-to-one if and only if the pre-image of every element of the codomain $Y$ is a single element of the domain, $X$.

Exercise. Prove the theorem.

To summarize, the restrictions in these definitions can be violated when there are too few or too many arrows arriving to a given $y$. These violations are seen in the co-domain. This one is not onto:

Not onto.png

That one is not one-to-one:

Not one-to-one.png

What functions are the most “regular”? The ones that are both one-to-one and onto:

Boys and balls -- bijection.png

Exercise. Sketch the graph of the function $f$ given by its list of values below. Is it one-to-one? $$\begin{array}{r|ll} x&1&2&3&4&5\\ \hline y=f(x)&1&2&0&3&1 \end{array}$$

5 Compositions of functions

Let's note the colors of the balls the boys are, or aren't, playing with. This creates a new function:

Balls and colors.png

It is a function $G:Y\to Z$ from the set of all balls to the new set $Z$ of the main colors. (Note that the new function is one-to-one but not onto.)

Since we also know the boys' preferences in balls, we can answer the question about their preferences in colors! We just need to combine the new function with the old:

Boys, balls, and colors.png

If we start with a boy on the left we can continue with the arrows all the way to the right. This way we will know what color the of the ball the boy is playing with.

Boys, balls, and colors 2.png

This is a new function $H:X\to Z$ from the set of boys to the set $Z$ of the main colors.

Boys and colors.png

(Note that the new function is neither one-to-one nor onto.)

Definition. Given two functions $$F:X\to Y \text{ and } G:Y\to Z,$$ their composition is the function $$H:X\to Z,$$ denoted by: $$G\circ F,$$ which is computed by for every $x$ in $X$ according to the following two-step procedure: $$x\mapsto F(x)=y \mapsto G(y)=z;$$ i.e., the new function is computed by: $$z=H(x)=G(F(x)).$$

We just follow from $X$ along the arrows of $F$ to $Y$ and then along the arrows of $G$ to $Z$:

Composition of 2 with arrows.png

If we think of functions are lists of instructions, here is the list of $G\circ F$:

  • step 1: do $F$,
  • step 2: do $G$.

They are executed consecutively: you can't start with the second until you are done with the first.

If we represent the two functions as black boxes, we use the output of the former as the input of the latter: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} \text{input} & & \text{function} & & \text{output} \\ x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y\\ &&&&\text{input} & & \text{function} & & \text{output} \\ &&&&y & \mapsto & \begin{array}{|c|}\hline\quad g \quad \\ \hline\end{array} & \mapsto & z\\ \end{array}$$


So, the new function is computed by: $$H(x)=G(F(x)).$$ This is nothing but substitution!

Example. Let's test that on the last example. We take the two lists of values and then substitute: $$\begin{array}{lll} F(\text{ Tom })&=\text{ basketball },\\ F(\text{ Ned })&=\text{ tennis },\\ F(\text{ Ben })&=\text{ basketball },\\ F(\text{ Ken })&=\text{ football },\\ F(\text{ Sid })&=\text{ football };\\ \end{array}\qquad\begin{array}{lll} G(\text{ basketball })&=\text{ orange },\\ G(\text{ tennis })&=\text{ yellow},\\ G(\text{ football })&=\text{ brown },\\ G(\text{ baseball })&=\text{ white }.\\ \end{array}$$ We ignore any alignment between the two lists. We take the first entry in the second list, $$G(\text{ basketball })=\text{ orange },$$ and replace “basketball”, according to the first entry of the first list, with $F(\text{ Tom })$. This is the result: $$G(\ F(\text{ Tom })\ )=\text{ orange }.$$ Therefore, $$H(\text{ Tom })=\text{ orange }.$$ This is the first entry in the new list! This is the whole list of values of $H$: $$\begin{array}{lll} H(\text{ Tom })&=\text{ orange },\\ H(\text{ Ned })&=\text{ yellow },\\ H(\text{ Ben })&=\text{ orange },\\ H(\text{ Ken })&=\text{ brown },\\ H(\text{ Sid })&=\text{ brown }.\\ \end{array}$$ $\square$

Example. This substitution is just as simple for numerical functions. For example, $y=x^2$ is substituted into $z=y^3$ resulting in $z=\big(x^2\big)^3$. The idea remains the same: insert the input value in all of these boxes. For example, this function on the left is understood and evaluated via the diagram on the right: $$f\left(y \right)=\frac{2y^2-3y+7}{y^3+2y+1},\quad f\left( \square \right)=\frac{2\square^2-3\square+7}{\square^3+2\square+1}.$$ In the last chapter, we inserted $3$ at each of these windows: $$f\left( \begin{array}{|c|}\hline\ 3 \ \\ \hline\end{array} \right)=\frac{2\begin{array}{|c|}\hline\ 3 \ \\ \hline\end{array}^2-3\begin{array}{|c|}\hline\ 3 \ \\ \hline\end{array}+7}{\begin{array}{|c|}\hline\ 3 \ \\ \hline\end{array}^3+2\begin{array}{|c|}\hline\ 3 \ \\ \hline\end{array}+1}.$$ This time, let's insert $\sin x$, or $(\sin x)$: $$f \begin{array}{|c|}\hline\ (\sin x) \ \\ \hline\end{array} =\frac{2\begin{array}{|c|}\hline\ (\sin x) \ \\ \hline\end{array}^2-3\begin{array}{|c|}\hline\ (\sin x) \ \\ \hline\end{array}+7}{\begin{array}{|c|}\hline\ (\sin x) \ \\ \hline\end{array}^3+2\begin{array}{|c|}\hline\ (\sin x) \ \\ \hline\end{array}+1}.$$ Then, we have $$f\left(\sin x \right)=\frac{2(\sin x)^2-3(\sin x)+7}{(\sin x)^3+2(\sin x)+1}.$$ Note that if you don't know what $\sin$ does, it makes no difference! The only thing that matters is that we know that this is a function. $\square$

Example. Next, what about representing functions by their tables? These are the tables of $F$ and $G$ above:

Boys balls colors -- table.png

How do we combine them to find $H$? The alignment we might see is meaningless. We need to align what the two have in common, $Y$. Then we start with an $x$ in $X$, use $F$ to find the corresponding value of $y$ in $Y$, then use $G$ to find the corresponding value of $z$ (one such step is illustrated below):

Boys balls colors -- tables combined.png

$\square$

Example. What if we have their graphs? Suppose we have the two graphs side by side and we need to find $d=g(f(a))$. Then, we use the first graph to find $c=f(a)$ on the vertical axis, then travel all the way to the horizontal axis of the second, find the corresponding $c$ on it, and finally find $d=g(c)$ on the vertical axis.

Composition via graphs 0.png

Alternatively, we match the output axis, $u$, of the first function with the input axis, $u$, of the second:

Composition via graphs.png

It's complicated! $\square$

Example. What if we, instead, think of functions as transformations? For example, consider this:

  • if the first transformation is a stretch by a factor of $2$, and
  • the second transformation is a stretch by a factor of $3$, then
  • the composition of the two transformations is a stretch by a factor of $3\cdot 2=6$:
Composition of stretches.png

So, we just carry out two transformations in a row.

Composition of transformations.png

$\square$

Example. What if the functions are given by nothing but their lists of values? Then we need find a match for the output of the first function among the inputs of the second. Given the tables of values of $f, g$, find the table of values of $f \circ g$: $$\begin{array}{l|ll} x&y=g(x)\\ \hline 0&1\\ 1&0\\ 2&2\\ 3&4\\ 4&2 \end{array}\qquad\circ\qquad \begin{array}{l|ll} y&z=g(y)\\ \hline 0&0\\ 1&3\\ 2&5\\ 3&1\\ 4&2 \end{array}\qquad = \qquad \begin{array}{l|ll} x&z=f(g(x))\\ \hline 0&?\\ 1&?\\ 2&?\\ 3&?\\ 4&? \end{array}$$ We need to fill the second column of the last table. First, we need to match the outputs of $f$ with the inputs of $g$.

Composition from lists.png

Alternatively, we simply re-arrange the rows of $g$ according to the values of $y$ and then just remove the $y$-columns: $$\begin{array}{l|ll} x&y\\ \hline 0&1 \\ 1&0\\ 2&2\\ 3&4\\ 4&2 \end{array} \begin{array}{l|ll} y&z\\ \hline 1&3\\ 0&0\\ 2&5\\ 4&2\\ 2&5 \end{array}\quad\leadsto\quad\begin{array}{l|ll} x&z\\ \hline 0&3 \\ 1&0\\ 2&5\\ 3&2\\ 4&5 \end{array}$$ $\square$

Exercise. Given the tables of values of $f, g$, find the table of values of $f \circ g$: $$\begin{array}{l|ll} x&y=g(x)\\ \hline 0&0\\ 1&4\\ 2&3\\ 3&0\\ 4&1 \end{array}\qquad\circ\qquad \begin{array}{l|ll} y&z=g(y)\\ \hline 0&4\\ 1&4\\ 2&0\\ 3&1\\ 4&2 \end{array}\quad = \quad ?$$

Example. For this task, we have to use a search feature of the spreadsheet.

Compositions with spreadsheet.png

For example, the search may be executed with this formula: $$\texttt{=VLOOKUP(RC[-6],R3C[-4]:R18C[-3],2)}.$$ $\square$

Example. Problem: find the composition of the functions: $$f(x) = \dfrac{x}{1 + x},\ g(x) = \sin 2x.$$

As stated, the problem is ambiguous. Is it $f$ followed by $g$ or $g$ followed by $f$? We'll do both. This is the new version of the problem: given functions $$f(x) = \dfrac{x}{1 + x},\ g(x) = \sin 2x,$$ find their compositions, $f \circ g$ and $g \circ f$, and their domains.

The composition $f \circ g$ is: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad g \quad \\ \hline\end{array} & \mapsto & y & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & z \end{array}$$ This means that, in order to make the output of the first to match the input of the second, we will have to rename the variables: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad \sin 2x \quad \\ \hline\end{array} & \mapsto & y & \mapsto & \begin{array}{|c|}\hline\quad \dfrac{y}{1 + y} \quad \\ \hline\end{array} & \mapsto & z \end{array}$$ Now we substitute $y = \sin 2x$ into $f(y)=\tfrac{y}{1 + y}$: $$\begin{array} {lll} (f \circ g )( x ) & = f(g(x)) = f(y) \\ & = \dfrac{y}{1 + y } \\ & = \dfrac{\sin 2x}{1 + \sin 2x} . \end{array} $$ To find the domain, solve: $1 + \sin 2x = 0$, as follows: $$ \begin{array} {lll} \sin 2x &= -1 \\ \Longrightarrow 2x & = -\frac{\pi}{2} + 2\pi k, \end{array} $$ where $k$ is any integer. Therefore, the domain is $$D= \{x:\ x\ne -\tfrac{\pi}{4} + \pi k,\ k=0,\pm 1,\pm 2,...\}. $$

Next we consider the composition $g \circ f$: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y & \mapsto & \begin{array}{|c|}\hline\quad g \quad \\ \hline\end{array} & \mapsto & z \end{array}$$ Once again, we will have to rename the variables: $$ \newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad \dfrac{x}{1 + x} \quad \\ \hline\end{array} & \mapsto & y & \mapsto & \begin{array}{|c|}\hline\quad \sin 2y \quad \\ \hline\end{array} & \mapsto & z \end{array}$$ Now we substitute $y=\tfrac{x}{1 + x}$ into $g(y)=\sin 2y$: $$\begin{aligned} (g \circ f )( x ) & = g(f(x)) = g(y) \\ & = \sin\left( 2\dfrac{x}{1 + x }\right) . \end{aligned} $$ Therefore, the domain is $$D= (-\infty,-1)\cup (-1,+\infty). $$ $\square$

Exercise. Represent the function $h(x)=2\sin^3x+\sin x+5$ as the composition of two functions one of which is trigonometric.

Exercise. Suppose function $f$ performs the operation: “take the logarithm of”, and function $g$ performs: “take the square root of”. (a) Verbally describe the inverses of $f$ and $g$. (b) Find the formulas for these four functions. (c) Find their domains.

Exercise. (a) Represent the function $h(x)=\sqrt{x-1}$ as the composition of two functions. (b) Represent the function $k(t)=\sqrt{t^2-1}$ as the composition of three functions. (c) Represent the function $p(t)=\sin\sqrt{t^2-1}$ as the composition of four functions.

Exercise. Functions $y=f(x)$ and $u=g(y)$ are given below by tables of some of their values. Present the composition $u=h(x)$ of these functions by a similar table: $$\begin{array}{r|c|c|c|c} x &0 &1 &2 &3 &4 \\ \hline y=f(x) &1 &1 &2 &0 &2 \end{array}$$ $$\begin{array}{c|c|c|c|c} y &0 &1 &2 &3 &4 \\ \hline u=g(y) &3 &1 &2 &1 &0 \end{array}$$

Exercise. Represent the composition of these two functions: $f(x)=1/x$ and $g(y)=\frac{y}{y^2-3}$, as a single function $h$ of variable $x$. Don't simplify.

Exercise. Function $y=f(x)$ is given below by a list of its values. Is the function one-to-one? $$\begin{array}{r|l|l|l|l|l}x&0 &1 &2 &3 &4 \\ \hline y=f(x)&0 &1 &2 &1 &2 \end{array}$$

If we think of functions are lists of instructions, then each function is already a composition! The steps on the list are the functions the composition of which form the function. For example,

  • $F$: add $3$, multiply by $-2$, subtract $1$.

If, furthermore, there is another function, say,

  • $G$: subtract $2$, apply $\sin$,

we just add the latter to the bottom of the former:

  • $G\circ F$: add $3$, multiply by $-2$, subtract $1$, subtract $2$, apply $\sin$.

Of course, we can have compositions of many functions in a row as long the output of a function matches the input of the next.

Composition of several with arrows.png

It's as if the first function gives us direction to a destination and at that destination we receive the directions to our next destination. At that location, we get further directions, and so on...

We represent functions as black boxes that process the input and produce the output: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} \text{input} & & \text{function} & & \text{output} \\ x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y\\ &&&&\text{input} & & \text{function} & & \text{output} \\ &&&&y & \mapsto & \begin{array}{|c|}\hline\quad g \quad \\ \hline\end{array} & \mapsto & z\\ &&&&&&&&\text{input} & & \text{function} & & \text{output} \\ &&&&&&&&z & \mapsto & \begin{array}{|c|}\hline\quad h \quad \\ \hline\end{array} & \mapsto & u \end{array}$$ Because of the match, we can carry over the output to the next line -- as the input of the next function.

This chain of events can be as long as we like: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x_1 & \mapsto & \begin{array}{|c|}\hline f_1 \\ \hline\end{array} & \mapsto & x_2& \mapsto & \begin{array}{|c|}\hline f_2 \\ \hline\end{array} & \mapsto & x_3& \mapsto & \begin{array}{|c|}\hline f_3 \\ \hline\end{array} & \mapsto & x_4&\mapsto& \begin{array}{|c|}\hline f_4 \\ \hline\end{array} & \mapsto & x_5&\mapsto&...\\ \end{array}$$

Example. Such a decomposition will allow us to study the function one piece at a time:

Composition of three.png

$\square$

Example. This is how the composition of several functions is computed with a spreadsheet. We start with just a list of numbers in the first column. Then we produce the values in the next column one row at a time. How? We input a formula in the next column with a reference to the last one. For example, we have in the second and third columns respectively: $$\texttt{=RC[-1]*2},\ \texttt{=RC[-1]+5}.$$ Each of the two consecutive columns is a list of values of a function, left:

Compositions with spreadsheet 3.png

If we hide the middle column, we have the list of values of the composition. We can have as many columns as we like. $\square$

Exercise. Represent the following function by a single formula: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\ \text{multiply by }2 \ \\ \hline\end{array} & \mapsto & y& \mapsto & \begin{array}{|c|}\hline\ \text{add }5 \ \\ \hline\end{array} & \mapsto & z& \mapsto & \begin{array}{|c|}\hline\ \text{divide by }3 \ \\ \hline\end{array} & \mapsto & u\\ \end{array}$$

Exercise. Represent the function $h(x)=(x-1)^2+(x-1)^3$ as the composition $g\circ f$ of two functions $y=f(x)$ and $z=g(y)$.

6 The inverse of a function

Our main example of a function answers the question: which ball is this boy playing with?

Boys and balls -- function.png

What if we turn this around: which boy is playing with this ball? Even though the latter question is asked about the same situation as the former, it cannot be answered in a positive manner! Indeed:

  • there are two playing with the basketball -- two answers;
  • there is no boy playing with the baseball -- no answer.

This mean that there is no function this time! This is our attempt to simply reverse the arrows:

Boys and balls -- inverse function.png

All functions from $X$ to $Y$ are also relations between $X$ and $Y$. However, not every relation is a function -- either from $X$ to $Y$ or from $Y$ to $X$. The reasons are the same: too many or too few arrows starting at the domain set.

An especially important question is, can we reverse the arrows of a function so that that same relation is now seen as a new, “inverse”, function? The answer is No for all of the example. Why not?

  • First, some $y$'s in $Y$ have no corresponding $x$'s in $X$. In other words, the function isn't onto!
  • Second, some $y$'s in $Y$ have two or more corresponding $x$'s in $X$. In other words, the function isn't one-to-one!

So, the original function lacked either of the two types of regularity for this to be possible.

What kind of function would make this possible. A function that is both one-to-one and onto:

Boys and balls -- bijection.png

We have added an extra ball (soccer) and redrew the arrows: there is exactly one arrow for each ball. This is a very simple, almost uninteresting, kind of function. Indeed, each boy holds a ball and every ball is held by a boy. The difference is only in the name... Indeed, if you don't remember Tom's name, you just say “the boy who plays with a basketball”. Or, if you don't remember what that red ball is for, you just say “the game Sid plays". There is no ambiguity in this substitution.

Definition. Suppose $F:X\to Y$ is a function that is both one-to-one and onto. A function $G:Y\to X$ is called the inverse of $F$ when $$G(y)=x \text{ if and only if }F(x)=y.$$

The arrows can now be safely reversed:

Boys and balls -- bijection reversed.png

There is only one such function which justifies using “the inverse”.

Exercise. Prove this statement.

The inverse of a function $F$ is denoted by: $$F^{-1}.$$ It is read “$F$ inverse”. Here “$F$” is the name of the old function and “$F^{-1}$” is the name of the new function.

Warning: the notation is not to be confused with the power notation for the reciprocal: $2^{-1}=\frac{1}{2}$.

An idea to hold on to is that a function and its inverse represent the same relation between sets $X$ and $Y$:

  • $x$ and $y$ are related when $y=F(x)$, or
  • $x$ and $y$ are related when $x=F^{-1}(y)$.

The choice between $F$ and $F^{-1}$ is the choice the “roles” for $X$ and $Y$, input or output, domain or codomain.

Boys and balls -- correspondence.png

Exercise. Explain the picture below:

Relations and functions.png

What does this have to do with compositions? They allow us to make the informal idea of “reversing the arrows” fully precise.

Notice that the domain of the new function would have to be the codomain of the original! Their composition then makes sense:

Boys and balls -- bijection 1.png

We have made -- through this composition -- a full circle from boys to balls and back to boys. Every time, we arrive to our starting point, a boy.

There is another way to build a composition though!

Boys and balls -- bijection 2.png

We have made -- through that composition -- a full circle from balls to boys and back to balls. Every time, we arrive to our starting point, a ball.

Boys and balls -- bijection 3.png

Here is a flowchart representation of this idea: $$\begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad F \quad \\ \hline\end{array} & \mapsto & y & \mapsto & \begin{array}{|c|}\hline\quad G \quad \\ \hline\end{array} & \mapsto & x &,\text{ same }x!\\ y & \mapsto & \begin{array}{|c|}\hline\quad G \quad \\ \hline\end{array} & \mapsto & x & \mapsto & \begin{array}{|c|}\hline\quad F \quad \\ \hline\end{array} & \mapsto & y &,\text{ same }y! \end{array}$$ We feed the output of $F$ into $G$ and vice versa.

Theorem. Suppose $F:X\to Y$ is a function that is both one-to-one and onto. Then a function $G:Y\to X$ is the inverse of $F$ if

  • $G(F(x))=x$ for all $x$, and
  • $F(G(y))=y$ for all $y$.

Exercise. Prove the theorem.

The two identities in the theorem take the following form: $$(F^{-1}\circ F)(x)=x \text{ and }(F\circ F^{-1})(y)=y.$$ Making circles in the diagram below won't change the value of $x$ or $y$: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\la}[1]{\!\!\!\!\!\xleftarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} x& \ra{ F }& y\\ \uparrow& & \downarrow\\ x& \la{ F^{-1} }& y\\ \end{array}$$

Definition. A function that is both one-to-one and onto is also called invertible.

Bijection.png

Such a function creates such a correspondence between the two sets that it's as if this is the same set...

Exercise. Complete the sentence: “The set of all invertible functions from $X$ to $Y$ is the _____________ of the set of one-to-one functions and the set of onto functions.”

Example (transformations). What is the meaning of the inverse of a function when seen as a transformation of the line? It is a transformation what would reverse the effect of the original.

Axis transformations.png

Just by examining these simple transformations, we discover the following:

  • the inverse of the shift $s$ units to the right is the shift of $s$ units to the left;
  • the inverse of the flip is another flip;
  • the inverse of the stretch by $k$ is the shrink by $1/k$.

In fact, we realize that they pair up:

  • the shift $s$ units to the right and the shift of $s$ units to the left are the inverses of each other;
  • the flip is the inverse with itself;
  • the stretch by $k$ and the shrink by $1/k$ are the inverses of each other.

When executed consecutively, the effect is nil. Algebraically: $$\begin{array}{l|ccc} &f&\text{vs.}&f^{-1}\\ \hline \text{shift}&y=x+s&&x=y-s\\ \text{flip}&y=-x&&x=-y\\ \text{stretch}&y=x\cdot k &&x=y/k\\ \end{array}$$ What about the fold?

Transformations of the line -- 1-1 and onto.png

It can't be undone as any two points that are brought together become indistinguishable... Any further transformations will produce the same output: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\la}[1]{\!\!\!\!\!\xleftarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} x=a& \\ &\searrow_F\\ &&y&\ra{ G? }&x\\ &\nearrow_F\\ x=b&\\ \end{array}$$ This function isn't one-to-one! $\square$

Now, the numerical functions...

Example (lists). Suppose a function is given by its list of values: $$f=\begin{array}{l|l} x&y=f(x)\\ \hline 0&1\\ 1&0\\ 2&2\\ 3&1\\ 4&3\\ ... \end{array}\qquad f=\begin{array}{ll} x&\to&y=f(x)\\ \hline 0&\to&1\\ 1&\to&0\\ 2&\to&2\\ 3&\to&1\\ 4&\to&3\\ ... \end{array}$$ The table is understood as if there are arrows going horizontally left to right. That is why “reversing the arrows” means interchanging the columns: $$f^{-1}=\begin{array}{l|l} y&x=f^{-1}(y)\\ \hline 1&0\\ 0&1\\ 2&2\\ 1&3\\ 3&4\\ ... \end{array}\qquad f^{-1}=\begin{array}{ll} y&\to&x=f^{-1}(y)\\ \hline 1&\to&0\\ 0&\to&1\\ 2&\to&2\\ 1&\to&3\\ 3&\to&4\\ ... \end{array}\qquad f^{-1}=\begin{array}{ll} y&\to&x=f^{-1}(y)\\ \hline 0&\to&1\\ 1&\to&0\\ 1&\to&3\\ 2&\to&2\\ 3&\to&4\\ ... \end{array}$$ It may, or may not, become clear that the new function isn't a function! To make sure, it's a good idea to arrange the inputs in the increasing order. Then we clearly see the conflict: $f^{-1}(1)=0$ and $f^{-1}(1)=3$. The original function, $f$, wasn't one-to-one! $\square$

The general rule for finding the inverse of a function given by a formula follows from the definition:

  • the inverse of $y=f(x)$ is found by solving this equation for $x$; i.e., $x=f^{-1}(y)$.

Example. To find the inverse of a linear polynomial $$f(x)=3x-7,$$ set and solve $$y=3x-7\ \Longrightarrow\ y+7=3x\ \Longrightarrow\ \frac{y+7}{3}=x.$$ Therefore, $$f^{-1}(y)=\frac{y+7}{3}.$$ If it is not known ahead of time if the function is one-to-one, this fact is established, automatically, as a part of the solution. For example, to find the inverse of the quadratic function $$f(x)=x^2,$$ set and solve $$y=x^2\ \Longrightarrow\ \pm\sqrt{y}=x.$$ The $\pm$ sign indicates that there are two solutions ($x>0$). The original function wasn't invertible! $\square$

A linear polynomial, $$f(x)=mx+b,$$ is one-to-one and onto whenever $m\ne 0$.

Slope of inverse.png

Algebraically, we just solve the equation $y=mx+b$ for $x$. The algebraic result is below.

Theorem (inverse of linear polynomial). The inverse of a linear polynomial $$f(x)=mx+b,\ m\ne 0,$$ is also a linear polynomial and its slope is the reciprocal of that of the original: $$f^{-1}(y)=\frac{1}{m}y-\frac{b}{m}.$$

So, the set of all linear polynomials is split into pairs: a steeper line and a shallower one:

Inverse of linear function.png

One can imagine how some new algebraic operations may have appeared. Some appeared as repeated “old” operations; for example, repeated addition: $$ 2 + 2 + 2 = 2 \cdot 3, $$ leads to a new operation: multiplication. Meanwhile, repeated multiplication: $$ 2 \cdot 2 \cdot 2 \cdot 2 = 2^{4}. $$ leads to a new operation: exponent. But what about subtraction and division? How do they appear? It's different.

Example. Suppose I know how to add. Problem: I have $\$5$, how much do I add to have $\$ 12$? Answer: $\$ 7$. How do I know? Algebra: solve $$ 5 + x = 12. $$ This equation leads to a new operation, subtraction: $x = 12 - 5$. Subtraction is the “inverse” of addition. $\square$

Example. Suppose now I know to multiply. Problem: I have a few $2$-by-$4$s and I need a table $20$ inches wide. How many do I need? Answer: $5$. How do I know? Algebra: solve $$ 4x = 20 .$$ This equation leads to a new operation, division: $x = \frac{20}{4}$. Division is the “inverse” of multiplication. $\square$

Example. I need a square table of area 25 square feet. What is the width of the table? Algebra: Solve $$ x \cdot x = 25 \Longrightarrow x^{2} = 25 \Longrightarrow x = \sqrt{25} .$$ Thus, we have a new operation: square root. It is the “inverse” of square. $\square$

Example. What about $\sqrt[3]{\quad}$? What is the side of a box given a volume of $8$ cubic feet? Solve $$ x^{3} = 8 \Longrightarrow x = \sqrt[3]{8}. $$ $\square$

Thus, solving equations requires us to undo some operations present in the equation: $$\begin{array}{rl} x+2=5& \Longrightarrow & (x+2)-2=5-2& \Longrightarrow &x=3;\\ 3x=6&\Longrightarrow & (3x)/3=6/3&\Longrightarrow &x=2;\\ x^2=4&\Longrightarrow & \sqrt{x^2}=\sqrt{4}& \Longrightarrow &x=\pm 2. \end{array}$$

But these are functions! And some functions undo the effect of others:

  • the addition of $2$ is undone by the subtraction of $2$, and vice versa;
  • the multiplication by $3$ is undone by the division by $3$, and vice versa;
  • the second power is undone by the square root (for $x\ge 0$), and vice versa.

Each of these undoes the effect of its counterpart under substitution:

  • substituting $y=x+2$ into $x=y-2$ gives us $x=x$;
  • substituting $y=3x$ into $x=\frac{1}{3}y$ gives us $x=x$;
  • substituting $y=x^2$ into $x=\sqrt{y}$ gives us $x=x$, for $x,y\ge 0$.

And vice versa!

  • substituting $x=y-2$ into $y=x+2$ gives us $y=y$;
  • substituting $x=\frac{1}{3}y$ into $y=3x$ gives us $y=y$;
  • substituting $x=\sqrt{y}$ into $y=x^2$ gives us $y=y$, for $x,y\ge 0$.

As we know, it is more precise to say that they undo each other under composition: two numerical functions $y=f(x)$ and $x=g(y)$ are inverse of each other when for all $x$ in the domain of $f$ and for all $y$ in the domain of $g$, we have: $$g(f(x))=x \quad\text{ and }\quad f(g(y))=y.$$ This is how they are written via substitutions: $$g(y)\Bigg|_{y=f(x)}=x \quad\text{ and }\quad f(x)\Bigg|_{x=g(y)}=y.$$

Thus, we have three pairs of inverse functions: $$\begin{array}{rl} f(x)=x+2& \text{ vs. }& f^{-1}(y)=y-2,\\ f(x)=3x&\text{ vs. }& f^{-1}(y)=\frac{1}{3}y,\\ f(x)=x^2&\text{ vs. }& f^{-1}(y)=\sqrt{y} \quad\text{ for }x,y\ge 0. \end{array}$$

Next, what is the relation between the graph of a function and the graph of its inverse?

In other words, what do we do with the graph of $f$ to get the graph $f^{-1}$? We don't really need to do anything. After all, a function and its inverse represent the same relation. Indeed, the graph of $f$ illustrates how $y$ depends on $x$... as well as how $x$ depends on $y$. But the latter is what determines $f^{-1}$! So, there is no need for a new graph -- the graph of $f^{-1}$ is the graph of $f$. The only problem is that the $x$- and $y$-axes point in the wrong directions. It's easy to fix.

Example (points on the graph). Transitioning from $f$ to its inverse $f^{-1}$, $$f=\begin{array}{l|l} x&y=f(x)\\ \hline 2&5\\ 3&1\\ 8&7\\ ... \end{array}\quad \leadsto \quad f^{-1}=\begin{array}{l|l} y&x=f^{-1}(y)\\ \hline 5&2\\ 1&3\\ 7&8\\ ... \end{array}$$ makes us replace the points in the $xy$-plane to new points $(y,x)$ in the $yx$-plane: $$\begin{array}{ll} (2,5)&\leadsto&(5,2)\\ (3,1)&\leadsto&(1,3)\\ (8,7)&\leadsto&(7,8)\\ ... \end{array}$$ The coordinates are flipped. As a result, each point jumps across the diagonal line, as shown below:

(x,y) vs (y.x).png

So, every point $(x,y)$ in the $xy$-plane corresponds to the point $(y,x)$ in the $yx$-plane. $\square$

We realize that this is a reflection of the plane with respect to the diagonal line $y=x$, a new transformation of the plane.

Example. This can be done by hand. One grabs the piece of paper with the $xy$-axis and the graph of $y=f(x)$ on it and flips it. We flip by grabbing the end of the $x$-axis with the right hand and grabbing the end of the $y$-axis with the left hand then interchanging them:

Inverse by hand.png

We face the opposite side of the paper then, but the graph is still visible: the $x$-axis is now pointing up and the $y$-axis right, as intended. $\square$

Example. We can also fold:

Inverse by folding paper.png

The shapes of the graphs are the same!

Inverse of function.png

$\square$

Example (graph with software). Such a transformation of the plane can be accomplished with image processing software by first rotating the image clockwise $90$ degrees and then flipping it vertically:

Flip about diagonal.png

Suppose a function is given only by its graph. Find the graph of the inverse $x = f^{-1}(y)$.

Inverse via flip.png

$\square$

Example (graph point by point). Suppose, again, a function is given only by its graph and we need to find the graph of the inverse $x = f^{-1}(y)$. This time we are to do this without any help.

Inverse graph.png

Start with choosing a few points on the graph. Each of them will just across the diagonal under this flip. How exactly? The general rule for plotting a counterpart of a point is:

  • from the point go perpendicular to the diagonal ($45$ degrees) and then measure the same distance on the other side.

In other words, we plot a line through our point with slope $-1$. However, we can choose the point more judiciously: choose ones with easy to find counterparts. First, points on the diagonal don't mode by the flip about the diagonal. Second, points on one of the axes jumps to the other axis with no need for measuring. Once all points are in place, finally, draw a curve that connects them. $\square$

Furthermore, we only need the graph of the original function to be able to evaluate the inverse:

Function and its inverse same graph.png

Example (square and square root). This is a familiar pair of inverse functions: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad \text{ square } \quad \\ \hline\end{array} & \mapsto & y & \mapsto & \begin{array}{|c|}\hline\quad \text{ square root} \quad \\ \hline\end{array} & \mapsto & x \text{, same? } \end{array}$$ No, the diagram fails if we plug in $x=-2$: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} -2 & \mapsto & \begin{array}{|c|}\hline\quad \text{ square } \quad \\ \hline\end{array} & \mapsto & 4 & \mapsto & \begin{array}{|c|}\hline\quad \text{ square root} \quad \\ \hline\end{array} & \mapsto & 2 \text{, not the same! } \end{array}$$ As we know, not all functions have inverses...

However, we can make it work by restricting the domain and the codomain of the function. For example, the old function is $y = x^{2}$, with the domain and the codomain assumed to be $(-\infty, \infty)$. It simply doesn't have the inverse! The new function is $y = x^{2}$, with the domain and the codomain chosen to be $[0, \infty )$. Then it works: this function has the inverse:

Inverting square.png

We have eliminated the second possibility: $$ 2^{2} = 4,\ (-2)^{2} = 4. $$

So, $f(x)=x^{2}$ is not one-to-one, but $g(x)=x^{3}$ is!

Square and cubic -- one-to-one.png

What is the difference? The latter satisfies the Horizontal Line Test: a function is one-to-one if and only if every horizontal line has at most one intersection with its graph.

Horizontal Line Test.png

$\square$

Theorem (Powers). The odd powers are one-to-one; consequently, they are invertible. The even powers aren't one-to-one; consequently, they are not invertible. The even powers with domains and codomains reduced to $[0,+\infty)$ are one-to-one; consequently, they are invertible.

Power functions -- one-to-one.png

Exercise. Can we reduce the domain to $(-\infty,0]$ instead? Are there other options?

Example. Suppose a function is given only by its formula. Find the formula of the inverse $x = f^{-1}(y)$. For example, let $$f(x)=x^3-3.$$ We simply rewrite $$y=x^3-3,$$ and then solve for $x$: $$x=\sqrt[3]{y+3}.$$ Thus the answer is: $$f^{-1}(y)=\sqrt[3]{y+3}.$$ $\square$

Example. Plot the graph of the inverse of $y = f(x)$ shown below:

Graph of the inverse.png
  • Draw the diagonal $y = x$,
  • pick a few points on the graph of $f$ (we choose four);
  • plot a corresponding point for each of them:
    • on the line through point $A$ that is perpendicular to the diagonal (i.e., its slope is $45$ degrees down),
    • on the other side of the diagonal from $A$,
    • same distance from the diagonal as $A$;
  • draw by hand a curve from point to point;
  • verify the answer with drawing software.

$\square$

Exercise. Function $y=f(x)$ is given below by a list its values. Find its inverse and represent it by a similar table. $$\begin{array}{r|l|l|l}x &0 &1 &2 &3 &4 \\\hline y=f(x) &1 &2 &0 &4 &3 \end{array}$$

Exercise. What is the function that is its own inverse?

Exercise. Plot the inverse of the function shown below, if possible.

Graph for derivative.png

Exercise. Plot the graph of the inverse of this function:

Graph on grid.png

Exercise. Function $y=f(x)$ is given below by a list of its values. Is the function one-to one? What about its inverse? $$\begin{array}{r|l|l|l|l|l}x&0 &1 &2 &3 &4 \\ \hline y=f(x)&7 &5 &3 &4 &6 \end{array}$$

Exercise. Plot the graph of the function $f(x)=\frac{1}{x-1}$ and the graph of its inverse. Identify its important features.

Exercise. Find the formulas of the inverses of the following functions: (a) $f(x)=(x+1)^3$, (b) $g(x)=\ln (x^3)$.

Exercise. Sketch the graph of the inverse of the function below:

Sketch the graph of the inverse.png

7 Transforming the axes transforms the plane

First, a function is represented by its graph as a certain subset of the $xy$-plane. Second, a function is seen as a transformation of the real number line. Now, we discover two prominent number lines on the $xy$-plane: the $x$-axis and the $y$-axis! Suppose we have the graph of a function $f$. We then face the following two questions.

  • Question 1: What will happen to the graph of $f$ if the $x$-axis is transformed by another function $g$? Answer: the graph will transform into that of $f\circ g$.
  • Question 2: What will happen to the graph of $f$ if the $y$-axis is transformed by another function $h$? Answer: the graph will transform into that of $h\circ f$.

The order, of course, matters: $$\begin{array}{ccc} t & \mapsto & \begin{array}{|c|}\hline\quad g \quad \\ \hline\end{array} & \mapsto & x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y \\ &&&&x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y & \mapsto & \begin{array}{|c|}\hline\quad h \quad \\ \hline\end{array} & \mapsto & z \end{array}$$

The graphs of functions are plotted on the Cartesian plane. We then start with a broader question:

  • how the transformations of the axes -- both horizontal and vertical -- affect the $xy$-plane?
Transformations of the axes.png

But first let's review what we know. These are the three transformations of an axis: shift, flip, and stretch:

Axis transformations.png

What are the basic transformations of the $x$-axis? It is oriented horizontally on the $xy$-plane. Then, we have a horizontal shift: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} t& \ra{ \text{ shift by } k}& x=g(t)=t+k; \end{array}$$ a horizontal flip: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} t& \ra{ \text{ flip } }& x=g(t)=-t; \end{array}$$ and a horizontal stretch: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} t& \ra{ \text{ stretch by } k}& x=g(t)=t\cdot k. \end{array}$$ What about the $y$-axis? It is oriented vertically on the $xy$-plane. Then, we have a vertical shift: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} y& \ra{ \text{ shift by } k}& h(y)=y+k; \end{array}$$ a vertical flip: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} y& \ra{ \text{ flip } }& h(y)=-y; \end{array}$$ and a vertical stretch: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} y& \ra{ \text{ stretch by } k}& h(y)=y\cdot k. \end{array}$$

Now, transforming the axes transforms -- in the same manner -- all the lines on the plane parallel to it. The result is this set of transformations familiar from using a graphics editor:

Transformations with MS Paint 0.png

What remains is to see how the above algebra of the real line creates a new algebra of the Cartesian plane.

We start with a vertical shift. We shift the whole $xy$-plane as if it is printed on a sheet of paper. Furthermore, there is another sheet of paper underneath used for reference. It is on the second sheet that we see the resulting points. We then use its coordinate system to record the coordinates of the new point. For example, a shift of $3$ units upward is shown below:

Vertical shift of the plane.png

So, all vertical lines are shifted up by $k$. Then, the whole plane is shifted $k>0$ units up. A generic point $(x,y)$ makes a step up/down by $k$ and becomes $(x,y+k)$. This is another algebraic way to present the transformation: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} (x,y)& \ra{ \text{ up } k}& (x,y+k). \end{array}$$ It is as if the algebra of the flip of the $y$-axis given previously, $y\to y+k$, is copied and paired with $x$.

Exercise. What is the effect of two vertical stretches executed consecutively?

What about the horizontal shift? For example, a shift of $2$ units right is shown below:

Horizontal shift of the plane.png

So, all horizontal lines are shifted right by $k$. Then, the whole plane is shifted $k>0$ units right. A generic point $(x,y)$ makes a step right/left by $k$ and becomes $(x+k,y)$. This is an algebraic way to present the transformation: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} (x,y)& \ra{ \text{ right } k}& (x+k,y). \end{array}$$ It is as if the algebra of the flip of the $x$-axis given previously, $x\to x+k$, is copied and paired with $y$.

Exercise. What is the effect of a vertical stretch and a horizontal stretch executed consecutively? What if we change the order?

These shifts can also be described a translation along the $y$-axis and a translation along the $x$-axis respectively. That is why the former only changes the $y$-coordinates of the points and the latter only the $x$-coordinates.

Now a vertical flip. We lift, then flip the sheet of paper with $xy$-plane on it, and finally place it on top of another such sheet so that the $x$-axes align. This flip is shown below:

Vertical flip of the plane.png

So, all vertical lines are flipped about their origins. Then, the whole plane is flipped about the $x$-axis. A generic point $(x,y)$ jumps across the $x$-axis and becomes $(x,-y)$. This is the algebraic outcome: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} (x,y)& \ra{ \text{ vertical flip } }& (x,-y). \end{array}$$

Exercise. What is the effect of two vertical flips executed consecutively?

For the horizontal flip, we lift, then flip the sheet of paper with $xy$-plane on it, and finally place it on top of another such sheet so that the $y$-axes align. This flip is shown below:

Horizontal flip of the plane.png

So, all horizontal lines are flipped about their origins. Then, the whole plane is flipped about the $y$-axis. A generic point $(x,y)$ jumps across the $y$-axis and becomes $(-x,y)$. This is the algebraic outcome: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} (x,y)& \ra{ \text{ horizontal flip } }& (-x,y). \end{array}$$

Exercise. What is the effect of a vertical flip and a horizontal flip executed consecutively? What if we change the order?

These flips can also be described a mirror reflection about the $x$-axis and a mirror reflection about the $y$-axis respectively. That is why the former only changes the $y$-coordinates of the points and the latter only the $x$-coordinates.

Next, a vertical stretch. The coordinate system isn't on a piece of paper anymore! It is on a rubber sheet. We grab it by the top and the bottom and pull them apart in such a way that the $x$-axis doesn't move. For example, a stretch by a factor of $2$ is shown below:

Vertical stretch of the plane.png

So, all vertical lines are stretched by $k$ away from their origins. Then, the whole plane is stretched/shrunk by a factor $k>0$ away from the $x$-axis. The distance of a generic point $(x,y)$ from the $x$-axis grows/declines proportionally to $k$ and the point becomes $(x,y\cdot k)$. This is the algebra to describe it: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} (x,y)& \ra{ \text{ vertical stretch by } k}& (x,y\cdot k). \end{array}$$

Even though the stretch is the same, the placement will vary depending on the location of the object relative to the $x$-axis:

Stretch of squares.png

Recall that $k=0$ is the collapse: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} (x,y)& \ra{ \text{ projection } }& (x,0). \end{array}$$ Since all points land on the $x$-axis, this transformation is also called the projection on the $x$-axis.

Exercise. What is the effect of a vertical flip and a horizontal shift executed consecutively? What if we change the order?

What about horizontal stretch? This time, we grab it by the left and right edges of the rubber sheet and pull them apart in such a way that the $y$-axis doesn't move. For example, a stretch by a factor of $2$ is shown below:

Horizontal stretch of the plane.png

So, all horizontal lines are stretched by $k$ away from their origins. Then, the whole plane is stretched by a factor $k>0$ away from the $y$-axis. The distance of a generic point $(x,y)$ from the $y$-axis grows/declines proportionally to $k$ and the point becomes $(kx,y)$. This is a way describe a horizontal stretch: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} (x,y)& \ra{ \text{ horizontal stretch by } k}& (x\cdot k,y). \end{array}$$ The case $k=0$ is the projection on the $y$-axis: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} (x,y)& \ra{ \text{ projection } }& (0,y). \end{array}$$

Exercise. What is the effect of a vertical flip and a horizontal flip executed consecutively? What if we change the order?

Exercise. What is the effect of a vertical projection and a horizontal projection executed consecutively?

These stretches can also be described a uniform deformation away from the $y$-axis and a uniform deformation away from the $y$-axis respectively. That is why the former only changes the $x$-coordinates of the points and the latter only the $y$-coordinates.

These are our six basic transformations:

Six transformations of the plane.png

The algebra below reflects the geometry above. $$\begin{array}{lcccclcccclcccc}\text{Vertical shift: }&\begin{array}{rlcll} (&x&,&y&)\\ (&x&,&y+k&)\end{array},&\text{flip: }&\begin{array}{rlcll} (&x&,&y&)\\ (&x&,&y\cdot(-1)&)\end{array},&\text{stretch: }&\begin{array}{rlcll} (&x&,&y&)\\ (&x&,&y\cdot k&)\end{array}\\ \text{Horizontal shift: }&\begin{array}{rlcll} (&x&,&y&)\\ (&x+k&,&y&)\end{array},&\text{flip: }&\begin{array}{rlcll} (&x&,&y&)\\ (&x\cdot(-1)&,&y&)\end{array},&\text{stretch: }&\begin{array}{rlcll} (&x&,&y&)\\ (&x\cdot k&,&y&)\end{array}\end{array}.$$ Horizontal transformations don't change $y$ and vertical don't change $x$!

These transformations of the plane are functions of the plane to itself, i.e., $F:{\bf R}^2\to{\bf R}^2$. For now, each of these six operations is limited to one of the two directions: along the $x$-axis or along the $y$-axis. We combine them as compositions. For example, $$\begin{array}{ccc} ...& \to & \begin{array}{|c|}\hline\quad \text{ stretch vertically by }k \quad \\ \hline\end{array} & \to & \to & \to & \begin{array}{|c|}\hline\quad \text{ flip horizontally } \quad \\ \hline\end{array} & \to &... \\ (x,y) & \mapsto & \begin{array}{|c|}\hline\quad \text{ multiply }y\text{ by }k \quad \\ \hline\end{array} & \mapsto & (x,yk) & \mapsto & \begin{array}{|c|}\hline\quad \text{ multiply }x\text{ by }(-1) \quad \\ \hline\end{array} & \mapsto & (-x,yk). \end{array}$$ We produce a variety of results:

Transformations of the plane -- compositions.png

Exercise. Execute -- both geometrically and algebraically -- the following transformations:

  • translate up by $2$, then reflect about the $x$-axis, then translate left by $3$;
  • pull away from the $y$-axis by a factor of $3$, then pull toward the $x$-axis by a factor of $2$.

Exercise. What sequences of transformations produce these results?

Transformations with MS Paint.png

Exercise. Describe -- both geometrically and algebraically -- a transformation that makes a circle into an oval.

Exercise. What transformations increase/decrease slopes of lines?

Exercise. Point out the inverses of each of the six transformations of the plane on the list.

Exercise. Has this parabola been shrunk vertically or stretched horizontally?

Parabola shrunk stretched.png

Recall some of the transformations of the plane we saw in the last chapter when we discussed symmetry. For example, the fact that the parabola's left branch is a mirror image of its right branch is revealed via a horizontal flip: $$(x,y)\mapsto (-x,y).$$

Symmetry of parabola.png

How do we represent a rotation $180$ degrees around the origin?

Rotation of x^3.png

We can imagine instead we flip the plane about the $y$-axis and then about the $x$-axis (or vice versa): $$(x,y)\mapsto (-x,y)\mapsto (-x,-y).$$ However, some transformations cannot be decomposed into a composition of those six transformations! Here is, for example, a $90$-degree rotation:

90-degree rotation.png

Exercise. Find a formula for a $90$-degree clockwise rotation.

Another is a flip about the line $x=y$ that appeared in the last section:

Flip about the diagonal.png

It is given by $$(x,y)\mapsto (y,x).$$ Transformations of the plane are discussed in Chapter 17 and Chapter 22.

Exercise. What are the inverses of the transformations presented in this section?

Before addressing functions, what happens to relations under these transformations? We just execute the corresponding substitution in the formula. For example, what happens to the line $$3x-5y=7$$ under the shift $5$ units left and $2$ units up? We execute the substitution: $$u=x+5,\ v=y+5\,\ \text{ or }\ x=u-5,\ y=v-5.$$ This is the new line: $$3(u-5)-5(v-2)=7.$$ The circle $$x^2+y^2=1$$ becomes $$(u-5)^2+(v-2)^2=1.$$ And so on. Now, a function $$y=f(x)\ \text{ becomes }\ (v-2)=f(u-5).$$ Are we done? Not yet, the formula for the new function is: $$v=f(u-5)+2.$$ This minus sign is something to watch out for when dealing with transformations of functions.

8 Changing variables transforms the graphs of functions

We now look at what happens to the graph of a function “drawn” on the $xy$-plane as it is being transformed.

Warning: graphs aren't functions and functions aren't graphs; this is about visualization...

For the six transformations, there will be six rules governing the algebra of the functions affected by them.

We start with the vertical shift. Since the graph is drawn on the same piece of paper, it is shifted exactly the same way.

Vertical shift of the plane -- graphs.png

What about the formula for the new function? Suppose a point $(x,y)$ lies on the graph of $f$, then $f(x)=y$. The shifted point $(x,y+k)$ lies on the graph of the new function $F$, hence $F(x)=y+k=f(x)+k$.

Vertical shift of the plane -- graphs 2.png

Rule 1 (vertical shift): If the graph $y = F(x)$ is the graph of $y = f(x)$ shifted $k$ units up, then $$ F(x) = f(x) + k, $$ and vice versa.

By “vice versa”, we mean that if function $g$ satisfies $F(x) = f(x) + k$ then its graph is the graph of $f$ shifted $k$ units up.

The most important conclusion is the new function has the exact same shape of the graph as the old one.

Next is the horizontal shift.

Horizontal shift of the plane -- graphs.png

What about the formula for the new function? Things are a bit more complicated than for a horizontal shift. Suppose a point $(x,y)$ lies on the graph of $f$, then $f(x)=y$. The shifted point $(x+k,y)$ lies on the graph of the new function $F$, hence $F(x+k)=y=f(x)$. Therefore, the new function is $F(x)=f(x-k)$.

Example. To confirm the idea, take $f(x) = x^{2}$, and shift $2$ units to the left and to the right too: $$ f(x+2) = (x+2)^{2} \text{ and } f(x-2) = (x-2)^{2}. $$

Horizontal shift of parabola.png

To confirm the match, what is the $x$-intercept of these two new functions? Set either equal to $0$ and solve: $$\begin{array}{r | l} (x + 2) ^2 = 0 & (x - 2) ^2 = 0 \\ x + 2 = 0 & x - 2=0 \\ x = -2 & x = 2\\ \text{left shift } & \text{ right shift } \end{array}$$ The shift is in the opposite direction! $\square$

Horizontal shift of the plane -- graphs 2.png

Rule 2 (horizontal shift): If the graph of $y = F(x)$ is the graph of $y = f(x)$ shifted $k$ units to the right, then $$ F(x) = f(x-k),$$ and vice versa.

Once again, the new function has the exact same shape of the graph as the old one.

This is the algorithmic interpretation of these shifts. Vertical shift, up $3$ units: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & u & \mapsto & \begin{array}{|c|}\hline\quad u+3 \quad \\ \hline\end{array} & \mapsto & y; \end{array}$$ horizontal shift, left $2$ units: $$ \newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad x+2 \quad \\ \hline\end{array} & \mapsto & u & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y. \end{array}$$

What about “combination” of these two types of transformations?

Example. Let $$Q(x) = (x + 2)^{2} +4.$$ What is the graph? First, some analysis: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad x+2 \quad \\ \hline\end{array} & \mapsto & u & \mapsto & \begin{array}{|c|}\hline\quad u^2 \quad \\ \hline\end{array} & \mapsto & z & \mapsto & \begin{array}{|c|}\hline\quad z+4 \quad \\ \hline\end{array} & \mapsto & y \end{array}$$ This is a $2$-unit leftward shift followed by a $4$-unit upward shift.

Horizontal and vertical shifts of parabola.png

$\square$

Exercise. What happens to the $x$- and $y$-intercepts of a function under vertical and horizontal shifts?

Exercise. What happens to the domain and the range of a function under vertical and horizontal shifts?

Next is the vertical flip.

Vertical flip of the plane -- graphs.png

Suppose a point $(x,y)$ lies on the graph of $f$, then $f(x)=y$. The vertically flipped point $(x,-y)$ lies on the graph of the new function $F$, hence $F(x)=-y=-f(x)$.

Vertical flip of the plane -- graphs 2.png

Rule 3 (vertical flip): If the graph of $y = F(x)$ is the graph of $y = f(x)$ flipped vertically then $$ F(x) = - f(x), $$ and vice versa.

Again, the new function has the exact same shape of the graph as the old one.

Example. Let $$ Q(x) = - f(x) + 3. $$ How do we get the graph of $h$? $$ x \longmapsto f(x) \underbrace{\longmapsto}_{\textrm{vertical flip}} - f(x) \underbrace{\longmapsto}_{\textrm{vertical shift}} - f(x) + 3. $$ The order matters... Let's interchange these two: $$ x \longmapsto f(x) \underbrace{\longmapsto}_{\textrm{vertical shift}} f(x) + 3 \underbrace{\longmapsto}_{\textrm{vertical flip}} - (f(x)+3). $$ The graphs are also different:

Shift flip interchanged.png

$\square$

Next is the horizontal flip.

Horizontal flip of the plane -- graphs.png

Suppose a point $(x,y)$ lies on the graph of $f$, then $f(x)=y$. The horizontally flipped point $(-x,y)$ lies on the graph of the new function $F$, hence $F(-x)=y=f(x)$. Therefore, $F(x)=-f(x)$.

Horizontal flip of the plane -- graphs 2.png

Rule 4 (horizontal flip): If the graph of $y = F(x)$ is the graph of $y = f(x)$ flipped horizontally, then $$ F(x) = f(-x), $$ and vice versa.

Exercise. Does the order matter when the horizontal flip is combined with a horizontal shift? What about the horizontal flip with a vertical shift?

Vertical flip: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & u & \mapsto & \begin{array}{|c|}\hline\quad -u \quad \\ \hline\end{array} & \mapsto & y \end{array}$$ Horizontal flip: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad -x \quad \\ \hline\end{array} & \mapsto & u & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y \end{array}$$

Exercise. What happens to the $x$- and $y$-intercepts of a function under vertical and horizontal flips?

Exercise. What happens to the domain and the range of a function under vertical and horizontal flips?

Next is the vertical stretch.

Vertical stretch of the plane -- graphs.png

Suppose a point $(x,y)$ lies on the graph of $f$, then $f(x)=y$. After a vertical stretch, the point $(x,ky)$ lies on the graph of the new function $F$, hence $F(x)=ky=kf(x)$.

Vertical stretch of the plane -- graphs 2.png

Rule 5 (vertical stretch): If the graph of $y = F(x)$ is the graph of $y = f(x)$ stretched vertically by a factor of $k > 0$, then $$F(x) = kf(x),$$ and vice versa.

Next is the horizontal stretch.

Horizontal stretch of the plane -- graphs.png

What about the formula for the new function after the plane has been stretched, horizontally? Suppose a point $(x,y)$ lies on the graph of $f$, then $f(x)=y$. After the stretch, the point $(kx,k)$ lies on the graph of the new function $F$, hence $F(kx)=y=f(x)$. Therefore, $F(x)=f(x/k)$.

Horizontal stretch of the plane -- graphs 2.png

Rule 6 (horizontal stretch): If graph $y = F(x)$ is the graph of $y = f(x)$ stretched by the factor $k>0$ horizontally, then $$F(x) = f(x/k),$$ and vice versa.

It is clear that the new function has a somewhat different shape of the graph than the old one.

Example. One can stretch and shrink with image processing software:

Stretching with Paint.png

$\square$

Now the algorithmic interpretation of these operations. A vertical stretch, factor $3$: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & u & \mapsto & \begin{array}{|c|}\hline\quad 3u \quad \\ \hline\end{array} & \mapsto & y \end{array}$$ A horizontal stretch, factor $2$: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad x/2 \quad \\ \hline\end{array} & \mapsto & u & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y \end{array}$$

Example. It seems that vertical stretching is somehow equivalent to horizontal shrinking. Consider $$ f(x) = x. $$ Stretched by a factor $2$ vertically it becomes: $$ F(x) = 2 x. $$ Shrunk by a factor $2$ horizontally it becomes: $$ Q(x) = x/\tfrac{1}{2}=2x. $$ It is the same function. However, if we do the same to $f(x)=x^2$, we discover that $$2 x^{2} \ne (2 x )^{2}!$$ Let's try the horizontal stretch by $\sqrt{2}$. Then $$H(x) = (\sqrt{2} x )^{2}.$$ Now there is a match: $$(\sqrt{2} x)^{2} =2 x^{2}.$$ We don't expect such a match for most functions; just try $f(x)=1$! $\square$

This is the summary of our general analysis: the vertical transformations of the graph of a function $y=f(x)$ result from compositions of $f$ with functions that follow $f$, i.e., $h\circ f$:

Change of variables 2.png

And the horizontal transformations result from compositions of $f$ with functions that precede $f$, i.e., $f\circ g$:

Change of variables 1.png

As we can see, such a transformation of an axis is a change of variables (or units). Every function $f$ has two, input and output. Then,

  • in the former case, we change the output variable: from $y$ to $z=h(y)$, while
  • in the latter case, we change the input variable: from $x$ to $t=g^{-1}(x)$.

This difference is the reason why the effect on the graph of $f$ is so different.

Exercise. What happens to the $x$- and $y$-intercepts of a function under vertical and horizontal stretches?

Exercise. What happens to the domain and the range of a function under vertical and horizontal stretches?

Exercise. (a) How do these transformations affect the monotonicity of a function? (b) Investigate the monotonicity of quadratic functions.

Exercise. By transforming the graph of $y=x^2$, plot the graphs of the functions: (a) $y=\sqrt{x}$ and (b) $y=\sqrt{x+3}$.

9 The graph of a quadratic polynomial is a parabola

In this section, we will concentrate on a specific class of functions.

We have called the graph of $y=x^2$ a “parabola”. What about others?

$$\begin{array}{|c|}\hline \\ \quad \text{ The graph of every quadratic polynomial is a parabola.} \quad \\ \\ \hline\end{array}$$

This is what it means. Suppose we have a quadratic polynomial, $$F(x)=ax^2+bx+c,\ a\ne 0,$$ then its graph can be acquired from the parabola of $$f(x)=x^2,$$ via our six transformations, even fewer in fact.

Example (transforming a parabola). Suppose the graph of $g$ is given on right. We need to transform the graph of $y=x^2$ into this parabola.

Two parabolas.png

We start with a comparison.

  • The most obvious feature is that the right one opens down. We will, therefore, have to do a vertical flip.
  • The second most prominent feature is that the right one is slimmer. We will have do a vertical stretch or a horizontal shrink.
  • The last one is the location: the vertex of the parabola is away from the origin. We will have to do both vertical and horizontal shifts.

Note that a horizontal flip is useless here because the parabola has a vertical mirror symmetry. Also note that we pick a vertical stretch over a horizontal shrink as a simpler one to implement.

We now turn to the actual algebra. What is the order of operations? We start with the vertical: $$\begin{array}{rcl} \text{original:}& x^2\\ \text{vertical flip:}& x^2\cdot (-1)&=-x^2\\ \text{vertical stretch:}& x^2\cdot (-1)\cdot 5&=-5x^2\\ \text{vertical shift:}& x^2\cdot (-1)\cdot 5+4&=-5x^2+4\\ \text{horizontal shift:}& (x-3)^2\cdot (-1)\cdot 5+4&=-5(x-3)^2+4\\ \end{array}$$ This algebra produces the following sequence of transformations:

Two parabolas 2.png

One can also see how the data is changing as we progress through the sequence:

Two parabolas 3.png

$\square$

If the polynomial is given by a formula, its standard representation, $$f(x)=ax^2+bx+c,\ a\ne 0,$$ the list of such transformations is unclear. Judging by the example, we need to morph it into the following form: $$f(x)=a(x-h)^2+k.$$ While $a$ contains information about the stretch/shrink and the flip of the graph, $h$ and $k$ are the shifts. In fact, the point $(h,k)$ is called the vertex of the parabola.

Example (completing a square). Let's show how this is done algebraically. Suppose $$f(x)=2x^2+8x+3.$$ We manipulate the formula towards our goal: $$\begin{array}{ll} f(x)&=2x^2+8x+3&\text{ start with the original;}\\ &=(2x^2+8x)+3&\text{ bring together the two terms with }x;\\ &=2(x^2+4x)+3&\text{ factor, so that you have }x^2;\\ &=2(x^2+4x+2^2-2^2)+3&\text{ add (and subtract) the missing term of the square;}\\ &=2(x^2+4x+2^2)-2\cdot 2^2+3&\text{ pull out the extra term;}\\ &=2(x+2)^2-8+3&\text{ complete the square;}\\ &=2(x+2)^2-5&\text{ acquire the final form.}\\ \end{array}$$ Reading from the inside out: shift left by $2$, stretch vertically by $2$, flip vertically, shift up by $15$.

Parabola 2x^2+8x+3.png

$\square$

Exercise. How can you transform any parabola into any other parabola?

Recall the complete square formula: $$(u+v)^2=u^2+2uv+v^2.$$ A quadratic polynomial that may be called a “complete square” if it is $$f(x)=(x-h)^2=x^2+2xh+h^2.$$ It is easy to plot; just shift the original $h$ units right. This idea has a broader applicability, but the challenge is to recognize complete squares in (or extract from) quadratic polynomials.

Theorem. Any quadratic function $$f(x)=ax^2+bx+c,\ a\ne 0,$$ can be represented as an “incomplete square”: $$f(x)=a(x-h)^2+k,$$ where $h,k$ are for some numbers.

Proof. All we need is to find these parameters: $h$ and $k$. We simply set the two equal to each other: $$f(x)=ax^2+bx+c=a(x-h)^2+k=ax^2+2axh+ah^2+k.$$ We then match up the terms: $$b=2ah,\ c=ah^2+k.$$ Then, $$h=-\frac{b}{2a},\ k=c-ah^2.$$ $\blacksquare$

Consequently, the graph of $f$ can be acquired from the graph of $y=x^2$ via the six transformations, or just four if we exclude the vertical flip and the horizontal shrink. We can say that there is only one parabola!

Exercise. The graphs below are parabolas. One is $y=x^2$. What is the other?

Two graphs x2.png

In conclusion, composing a function with a linear function -- before or after -- will transform its graph in these six ways: shift, flip, and stretch, vertical or horizontal. This is the summary of the rules: $$\begin{array}{l|ll||ll} &\text{vertical, }y&&\text{horizontal, }x&\\ \hline \text{shift by }s:&y=f(x)&+s&y=f(x&-s)\\ \text{flip }:&y=f(x)&\cdot(-1)&y=f(x&\cdot(-1))\\ \text{stretch by }k:&y=f(x)&\cdot k&y=f(x&/k)\\ \end{array}$$ What is behind these pairs of transformations we see above? Compare these:

  • add $s$ vs. subtract $s$;
  • multiply by $(-1)$ vs. multiply by $(-1)$;
  • multiply by $k>0$ vs. divide by $k$.

They are inverses of each other. Inverses appeared every time we solved an equation to find the formula for the new function, $F$, after a change of the input variable (i.e., a horizontal transformation) of a function $f$. For example, if we have $F(x+k)=f(x)$ after a horizontal shift, we substitute $u=x+k$ and find $x$ in terms of $u$, i.e., $x=u-k$, resulting in $F(u)=f(u-k)$. After an optional renaming, $u$ for $x$, the formula takes its final form, $F(x)=f(x-k)$.

Exercise. The graph drawn with a solid line is $y=x^3$. What are the other two?

Shifts and flips of graphs.png

Exercise. The graph below is the graph of the function $f(x)=A\sin x+B$ for some $A$ and $B$. Find these numbers.

Asin+B.png

Exercise. The graph of the function $y=f(x)$ is given below. Sketch the graph of $y=2f(x)$ and then $y=2f(x)-1$.

Parabola on grid.png

10 The algebra of compositions

Functions can be visualized as flowcharts and so can be their compositions:

Composition as flowchart.png

$$ \newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad x+3 \quad \\ \hline\end{array} & \mapsto & y & \mapsto & \begin{array}{|c|}\hline\quad y\cdot 2 \quad \\ \hline\end{array} & \mapsto & z & \mapsto & \begin{array}{|c|}\hline\quad z^2 \quad \\ \hline\end{array} & \mapsto & u \end{array}$$ Note how the names of the variables match so that we can proceed to the next step. An algebraic representation of the diagram is below: $$y=x+3,\quad z=y\cdot 2,\quad u=z^2.$$ It is also possible but not required to name the functions, say $f,g,h$. Then we have: $$y=f(x)=x+3,\quad z=g(y)=y\cdot 2,\quad u=h(z)=z^2.$$

As we see, with the variables properly named, composition is substitution, Indeed,

  • we substitute $z=g(y)=y\cdot 2$ into $u=h(z)=z^2$, which results in the following:

$$u=h(z)=h(g(y)), \quad u=z^2=(y\cdot 2)^2.$$

  • we substitute $y=f(x)=x+3$ into $z=g(y)=y\cdot 2$, which results in the following:

$$z=g(y)=g(f(x)), \quad z=y\cdot 2=(x+3)\cdot 2.$$

In general, we represent a function $f$ diagrammatically as a black box that processes the input and produces the output: $$ \newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} \text{input} & & \text{function} & & \text{output} \\ x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y \end{array}$$

Now, what if we have another function $g$: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} \text{input} & & \text{function} & & \text{output} \\ x & \mapsto & \begin{array}{|c|}\hline\quad g \quad \\ \hline\end{array} & \mapsto & y \end{array}$$ How do we represent their composition $g \circ f$? To represent it as a single function, we need to “wire” their diagrams together consecutively: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y& \ne & x & \mapsto & \begin{array}{|c|}\hline\quad g \quad \\ \hline\end{array} & \mapsto & y \end{array}$$ But its only possible when the output of $f$ coincides with the input of $g$. We can rename the variables of $g$.

Warning: If the names of the variables don't match, it might be for a good reason. In that case, do nothing.

This is what we have after renaming: $$\begin{array}{ccccccccccccccc} & x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y & \mapsto & \begin{array}{|c|}\hline\quad g \quad \\ \hline\end{array} & \mapsto & z \end{array}$$ Then we have a diagram of a new function: $$\begin{array}{ccccccccccccccc} g\circ f:& x & \mapsto & \begin{array}{|c|}\hline x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y & \mapsto & \begin{array}{|c|}\hline\quad g \quad \\ \hline\end{array} & \mapsto & z \\ \hline\end{array} & \mapsto & z \end{array}$$ It's just another black box: $$\begin{array}{ccccccccccccccc} & x & \mapsto & \begin{array}{|c|}\hline \quad g\circ f \quad \\ \hline\end{array} & \mapsto & z \end{array}$$

Compositions are meant to represent tasks that cannot be carried out in parallel. If you have two persons working for you, you can't split the work in half to have them work on it at the same time as the second task cannot be started until the first is finished.

Example. For example, you are making a chair. The last two stages are polishing and painting. You can't do them at the same time: $$ \begin{array}{ccccccccccccccc} & \text{ chair } & \mapsto & \begin{array}{|c|}\hline\quad \text{ polishing } \quad \\ \hline\end{array} & \mapsto & & \mapsto & \begin{array}{|c|}\hline\quad \text{ painting } \quad \\ \hline\end{array} & \mapsto & \text{ finished chair } \end{array}$$ You can't change the order either! $\square$

Example. Below the instructions of the function is “push these buttons” (in that order):

Composition with calculator.png

These are the functions: $$\frac{1}{x^2},\ \sqrt{x+6},\ -\left( x^2 \right)^2.$$ $\square$

Example. The composition of $$g(x)=x^2 \text{ and } f(x)=x+2$$ is in fact the composition of $$z=g(y)=y^2 \text{ and } y=f(x)=x+2,$$ after renaming. Then we just substitute the latter into the former: $$(g\circ f)(x)=g(f(x))=g(x+2)=(x+2)^2.$$ $\square$

Just as with the rest of the algebraic operations, we sometimes want to “reverse” composition. By doing so, we decompose the given function into two (or more) simpler parts that can then be addressed separately.

Example. Represent $z = h(x) = \sqrt[3]{x^{2} + 1 }$ as the composition of two functions: $$ x \mapsto y=x^{2} + 1 \mapsto z=\sqrt[3]{y} . $$ To confirm, substitute back... $\square$

Example. Decompose: $$y=\sin(t^2+1).$$ The presence of parentheses is a clue that what's inside may be our new variable: $$x=t^2+1.$$ We substitute that into the original: $$y=\sin(x).$$ Done! For completeness, we can name the functions: $$x=f(t)=t^2+1,\ y=g(x)=\sin x\ \Longrightarrow\ h(t)=(g\circ f)(t)=\sin(t^2+1).$$ $\square$

Example. Decompose: $$y=\frac{t^2+1}{t^2-1}.$$ There are no parentheses to use as a clue here but what if we choose the numerator (the same formula as in the last example) as our new variable: $$x=t^2+1.$$ We substitute that into the original: $$y=\frac{x}{t^2-1}.$$ Not done! The substitution remains unfinished because there is still $t$ left. Solving a simple equation, we conclude: $$t^2-1=x-2.$$ Then, $$y=\frac{x}{x-2}.$$ Now we are done.

Just as valid, but simpler, choice is $$x=t^2;$$ then $$y=\frac{x+1}{x-1}.$$

What can we say about the choice $$x=\frac{t^2+1}{t^2-1}?$$ The new function is the same as the original. Such a decomposition is, though technically correct, is pointless as it provides no simplification. $\square$

Exercise. Decompose $y=\frac{1}{t^2+1}.$

There may be more than two functions involved in compositions.

Example. Suppose a car is driven at $60$ m/h. Suppose we also know that the car uses $30$ m/gal, while the cost per gallon is $\$ 5$. Represent the expense as a function of time.

Analysis: $$\begin{array}{ccc} \text{time (hours)}& \xrightarrow{\ 60\text{ m/h }\ }& \text{distance (miles)}&\xrightarrow{\ 30\text{ m/gal }\ }& \text{gas used (gal)}& \xrightarrow{\ \$ 5/ \text{ gal }}&\text{expense } (\$) \\ t& \xrightarrow{\ f\ }& d&\xrightarrow{\ k\ }& g& \xrightarrow{\ h\ }&e \\ \end{array}$$ The functions: $$ d = f(t) = 60t, \ g = k(d) = \frac{d}{30}, \ e = h(g) = 5g. $$ Substitution: $$\begin{array}{ll} g = k(d) & = k(f(t)) \\ e = h(g) & = h(k(d)) \\ & = h(k(f(t))) \end{array}$$ $\square$

Example. Find $f(g(x))$ and $g(f(x))$ with: $$f(x) = x^{2}\text{ and } g(x) = \cos x.$$ The problem may represent a challenge because the variables don't match!

First, to find $f(g(x))$, first re-write: $$f(y) = y^{2}\text{ and } y=g(x) = \cos x.$$ Then replace (substitute) $y$ in $f$ with $(\cos x )$, always with parentheses: $$y^{2} \leadsto ( \cos x )^{2}, $$ or $\cos^{2} x$.

Second, to find $g(f(x))$, first re-write: $$y=f(x) = x^{2}\text{ and } g(y) = \cos y.$$ Then replace $y$ in $g$ with $(x^{2})$: $$\cos y \leadsto \cos (x^{2}). $$ $\square$

Example. When the two functions are represented by their tables of values, the composition can be computed just as with the rest of algebraic operations (as discussed later). It is more complex as we cannot simply go row by row adding the values. One has to find the right entry in the next function.

Suppose we need to compose these two functions: $$\begin{array}{c|cc} t&x=f(t)\\ \hline 0&1\\ 1&2\\ 2&3\\ 3&0\\ 4&1 \end{array}\quad \circ \quad \begin{array}{c|cc} x&y=g(x)\\ \hline 0&5\\ 1&-1\\ 2&2\\ 3&3\\ 4&0 \end{array}\quad=\quad ?$$ The result should be another table of values for the function $h=g\circ f$. To fill this table, we watch where every $t$ goes, after two steps: under $f$ we have $0\mapsto 1$, where does $1$ go under $g$? We look at the second table: under $g$ we have $1\mapsto -1$. Therefore, under $h$ we have $0\mapsto -1$. That gives us the first row in the new table. Furthermore: $$f:1\mapsto 2\quad g:2\mapsto 2\quad \Longrightarrow\ h:1\mapsto 2.$$ And so on. Some are shown below: $$\begin{array}{c|rcl|cll} t&x&&x&y\\ \hline 0&1&\searrow&0&5\\ 1&2&\searrow&1&-1& \Longrightarrow\ 0\mapsto -1\\ 2&3&\searrow&2&2& \Longrightarrow\ 1\mapsto 2\\ 3&0&&3&3& \Longrightarrow\ 2\mapsto 3\\ 4&1&&4&0 \end{array}$$ And this is the answer: $$ \begin{array}{c|cc} t&x=f(t)\\ \hline 0&1\\ 1&2\\ 2&3\\ 3&0\\ 4&1 \end{array}\quad \circ \quad \begin{array}{c|cc} x&y=g(x)\\ \hline 0&5\\ 1&-1\\ 2&2\\ 3&3\\ 4&0 \end{array}\quad =\quad \begin{array}{c|cc} t&y=g(f(t))\\ \hline 0&-1\\ 1&2\\ 2&3\\ 3&5\\ 4&-1 \end{array}$$

$\square$

Functions represented by graphs can also be composed. The procedure is, however, more convoluted than for the rest of the algebraic operations.

Example. Suppose a car is driven through a mountain terrain. The location, as seen on a map, is known and so is the altitude for each location.

Time-location-altitude.png

We set up two functions, for location and altitude, and their composition is what we are interested in:

Composition -- time-location-altitude.png

The second function is literally the profile of the road.

Here,

  • $t$ is time measured in $\text{hr}$;
  • $x=f(t)$ is the location of the car as a function of time -- measured in $\text{mi}$;
  • $y=g(x)$ is the altitude of the road as a function of (horizontal) location -- measured in $\text{ft}$; and
  • $y=h(t)=g(f(t))$ is the altitude of the road as a function of time -- measured in $\text{ft}$.

$\square$

This is the familiar way to evaluate a function: $$f(x)=x^2-x\ \Longrightarrow\ f(3)=3^2-3.$$ There is also an alternative notation for substitution: $$f(x)=x^2-x\ \Longrightarrow\ f(3)=x^2-x\Bigg|_{x=3}=3^2-3.$$ This notation also applies to compositions. For example,

  • we substitute $z=g(y)=y\cdot 2$ into $u=h(z)=z^2$, which results in the following:

$$u=z^2\Bigg|_{z=y\cdot 2}=(y\cdot 2)^2.$$

  • we substitute $y=f(x)=x+3$ into $z=g(y)=y\cdot 2$, which results in the following:

$$z=y\cdot 2\Bigg|_{y=x+3}=(x+3)\cdot 2.$$

11 Solving equations

As explained in Chapter 1, to solve an equation with respect to $x$ means to find all values of $x$ that satisfy the equation. In other words, when we substitute those values into the equation we have a true statement. For example, $$x+2=5\ \Longrightarrow\ x=3.$$ This is an abbreviated version of the following statement:

  • if $x$ satisfies the equation $x+2=5$ then $x$ satisfies the equation $x=3$.

Plug in: $$x+2=(3)+2=5.$$ It checks out! We could try others (the trail-and-error method) and they won't check out.

How we may arrive to the answer is discussed in this section.

We will address a simple kind of equation:

  • $x$ is present only once, in the left-hand side.

For example, we might have: $$5\cdot\Big( \left( \frac{x}{2}+1\right)^2+3 \Big)-17=3.$$ Many equations can be reduced to this kind via algebraic manipulations; for example, $$2x+2=5+x\ \Longrightarrow\ x+2=5.$$

In the special case when the right-hand side is zero, a solution to this equation has a clear geometric meaning.

Definition. Suppose $y=f(x)$ is a numerical function. Then an $x$-intercept of $f$ is any solution to the equation $f(x)=0$.

In other words, these are the $x$-coordinates of the intersections of the graph with the $x$-axis:

X- and y-intercepts.png

When the right-hand side is a number, say, $k$, a solution to this equation $f(x)=k$ gives us an intersection of the graph with the line $y=k$.

Our interest in this section is algebra though...

Starting with such an equation, our goal is -- through a series of manipulations -- to arrive to an equation that consists of an isolated $x$, only $x$ on the left and a number, with no $x$, on the right: $$x=...$$ We see that $x$ is wrapped in several layers of functions and get to it, we will need to remove them one by one. In what order? From the outside in, of course.

Warning: this plan does not work for many familiar types of equations including quadratic equations.

The main idea is as follows:

  • we apply a function to both sides of the equation producing a new equation.

For example, $$z=x+2=5\ \text{, apply }z=y-2\ \Longrightarrow\ (x+2)-2=3-2\ \Longrightarrow\ x=3.$$ The idea is to produce -- from an equation satisfied by $x$ -- another equation satisfied by $x$.

However, any function will produce a new equation! $$\begin{array}{lll} z=x+2=5,& \text{apply }z=y+2& \Longrightarrow\ (x+2)+2=5+2& \Longrightarrow\ x+4=7;\\ z=x+2=5,& \text{apply }z=y^2& \Longrightarrow\ (x+2)^2=5^2;\\ z=x+2=5,& \text{apply }z=\sin y& \Longrightarrow\ \sin (x+2)=\sin 5. \end{array}$$ Indeed, it is the definition of a function that every input has exactly one output. Therefore, two equal inputs (an equation) produce -- under $f$ -- two equal outputs (another equation), always: $$\newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\la}[1]{\!\!\!\!\!\xleftarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \newcommand{\ua}[1]{\left\uparrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} \begin{array}{ccc} \text{old equation:}&a& = &b\\ &\da{g}& &\da{g}\\ \text{new equation:}&g(a) & = &g(b) \end{array}$$ So, we have, for any function $f$: $$x+2=5\ \Longrightarrow\ g(x+2)=g(5).$$ That is why if the first equation is satisfied by $x$ then so does the second.

There are infinitely many possibilities for this function $f$ then: $$\begin{array}{rrcll} x+4=7 & & (x+2)^2=5^2 & & \sin (x+2)=\sin 5\\ & \nwarrow & \uparrow & \nearrow\\ x+5=8 & \leftarrow & x+2=5 & \to & 2^{x+2}=2^5\\ & \swarrow & \downarrow & \searrow\\ x+6=9 & & (x+2)^3=5^3 & & \sqrt{x+2}=\sqrt{5}\\ \end{array}$$ If $x$ satisfies the equation in the middle, it satisfies the rest of them too.

If we want to solve the original equation, which one -- out of infinitely many -- do we pick? Some of them clearly make the equation more complex than the original! It is the challenge for the equation solver to have enough foresight to choose a function to apply that will make the equation simpler. If between us and $x$ is a function, we would like to remove it. How? The answer is, apply the inverse of the function that we face! We have for our equation: $$x\mapsto f(x)=x+2\ \Longrightarrow\ f^{-1}(y)=y-2.$$

Is applying the inverse of the function that contains $x$ in the equation a fool-proof plan? No. Try this: $$x^2=1, \text{ apply } z=\sqrt{y}\ \Longrightarrow\ \sqrt{x^2} =\sqrt{1}\ \Longrightarrow\ x=1??$$ We have lost $x=-1$! It satisfies the first equation but not the last. What happened? There is nothing wrong with the logic of applying the inverse and producing a new equation satisfied by $x$; however, the cancellation of the function and its “inverse” was incorrect. The square and the square root are inverses of each other (and cancel) only, separately, on the rays $[0,+\infty)$ and $(-\infty, 0]$. We disregarded the latter of these two cases: $$x\ge 0\ \Longrightarrow\ \sqrt{x^2}=x,\quad x\le 0\ \Longrightarrow\ \sqrt{x^2}=-x.$$ We can point out exactly why this failed; the function isn't one-to-one!

Example. What if, as in the other example, we have many functions applied consecutively to $x$? Which function do we choose to apply? Still, the inverse of the function we face: $$5\cdot\Big( \left( \frac{x}{2}+1\right)^2+3 \Big)-17=3, \text{ choose } f(z)=z-17\ \Longrightarrow\ f^{-1}(y)=y+17,$$ where $$z=5\cdot\Big( \left( \frac{x}{2}+1\right)^2+3 \Big).$$ Therefore, $$z-17=3\ \Longrightarrow\ (z-17)+17=3+17\ \Longrightarrow\ z=20.$$ We have a new equation: $$5\cdot\Big( \left( \frac{x}{2}+1\right)^2+3 \Big)=20.$$ As we progress, we apply the inverse of the function that appear first in the equation (i.e., it is applied last). We have the following sequence of steps “unwrapping” the parentheses one pair at a time: $$\begin{array}{llll} 5\cdot\Big( \left( \frac{x}{2}+1\right)^2+3 \Big)=20& \Longrightarrow&5\cdot\Big( \left( \frac{x}{2}+1\right)^2+3 \Big)/5=20 /5&\Longrightarrow&\\ \left( \frac{x}{2}+1\right)^2+3 =4 &\Longrightarrow&\left( \frac{x}{2}+1\right)^2+3-3 =4-3 &\Longrightarrow&\\ \left( \frac{x}{2}+1\right)^2 =1 &\Longrightarrow&\sqrt{\left( \frac{x}{2}+1\right)^2} =\sqrt{1} &?\Longrightarrow?&\\ \frac{x}{2}+1 =1 &\Longrightarrow&\frac{x}{2}+1-1 =1-1&\Longrightarrow& \\ \frac{x}{2} =0 &\Longrightarrow&\frac{x}{2} \cdot 2=0\cdot 2 &\Longrightarrow&\\ x =0. \\ \end{array}$$ But $x=-4$ is also a solution! What happened? We disregarded the latter of these two cases: $$z\ge 0\ \Longrightarrow\ \sqrt{z^2}=z,\quad z\le 0\ \Longrightarrow\ \sqrt{z^2}=-z.$$ We then re-do the solution starting at the question mark. The equation produces two cases: $$\begin{array}{rcl} &\sqrt{\left( \frac{x}{2}+1\right)^2} =\sqrt{1}\\ \swarrow&&\searrow\\ \end{array}$$ $$\begin{array}{lll|c|ll} z=\frac{x}{2}+1\ge 0&&&\texttt{ OR }&z=\frac{x}{2}+1\le 0\\ \hline \left( \frac{x}{2}+1\right)^2 &=1 &\Longrightarrow&\texttt{ OR }&-\left( \frac{x}{2}+1\right)^2 &=1 &\Longrightarrow&\\ \frac{x}{2}+1 &=1 &\Longrightarrow&\texttt{ OR }&\frac{x}{2}+1 &=-1 &\Longrightarrow \\ \frac{x}{2} &=0 &\Longrightarrow&\texttt{ OR }&\frac{x}{2} &=-2 &\Longrightarrow&\\ x &=0&&\texttt{ OR }&x&=-4. \\ \end{array}$$ Both $x=1$ and $x=-4$ satisfy their respective conditions. Therefore, the solution set is $\{1,-4\}$... unless we have missed a few solutions on the way! The issue is addressed in this section. $\square$

Is applying the inverse of the function that contains $x$ in the equation -- making sure that it is one-to-one -- a fool-proof plan? No. Try this: $$\sqrt{x}=-1, \text{ apply } z=y^2\ \Longrightarrow\ \left( \sqrt{x} \right)^2 =(-1)^2\ \Longrightarrow\ x=1??$$ We have a solution where there is none! It satisfies the last equation but not the first. What happened? There is nothing wrong with our logic; however, the cancellation of the function and its “inverse” was incorrect, once again. The square and the square root are inverses of each other (and cancel) only, separately, on the rays $[0,+\infty)$ and $(-\infty, 0]$. We can point out exactly why this failed; the function isn't onto!

Example. Consider the equation: $$\sqrt{x+1}=3.$$ Examining the equation, we see $x$ on left only and it is subjected to two functions, the last of which is the square root. Therefore, to make a step toward isolating $x$, square both sides: $$\left( \sqrt{x+1} \right)^2=3^2.$$ If we were to cancel the two functions on left as inverses, we get this new equation: $$x+1=9.$$ The solution is $x=8$... but was the cancellation valid? We just need to confirm that the solution falls within the domain -- $x+1\ge 0$ -- of the original equation. It does. $\square$

Using only invertible functions ensures that we don't lose solutions or gain non-solutions. This is why this approach allows us to improve our solution method: from

  • if $x$ satisfies an equation then it satisfies the next, to
  • $x$ satisfies an equation if and only if it satisfies the next.

Therefore, they have the same solution set every time. For example, this how we would rather present the solution of the very first equation in this section: $$x+2=5\ \Longleftrightarrow\ x=3.$$ This is an abbreviated version of the following statement:

  • $x$ satisfies $x+2=5$ if and only if $x$ satisfies $x=3$.

Repeated as many times as necessary, the solution set of each equation is the same as that of the original equation!

Example. Complete solutions are below: $$2(x+2)-3=5x\ \Longleftrightarrow\ 2x+4-3=5x\ \Longleftrightarrow\ -3x=-1\ \Longleftrightarrow\ x=1/3.$$ $$x^2=1\ \Longleftrightarrow\ x=-1\ \texttt{ OR }\ x=1.$$ $\square$

So, to solve the type of equation we face -- $x$ subjected to a sequence of functions -- we apply the inverses of these functions in the reversed order. We may have to split the domains of the functions so that they are both one-to-one and onto. This also splits our equation into several.

12 The arithmetic operations on functions

At the next level, we will study functions as a group. Composition is the first and the most important one.

For each of the four arithmetic operations on numbers -- addition, subtraction, multiplication, and division -- there is an operation on (numerical) functions. But first we need to a clear understanding of what it means for two functions to be the same. For example, are these the same: $$\frac{2x^2+2x}{2} \text{ and } x^2+x?$$ What about these: $$\frac{2x^2+2x}{x} \text{ and } 2x+2?$$ To find out, we can just test the formulas by plugging input values and watching the outputs. In the former case, the results will be the same but in the latter plugging in $x=0$ will produce division by $0$ for the first function in the pair but not for the second. It is clear then that two functions can't be the same unless their domains are equal too (as sets).

Definition. Two functions $f$ and $g$ are called equal, or the same, if they have the same domain and $$f(x)=g(x)$$ for every $x$ in the domain.

These are our answers to the above questions. Are these two functions the same: $$f(x)=\frac{2x^2+2x}{2} \text{ and } g(x)=x^2+x?$$ Yes, because $$\frac{2x^2+2x}{2}=x^2+x \text{ for all every } x.$$ We then use the simple notation: $$f=g.$$ Are these two functions the same: $$f(x)=\frac{2x^2+2x}{x} \text{ and } g(x)=2x+2?$$ No, because the domain of the former doesn't include $0$ while that of the latter does. As you can see, once we discover that the domains don't match, we are done. As an even simpler example, these are two different functions:

  • $x^2$ with domain $(-\infty, \infty)$;
  • $x^2$ with domain $[0, \infty)$.

The statement, such as $$\frac{2x^2+2x}{2}=x^2+x \text{ for every real } x,$$ is called an identity. This is also an identity: $$\frac{2x^2+2x}{x} =2x+2\text{ for every real } x\ne 0.$$ In other words, an identity is just a statement of two functions being “identically” equal.

Now, the outputs of numerical functions are numbers. Therefore, any arithmetic operation -- addition, subtraction, multiplication, and division -- on numbers can now be applied to functions, one input at a time.

The definitions of these new functions are simple.

Definition. Given two functions $f$ and $g$, the sum $f+g$ of $f$ and $g$ is a function defined by: $$(f+g)(x)=f(x)+g(x),$$ for all $x$ in both of the domains of $f$ and $g$ .

Note how the two plus signs in the formula are different: the first one is a part of the name of the new function while the second is the actual sign of summation of two real numbers. Furthermore, we have now an operation on functions: $f+g$ is a new function.

Example. The sum of $$g(x)=x^2 \text{ and } f(x)=x+2$$ is $$(g+ f)(x)=g(x)+f(x)=\big( x^2 \big) +\big( x+2 \big).$$ $\square$

This is an illustration of the meaning of the sum of two functions:

Sum Rule for sequences 0.png

One can see how the values are added location by location.

We represent a function $f$ diagrammatically as a black box that processes the input and produces the output: $$ \newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} \text{input} & & \text{function} & & \text{output} \\ x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y \end{array} $$ Now, what if we have another function $g$: $$ \newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} \text{input} & & \text{function} & & \text{output} \\ t & \mapsto & \begin{array}{|c|}\hline\quad g \quad \\ \hline\end{array} & \mapsto & u \end{array} $$ How do we represent their sum $f+g$? To represent it as a single function, we need to “wire” their diagrams together side by side: $$ \newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y& \\ ||&&&&\updownarrow\\ t & \mapsto & \begin{array}{|c|}\hline\quad g \quad \\ \hline\end{array} & \mapsto & u \end{array}$$ But it's only possible when the input of $f$ coincides with the input of $g$. We may have to rename the variable of $g$. We replace $t$ with $x$. For the outputs, only when units are involved, we must make sure that they match so that we can add them. Then we have a diagram of a new function: $$\begin{array}{ccccccccccccccc} f+g:& x & \mapsto & \begin{array}{|c|}\hline &x& \begin{array}{lllll} \nearrow &x &\mapsto &\begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y & \searrow\\ \\ \searrow &x &\mapsto &\begin{array}{|c|}\hline\quad g \quad \\ \hline\end{array} & \mapsto & u & \nearrow\\ \end{array}& \begin{array}{|c|}\hline\text{ add } \\ \hline\end{array}\mapsto & z\\ \hline\end{array} & \mapsto & z \end{array}$$ We see how the input variable $x$ is copied into the two functions, processed by them in parallel, and finally the two outputs are added together to produce a single output. The result can be seen as just another black box: $$ \begin{array}{ccccccccccccccc} & x & \mapsto & \begin{array}{|c|}\hline \quad f+g \quad \\ \hline\end{array} & \mapsto & y \end{array}$$

With all of the algebraic operations, we sometimes want to “reverse” them. By doing so, we decompose the given function into two (or more) simpler parts that can then be studied separately.

Example. Represent $z = h(x) = x^{2} + \sqrt[3]{x}$ as the sum of two functions: $$ x \mapsto y=x^{2} \text{ and } x \mapsto y=\sqrt[3]{x} . $$ $\square$

Subtraction also gives us an operation on functions.

Definition. Given two functions $f$ and $g$, the difference $g-f$ of $f$ and $g$ is a function defined by: $$(g-f)(x)=g(x)-f(x),$$ for all $x$ in both of the domains of $f$ and $g$ (i.e., in their intersection).

Graph of difference.png

Before we get to multiplication of functions, there a simpler but very important version of this operation.

Definition. Given a function $f$, the constant multiple $cf$ of $f$, for some real number $c$, is a function defined by: $$(cf)(x)=cf(x),$$ for all $x$ in the domain of $f$.

In the following illustration of the meaning of a constant multiple of a function one can see how its values are multiplied by $1.3$ one location at a time:

Constant Multiple Rule for sequences 0.png

There may be more than two functions involved in these operations or they can be combined.

Example. Sum combined with differences: $$h(x)=2x^3-\frac{5}{x} +3x-4.$$ The function is also seen as the sum of constant multiples, called a “linear combination”: $$h(x)=2\cdot\left( x^3 \right)+(-5)\cdot\frac{1}{x} +3\cdot x+(-4)\cdot 1.$$ $\square$

Example. When the two functions are represented by their tables of values, the sum etc. can be easily computed. It is simple as we simply go row by row adding the values.

Suppose we need to add these two functions: $$ \begin{array}{c|cc} x&y=f(x)\\ \hline 0&1\\ 1&2\\ 2&3\\ 3&0\\ 4&1 \end{array}\quad + \quad \begin{array}{c|cc} x&y=g(x)\\ \hline 0&5\\ 1&-1\\ 2&2\\ 3&3\\ 4&0 \end{array}\quad=\quad? $$ We simply add the output of the two functions for the same input. First row: $$f:0\mapsto 1\quad g:0\mapsto 5\quad \Longrightarrow\ h:0\mapsto 0+5=5.$$ Second row: $$f:1\mapsto 2\quad g:1\mapsto -1\quad \Longrightarrow\ h:1\mapsto 2+(-1)=1.$$ And so on. This is the whole solution: $$ \begin{array}{c|cc} x&y=f(x)\\ \hline 0&1\\ 1&2\\ 2&3\\ 3&0\\ 4&1 \end{array}\quad + \quad \begin{array}{c|cc} x&y=g(x)\\ \hline 0&5\\ 1&-1\\ 2&2\\ 3&3\\ 4&0 \end{array}\quad =\quad \begin{array}{c|l} x&y=f(x)+g(x)\\ \hline 0&0+5=5\\ 1&2+(-1)=1\\ 2&3+2=5\\ 3&0+3=3\\ 4&1+0=1 \end{array} $$

$\square$

Example. This how the sum of two functions is computed with a spreadsheet:

Algebra of functions with spreadsheet.png

The formula is very simple: $$\texttt{=RC[-6]+RC[-3]}.$$ $\square$

There are two more operations, multiplication and division.

Definition. Given two functions $f$ and $g$, the product $f\cdot g$ of $f$ and $g$ is a function defined by: $$(f\cdot g)(x)=f(x)\cdot g(x),$$ for all $x$ in both of the domains of $f$ and $g$ (i.e., in their intersection).

For each value of $x$, we use the pair $f(x)$ and $g(x)$ the sides of a rectangle. Then the product $f(x)\cdot g(x)$ is seen as the area of this rectangle:

Product Rule for sequences.png

If we think of $x$ as time, we can see the function is a short clip:

Growing rectangle.png

Definition. Given two functions $f$ and $g$, the quotient $f/ g$ of $f$ and $g$ is a function defined by: $$(f/ g)(x)=f(x)/g(x),$$ for all $x$ in both of the domains of $f$ and $g$ and for $g(x)\ne 0$ (i.e., in the intersection of these three sets).

For each value of $x$, we use the pair $f(x)$ and $g(x)$ as the sides of a right triangle. Then the quotient $f(x)/g(x)$ is seen as the tangent of the base angle of this triangle:

Quotient Rule for sequences.png

Note: the implied domains of these new functions are to be determined.

These are two important groups of functions.

Theorem. (a) The sum, the difference, or the product of two polynomials is also a polynomial. (b) The sum, the difference, the product, or the quotient of two rational functions is also a rational function.

Exercise. Explain the difference between these two functions: $$\sqrt{\frac{x-1}{x+1}}\text{ and } \frac{\sqrt{x-1}}{\sqrt{x+1}}.$$

All four algebraic operations produce new functions in the same manner: $$\begin{array}{ccccccccccccccc} x & \mapsto & \begin{array}{|c|}\hline &x& \begin{array}{lllll} \nearrow &x &\mapsto &\begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y & \searrow\\ \\ \searrow &x &\mapsto &\begin{array}{|c|}\hline\quad g \quad \\ \hline\end{array} & \mapsto & u & \nearrow\\ \end{array}& \begin{array}{|c|}\hline\quad +\ -\ \cdot\ \div \quad \\ \hline\end{array} \mapsto & z \\ \hline \end{array} & \mapsto & z \end{array}$$