Chapter 1: Functions and Their Graphs

Precalculus Textbook • Estimated reading time: 25 min

Chapter Contents

  1. 1.1 What is a Function?
  2. 1.2 Types of Functions
  3. 1.3 Transformations of Functions
  4. 1.4 Function Operations and Composition
  5. 1.5 Inverse Functions
  6. 1.6 Practice Problems

Functions are the foundation of precalculus and all of higher mathematics. In this chapter, we develop a thorough understanding of what functions are, how to classify and transform them, how to combine them through operations and composition, and how to reverse them through inverses. Every concept is reinforced with worked examples and interactive graphs so that you build both intuition and computational skill.

1.1 What is a Function?

In everyday life, we frequently encounter relationships between quantities. The distance you travel depends on how long you drive. The price of a purchase depends on how many items you buy. Mathematics formalizes these relationships through the concept of a function.

Definition: Function

A function from a set $A$ to a set $B$ is a rule that assigns to each element $x$ in $A$ exactly one element $y$ in $B$. We write $y = f(x)$ and say "$y$ is a function of $x$." The set $A$ is called the domain, and the set of all output values is called the range.

The key requirement is the phrase exactly one. For every input $x$ in the domain, there must be one and only one output $f(x)$. An input cannot produce two different outputs. However, it is perfectly acceptable for two different inputs to produce the same output. For instance, the function $f(x) = x^2$ sends both $x = 3$ and $x = -3$ to the same output $9$.

Function Notation

When we write $f(x) = 2x + 5$, the letter $f$ names the function, and $x$ is the independent variable (the input). The expression $f(x)$ represents the dependent variable (the output). To evaluate the function at a specific value, we substitute that value for $x$. For example, $f(3) = 2(3) + 5 = 11$.

Function notation is powerful because it allows us to communicate precisely which function we mean and at which input we are evaluating it. We can use any letter for the function name ($f$, $g$, $h$, etc.) and any variable for the input ($x$, $t$, $n$, etc.).

Domain and Range

The domain of a function is the set of all permissible inputs. Unless a domain is explicitly stated, we adopt the convention that the domain is the largest set of real numbers for which the expression defining $f(x)$ produces a real number. Two common restrictions arise:

The range is the set of all outputs that the function actually produces. Finding the range often requires more analysis; graphing the function or using algebraic techniques can help.

The Vertical Line Test

Vertical Line Test

A curve in the $xy$-plane is the graph of a function of $x$ if and only if every vertical line intersects the curve at most once. If any vertical line crosses the curve more than once, the curve does not represent a function, because a single $x$-value would correspond to multiple $y$-values.

For example, the graph of $y = x^2$ passes the vertical line test (every vertical line hits the parabola at most once), but the graph of $x^2 + y^2 = 1$ (a circle) fails the test because vertical lines between $x = -1$ and $x = 1$ hit the circle twice.

Example 1.1.1 — Finding the Domain

Find the domain of $f(x) = \dfrac{\sqrt{x + 3}}{x - 1}$.

Solution. We need two conditions to hold simultaneously:

  1. The expression under the square root must be non-negative: $x + 3 \geq 0$, which gives $x \geq -3$.
  2. The denominator must not be zero: $x - 1 \neq 0$, which gives $x \neq 1$.

Combining these, the domain is $[-3, 1) \cup (1, \infty)$. In other words, $x$ must be at least $-3$ but cannot equal $1$.

Example 1.1.2 — Evaluating a Function

Let $g(x) = x^2 - 4x + 7$. Evaluate $g(-2)$ and $g(a+1)$.

Solution.

For $g(-2)$: substitute $x = -2$:

$$g(-2) = (-2)^2 - 4(-2) + 7 = 4 + 8 + 7 = 19$$

For $g(a+1)$: substitute $x = a+1$:

$$g(a+1) = (a+1)^2 - 4(a+1) + 7 = a^2 + 2a + 1 - 4a - 4 + 7 = a^2 - 2a + 4$$

1.2 Types of Functions

