Chapter 21 — Functions
Table of Contents
21.1 What is a Function?
Definition — Function. A function is a rule or “machine” that, for each allowable input, produces one and only one output. We write $f(x)$ (read “$f$ of $x$”) to denote a function named $f$ applied to the variable $x$.
Consider the line given by $-3x + 4y = 12$. Converting to slope-intercept form gives
\[y = \frac{3}{4}x + 3.\]For each $x$ we put in, the procedure $\frac{3}{4}x + 3$ gives back exactly one $y$. We can think of this equation as a machine: input $x$, output $y$.
Not every expression defines a function. For example, $y = \pm\sqrt{x}$ is not a function because most positive numbers have two square roots — the machine would not know whether to produce $1$ or $-1$ for $\sqrt{1}$. We can make it a function by specifying we take only the positive root.
When treating an equation as a function we write $f(x) = \frac{3}{4}x + 3$ instead of using $x$ and $y$.
Example 21-1. If $r(x) = \dfrac{x}{x^2 + 1}$, find $r(-1)$, $r(0)$, and $r(2)$.
Solution. Substitute and simplify:
\(r(-1) = \frac{-1}{(-1)^2 + 1} = -\frac{1}{2}, \quad r(0) = \frac{0}{1} = 0, \quad r(2) = \frac{2}{4+1} = \frac{2}{5}.\)
Exercise 21-1. Do all line equations give back one, and only one, $y$ for each $x$?
Exercise 21-2. Which of the following are functions?
- $\sqrt[3]{x}$
- $\sqrt[6]{x}$
- $\dfrac{x}{x+1}$
Exercise 21-3. For each function $f(x)$ in Exercise 21-2, find $f(64)$.
Exercise 21-4. If $f(x) = 2^x$, find $\dfrac{f(4)}{f(3)}$.
Exercise 21-5. Given that $f(x+1) = x^3 + 6x^2 + x + 3$, find $f(4)$. (MAΘ 1987)
21.2 Graphing Functions
A function is graphed on the coordinate plane with the independent variable $x$ on the horizontal axis and the function value $f(x)$ on the vertical axis.
Vertical Line Test. A curve in the $xy$-plane represents a function if and only if no vertical line intersects the curve more than once. This captures the idea that a function gives only one output for every input.
Example 21-2. Graph $f(x) = x^2$.
Solution. Plug in values:
| $x$ | $-3$ | $-2$ | $-1$ | $0$ | $1$ | $2$ | $3$ |
|---|---|---|---|---|---|---|---|
| $f(x)$ | $9$ | $4$ | $1$ | $0$ | $1$ | $4$ | $9$ |
Two different $x$-values can map to the same $f(x)$ (e.g. $f(2) = f(-2) = 4$), but a single $x$ cannot map to two values. The resulting shape is a parabola opening upward.
Exercise 21-6. Graph the functions $f(x) = x^3$ and $h(x) = x^3 + 3$.
Exercise 21-7. Graph $f(x) = \dfrac{1}{x}$. Use some non-integral values near $x=0$ to get the shape right.
21.3 Common Functions
Domain and Range
Domain — the set of allowable inputs to a function.
Range — the set of all outputs of the function.
Unless stated otherwise, assume both domain and range are restricted to the real numbers.
Example 21-3. What is the domain of $\log x$?
Solution. Since $10^y = x$ has a solution $y$ only when $x > 0$, the domain is the positive real numbers.
Example 21-4. Find the range of $2^x$.
Solution. A power of a positive number is always positive, and can be any positive number. The range is all positive reals.
Exercise 21-8. Plot $f(x) = \log_2 x$.
Exercise 21-9. Find the domains of:
- $f(x) = \dfrac{x^2 + 3x - 2}{x^2 - 3x + 2}$
- $h(y) = 2^y$
- $g(t) = \sqrt{t}$ (positive square root)
Exercise 21-10. Find the ranges of $\log x$, $x^2 + 1$, and $\dfrac{1}{x-1}$.
Exercise 21-11. Find the range of $\dfrac{x}{x+1}$. (You will probably need a graph.)
Iterated Functions
Given $f(x)$, we can create $f(f(x))$, $f(f(f(x)))$, etc. The function $f$ applied $n$ times is written $f^n(x)$.
Example 21-5. If $f(x) = x + 2$, then $f^6(x) = x + 12$.
Example 21-6. If $f(x) = x^2$, then $f^3(x) = ((x^2)^2)^2 = x^8$, while $[f(x)]^3 = (x^2)^3 = x^6$.
Warning. $f^n(x)$ means applying $f$ a total of $n$ times — it is not the same as $[f(x)]^n$. Unfortunately, trig notation like $\sin^2 x$ means $(\sin x)^2$ by convention, which contradicts the iterated-function notation. Be careful!
Exercise 21-12. Find $f^2(x)$ for:
- $f(x) = \dfrac{x}{x+1}$
- $f(x) = \sqrt{x}$
- $f(x) = x$
Absolute Value
| The absolute value function $ | x | $ returns the distance from $x$ to $0$: |
More generally, $|x - y|$ measures the distance between $x$ and $y$.
| Example 21-10. Solve $ | x^2 - 3x | = 4$. |
Solution. Split into two cases:
- $x^2 - 3x = 4 \;\Rightarrow\; x^2 - 3x - 4 = 0 \;\Rightarrow\; x = 4$ or $x = -1$.
- $x^2 - 3x = -4 \;\Rightarrow\; x^2 - 3x + 4 = 0 \;\Rightarrow\; x = \frac{3 \pm i\sqrt{7}}{2}$.
Restricting to real solutions: $x = 4$ or $x = -1$.
Exercise 21-20. Why does $|x - y| < 2$ mean that $x$ and $y$ are less than $2$ apart? Why do we need the absolute value?
Exercise 21-21. Graph $f(x) = |x|$. What are its domain and range?
Exercise 21-22. Solve $\left|\dfrac{x+2}{3x-1}\right| = 5$.
Floor and Ceiling Functions
The floor function $\lfloor x \rfloor$ (or $[x]$) returns the greatest integer less than or equal to $x$.
The ceiling function $\lceil x \rceil$ returns the smallest integer greater than or equal to $x$.
The fractional part is ${x} = x - \lfloor x \rfloor$.
Examples: $\lfloor 3 \rfloor = 3$, $\lfloor 4.3 \rfloor = 4$, $\lfloor -\pi \rfloor = -4$, $\lfloor \sqrt{2}/2 \rfloor = 0$.
The floor function is not continuous — its graph looks like a staircase with jumps at every integer. Open circles show excluded endpoints; closed circles show included endpoints.
Exercise 21-23. Find $\lfloor -\sqrt{17} \rfloor$, $\lfloor \sqrt{17} \rfloor$, $\lceil -\sqrt{17} \rceil$, and $\lceil \sqrt{17} \rceil$.
Exercise 21-24. Find ${17}$, ${-17/2}$, ${17/3}$, ${-17/4}$, and ${17/5}$. Plot $f(x) = {x}$.
Exercise 21-25. Plot the floor and ceiling functions on the same axes. Where do the two coincide?
Exercise 21-26. If $f(x) = \lfloor x \rfloor$ and $g(x) = \lceil x \rceil$, express $g(x)$ in terms of $f(x)$ and $x$.
Exercise 21-27. Are the absolute value and floor functions even, odd, or neither?
Exercise 21-28. Prove the following for all real $x$:
- $\lfloor x \rfloor + \lfloor -x \rfloor$ equals either $0$ or $-1$.
- $\lfloor x + \frac{1}{2} \rfloor$ is the integer nearest $x$.
- $\lfloor x \rfloor - 2\lfloor x/2 \rfloor$ equals either $0$ or $1$.
Piecewise Functions
Not all functions can be described by a single expression. Sometimes a function behaves differently in different regions.
The absolute value itself is a piecewise function:
\[|x| = \begin{cases} x & \text{if } x \geq 0 \\ -x & \text{if } x < 0 \end{cases}\]A more general piecewise function:
\(g(x) = \begin{cases} x^2 & x > 3 \\ x^3 & -2 < x \leq 3 \\ x^4 & x \leq -2 \end{cases}\)
Exercise 21-29. How many times does the function
\[g(x) = \begin{cases} x^2 - 8 & x > 3 \\ x^3 + 9 & -2 < x \leq 3 \\ x^4 - 15 & x \leq -2 \end{cases}\]intersect the $x$-axis?
21.4 Composition
Function Composition. Given functions $f$ and $g$, the composition $(g \circ f)(x) = g(f(x))$ feeds the output of $f$ into $g$. The output $f(x)$ must be in the domain of $g$.
Example 21-7. Let $f(x) = 6x^2$ and $g(x) = \dfrac{x}{\sqrt{x}+1}$. Then
\((g \circ f)(x) = g(f(x)) = \frac{6x^2}{\sqrt{6}\,|x| + 1}.\)
Exercise 21-13. Find a counterexample to the claim $f \circ g = g \circ f$. (Composition is not commutative in general.)
21.5 Inverse Functions
A function $f$ has an inverse $f^{-1}$ if and only if $f$ is one-to-one (injective): every output corresponds to exactly one input.
If $f^{-1}$ exists, then $f^{-1}(f(x)) = x$ and $f(f^{-1}(y)) = y$.
Horizontal Line Test. $f$ is one-to-one if no horizontal line intersects its graph more than once.
Finding an inverse (algebraic method):
- Write $y = f(x)$.
- Swap $x$ and $y$.
- Solve for $y$; this gives $f^{-1}(x)$.
The graph of $f^{-1}$ is the reflection of the graph of $f$ across the line $y = x$.
21.6 Even and Odd Functions
A function $f$ is even if $f(-x) = f(x)$ for all $x$ in its domain. Its graph is symmetric about the $y$-axis.
A function $f$ is odd if $f(-x) = -f(x)$ for all $x$. Its graph is symmetric about the origin (i.e. invariant under $180°$ rotation about the origin).
Example 21-9. What values can $f(0)$ take for even or odd functions?
- If $f$ is odd: $f(0) = -f(0) \Rightarrow 2f(0) = 0 \Rightarrow f(0) = 0$. An odd function must pass through the origin.
- If $f$ is even: $f(0) = f(0)$, which gives no restriction. $f(0)$ can be anything.
Exercise 21-16. Draw some functions that are even, odd, and neither.
Exercise 21-17. Write down some functions that are even, odd, and neither.
Exercise 21-18. Classify as even, odd, or neither: $x$, $x^2$, $x^3$, $x^4$, $x^6 + 27x^4 + x^2$, $x^5 + 1$, $x^6 + x^5$.
Exercise 21-19. A polynomial $a_n x^n + a_{n-1}x^{n-1} + \cdots + a_0$ is even when? Odd when?
Key Insight: A polynomial is even if and only if it contains only even-power terms. A polynomial is odd if and only if it contains only odd-power terms.
21.7 Graphing Transformations
There are four basic transformations of a function $f(x)$:
| Transformation | Effect on Graph |
|---|---|
| $f(x + a)$ | Horizontal shift left by $a$ (if $a > 0$) |
| $f(x) + a$ | Vertical shift up by $a$ |
| $a \cdot f(x)$ | Vertical stretch by factor $a$ |
| $f(ax)$ | Horizontal shrink by factor $a$ |
| Example 21-11. Compare $f(x) = | x | $ and $g(x) = | x + 2 | $: |
| $x$ | $-5$ | $-4$ | $-3$ | $-2$ | $-1$ | $0$ | $1$ | $2$ | $3$ |
|---|---|---|---|---|---|---|---|---|---|
| $|x|$ | $5$ | $4$ | $3$ | $2$ | $1$ | $0$ | $1$ | $2$ | $3$ |
| $|x+2|$ | $3$ | $2$ | $1$ | $0$ | $1$ | $2$ | $3$ | $4$ | $5$ |
The graph of $|x + 2|$ is the graph of $|x|$ shifted 2 units to the left. For each $x$, the value $f(x+2)$ equals the value of $f$ at $x+2$, which is $2$ units to the right. Hence the graph shifts left.
Example 21-12. $f(x) + 2 = |x| + 2$ shifts the graph of $|x|$ up by 2.
Example 21-13. $2f(x) = 2|x|$ is a vertical stretch by factor $2$: every point’s distance from the $x$-axis is doubled.
Example 21-14. $f(2x) = |2x|$ is a horizontal shrink by factor $2$: $g(1) = f(2)$, $g(2) = f(4)$, etc.
Warning. Although $2|x|$ and $|2x|$ happen to look the same (both equal $2|x|$), a vertical stretch by $2$ and a horizontal shrink by $2$ are not generally the same. For example, $2\sqrt{x} \neq \sqrt{2x}$ in general ($2\sqrt{8} = 4\sqrt{2}$ but $\sqrt{16} = 4$).
Exercise 21-30. Understand why $f(x+2)$ is a shift to the left, even though $2$ is added to $x$.
Exercise 21-31. What relationship does $f(x/2)$ have to $f(x)$?
Exercise 21-32. Shift and stretch some more functions to get comfortable. Plot both original and transformed, and verify the transformation visually.
Problems to Solve for Chapter 21
Problem 402. Which values of $x$ must be excluded from the domain of $f(x) = \dfrac{x}{x^2 - 4}$? (MAΘ 1990)
Problem 403. If $f(x) = 2x^2 - 3x + 1$, find $f(4x)$. (MAΘ 1990)
Problem 404. If $f(x + 1) = x^2 + 3x + 5$, find $f(x)$. (MAΘ 1991)
Problem 405. If $f(4x + 3) = 2x + 1$, find $f(-9)$. (MAΘ 1987)
Problem 406. How many solutions are there to $|x^2 - 6x| = 9$? (MAΘ 1991)
Problem 407. Let $[x]$ denote the greatest integer function and ${x} = x - [x]$ the fractional part. Find
\(\frac{\{\sqrt{3}\}^2 - 2\{\sqrt{2}\}^2}{\{\sqrt{3}\} - 2\{\sqrt{2}\}}.\)
Problem 408. Let $f$ be defined by
\[f(x) = \begin{cases} x + 2 & \text{if } 3 \mid \lfloor x \rfloor \\ x - 1 & \text{otherwise} \end{cases}\]Compute $f(f(f(f(f(\frac{1}{2})))))$. (MAΘ 1992)
Problem 409. Solve for all real $y$: $|3y + 7| = |2y - 1|$. (MATHCOUNTS 1990)
Problem 410. Find the area of the region determined by
\[y \geq |x|, \quad y \leq -|x+1| + 4.\](MATHCOUNTS 1992)
Problem 411. Find the coordinates of the points of intersection of $y = |2x| - 2$ and $y = -|2x| + 2$. (MATHCOUNTS 1989)
Problem 412. Find an equation whose graph is a “V”-shape with vertex at $(1, -1)$ opening upward with slopes $\pm 1$. (MATHCOUNTS 1989)
Problem 413. Prove that $\lfloor 2x \rfloor + \lfloor 2y \rfloor \geq \lfloor x \rfloor + \lfloor y \rfloor + \lfloor x + y \rfloor$ for all real $x$ and $y$.