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 The two main classes of functions

Definition. A function, denoted by $$F:X\to Y,$$ is a rule or procedure $f$ that assigns to any element $x$ in a set $X$, called the domain, exactly one element $y$ in another set $Y$. The latter set is called the co-domain.

Definition of function.png

Recall our original example of a function:

Boys and balls -- function.png

Then, the table of this relation must have exactly one mark in each row:

Boys and balls -- function with values.png

There are two aspects of the function we see here.

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

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

The above function is modified: there is an arrow for each ball and all columns have marks.

Boys and balls -- onto function.png

Second, both Tom and Ben like 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.

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

The above function is modified: no two arrows converge on one ball and no column has more than one mark.

Boys and balls -- 1-1 function.png

When the function is represented by its graph, the above picture rotates and this rule becomes the following.

Theorem (Horizontal Line Test). A function is one-to-one of and only if its graph and any horizontal line have at most point in common.

Horizontal Line Test.png

Example. Linear functions, $$F(x)=mx+b,$$ are easy to classify this way.

Slopes.png
  • If $m\ne 0$, $F$ is both one-to-one and onto.
  • If $m= 0$, $F$ is neither one-to-one nor onto.

$\square$

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

Parabolas.png

$\square$

Monotone is 1-1.png

Theorem. Any monotonic function is one-to-one.

The restrictions in these definitions can be violated when there are too few or too many arrows for a given $y$. These violations are seen in the co-domain. Not onto:

Not onto.png

Not one-to-one:

Not one-to-one.png

Exercise. Identify and classify the functions below:

Employees.png

2 Compositions and inverses

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.

We note that the new function is one-to-one but not onto.

What if we combine the new function with the old? There is only one way to do it:

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. 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

The 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,$$ evaluated by for every $x$ in $X$ according to the following rule: $$H(x)=G(F(x)).$$

The new function is denoted by: $$G\circ F.$$

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. Let's represent two function $f$ and $g$ diagrammatically 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 functions 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 & \mapsto & \begin{array}{|c|}\hline\quad \text{multiply by }2 \quad \\ \hline\end{array} & \mapsto & y& \mapsto & \begin{array}{|c|}\hline\quad \text{add }5 \quad \\ \hline\end{array} & \mapsto & z& \mapsto & \begin{array}{|c|}\hline\quad \text{divide by }3 \quad \\ \hline\end{array} & \mapsto & u&\mapsto&...\\ \end{array}$$

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, third, and fourth columns respectively: $$\texttt{=RC[-1]*2},\ \texttt{=RC[-1]+5},\ \texttt{=RC[-1]/3} .$$ We can have as many columns as we like. $\square$

Example. But what if there are no formulas and the functions are given by nothing but tables? Then we need find a match for the output of the first function among the inputs of the second. 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$

Our main example 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! There is no boy playing with the baseball. There are two playing with the basketball. There is no function this time!

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 above examples. What happens?

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!

The function below is both one-to-one and onto:

Boys and balls -- bijection.png

This is a very simple kind of function. Indeed, each boy holds a ball and every ball is held by a boy. The difference is only in the name...

But 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 co-domain 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 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.

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$ if $$G(F(x))=x\text{ for all }x \text{ and }F(G(y))=y\text{ for all }y.$$

There is only one such function and it is denoted by: $$F^{-1}.$$ In other words, $$(F^{-1}\circ F)(x)=x \text{ and }(F\circ F^{-1})(y)=y.$$

Example. A linear function, $$y=f(x)=mx+b,$$ is one-to-one and onto whenever $m\ne 0$. Algebraically, we just solve the equation $y=mx+b$ for $x$. Then the inverse is: $$x=f^{-1}(y)=\frac{y-b}{m}.$$ Geometrically, the answer is also transparent: there is exactly one $x$ for each $y$.

It's also a linear function and the slope is the reciprocal of the original. $\square$

So, every function $f:X\to Y$ is also a relation between $X$ and $Y$. Now, does this relation -- implicitly -- contain a function $g:Y\to X$? Yes, but the original function must have exactly one input for each output.

Bijection.png

It's as if this is the same set...

3 Algebra of functions

At the next level, we will study functions as a group.

For each of the four algebraic operations on numbers -- addition, subtraction, multiplication, and division -- there is an operation on functions. But first we need to make something clear.

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

In particular, these are two different functions:

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

Now 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}& y+u\\ \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$.

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

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

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 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.

4 Functions are transformations of the line

...and vice versa.