Functions come in many varieties, and recognizing each type by its equation and graph is an essential precalculus skill. Below we survey the most important families of functions you will encounter throughout this course.

Linear Functions

A linear function has the form $f(x) = mx + b$, where $m$ is the slope and $b$ is the $y$-intercept. Its graph is a straight line. The slope $m$ measures the rate of change: for every unit increase in $x$, the output changes by $m$ units. If $m > 0$ the line rises from left to right; if $m < 0$ it falls; and if $m = 0$ the function is constant.

Quadratic Functions

A quadratic function has the form $f(x) = ax^2 + bx + c$ with $a \neq 0$. Its graph is a parabola. When $a > 0$ the parabola opens upward and has a minimum value; when $a < 0$ it opens downward and has a maximum value. The vertex of the parabola is located at $\left(-\dfrac{b}{2a},\; f\!\left(-\dfrac{b}{2a}\right)\right)$, and this point represents the extreme value of the function.

Square Root and Absolute Value Functions

The square root function $f(x) = \sqrt{x}$ is defined for $x \geq 0$ and produces non-negative outputs. Its graph starts at the origin and rises gradually, getting flatter as $x$ increases.

The absolute value function $f(x) = |x|$ returns the non-negative magnitude of $x$. Its graph forms a V-shape with its vertex at the origin. Algebraically, $|x| = x$ when $x \geq 0$ and $|x| = -x$ when $x < 0$.

Piecewise-Defined Functions

A piecewise function uses different formulas on different parts of its domain. For example:

$$f(x) = \begin{cases} x^2 & \text{if } x < 0 \\ 2x + 1 & \text{if } x \geq 0 \end{cases}$$

To evaluate a piecewise function, first determine which piece applies based on the input value, then use the corresponding formula. To graph one, draw each piece on its respective interval, paying careful attention to whether endpoints are included (closed dot) or excluded (open dot).

Even and Odd Functions

Definition: Even and Odd Functions

A function $f$ is even if $f(-x) = f(x)$ for all $x$ in its domain. Graphically, even functions are symmetric about the $y$-axis. Examples: $f(x) = x^2$, $f(x) = |x|$, $f(x) = \cos x$.

A function $f$ is odd if $f(-x) = -f(x)$ for all $x$ in its domain. Graphically, odd functions are symmetric about the origin. Examples: $f(x) = x^3$, $f(x) = x$, $f(x) = \sin x$.

Many functions are neither even nor odd. To test, compute $f(-x)$ and compare it to both $f(x)$ and $-f(x)$.

Example 1.2.1 — Identifying Function Types

Classify $f(x) = 3x^2 - 12x + 7$ and find its vertex.

Solution. This is a quadratic function with $a = 3$, $b = -12$, and $c = 7$. Since $a = 3 > 0$, the parabola opens upward.

The $x$-coordinate of the vertex is:

$$x = -\frac{b}{2a} = -\frac{-12}{2(3)} = \frac{12}{6} = 2$$

The $y$-coordinate is:

$$f(2) = 3(4) - 12(2) + 7 = 12 - 24 + 7 = -5$$

The vertex is $(2, -5)$, and since the parabola opens upward, the minimum value of $f$ is $-5$. The range is $[-5, \infty)$.

Example 1.2.2 — Testing for Symmetry

Determine whether $h(x) = x^3 - x$ is even, odd, or neither.

Solution. Compute $h(-x)$:

$$h(-x) = (-x)^3 - (-x) = -x^3 + x = -(x^3 - x) = -h(x)$$

Since $h(-x) = -h(x)$ for all $x$, the function $h$ is odd. Its graph is symmetric about the origin.

1.3 Transformations of Functions

One of the most powerful ideas in precalculus is that you can build a vast collection of functions by transforming a few basic "parent functions." If you understand the parent function and the transformation rules, you can quickly sketch or analyze any transformed graph without plotting individual points.

Vertical and Horizontal Shifts

Shift Rules

Let $c > 0$ and let $y = f(x)$ be any function.

A common point of confusion: the horizontal shift is in the opposite direction of the sign inside the parentheses. The expression $f(x - 3)$ shifts the graph to the right, not to the left.

