---
# System prepended metadata

title: Review II
tags: [' review', ' calculus', teaching]

---

---
title: Review II
tags: teaching, review, calculus
---
# Review II (Functions and composition)
## Function notation

### Making sense of the parts of a function
When you want to start talking about some function, you will often write something like $$f(x) = \sin(3x)+2|x|+x^2.$$

Let's break that down a bit. First, you want to realize that this is *declaring* the **name** of a function. The name of the function above is $f$. You could name a function $kim$, by writing $$kim(x) = 2|x|+x^2.$$ On the left, whatever comes before the $(x)$, or $(\langle{\scriptsize\texttt{input variable}}\rangle)$, becomes the name of the function. Mostly, you do this so that you can easily to refer to the function. For example, now that we have these names it becomes true to say that $$f(x) - kim(x) = \sin(3x).$$

::: danger
The parentheses that show up here have nothing to do with multiplication. So, generally, you cannot do something to the input that really has to do with multiplication. For example, writing

:warning: <span style="padding-left:1.5cm;padding-right:1.5cm;">$\frac{\sin(3x)}{x} = \sin(3)$</span> does not make sense.
:::
::: spoiler
You can only "cancel" when the thing cancelled is being multiplied by everything else (in the numerator or denominator; sometimes, everything else is just 1). While $x$ is being multiplied by $3$ above, it is not being multiplied by $\sin$ -- that doesn't even make sense, since $\sin$ is just the **name** of a function. 
:::

### Domains, and functions that are equal
When I wrote $f(x) = \sin(3x)+2|x|+x^2$ above, think of the right-hand side (the $\sin(3x)+2|x|+x^2$ part) as the *expression* that defines the input-output relationship. It tells you how to take an input and produce an output from it.

In addition to the input-output relationship, a function also has a *domain*: the set of numbers which are allowed as inputs. Typically, in calculus, the numbers which are allowed are all real numbers where the defining expression *could be* evaluated. Two functions are considered equal (the same function) if they have the same domain and all their input-output pairs are the same.

For example, define $g(x) = f(2x) - x^2$ (using the named function $f$ above). Then $g(x)$ and the function defined by the expression $\sin(6x)+4|x|+3x^2$ are equal functions: both have domain $(-\infty, \infty)$, and for every number $x$, $$g(x) = \sin(3\cdot 2x)+2|2x|+(2x)^2 - x^2 = \sin(6x)+4|x|+3x^2.$$


## Composition of functions

### The new function, from two old functions
You have (are given) two functions $a(x)$ and $b(x)$. You can get a new function as follows. (The new function is named "$a$ of $b$", or "$a\circ b$" symbolically.)
:::info
**Composition.** The output $a\circ b(x)$, for given input $x$, is $$a(b(x)).$$

This means: first find $b(x)$, the numerical value at input $x$, and then you put that value in (as input) to the function $a$. The result is the output of $a\circ b$ on the input $x$.
:::

### Examples
1. Let $a(x) = x^2$ and let $b(x) = x-2$. Then $$a\circ b(x) = a(x-2) = (x-2)^2$$
since the function $a$ takes its input, whatever it may be ($x-2$ in this case) and raises it to the power $2$. For example, $a\circ b(3) = (3-2)^2 = 1$, and $a\circ b(0)=4$.
2. In general, the function $a\circ b$ and the function $b\circ a$ are different functions. You'll see this in most examples. Try finding $b\circ a$ for the functions $a$ and $b$ from Example 1; you will see that you get a different function.
:::spoiler
$b\circ a(x) = b(x^2) = x^2 - 2$.
:::
3. We are free to have the two functions be the same -- composing a function with itself. For example, if $a(x)=2x-1$, we get that $$a\circ a(x) = a(2x-1) = 2(2x-1)-1 = 4x-3.$$

### Exercises
1. Using the functions $a(x)$ and $b(x)$ from Example 1 above, compute the function values $b\circ a(3)$ and $b\circ a(-1)$.
2. Define $f(x) = x^2 - x$ and $g(x) = x+1$. Find $f\circ g(x)$. Find a simple expression for $f\circ g(x)+f(x)$.
3. Define $p(x) = e^x$ and $q(x) = \ln(x)-1$. For some $m$, the function $p\circ q(x)$ equals $mx$. Find the number $m$.
:::spoiler
Solution to number 1: $b\circ a(3) = 7$; $b\circ a(-1) = -1$.
:::

### Reverse engineering composition
If you have been given a function, can you determine two functions whose composition is that function? For example, the function $f(x) = \sqrt{2x+1}$. Thinking for a moment, there is a function output being placed in the square root. So, setting $g(x) = \sqrt{x}$ and $h(x) = 2x+1$, we have that $g\circ h(x)=g(h(x))$ is equal to $f(x)$.

### Exercises
4. For each of the following functions $f(x)$, find two other functions, $g(x)$ and $h(x)$, so that $f(x) = g\circ h(x)$.
a) $f(x) = 2|x - 3|$
b) $f(x) = 9x^2 - 3x$
c) $f(x) = e^{2x} + 1$
d) $f(x) = 2\sin^2(x)$
### The domain of $a\circ b$
For an input $x$ to a function that is the composition $a\circ b$, we must have $b(x)$ be allowed as an input to $a$. So, you need $x$ in the domain of $b$ (to find $b(x)$) and you need $b(x)$ in the domain of $a$. 