We think as if the whole $x$-axis is drawn on a pencil:

Pencil as axis.png

We start with 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 right is shown below:

Shift of axis.png

Generally,

  • when shifted $k>0$ units right, point $x$ becomes $x+k$.

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}$$ This is a function: $$f(x)=x+k.$$

Now 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}$$ This is another function: $$f(x)=-x.$$

A new type of transformation is a stretch. The line isn't on a pencil 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

Generally,

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

In the mean time, 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}$$ This is the third kind of function we have discovered: $$f(x)=x\cdot k.$$

What about the $y$-axis? In this case, the line -- pencil and string -- is vertical. 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{ up } k}& g(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 } }& g(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}& g(y)=y\cdot k. \end{array}$$

5 Transformations of the axes produce new functions

We will see how the transformations of the axes -- both horizontal and vertical -- affect the functions.

We start with a shift, vertical. We shift the whole $xy$-plane as if it is drawn 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

Generally,

  • when shifted $k>0$ units up, point $(x,y)$ becomes $(x,y+k)$.

We understand “$k$ units down” as “$-k$ units up”. This 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,y)& \ra{ \text{ up } k}& (x,y+k). \end{array}$$

We next apply this operation to study graphs of functions. Since the graph is drawn on the same piece of paper, it is shifted exactly the same way. 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 $g$, hence $g(x)=y+k=f(x)+k$.

Vertical shift of the plane -- graphs.png

Such a shift can be carried out point by point:

Vertical shift of the plane -- graphs 2.png

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

By “vice versa” we mean that if function $g$ satisfies $g(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.

Example. The graph of each of these: $$x^{2}, x^{2} + 1, x^{2} + 10, x^{2} - 1 , x^{2} - 10,$$ is the same parabola just differently located. $\square$

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

Horizontal shift of the plane.png

We again allow the shift to be negative and understand “$k$ units left” as “$-k$ units right”. This 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,y)& \ra{ \text{ right } k}& (x+k,y). \end{array}$$

What about the formula for a function shifted this way? 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 $g$, hence $g(x+k)=y=f(x)$. Therefore, the new function is $g(x)=f(x-k)$.

Horizontal shift of the plane -- graphs.png

Such a shift can be carried out point by point:

Horizontal shift of the plane -- graphs 2.png

Example. Take $f(x) = x^{2}$, and shift $2$ units to the left and to the right too; we get $$ g(x) = f(x+2) = (x+2)^{2} \text{ and } h(x) = f(x-2) = (x-2)^{2}. $$

Horizontal shift of parabola.png

To confirm the match, what is the $x$-intercept of $g$? Set $g(x) = 0$ and $h(x)=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}$$ $\square$

Rule 2 (horizontal shift): If the graph of $g$ is the graph of $f$ shifted $k$ units to the right, then $$ g(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}$$

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.

What about combinations of these two transformations?

Example. Let $$h(x) = (x + 2)^{2} +4.$$ What is the graph?

First, 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 left shift followed by a $4$-unit up 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?

Now a different kind of transformation, flip, vertical. 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

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

We next apply this operation to study graphs of functions. Since the graph is drawn on the same piece of paper, it is flip exactly the same way. What about the formula for the new function? Suppose a point $(x,y)$ lies on the graph of $f$, then $f(x)=y$. The flipped point $(x,-y)$ lies on the graph of the new function $g$, hence $g(x)=-y=-f(x)$.

Vertical flip of the plane -- graphs.png

Such a flip can be carried out point by point:

Vertical flip of the plane -- graphs 2.png

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

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

Example. Let $$ h(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$

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

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

Now, the graphs of functions transformed this way. What about the formula for the new function? Suppose a point $(x,y)$ lies on the graph of $f$, then $f(x)=y$. The flipped point $(-x,y)$ lies on the graph of the new function $g$, hence $g(-x)=y=f(x)$. Therefore, $g(x)=-f(x)$.

Horizontal flip of the plane -- graphs.png

Such a flip can be carried out point by point:

Horizontal flip of the plane -- graphs 2.png

Rule 4 (horizontal flip): If the graph of $y = g(x)$ is the graph of $y = f(x)$ flipped horizontally, then $$ g(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}$$

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.

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?

A new type of transformation is a stretch, vertical. 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

Generally,

  • when the plane is stretched vertically by a factor $k>1$, point $(x,y)$ becomes $(x,y\cdot k )$.

We understand “stretched by a factor $k$” as “shrunk by a factor $1/k$”. This 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,y)& \ra{ \text{ vertical stretch by } k}& (x,y\cdot k). \end{array}$$