Vertical and Horizontal Stretches

Stretch and Compression Rules

Let $a > 0$ and $b > 0$.

Reflections

The General Transformation Formula

All transformations can be combined in a single expression. Given a parent function $f$, the graph of

$$y = a \cdot f\!\big(b(x - h)\big) + k$$

is obtained by applying, in order: horizontal shift by $h$, horizontal stretch/compression by $\frac{1}{b}$, vertical stretch/compression by $|a|$, reflection (if $a < 0$ or $b < 0$), and vertical shift by $k$.

Explore: Adjust the sliders to see how $a$, $h$, and $k$ transform the parabola $y = a(x-h)^2 + k$

In the interactive graph above, the dashed gray curve shows the parent function $y = x^2$ for reference, while the blue curve shows the transformed version $y = a(x - h)^2 + k$. Experiment with different slider values to build intuition:

Example 1.3.1 — Describing Transformations

Describe the transformations applied to the parent function $f(x) = |x|$ to obtain $g(x) = -2|x + 3| + 5$.

Solution. We rewrite $g$ in the general form: $g(x) = -2 \cdot f(x - (-3)) + 5$, so $a = -2$, $h = -3$, and $k = 5$.

  1. Horizontal shift: $h = -3$, so the graph shifts 3 units to the left.
  2. Vertical stretch: $|a| = 2$, so the graph is vertically stretched by a factor of 2 (the V-shape becomes narrower).
  3. Reflection: $a < 0$, so the graph is reflected across the $x$-axis (the V now opens downward).
  4. Vertical shift: $k = 5$, so the graph shifts 5 units up.

The vertex of the parent $|x|$ at $(0, 0)$ moves to $(-3, 5)$.

Example 1.3.2 — Writing an Equation from a Description

The graph of $y = \sqrt{x}$ is shifted 4 units to the right, vertically stretched by a factor of 3, and shifted down 2 units. Write the equation of the transformed function.

Solution. Starting from the parent function $f(x) = \sqrt{x}$:

The transformed function is $g(x) = 3\sqrt{x - 4} - 2$, with domain $[4, \infty)$ and range $[-2, \infty)$.

1.4 Function Operations and Composition

Just as we can add, subtract, multiply, and divide numbers, we can perform these operations on functions. We can also form entirely new functions by plugging one function into another, an operation called composition.

Arithmetic Operations on Functions

Definition: Function Operations

Let $f$ and $g$ be functions with overlapping domains. We define:

In each case, the domain of the resulting function is the intersection of the domains of $f$ and $g$ (with the additional restriction $g(x) \neq 0$ for the quotient).

Function Composition

Composition is a fundamentally different operation from arithmetic. Instead of combining the outputs of two functions, we use the output of one function as the input of another.

Definition: Composition

The composition of $f$ with $g$, written $(f \circ g)(x)$, is defined as:

$$(f \circ g)(x) = f\!\big(g(x)\big)$$

We read this as "$f$ of $g$ of $x$." First evaluate $g(x)$, then feed that result into $f$.

Composition is not commutative in general: $f \circ g \neq g \circ f$ for most functions. The order matters. Think of composition as a pipeline: the input flows through $g$ first, then through $f$.

Domain of a Composite Function

The domain of $f \circ g$ consists of all $x$ in the domain of $g$ such that $g(x)$ is in the domain of $f$. In other words, two conditions must hold:

  1. $x$ must be a valid input for $g$.
  2. The output $g(x)$ must be a valid input for $f$.

Example 1.4.1 — Arithmetic Operations

Let $f(x) = x^2 + 1$ and $g(x) = 3x - 2$. Find $(f + g)(x)$, $(fg)(x)$, and $\left(\dfrac{f}{g}\right)(x)$.

Solution.

$(f + g)(x) = (x^2 + 1) + (3x - 2) = x^2 + 3x - 1$

$(fg)(x) = (x^2 + 1)(3x - 2) = 3x^3 - 2x^2 + 3x - 2$