So, one way to determine the domain of $a\circ b$ is to first find the domain of just $a$, and then figure out which numbers $x$ in the domain of $b$ guarantee that $b(x)$ is in the domain of $a$ that you found. 
Another approach is to find $a\circ b$ as an expression in the input variable (*be careful with simplifying here*), and then use typical techniques for finding the domain.

### Examples
4. Let $f(x) = \frac{\sqrt{x}}{x-2}$ and $g(x)=\frac{1}{x}$. Find the domain of $f\circ g$.
&#9655; Solution. By using $1/x$ as the input to $f$, you get an expression for $f\circ g(x)$: $$f(1/x) = \frac{\sqrt{\frac{1}{x}}}{\frac{1}{x} - 2}.$$ 
For this expression to be defined, you need $\frac{1}{x}\geq 0$, $x\neq0$, and $\frac{1}{x} - 2 \neq 0$. Some algebra gives us that the last statement means $x\neq \frac{1}{2}$, and the first two are saying that $x$ is in $(0,\infty)$. So, the domain is $$(0,1/2) \cup (1/2, \infty).$$
:::danger
**Note:** If we had simplified the expression for $f\circ g(x)$ to $$\frac{\sqrt{x}}{1-2x}$$ by multiplying top and bottom by $x$, then it would make it seem as though $0$ is in the domain (as this expression is defined at $x=0$). But, clearly, $0$ is not in the domain of $g(x)$.
:::

### Exercises
5. Let $f(x) = \sqrt{x-1}$ and $g(x) = \frac{1}{x}$. Then 
a) Which of the following are in the domain of $f\circ{g}$ ? $\{-1, 0, 0.5, 1, 2\}$. 
b) State the whole domain of $f\circ g$, in interval notation.
6. Let $f(x) = \sqrt{x-1}$ and $a(x) = x^2$. Find the domain of $f\circ a$. 

<hr style="background-color:black;" />

## Inverse functions, exponentials, and logarithms
### Inverse functions
A function $b(x)$ is called the *inverse* of a function $a(x)$ if the following holds (alternatively, $a(x)$ is also called the *inverse* of $b(x)$): 
:::info 
- for all $x$ in the domain of $a$, the equation $b\circ a(x) = x$ is correct, and
- for all $x$ in the domain of $b$, the equation $a\circ b(x)=x$ is correct. 
:::
Thinking of a function as a machine that *does something* to its input, to produce the output, the inverse function "undoes" what it did.

The function $g(x) = \sqrt{x}$ is *not* the inverse function of $f(x)=x^2$, because of an issue with the standard domain. For example, $g\circ f(-2) = g(4) = \sqrt{4} = 2$. So $x=-2$ gives an example where $g\circ f(x) \neq x$.
> *This issue can be remedied by* "trimming" *the domain of $f(x)=x^2$ to be just $[0,\infty)$*

### Logarithms as inverses
Let $b>0$ be a fixed number. The common way to define the function $\log_b(x)$ is to say it is the inverse of the function defined by $f(x) = b^x$. (There are theoretical reasons why an exponential function with base $b$ *does have* a unique inverse function.) We simply use $\log_b$ for the name of this inverse function.

The fact these functions are inverses is very helpful for solving equations involving exponentials and logarithms.
> Recall that $\ln(x)$ is another way to write $\log_e(x)$ (the log. of $x$ with base $e$).

### Examples
5. Solve the equation $2 = 2^{3t}$.
&#9655; Solution. Using base $2$: The sides are equal, so putting both into $\log_2(x)$ produces equal outputs: $$\log_2(2) = \log_2(2^{3t}).$$
The left-hand side is $1$ and the right-hand side is $3t$: $$1 = \log_2(2) = \log_2(2^{3t}) = 3t,$$ so we get $t = 1/3$.
6. Solve $\ln(x) = 2+\ln(1+x)$.
&#9655; Solution. Begin with $$x = e^{\ln(x)} = e^{2+\ln(1+x)}$$ (using the given equation for the right side). Now, the right-hand side is equal to $e^2e^{\ln(1+x)} = e^2(1+x)$. So, you get $x = e^2(1+x)$. Using algebra to isolate $x$, we have $$x = \frac{e^2}{1 - e^2}.$$ 
:warning: But...look at that answer. It is a negative number, so it cannot be put into $\ln(x)$, and so it is *not* a solution to the equation. This means the equation has no solution.

### Exercises
7. Solve $\ln(x) = 2 + \ln(1-x)$.
8. Solve $e^x = e^{1-x^2}$.
:::spoiler
Answer: $x$ is either $-\frac{1}{2}+\frac{\sqrt{5}}{2}$ or $-\frac{1}{2}-\frac{\sqrt{5}}{2}$.
:::

9. Solve $\ln(3) = 2e^{x+2}$.
:::spoiler
Answer: $x = \ln(\ln(3)/2) - 2 \approx -2.6$.
:::

## Exercises from textbook

| Section | Question $\#$ |
| -------- | -------- | 
| 1.1     | 43:sparkles:, 46,  47:sparkles: |
| 1.4     | 201:sparkles:, 203:sparkles:; 200, 202, 204     | 
| 1.5     | 277:sparkles:, 282, 289:sparkles:, 290 |
| Chapter Review | 316, 317:sparkles: |


> :sparkles:Have answer in the online textbook.