Next, what about the formula for the new function after the plane has been stretched? Suppose a point $(x,y)$ lies on the graph of $f$, then $f(x)=y$. After the stretch, the point $(x,ky)$ lies on the graph of the new function $g$, hence $g(x)=ky=kf(x)$.

Vertical stretch of the plane -- graphs.png

Such a stretch can be carried out point by point:

Vertical stretch of the plane -- graphs 2.png

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

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

Once again, we understand “stretched by a factor $k$” as “shrunk by a factor $1/k$”. This is a way describe a horizontal stretch ($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,y)& \ra{ \text{ horizontal stretch by } k}& (x\cdot k,y). \end{array}$$

Next, 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 $g$, hence $g(kx)=y=f(x)$. Therefore, $g(x)=f(x/k)$.

Horizontal stretch of the plane -- graphs.png

Such a stretch can be carried out point by point:

Horizontal stretch of the plane -- graphs 2.png

Rule 6 (horizontal stretch): If graph $y = g(x)$ is the graph of $y = f(x)$ stretched by the factor $k>0$ horizontally, then $$g(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}$$

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.

Example. It seems that vertical stretching is somehow equivalent to horizontal shrinking. Consider $$ f(x) = x. $$ Stretched by a factor $2$ vertically it becomes: $$ g(x) = 2 x. $$ Shrunk by a factor $2$ horizontally it becomes: $$ h(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 $$g(x) = (\sqrt{2} x )^{2}.$$ Now there is a match: $$(\sqrt{2} x)^{2} =2 x^{2}.$$ $\square$

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. Show that any quadratic function $f(x)=ax^2+bx+c$ can be represented as $f(x)=a(x-h)^2+k$ for some numbers $h,k$ and consequently its graph can be acquired from $y=x^2$ via the above transformations.

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

We can see that the transformations of the plane are functions of their own and a new function is produced from a function $f$ by linking one of them to the diagrams of $f$. We call this linking compositions.

6 Compositions of numerical functions

Compositions of functions can be visualized as flowcharts:

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 have to rename the variables of $g$. Then we have what we want: $$\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. 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 re-naming. 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 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: $$ \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 } (\$) $$ We represent the procedure as a composition: $$ t \mapsto \underset{f}{60 t} \mapsto d \mapsto w \underset{k}{\frac{d}{30}} \mapsto g \mapsto \underset{h}{5 g} \mapsto e, $$ or, algebraically: $$ d = f(t) = 60t, \; g = k(d) = \frac{d}{30} \; e = h(g) = 5g. $$ Substitute: $$\begin{aligned}g = k(d) & = k(f(t)) \\ e = h(g) & = h(k(d)) \\ & = h(k(f(t))) \end{aligned}$$ We read from right to left though: $f(t)$ is not $(t)f$. $\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. 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& \Longrightarrow\ 0\mapsto -1\\ 1&2&\searrow&1&-1& \Longrightarrow\ 1\mapsto 2\\ 2&3&\searrow&2&2& \Longrightarrow\ 2\mapsto 3\\ 3&0&&3&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$

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

Compositions with spreadsheet.png

The search is executed with this formula: $$\texttt{=VLOOKUP(RC[-6],R3C[-4]:R18C[-3],2)}.$$ $\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.$$ Let's consider 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.$$

7 Inverses

Historically, some new algebraic operations may have 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]{}$? 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$.

More precisely, they undo each other under composition, as follows.

Definition. Two functions $y=f(x)$ and $x=g(y)$ are called inverse of each other when for all $x$ in the domain of $f$ and for all $y$ in the domain of $g$, we have for all $x$ and $y$: $$g(f(x))=x \quad\text{ and }\quad f(g(y))=y.$$

The inverse of function $f$ is denoted by $x=f^{-1}(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}$$

Note: here “$f$” is the name of the old function and “$f^{-1}$” is the name of the new function.

Example. Suppose the function is given numerically, by a table: $$\begin{array}{l|l} x&y=f(x)\\ \hline 0&1\\ 1&10\\ 2&-1\\ ... \end{array}$$ Then the table of the inverse is obtained by interchanging the columns: $$\begin{array}{l|l} y&x=f^{-1}(y)\\ \hline 1&0\\ 10&1\\ -1&2\\ ... \end{array}$$ $\square$

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}$? Technically, we don't need to do anything. Sounds strange, but consider this. 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. How can we fix that?