$\left(\dfrac{f}{g}\right)(x) = \dfrac{x^2 + 1}{3x - 2}$, with domain $\left\{x \in \mathbb{R} : x \neq \dfrac{2}{3}\right\}$

Example 1.4.2 — Composition and Its Domain

Let $f(x) = \sqrt{x}$ and $g(x) = 5 - x^2$. Find $(f \circ g)(x)$ and state its domain.

Solution.

$$(f \circ g)(x) = f\!\big(g(x)\big) = f(5 - x^2) = \sqrt{5 - x^2}$$

For the domain, we need $g(x) \geq 0$ (since $f$ requires non-negative input):

$$5 - x^2 \geq 0 \implies x^2 \leq 5 \implies -\sqrt{5} \leq x \leq \sqrt{5}$$

The domain of $f \circ g$ is $\big[-\sqrt{5},\; \sqrt{5}\big]$.

Note: $(g \circ f)(x) = g(\sqrt{x}) = 5 - (\sqrt{x})^2 = 5 - x$, with domain $[0, \infty)$. This demonstrates that $f \circ g \neq g \circ f$.

1.5 Inverse Functions

An inverse function "undoes" the action of the original function. If $f$ takes an input $x$ and produces output $y$, then the inverse $f^{-1}$ takes $y$ and returns $x$. This concept is central to solving equations and appears throughout calculus, particularly in the study of logarithms, inverse trigonometric functions, and differential equations.

Definition: Inverse Function

Let $f$ be a one-to-one function with domain $A$ and range $B$. The inverse function $f^{-1}$ has domain $B$ and range $A$, and is defined by the property:

$$f^{-1}\!\big(f(x)\big) = x \quad \text{for all } x \in A$$ $$f\!\big(f^{-1}(y)\big) = y \quad \text{for all } y \in B$$

Equivalently, $f^{-1}(y) = x$ if and only if $f(x) = y$.

Important notation: The symbol $f^{-1}$ does not mean $\frac{1}{f}$. The superscript $-1$ in function notation denotes the inverse, not a reciprocal. The reciprocal of $f(x)$ is written as $\frac{1}{f(x)}$ or $[f(x)]^{-1}$ to avoid confusion.

One-to-One Functions and the Horizontal Line Test

Not every function has an inverse. A function must be one-to-one (injective) to have an inverse. A function is one-to-one if no two different inputs produce the same output: whenever $x_1 \neq x_2$, we have $f(x_1) \neq f(x_2)$.

Horizontal Line Test

A function is one-to-one if and only if every horizontal line intersects its graph at most once. If any horizontal line intersects the graph more than once, the function is not one-to-one and does not have an inverse (unless we restrict its domain).

For example, $f(x) = x^2$ is not one-to-one on $(-\infty, \infty)$ because $f(2) = f(-2) = 4$. However, if we restrict the domain to $[0, \infty)$, the function becomes one-to-one, and its inverse is $f^{-1}(x) = \sqrt{x}$.

Finding an Inverse Algebraically

To find the inverse of a one-to-one function $f$:

  1. Write $y = f(x)$.
  2. Swap $x$ and $y$ to get $x = f(y)$.
  3. Solve the resulting equation for $y$.
  4. The solution is $f^{-1}(x) = y$.

Graphs of Inverse Functions

Since we obtain $f^{-1}$ by swapping $x$ and $y$, the graph of $f^{-1}$ is the reflection of the graph of $f$ across the line $y = x$. Every point $(a, b)$ on the graph of $f$ corresponds to a point $(b, a)$ on the graph of $f^{-1}$.

Observe: The function $y = x^2$ (for $x \geq 0$) and its inverse $y = \sqrt{x}$ are reflections over the line $y = x$

In the graph above, the blue curve is $y = x^2$ (restricted to $x \geq 0$), the red curve is its inverse $y = \sqrt{x}$, and the dashed gray line is $y = x$. Notice that every point on the blue curve has a mirror image on the red curve, reflected across $y = x$. The point $(4, 2)$ on the blue curve corresponds to $(2, 4)$ on the red curve.

Example 1.5.1 — Finding an Inverse

Find the inverse of $f(x) = \dfrac{2x + 3}{x - 1}$, where $x \neq 1$.

Solution. Write $y = \dfrac{2x + 3}{x - 1}$ and swap $x$ and $y$:

$$x = \frac{2y + 3}{y - 1}$$

Solve for $y$: multiply both sides by $(y - 1)$:

$$x(y - 1) = 2y + 3$$ $$xy - x = 2y + 3$$ $$xy - 2y = x + 3$$ $$y(x - 2) = x + 3$$ $$y = \frac{x + 3}{x - 2}$$

Therefore, $f^{-1}(x) = \dfrac{x + 3}{x - 2}$, with domain $\{x \in \mathbb{R} : x \neq 2\}$.

Verification: $(f \circ f^{-1})(x) = f\!\left(\frac{x+3}{x-2}\right) = \frac{2\cdot\frac{x+3}{x-2} + 3}{\frac{x+3}{x-2} - 1} = \frac{\frac{2(x+3) + 3(x-2)}{x-2}}{\frac{(x+3)-(x-2)}{x-2}} = \frac{2x+6+3x-6}{x+3-x+2} = \frac{5x}{5} = x$ ✓

Example 1.5.2 — Restricting Domain to Create an Inverse

The function $f(x) = (x - 3)^2 + 1$ is not one-to-one on $(-\infty, \infty)$. Restrict the domain so that $f$ has an inverse, then find $f^{-1}$.

Solution. The vertex of this parabola is at $(3, 1)$. We restrict the domain to $[3, \infty)$ (the right half of the parabola), where $f$ is increasing and therefore one-to-one.

Write $y = (x - 3)^2 + 1$ and swap:

$$x = (y - 3)^2 + 1$$ $$x - 1 = (y - 3)^2$$ $$\sqrt{x - 1} = y - 3 \quad \text{(taking the positive root since } y \geq 3\text{)}$$ $$y = \sqrt{x - 1} + 3$$

Therefore, $f^{-1}(x) = \sqrt{x - 1} + 3$, with domain $[1, \infty)$ and range $[3, \infty)$.

1.6 Practice Problems

Test your understanding of the concepts in this chapter. Each problem has a detailed solution that you can reveal after attempting it yourself.

Problem 1. Find the domain of $f(x) = \dfrac{1}{\sqrt{4 - x^2}}$.

Show Solution

We need two conditions: the expression under the square root must be strictly positive (since the square root is in the denominator, it cannot be zero).

$4 - x^2 > 0 \implies x^2 < 4 \implies -2 < x < 2$

The domain is $(-2, 2)$.

Problem 2. Determine whether $f(x) = x^4 - 3x^2 + 1$ is even, odd, or neither.

Show Solution

Compute $f(-x) = (-x)^4 - 3(-x)^2 + 1 = x^4 - 3x^2 + 1 = f(x)$.

Since $f(-x) = f(x)$, the function is even.

Problem 3. Let $f(x) = 2x - 1$ and $g(x) = x^2 + 3$. Find $(f \circ g)(4)$ and $(g \circ f)(4)$.

Show Solution

$(f \circ g)(4) = f(g(4)) = f(16 + 3) = f(19) = 2(19) - 1 = 37$

$(g \circ f)(4) = g(f(4)) = g(2(4) - 1) = g(7) = 49 + 3 = 52$

Notice that $(f \circ g)(4) \neq (g \circ f)(4)$, confirming that composition is not commutative.

Problem 4. Describe all transformations from $f(x) = \sqrt{x}$ to $g(x) = -\sqrt{x + 2} + 4$.

Show Solution

Rewrite: $g(x) = -1 \cdot f(x - (-2)) + 4$, so $a = -1$, $h = -2$, $k = 4$.

  • Horizontal shift 2 units left ($h = -2$)
  • Reflection across the $x$-axis ($a = -1$)
  • Vertical shift 4 units up ($k = 4$)

The starting point of $\sqrt{x}$ at $(0, 0)$ moves to $(-2, 4)$.

Problem 5. Find the inverse of $f(x) = 5x - 8$.