Example. Replacing $f$ with its inverse $f^{-1}$, $$\begin{array}{l|l} x&y=f(x)\\ \hline 0&1\\ 1&10\\ 2&-1\\ ... \end{array}\quad \leadsto \quad \begin{array}{l|l} y&x=f^{-1}(y)\\ \hline 1&0\\ 10&1\\ -1&2\\ ... \end{array}$$ replaces every point $(x,y)$ in the $xy$-plane with a point $(y,x)$ in the $yx$-plane:

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

$\square$

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

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.

We can also fold:

Inverse by folding paper.png

The shapes of the graphs are the same!

Inverse of function.png

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

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

Inverse graph.png

Start with choosing a few points on the graph, especially with ones easy to find counterparts (points on the axes, points on the diagonal, etc.). Plot their counterpart points: from the point go perpendicular to the diagonal ($45$ degrees) and then measure the same distance on the other side. Then draw a curve that connects these new points. $\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

When we interchange the axes or the rows of the table, a question then arises, does the new graph or the new table represent a function? To answer this question in the latter case, we would have to check every row of the table to make sure that we don't have something like this: $$\begin{array}{l|l} y&x=f^{-1}(y)\\ \hline ...\\ 1000&1\\ ...\\ 1000&2\\ ... \end{array}$$

These are the conditions of the definition written via the compositions of the functions: $$(g\circ f)(x)=x \quad\text{ and }\quad (f\circ g)(y)=y.$$ And 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.$$ And that is the diagram representation: $$ \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 f^{-1} \quad \\ \hline\end{array} & \mapsto & x \text{, same! } \end{array}$$ $$ \newcommand{\ra}[1]{\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{ccccccccccccccc} y & \mapsto & \begin{array}{|c|}\hline\quad f^{-1} \quad \\ \hline\end{array} & \mapsto & x & \mapsto & \begin{array}{|c|}\hline\quad f \quad \\ \hline\end{array} & \mapsto & y \text{, same! } \end{array}$$

Example. 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}$$ $\square$

Conclusion: Not all functions have inverses.

However, we can make it work by restricting the domain of the function.

Example. Old function: $y = x^{2}$, with the domain assumed to be $(-\infty, \infty)$. It simply doesn't have the inverse!

New function: $y = x^{2}$, with the domain chosen to be $[0, \infty )$. Then it works: this function has the inverse as we know.

What was the problem? We know that $$ 2^{2} = 4. $$ But we eliminated this possibility $$ (-2)^{2} = 4. $$ The conflict is visible in this diagram: $$f:\begin{array}{lll} 2\\ &\searrow\\ &&4\\ &\nearrow\\ -2 \end{array}\qquad\qquad f^{-1}:\begin{array}{lll} 2\\ &\nwarrow\\ &&4\\ &\swarrow\\ -2 \end{array} $$ The “inverse” is a relation but not not a function as there are two outputs for the same input. $\square$

What we need to require from a function is that two different inputs cannot produce the same output.

Definition. A function $y = f(x)$ is called a one-to-one if $$ f(x_{1}) \neq f(x_{2}) $$ unless $x_{1} = x_{2}$. Such a function is also called invertible.

In other words, there is only one $x$ for each $y$.

Example. $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

$\square$

What is the difference? Two points on the graph have the same height above the $x$-axis!

Theorem (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

Theorem. All monotonic functions are one-to-one.

Thinking geometrically, the graph of an increasing function can't come back and cross a horizontal line for the second time:

Monotone is 1-1.png

Now, algebraically, this is the definition: $$ f\nearrow \textrm{ when: } \underbrace{x_{1} < x_{2}}_{\textrm{two different inputs}} \Longrightarrow \underbrace{f(x_{1}) < f(x_{2})}_{\textrm{two different outputs}} .$$ Hence $f$ is one-to-one.

Theorem. The odd powers are one-to-one. The even powers aren't one-to-one. The even powers with domains reduced to $[0,\infty)$ or $(-\infty,0]$ are one-to-one.

The reason is that the former are monotonic and the latter aren't.

Power functions -- one-to-one.png

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$

While solving the equation $y=f(x)$ for $x$, we are watching out for multiple answers, such as $$y=x^2\ \Longrightarrow\ x=\pm\sqrt{y},$$ or $$y=|x|\ \Longrightarrow\ x=\pm y.$$

We then recognize that these functions are not one-to-one.

Exercise. Prove that a one-to-one function can have only one inverse.