Show Solution

Write $y = 5x - 8$ and swap $x$ and $y$: $x = 5y - 8$.

Solve for $y$: $x + 8 = 5y$, so $y = \dfrac{x + 8}{5}$.

$f^{-1}(x) = \dfrac{x + 8}{5}$

Verification: $f(f^{-1}(x)) = 5 \cdot \dfrac{x+8}{5} - 8 = x + 8 - 8 = x$ ✓

Problem 6. Evaluate the piecewise function at $x = -3$, $x = 0$, and $x = 5$:

$$f(x) = \begin{cases} x^2 + 1 & \text{if } x < 0 \\ 3 & \text{if } x = 0 \\ 2x - 1 & \text{if } x > 0 \end{cases}$$

Show Solution

$f(-3)$: Since $-3 < 0$, use the first piece: $(-3)^2 + 1 = 9 + 1 = 10$.

$f(0)$: Since $x = 0$, use the second piece: $f(0) = 3$.

$f(5)$: Since $5 > 0$, use the third piece: $2(5) - 1 = 9$.

Problem 7. Find the domain of $(f \circ g)(x)$ where $f(x) = \dfrac{1}{x - 2}$ and $g(x) = \sqrt{x}$.

Show Solution

$(f \circ g)(x) = f(\sqrt{x}) = \dfrac{1}{\sqrt{x} - 2}$

We need:

  1. $x \geq 0$ (for $g(x) = \sqrt{x}$ to be defined)
  2. $\sqrt{x} \neq 2$, i.e., $x \neq 4$ (to avoid division by zero)

Domain: $[0, 4) \cup (4, \infty)$.

Problem 8. Write the equation of the function whose graph is obtained by taking $y = x^2$, shifting it 1 unit left, stretching vertically by a factor of 4, and then shifting down 3 units.

Show Solution

Start with $y = x^2$.

  • Shift 1 unit left: $y = (x + 1)^2$
  • Vertical stretch by 4: $y = 4(x + 1)^2$
  • Shift down 3: $y = 4(x + 1)^2 - 3$

The equation is $y = 4(x + 1)^2 - 3$. The vertex is at $(-1, -3)$.

Problem 9. Show that $f(x) = \dfrac{x}{x + 1}$ and $g(x) = \dfrac{x}{1 - x}$ are inverses of each other.

Show Solution

We verify that $(f \circ g)(x) = x$ and $(g \circ f)(x) = x$.

$(f \circ g)(x) = f\!\left(\dfrac{x}{1-x}\right) = \dfrac{\frac{x}{1-x}}{\frac{x}{1-x} + 1} = \dfrac{\frac{x}{1-x}}{\frac{x + 1 - x}{1-x}} = \dfrac{\frac{x}{1-x}}{\frac{1}{1-x}} = x$ ✓

$(g \circ f)(x) = g\!\left(\dfrac{x}{x+1}\right) = \dfrac{\frac{x}{x+1}}{1 - \frac{x}{x+1}} = \dfrac{\frac{x}{x+1}}{\frac{x+1-x}{x+1}} = \dfrac{\frac{x}{x+1}}{\frac{1}{x+1}} = x$ ✓

Since both compositions equal $x$, the functions are inverses of each other.

Problem 10. Let $f(x) = x^2 - 6x + 11$. Restrict the domain so that $f$ is one-to-one, then find $f^{-1}$.

Show Solution

Complete the square: $f(x) = (x - 3)^2 + 2$. The vertex is at $(3, 2)$.

Restrict to $[3, \infty)$ (or alternatively $(-\infty, 3]$). Using $x \geq 3$:

Write $y = (x - 3)^2 + 2$ and swap: $x = (y - 3)^2 + 2$.

$x - 2 = (y - 3)^2$

$\sqrt{x - 2} = y - 3$ (positive root since $y \geq 3$)

$y = \sqrt{x - 2} + 3$

$f^{-1}(x) = \sqrt{x - 2} + 3$, with domain $[2, \infty)$ and range $[3, \infty)$.

Next: Ch 2 — Polynomial Functions →