Functions in Calculus: definition, domain, composition and worked examples (step by step)
What a function is in Calculus: domain, range, operations, composition, inverse, parity, piecewise functions and core families, step by step.
https://morrisonkuhlsen.com/functions/
Almost everything in Calculus — limits, derivatives, integrals, rates of change, and models — operates on functions. When an error creeps into a derivative or a limit, the culprit is often not the Calculus rule itself, but a detail from earlier on: a point outside the domain, a composition applied in the wrong order, or an inverse used without its required sign restriction.
In this post, we go from the intuitive idea of a function to the tools you use constantly in Calculus: natural domain, basic operations and the difference quotient, composition, inverse functions, symmetry (even and odd), piecewise functions, and the core function families. Every calculation is worked out step by step, checked in Julia, R, and Python, and every general property stated in the text is formally proved in Lean (provas/Provas/Funcoes.lean).
1. The central idea: intuition and definition
A function $f$ from a set $A$ to a set $B$ is a rule that assigns to each element $x \in A$ exactly one element $f(x) \in B$:
\[f: A \to B, \qquad x \mapsto f(x).\]The three sets attached to a function have distinct names and should not be confused:
- Domain ($A$ or $\text{Dom}(f)$): the set of all inputs $x$ for which the function is defined.
- Codomain ($B$): the set of allowed outputs declared in the definition of $f$.
- Range (or image, $\text{Im}(f)$): the set of outputs actually produced as $x$ runs through the domain, that is, $\text{Im}(f) = \lbracef(x) \mid x \in A\rbrace \subseteq B$.
For example, for $f: \mathbb{R} \to \mathbb{R}$ defined by $f(x) = x^2$, the domain is $\mathbb{R}$ and the declared codomain is $\mathbb{R}$, but the range is only $[0, +\infty)$, since no real number has a negative square.
Key notation
| Symbol | Meaning |
|---|---|
| $f(x)$ | value of $f$ at $x$ (read “$f$ of $x$”) |
| $\text{Dom}(f)$ | domain of $f$ |
| $\text{Im}(f)$ | range (image) of $f$ |
| $f \circ g$ | composition: $(f \circ g)(x) = f(g(x))$ |
| $f^{-1}$ | inverse function of $f$ (not $1/f(x)$) |
When does a rule fail to define a function?
Two failures keep a rule from defining a function from $A$ to $B$:
- More than one output for the same input: the rule “assign to $x$ every real number $y$ with $y^2 = x$” sends $x = 4$ to two values ($2$ and $-2$), so it is not a function. By convention, the radical symbol $\sqrt{x}$ selects only the non-negative (principal) square root ($\sqrt{4} = 2$), making $f(x) = \sqrt{x}$ a well-defined function on $[0, +\infty)$.
- An input in the domain with no output: if some $x \in A$ has no value in $B$ (for instance, $x = 0$ in $1/x$), the rule does not define a function on $A$ — that point must be excluded from the domain.
Vertical line test: a curve in the $xy$-plane is the graph of a function $y = f(x)$ if and only if no vertical line intersects the curve more than once. A circle $x^2 + y^2 = 1$ fails the test (at $x = 0$, both $y = 1$ and $y = -1$ lie on it).
2. Natural domain of a function
When a real function is given only by a formula without specifying $A$, we take its natural (or maximal) domain: the largest subset of $\mathbb{R}$ on which the formula produces a well-defined real number.
In single-variable real Calculus, the three most common restrictions are:
- Non-zero denominator: wherever $\frac{1}{u}$ appears, we require $u \neq 0$.
- Even-index root: wherever $\sqrt[2k]{u}$ (such as $\sqrt{u}$) appears, we require $u \geq 0$.
- Logarithm: wherever $\ln u$ or $\log_a u$ ($a > 0$, $a \neq 1$) appears, we require $u > 0$.
Example 1 — Linear denominator
Find the natural domain of $f(x) = \dfrac{1}{x - 3}$.
- Condition: the denominator cannot be zero, so $x - 3 \neq 0$.
- Calculation: adding $3$ to both sides gives $x \neq 3$.
- Result:
- Interpretation: every real number except $3$ works (for instance, $f(2) = \frac{1}{2 - 3} = -1$ and $f(4) = \frac{1}{4 - 3} = 1$), whereas $x = 3$ would force division by zero.
Example 2 — Square root
Find the natural domain of $f(x) = \sqrt{2x - 6}$.
- Condition: for the output to be real, the radicand must be non-negative: $2x - 6 \geq 0$.
- Calculation:
- Result:
- Interpretation: the endpoint $3$ is included because $f(3) = \sqrt{2 \cdot 3 - 6} = \sqrt{0} = 0$ exists; at $x = 5$, $f(5) = \sqrt{10 - 6} = \sqrt{4} = 2$; at $x = 2$, $2 \cdot 2 - 6 = -2 < 0$ has no real square root.
Example 3 — Square root in the numerator and linear denominator
Find the natural domain of $f(x) = \dfrac{\sqrt{x + 1}}{x - 2}$.
- Simultaneous conditions:
- Non-negative radicand: $x + 1 \geq 0 \implies x \geq -1$.
- Non-zero denominator: $x - 2 \neq 0 \implies x \neq 2$.
- Intersection: all real numbers from $-1$ upward, skipping $2$:
- Interpretation: at $x = -1$, $f(-1) = \frac{\sqrt{0}}{-3} = 0$; at $x = 0$, $f(0) = \frac{1}{-2} = -0.5$; at $x = 3$, $f(3) = \frac{\sqrt{4}}{1} = 2$. Only values below $-1$ and the isolated point $x = 2$ are excluded.
Example 4 — Logarithm of a quadratic expression
Find the natural domain of $f(x) = \ln(x^2 - 4)$.
- Condition: the argument of the natural logarithm must be strictly positive: $x^2 - 4 > 0$.
- Factoring and sign analysis: by difference of squares, $x^2 - 4 = (x - 2)(x + 2)$. A product of two factors is positive when both have the same sign:
- both positive: $x - 2 > 0$ and $x + 2 > 0 \implies x > 2$;
- both negative: $x - 2 < 0$ and $x + 2 < 0 \implies x < -2$. Between $-2$ and $2$, the factors have opposite signs and the product is negative; at $x = -2$ and $x = 2$, the argument is $0$ and $\ln 0$ is undefined (the equivalence $x^2 - 4 > 0 \iff x < -2 \text{ or } x > 2$ is proved in Lean).
- Result:
- Interpretation: at $x = 3$ and $x = -3$, we get $f(3) = f(-3) = \ln(9 - 4) = \ln 5 \approx 1.6094$. No number in $[-2, 2]$ belongs to the domain.
Example 5 — Square root in the denominator
Find the natural domain of $f(x) = \dfrac{1}{\sqrt{9 - x^2}}$.
- Condition: the radicand must be non-negative ($9 - x^2 \geq 0$) and the denominator cannot be zero ($\sqrt{9 - x^2} \neq 0$, i.e. $9 - x^2 \neq 0$). Together, the radicand must be strictly positive:
(Equivalence proved in Lean.)
- Result:
- Interpretation: unlike Example 2, the endpoints $-3$ and $3$ are excluded (open interval) because they make the denominator zero. At the center, $f(0) = \frac{1}{\sqrt{9}} = \frac{1}{3}$.
3. Evaluation, basic operations and the difference quotient
Evaluating $f(a)$ means replacing every occurrence of $x$ in the formula of $f$ with $a$, keeping careful track of parentheses and signs.
Given two functions $f$ and $g$ with domains $\text{Dom}(f)$ and $\text{Dom}(g)$, the four arithmetic operations are defined pointwise:
- $(f \pm g)(x) = f(x) \pm g(x)$, with domain $\text{Dom}(f) \cap \text{Dom}(g)$;
- $(f \cdot g)(x) = f(x) \cdot g(x)$, with domain $\text{Dom}(f) \cap \text{Dom}(g)$;
- $\left(\dfrac{f}{g}\right)(x) = \dfrac{f(x)}{g(x)}$, with domain $\lbracex \in \text{Dom}(f) \cap \text{Dom}(g) \mid g(x) \neq 0\rbrace$.
Example 1 — Numerical evaluation
Let $f(x) = x^2 - 3x + 1$. Compute $f(2)$, $f(-1)$, and $f(0)$.
Substituting each value in parentheses before computing powers, products, and sums:
\[\begin{aligned} f(2) &= (2)^2 - 3(2) + 1 = 4 - 6 + 1 = -1, \\ f(-1) &= (-1)^2 - 3(-1) + 1 = 1 + 3 + 1 = 5, \\ f(0) &= (0)^2 - 3(0) + 1 = 0 - 0 + 1 = 1. \end{aligned}\]Interpretation: the points $(2, -1)$, $(-1, 5)$, and $(0, 1)$ lie on the graph of $f$. Notice that $(-1)^2 = +1$ and $-3(-1) = +3$: parentheses prevent the classic sign mistake with negative inputs.
Example 2 — Symbolic evaluation
Let $g(x) = 2x + 5$. Compute $g(x + h)$.
Replace $x$ by the entire block $(x + h)$ and distribute:
\[g(x + h) = 2(x + h) + 5 = 2x + 2h + 5.\]Interpretation: increasing the input by $h$ raises the output of $g$ by $2h$, exactly twice the shift $h$, because the line has slope $2$.
Example 3 — Difference quotient
Let $f(x) = x^2$. Compute the difference quotient $\dfrac{f(x + h) - f(x)}{h}$, for $h \neq 0$.
- Evaluation: $f(x + h) = (x + h)^2 = x^2 + 2xh + h^2$.
- Substitution and simplification (valid for every $h \neq 0$, proved in Lean):
Interpretation: this quotient is the average rate of change of $f$ between $x$ and $x + h$ — geometrically, the slope of the secant line connecting $(x, f(x))$ and $(x + h, f(x + h))$. At $x = 3$, for instance, $h = 1$ gives slope $2(3) + 1 = 7$ and $h = 0.01$ gives $6.01$. Taking the limit as $h \to 0$, $2x + h$ approaches $2x$, which is the derivative (in Portuguese) of $x^2$.
Example 4 — Sum and product of functions
Let $f(x) = x + 1$ and $g(x) = x^2 - 1$, both with domain $\mathbb{R}$. Compute $(f + g)(x)$ and $(f \cdot g)(x)$.
- Sum:
- Product: factoring $x^2 - 1 = (x - 1)(x + 1)$ (difference of squares), or expanding term by term (proved in Lean):
Both have domain $\mathbb{R} \cap \mathbb{R} = \mathbb{R}$.
Example 5 — Quotient of functions and a hole in the domain
Let $f(x) = x^2 - 4$ and $g(x) = x - 2$. Compute $\left(\dfrac{f}{g}\right)(x)$ and its domain.
- Domain before simplifying: $g(x) = x - 2 \neq 0 \implies x \neq 2$.
- Simplification (for $x \neq 2$, we can cancel the non-zero factor $x - 2$; proved in Lean):
Interpretation: the function $f/g$ is not equal to the function $h(x) = x + 2$. Their graphs agree everywhere except at $x = 2$, where $h(2) = 4$ while $f/g$ has a hole (it is undefined). Always determine the domain from the original expression before canceling anything.
4. Function composition
Composing $f$ with $g$ means applying $g$ first to the input $x$, and then applying $f$ to the result:
\[(f \circ g)(x) = f\!\left(g(x)\right).\]We read right to left: $x \xrightarrow{\ g\ } g(x) \xrightarrow{\ f\ } f(g(x))$.
For $f(g(x))$ to be defined, two conditions must hold simultaneously: $x$ must lie in the domain of $g$, and the output $g(x)$ must land in the domain of $f$:
\[\text{Dom}(f \circ g) = \lbracex \in \text{Dom}(g) \mid g(x) \in \text{Dom}(f)\rbrace.\]In general, order matters: $f \circ g \neq g \circ f$.
Example 1 — Composition in both orders (not commutative)
Let $f(x) = x^2 + 1$ and $g(x) = 3x - 2$. Compute $(f \circ g)(x)$ and $(g \circ f)(x)$.
- Computing $(f \circ g)(x)$:
- Computing $(g \circ f)(x)$:
- Conclusion: at $x = 0$, $(f \circ g)(0) = 5$ whereas $(g \circ f)(0) = 1$. Since $5 \neq 1$, $f \circ g \neq g \circ f$: function composition is not commutative (proved in Lean).
Example 2 — Pointwise evaluation of a composition
Let $f(x) = \sqrt{x}$ and $g(x) = x^2 + 4$. Compute $(f \circ g)(3)$ and find the domain of $f \circ g$.
- First apply $g$ at $x = 3$: $g(3) = 3^2 + 4 = 9 + 4 = 13$.
- Then apply $f$ to the output: $(f \circ g)(3) = f(13) = \sqrt{13} \approx 3.6056$.
- Domain: $\text{Dom}(g) = \mathbb{R}$ and we need $g(x) = x^2 + 4 \geq 0$. Since $x^2 \geq 0$ for all $x \in \mathbb{R}$, $x^2 + 4 \geq 4 > 0$ always; hence $\text{Dom}(f \circ g) = \mathbb{R}$.
Example 3 — Decomposition (preparing for the chain rule)
Write $h(x) = (2x + 1)^5$ as a composition $f \circ g$.
Identify the inner function (computed first) as $g(x) = 2x + 1$ and the outer function (applied to the result) as $f(u) = u^5$:
\[(f \circ g)(x) = f(2x + 1) = (2x + 1)^5 = h(x).\]Note: the decomposition is not unique — for example, $g_2(x) = 2x$ and $f_2(u) = (u + 1)^5$ also give $(f_2 \circ g_2)(x) = (2x + 1)^5$. In Calculus, we pick the split that makes each piece easiest to differentiate with the chain rule.
Example 4 — Domain of a composition
Let $f(x) = \dfrac{1}{x}$ ($\text{Dom}(f) = \mathbb{R} \setminus \lbrace0\rbrace$) and $g(x) = x + 3$ ($\text{Dom}(g) = \mathbb{R}$). Compute $(f \circ g)(x)$ and its domain.
- Formula: $(f \circ g)(x) = f(x + 3) = \dfrac{1}{x + 3}$.
- Domain: all $x \in \mathbb{R}$ with $g(x) \in \text{Dom}(f)$, that is, $x + 3 \neq 0 \implies x \neq -3$.
- Result: $\text{Dom}(f \circ g) = \mathbb{R} \setminus \lbrace-3\rbrace$.
Example 5 — Triple composition
Let $f(x) = 2x$, $g(x) = x + 1$, and $h(x) = x^2$. Compute $(f \circ g \circ h)(x)$.
Apply from right to left ($h$, then $g$, then $f$; proved in Lean):
\[\begin{aligned} (g \circ h)(x) &= g(h(x)) = g(x^2) = x^2 + 1, \\ (f \circ g \circ h)(x) &= f(x^2 + 1) = 2(x^2 + 1) = 2x^2 + 2. \end{aligned}\]5. Inverse functions
A function $f: A \to B$ has an inverse function $f^{-1}: B \to A$ when it is bijective, meaning two things hold at once:
- Injective (one-to-one): different inputs produce different outputs ($x_1 \neq x_2 \implies f(x_1) \neq f(x_2)$). Graphically, it passes the horizontal line test: no horizontal line crosses the graph more than once.
- Surjective (onto): every element of $B$ is hit by some $x \in A$, that is, $\text{Im}(f) = B$.
When $f$ is bijective, $f^{-1}$ swaps the roles of input and output — the domain of $f^{-1}$ is the range of $f$, and the range of $f^{-1}$ is the domain of $f$. Both cancellation equations must hold:
\[f\!\left(f^{-1}(y)\right) = y \quad (\forall y \in B) \qquad \text{and} \qquad f^{-1}\!\left(f(x)\right) = x \quad (\forall x \in A).\]Algebraic recipe: write $y = f(x)$, solve for $x$ in terms of $y$, swap the variable names $x \leftrightarrow y$ (so $x$ stays the independent variable), state the domain of $f^{-1}$ (which is $\text{Im}(f)$), and verify both directions.
Watch the notation: $f^{-1}(x)$ means the inverse function, not the reciprocal $\dfrac{1}{f(x)}$. For the reciprocal, write $[f(x)]^{-1}$ or $1/f(x)$.
Example 1 — Linear function
Let $f: \mathbb{R} \to \mathbb{R}$ be $f(x) = 2x + 3$. Find $f^{-1}(x)$.
\[\begin{aligned} y &= 2x + 3 \\ y - 3 &= 2x \\ x &= \frac{y - 3}{2}. \end{aligned}\]Swapping $x \leftrightarrow y$: $f^{-1}(x) = \dfrac{x - 3}{2}$, with domain $\mathbb{R}$ and range $\mathbb{R}$.
Verification in both directions (proved in Lean):
\[f\!\left(f^{-1}(x)\right) = 2 \cdot \frac{x - 3}{2} + 3 = (x - 3) + 3 = x, \qquad f^{-1}\!\left(f(x)\right) = \frac{(2x + 3) - 3}{2} = \frac{2x}{2} = x.\]Example 2 — Cubic function
Let $f: \mathbb{R} \to \mathbb{R}$ be $f(x) = x^3 - 1$. Find $f^{-1}(x)$.
Because $x^3 - 1$ is strictly increasing on $\mathbb{R}$ and takes every real value, $f$ is bijective (proved in Lean):
\[\begin{aligned} y &= x^3 - 1 \\ x^3 &= y + 1 \\ x &= \sqrt[3]{y + 1}. \end{aligned}\]Hence $f^{-1}(x) = \sqrt[3]{x + 1}$, with domain $\mathbb{R}$ and range $\mathbb{R}$ (the cube root is defined for negative numbers too).
Verification: $f(f^{-1}(x)) = (\sqrt[3]{x + 1})^3 - 1 = (x + 1) - 1 = x$ and $f^{-1}(f(x)) = \sqrt[3]{(x^3 - 1) + 1} = \sqrt[3]{x^3} = x$.
Example 3 — Rational function (an involution)
Let $f(x) = \dfrac{x + 2}{x - 1}$, with domain $\mathbb{R} \setminus \lbrace1\rbrace$. Find $f^{-1}(x)$.
Before solving for $x$, rewrite $f(x) = \dfrac{(x - 1) + 3}{x - 1} = 1 + \dfrac{3}{x - 1}$. Because $\dfrac{3}{x - 1}$ is never zero, $y = f(x)$ never equals $1$: thus $\text{Im}(f) = \mathbb{R} \setminus \lbrace1\rbrace$, which guarantees $y - 1 \neq 0$ in the last step:
\[\begin{aligned} y &= \frac{x + 2}{x - 1} \\ y(x - 1) &= x + 2 \\ yx - y &= x + 2 \\ yx - x &= y + 2 \\ x(y - 1) &= y + 2 \\ x &= \frac{y + 2}{y - 1} \qquad (y \neq 1). \end{aligned}\]Swapping $x \leftrightarrow y$:
\[f^{-1}(x) = \frac{x + 2}{x - 1}, \qquad x \neq 1.\]Verification (for every $x \neq 1$, proved in Lean):
\[f(f(x)) = \frac{\frac{x + 2}{x - 1} + 2}{\frac{x + 2}{x - 1} - 1} = \frac{\frac{(x + 2) + 2(x - 1)}{x - 1}}{\frac{(x + 2) - (x - 1)}{x - 1}} = \frac{3x}{3} = x.\]This function is its own inverse ($f^{-1} = f$) — a function with that property is called an involution.
Example 4 — Exponential and natural logarithm
Let $f: \mathbb{R} \to (0, +\infty)$ be $f(x) = e^{x - 2}$. Find $f^{-1}(x)$.
Since $e^u > 0$ for all $u \in \mathbb{R}$, we have $y > 0$ (range $(0, +\infty)$), so we can take the natural logarithm of both sides:
\[\begin{aligned} y &= e^{x - 2} \\ \ln y &= x - 2 \\ x &= \ln y + 2. \end{aligned}\]Thus $f^{-1}(x) = \ln x + 2$, with domain $(0, +\infty)$ and range $\mathbb{R}$.
Verification in both directions (proved in Lean):
- For every $x > 0$: $f(f^{-1}(x)) = e^{(\ln x + 2) - 2} = e^{\ln x} = x$.
- For every $x \in \mathbb{R}$: $f^{-1}(f(x)) = \ln(e^{x - 2}) + 2 = (x - 2) + 2 = x$.
Example 5 — Square root and a restricted inverse domain
Let $f(x) = \sqrt{x - 1}$, with domain $[1, +\infty)$. Find $f^{-1}(x)$.
Because the principal square root is always non-negative, $y = \sqrt{x - 1} \geq 0$; hence $\text{Im}(f) = [0, +\infty)$. Squaring both sides:
\[\begin{aligned} y &= \sqrt{x - 1} \qquad (y \geq 0) \\ y^2 &= x - 1 \\ x &= y^2 + 1. \end{aligned}\]Therefore:
\[f^{-1}(x) = x^2 + 1, \qquad x \geq 0.\]Why is the restriction $x \geq 0$ mandatory? Without it, $x^2 + 1$ is a full parabola and is not one-to-one. Check both directions (proved in Lean):
- For every $x \geq 1$: $f^{-1}(f(x)) = (\sqrt{x - 1})^2 + 1 = (x - 1) + 1 = x$.
-
For every $x \geq 0$: $f(f^{-1}(x)) = \sqrt{(x^2 + 1) - 1} = \sqrt{x^2} = x = x$.
If we plug in a negative input like $x = -2$ outside the domain of $f^{-1}$, we get $f(f^{-1}(-2)) = \sqrt{(-2)^2} = 2 \neq -2$: cancellation fails! Geometrically, the graph of $f^{-1}$ is the reflection of the graph of $f$ across the line $y = x$, and only the $x \geq 0$ branch of the parabola reflects the square-root curve (see Figure 1 in the next section).
Checking operations, composition, and inverses on a computer
The block below checks numerically the difference quotient of $x^2$, the non-commutativity of $f \circ g$ and $g \circ f$, and the inverses in both directions — including what goes wrong if you drop the restriction $x \geq 0$ in Example 5.
using Printf
# 1) Difference quotient of f(x) = x² at x = 3 (limit value: 2x = 6)
f_sq(x) = x^2
println("1) Difference quotient of f(x) = x² at x = 3:")
for h in (1.0, 0.1, 0.01, 0.001)
dq = (f_sq(3 + h) - f_sq(3)) / h
@printf(" h = %5.3f -> (f(3+h) - f(3))/h = %.4f (2x + h = %.4f)\n", h, dq, 6 + h)
end
# 2) Composition is not commutative: f(x) = x² + 1, g(x) = 3x - 2
f(x) = x^2 + 1
g(x) = 3x - 2
println("\n2) Composition (f ∘ g)(x) vs. (g ∘ f)(x):")
for x in (0, 1, 2)
@printf(" x = %d -> (f ∘ g)(%d) = %2d, (g ∘ f)(%d) = %2d\n", x, x, f(g(x)), x, g(f(x)))
end
# 3) Checking inverses in both directions: f(f⁻¹(y)) = y and f⁻¹(f(x)) = x
lin(x) = 2x + 3
lin_inv(x) = (x - 3) / 2
invol(x) = (x + 2) / (x - 1) # self-inverse (x != 1)
root(x) = sqrt(x - 1) # domain x >= 1
root_inv(x) = x^2 + 1 # domain x >= 0
println("\n3) Inverse verification:")
@printf(" linear: f(f⁻¹(7)) = %.1f, f⁻¹(f(7)) = %.1f\n", lin(lin_inv(7)), lin_inv(lin(7)))
@printf(" involution: f(f(4)) = %.1f\n", invol(invol(4)))
@printf(" square root: f(f⁻¹(2)) = %.1f, f⁻¹(f(5)) = %.1f\n", root(root_inv(2)), root_inv(root(5)))
@printf(" careful (x = -2 outside domain x >= 0): f(f⁻¹(-2)) = %.1f != -2\n", root(root_inv(-2)))
1) Difference quotient of f(x) = x² at x = 3: h = 1.000 -> (f(3+h) - f(3))/h = 7.0000 (2x + h = 7.0000) h = 0.100 -> (f(3+h) - f(3))/h = 6.1000 (2x + h = 6.1000) h = 0.010 -> (f(3+h) - f(3))/h = 6.0100 (2x + h = 6.0100) h = 0.001 -> (f(3+h) - f(3))/h = 6.0010 (2x + h = 6.0010) 2) Composition (f ∘ g)(x) vs. (g ∘ f)(x): x = 0 -> (f ∘ g)(0) = 5, (g ∘ f)(0) = 1 x = 1 -> (f ∘ g)(1) = 2, (g ∘ f)(1) = 4 x = 2 -> (f ∘ g)(2) = 17, (g ∘ f)(2) = 13 3) Inverse verification: linear: f(f⁻¹(7)) = 7.0, f⁻¹(f(7)) = 7.0 involution: f(f(4)) = 4.0 square root: f(f⁻¹(2)) = 2.0, f⁻¹(f(5)) = 5.0 careful (x = -2 outside domain x >= 0): f(f⁻¹(-2)) = 2.0 != -2
# 1) Difference quotient of f(x) = x² at x = 3 (limit value: 2x = 6)
f_sq <- function(x) x^2
cat("1) Difference quotient of f(x) = x² at x = 3:\n")
for (h in c(1.0, 0.1, 0.01, 0.001)) {
dq <- (f_sq(3 + h) - f_sq(3)) / h
cat(sprintf(" h = %5.3f -> (f(3+h) - f(3))/h = %.4f (2x + h = %.4f)\n", h, dq, 6 + h))
}
# 2) Composition is not commutative: f(x) = x² + 1, g(x) = 3x - 2
f <- function(x) x^2 + 1
g <- function(x) 3 * x - 2
cat("\n2) Composition (f ∘ g)(x) vs. (g ∘ f)(x):\n")
for (x in c(0, 1, 2)) {
cat(sprintf(" x = %d -> (f ∘ g)(%d) = %2d, (g ∘ f)(%d) = %2d\n", x, x, f(g(x)), x, g(f(x))))
}
# 3) Checking inverses in both directions: f(f⁻¹(y)) = y and f⁻¹(f(x)) = x
lin <- function(x) 2 * x + 3
lin_inv <- function(x) (x - 3) / 2
invol <- function(x) (x + 2) / (x - 1) # self-inverse (x != 1)
root <- function(x) sqrt(x - 1) # domain x >= 1
root_inv <- function(x) x^2 + 1 # domain x >= 0
cat("\n3) Inverse verification:\n")
cat(sprintf(" linear: f(f⁻¹(7)) = %.1f, f⁻¹(f(7)) = %.1f\n", lin(lin_inv(7)), lin_inv(lin(7))))
cat(sprintf(" involution: f(f(4)) = %.1f\n", invol(invol(4))))
cat(sprintf(" square root: f(f⁻¹(2)) = %.1f, f⁻¹(f(5)) = %.1f\n", root(root_inv(2)), root_inv(root(5))))
cat(sprintf(" careful (x = -2 outside domain x >= 0): f(f⁻¹(-2)) = %.1f != -2\n", root(root_inv(-2))))
1) Difference quotient of f(x) = x² at x = 3: h = 1.000 -> (f(3+h) - f(3))/h = 7.0000 (2x + h = 7.0000) h = 0.100 -> (f(3+h) - f(3))/h = 6.1000 (2x + h = 6.1000) h = 0.010 -> (f(3+h) - f(3))/h = 6.0100 (2x + h = 6.0100) h = 0.001 -> (f(3+h) - f(3))/h = 6.0010 (2x + h = 6.0010) 2) Composition (f ∘ g)(x) vs. (g ∘ f)(x): x = 0 -> (f ∘ g)(0) = 5, (g ∘ f)(0) = 1 x = 1 -> (f ∘ g)(1) = 2, (g ∘ f)(1) = 4 x = 2 -> (f ∘ g)(2) = 17, (g ∘ f)(2) = 13 3) Inverse verification: linear: f(f⁻¹(7)) = 7.0, f⁻¹(f(7)) = 7.0 involution: f(f(4)) = 4.0 square root: f(f⁻¹(2)) = 2.0, f⁻¹(f(5)) = 5.0 careful (x = -2 outside domain x >= 0): f(f⁻¹(-2)) = 2.0 != -2
import math
# 1) Difference quotient of f(x) = x² at x = 3 (limit value: 2x = 6)
f_sq = lambda x: x**2
print("1) Difference quotient of f(x) = x² at x = 3:")
for h in (1.0, 0.1, 0.01, 0.001):
dq = (f_sq(3 + h) - f_sq(3)) / h
print(f" h = {h:5.3f} -> (f(3+h) - f(3))/h = {dq:.4f} (2x + h = {6 + h:.4f})")
# 2) Composition is not commutative: f(x) = x² + 1, g(x) = 3x - 2
f = lambda x: x**2 + 1
g = lambda x: 3 * x - 2
print("\n2) Composition (f ∘ g)(x) vs. (g ∘ f)(x):")
for x in (0, 1, 2):
print(f" x = {x} -> (f ∘ g)({x}) = {f(g(x)):2d}, (g ∘ f)({x}) = {g(f(x)):2d}")
# 3) Checking inverses in both directions: f(f⁻¹(y)) = y and f⁻¹(f(x)) = x
lin = lambda x: 2 * x + 3
lin_inv = lambda x: (x - 3) / 2
invol = lambda x: (x + 2) / (x - 1) # self-inverse (x != 1)
root = lambda x: math.sqrt(x - 1) # domain x >= 1
root_inv = lambda x: x**2 + 1 # domain x >= 0
print("\n3) Inverse verification:")
print(f" linear: f(f⁻¹(7)) = {lin(lin_inv(7)):.1f}, f⁻¹(f(7)) = {lin_inv(lin(7)):.1f}")
print(f" involution: f(f(4)) = {invol(invol(4)):.1f}")
print(f" square root: f(f⁻¹(2)) = {root(root_inv(2)):.1f}, f⁻¹(f(5)) = {root_inv(root(5)):.1f}")
print(f" careful (x = -2 outside domain x >= 0): f(f⁻¹(-2)) = {root(root_inv(-2)):.1f} != -2")
1) Difference quotient of f(x) = x² at x = 3: h = 1.000 -> (f(3+h) - f(3))/h = 7.0000 (2x + h = 7.0000) h = 0.100 -> (f(3+h) - f(3))/h = 6.1000 (2x + h = 6.1000) h = 0.010 -> (f(3+h) - f(3))/h = 6.0100 (2x + h = 6.0100) h = 0.001 -> (f(3+h) - f(3))/h = 6.0010 (2x + h = 6.0010) 2) Composition (f ∘ g)(x) vs. (g ∘ f)(x): x = 0 -> (f ∘ g)(0) = 5, (g ∘ f)(0) = 1 x = 1 -> (f ∘ g)(1) = 2, (g ∘ f)(1) = 4 x = 2 -> (f ∘ g)(2) = 17, (g ∘ f)(2) = 13 3) Inverse verification: linear: f(f⁻¹(7)) = 7.0, f⁻¹(f(7)) = 7.0 involution: f(f(4)) = 4.0 square root: f(f⁻¹(2)) = 2.0, f⁻¹(f(5)) = 5.0 careful (x = -2 outside domain x >= 0): f(f⁻¹(-2)) = 2.0 != -2
6. Even and odd functions
To test a function’s parity, its domain must first be symmetric about the origin: whenever $x \in \text{Dom}(f)$, $-x \in \text{Dom}(f)$ as well (otherwise $f(-x)$ may not even be defined — for example, $f(x) = \sqrt{x}$ on $[0, +\infty)$ is neither even nor odd).
On a symmetric domain:
- Even function: $f(-x) = f(x)$ for every $x \in \text{Dom}(f)$. Its graph is symmetric across the vertical $y$-axis (left–right mirror image).
- Odd function: $f(-x) = -f(x)$ for every $x \in \text{Dom}(f)$. Its graph is symmetric about the origin ($180°$ rotation).
Most functions are neither even nor odd.
Example 1 — $f(x) = x^2 + 4$
Domain $\mathbb{R}$ (symmetric). Substituting $-x$ for $x$ (proved in Lean):
\[f(-x) = (-x)^2 + 4 = x^2 + 4 = f(x).\]So $f$ is even.
Example 2 — $f(x) = x^3 - 2x$
Domain $\mathbb{R}$ (symmetric). Substituting $-x$ for $x$ (proved in Lean):
\[f(-x) = (-x)^3 - 2(-x) = -x^3 + 2x = -(x^3 - 2x) = -f(x).\]So $f$ is odd.
Example 3 — $f(x) = x^2 + x$
Domain $\mathbb{R}$ (symmetric). Substituting $-x$ for $x$:
\[f(-x) = (-x)^2 + (-x) = x^2 - x.\]To be certain that $f$ is neither even nor odd, a single test point such as $x = 1$ suffices:
\[f(1) = 1^2 + 1 = 2, \qquad f(-1) = (-1)^2 + (-1) = 1 - 1 = 0.\]Since $f(-1) = 0$ equals neither $f(1) = 2$ nor $-f(1) = -2$, the function is neither even nor odd (proved in Lean).
Example 4 — $f(x) = \cos x$
Domain $\mathbb{R}$ (symmetric). On the unit circle, the angles $x$ and $-x$ share the same horizontal coordinate, so $\cos(-x) = \cos x$ for all $x \in \mathbb{R}$ (proved in Lean). Thus $\cos x$ is even.
Example 5 — $f(x) = \sin x$
Domain $\mathbb{R}$ (symmetric). The angles $x$ and $-x$ have opposite vertical coordinates, so $\sin(-x) = -\sin x$ for all $x \in \mathbb{R}$ (proved in Lean). Thus $\sin x$ is odd.
7. Piecewise functions
A piecewise function uses different formulas on disjoint subsets of its domain. To compute $f(a)$, first check which branch contains $a$, and then evaluate only that branch’s formula.
Example 1 — Evaluating a two-branch function
\[f(x) = \begin{cases} x^2, & x < 0, \\ 2x + 1, & x \geq 0. \end{cases}\]Compute $f(-3)$, $f(0)$, and $f(4)$.
- $x = -3 < 0$ (first branch): $f(-3) = (-3)^2 = 9$.
- $x = 0 \geq 0$ (second branch, since it includes equality): $f(0) = 2(0) + 1 = 1$.
- $x = 4 \geq 0$ (second branch): $f(4) = 2(4) + 1 = 9$.
Note: two different inputs ($-3$ and $4$) give the same output ($9$) — completely allowed for a function (it only means $f$ is not one-to-one). Notice also the jump at $x = 0$: from the left $x^2 \to 0$, while at $x = 0$ the value is already $1$.
Example 2 — Absolute value as a piecewise function
Rewrite $f(x) = \lvert x - 2\rvert$ without absolute value bars and evaluate $f(5)$ and $f(-1)$.
The expression $x - 2$ changes sign at $x = 2$: if $x \geq 2$, $x - 2 \geq 0$ and the bars drop unchanged; if $x < 2$, $x - 2 < 0$ and we flip the sign:
\[\lvert x - 2\rvert = \begin{cases} x - 2, & x \geq 2, \\ -(x - 2) = 2 - x, & x < 2. \end{cases}\]- For $x = 5 \geq 2$: $f(5) = 5 - 2 = 3$.
- For $x = -1 < 2$: $f(-1) = 2 - (-1) = 2 + 1 = 3$.
Interpretation: $\lvert x - 2\rvert$ measures the distance from $x$ to $2$ on the real line; both $5$ and $-1$ sit $3$ units away from $2$.
Example 3 — Continuity at a junction point
\[g(x) = \begin{cases} 3x - 1, & x < 2, \\ ax + 3, & x \geq 2. \end{cases}\]Find the constant $a$ so that $g$ is continuous at $x = 2$.
By the definition of continuity at $x = 2$, three conditions must hold: (1) $g(2)$ is defined, (2) $\lim_{x \to 2} g(x)$ exists (equal one-sided limits), and (3) that limit equals $g(2)$. Computing each piece:
\[\begin{aligned} g(2) &= a(2) + 3 = 2a + 3, \\ \lim_{x \to 2^-} g(x) &= \lim_{x \to 2^-} (3x - 1) = 3(2) - 1 = 5, \\ \lim_{x \to 2^+} g(x) &= \lim_{x \to 2^+} (ax + 3) = 2a + 3. \end{aligned}\]Since the right-hand limit already matches $g(2)$, we set the left-hand limit equal to $2a + 3$:
\[\begin{aligned} 2a + 3 &= 5 \\ 2a &= 5 - 3 = 2 \\ a &= \frac{2}{2} = 1. \end{aligned}\]Interpretation: with $a = 1$, both branches meet cleanly at $(2, 5)$ with no jump; for any other $a$ (such as $a = 2$, where $g(2) = 7$), the graph jumps vertically at $x = 2$ (Figure 2, left).
Example 4 — Heaviside step function
In engineering and differential equations, the Heaviside step function models a switch that turns on at $x = 0$. Using the convention $H(0) = 1$ (some texts define $H(0) = 0$ or $H(0) = 1/2$, depending on the field):
\[H(x) = \begin{cases} 0, & x < 0, \\ 1, & x \geq 0. \end{cases}\]Compute $H(-5)$, $H(0)$, $H(3)$, and write $2H(x - 1)$ piecewise.
- $H(-5) = 0$ (since $-5 < 0$);
- $H(0) = 1$ (since $0 \geq 0$);
- $H(3) = 1$ (since $3 \geq 0$).
For $2H(x - 1)$, replace $x$ by $x - 1$ in the conditions: $x - 1 < 0 \iff x < 1$ and $x - 1 \geq 0 \iff x \geq 1$:
\[2H(x - 1) = \begin{cases} 2 \cdot 0 = 0, & x < 1, \\ 2 \cdot 1 = 2, & x \geq 1. \end{cases}\]Interpretation: the shift $x - 1$ moves the switching point to $x = 1$, and the factor $2$ doubles the height of the step.
Example 5 — Simplifying an absolute-value ratio
Let $f(x) = \dfrac{\lvert x^2 - 1\rvert}{x + 1}$, with $x \neq -1$. Simplify $f(x)$ for $x > 1$ and for $-1 < x < 1$ (and see what happens for $x < -1$).
Because $x \neq -1$, the factor $x + 1$ is never zero and can be canceled once we remove the absolute value bars (all three branches are proved in Lean):
- For $x > 1$: $x^2 - 1 > 0$, so $\lvert x^2 - 1\rvert = x^2 - 1 = (x - 1)(x + 1)$, and
- For $-1 < x < 1$: $x^2 - 1 < 0$, so $\lvert x^2 - 1\rvert = -(x^2 - 1) = 1 - x^2 = (1 - x)(1 + x)$, and
- Elsewhere in the domain: at $x = 1$, $f(1) = \frac{0}{2} = 0$ (agreeing with both branches); for $x < -1$, $x^2 - 1 > 0$ again, so $f(x) = x - 1$. At $x = -1$ (outside the domain), the function jumps from $-2$ on the left to $+2$ on the right (Figure 2, right).
Checking parity and piecewise functions on a computer
The block below numerically checks the parity of the five functions in Section 6 at $x = 2$, compares the one-sided limits of $g(x)$ at $x = 2$ for $a = 1$ and $a = 2$, and verifies the simplified branches of $\lvert x^2 - 1\rvert/(x + 1)$.
using Printf
# 1) Numerical parity check at x = 2
tests = [
("x² + 4", x -> x^2 + 4),
("x³ - 2x", x -> x^3 - 2x),
("x² + x", x -> x^2 + x),
("cos(x)", cos),
("sin(x)", sin),
]
println("1) Parity at x = 2:")
for (name, fn) in tests
pos, neg = fn(2.0), fn(-2.0)
kind = isapprox(neg, pos) ? "even" : isapprox(neg, -pos) ? "odd" : "neither"
@printf(" %-8s f(2) = %7.4f f(-2) = %7.4f -> %s\n", name, pos, neg, kind)
end
# 2) Continuous join: g(x) = 3x - 1 (x < 2), a*x + 3 (x >= 2)
g_piecewise(x, a) = x < 2 ? 3x - 1 : a * x + 3
println("\n2) One-sided limits at x = 2 for g(x):")
for a in (1, 2)
left = g_piecewise(2 - 1e-6, a)
right = g_piecewise(2 + 1e-6, a)
@printf(" a = %d -> left = %.6f, right = %.6f, g(2) = %.1f\n",
a, left, right, g_piecewise(2.0, a))
end
# 3) Simplifying |x² - 1| / (x + 1) for x != -1
h(x) = abs(x^2 - 1) / (x + 1)
println("\n3) |x² - 1| / (x + 1) vs. simplified branches:")
for x in (-2.0, -0.5, 0.5, 2.0)
expected = (-1 < x < 1) ? (1 - x) : (x - 1)
@printf(" x = %5.1f -> h(x) = %6.2f (branch = %6.2f)\n", x, h(x), expected)
end
1) Parity at x = 2: x² + 4 f(2) = 8.0000 f(-2) = 8.0000 -> even x³ - 2x f(2) = 4.0000 f(-2) = -4.0000 -> odd x² + x f(2) = 6.0000 f(-2) = 2.0000 -> neither cos(x) f(2) = -0.4161 f(-2) = -0.4161 -> even sin(x) f(2) = 0.9093 f(-2) = -0.9093 -> odd 2) One-sided limits at x = 2 for g(x): a = 1 -> left = 4.999997, right = 5.000001, g(2) = 5.0 a = 2 -> left = 4.999997, right = 7.000002, g(2) = 7.0 3) |x² - 1| / (x + 1) vs. simplified branches: x = -2.0 -> h(x) = -3.00 (branch = -3.00) x = -0.5 -> h(x) = 1.50 (branch = 1.50) x = 0.5 -> h(x) = 0.50 (branch = 0.50) x = 2.0 -> h(x) = 1.00 (branch = 1.00)
# 1) Numerical parity check at x = 2
tests <- list(
"x² + 4" = function(x) x^2 + 4,
"x³ - 2x" = function(x) x^3 - 2 * x,
"x² + x" = function(x) x^2 + x,
"cos(x)" = cos,
"sin(x)" = sin
)
cat("1) Parity at x = 2:\n")
for (name in names(tests)) {
fn <- tests[[name]]
pos <- fn(2.0)
neg <- fn(-2.0)
kind <- if (abs(neg - pos) < 1e-9) "even" else if (abs(neg + pos) < 1e-9) "odd" else "neither"
cat(sprintf(" %-8s f(2) = %7.4f f(-2) = %7.4f -> %s\n", name, pos, neg, kind))
}
# 2) Continuous join: g(x) = 3x - 1 (x < 2), a*x + 3 (x >= 2)
g_piecewise <- function(x, a) if (x < 2) 3 * x - 1 else a * x + 3
cat("\n2) One-sided limits at x = 2 for g(x):\n")
for (a in c(1, 2)) {
left <- g_piecewise(2 - 1e-6, a)
right <- g_piecewise(2 + 1e-6, a)
cat(sprintf(" a = %d -> left = %.6f, right = %.6f, g(2) = %.1f\n",
a, left, right, g_piecewise(2.0, a)))
}
# 3) Simplifying |x² - 1| / (x + 1) for x != -1
h <- function(x) abs(x^2 - 1) / (x + 1)
cat("\n3) |x² - 1| / (x + 1) vs. simplified branches:\n")
for (x in c(-2.0, -0.5, 0.5, 2.0)) {
expected <- if (x > -1 && x < 1) 1 - x else x - 1
cat(sprintf(" x = %5.1f -> h(x) = %6.2f (branch = %6.2f)\n", x, h(x), expected))
}
1) Parity at x = 2: x² + 4 f(2) = 8.0000 f(-2) = 8.0000 -> even x³ - 2x f(2) = 4.0000 f(-2) = -4.0000 -> odd x² + x f(2) = 6.0000 f(-2) = 2.0000 -> neither cos(x) f(2) = -0.4161 f(-2) = -0.4161 -> even sin(x) f(2) = 0.9093 f(-2) = -0.9093 -> odd 2) One-sided limits at x = 2 for g(x): a = 1 -> left = 4.999997, right = 5.000001, g(2) = 5.0 a = 2 -> left = 4.999997, right = 7.000002, g(2) = 7.0 3) |x² - 1| / (x + 1) vs. simplified branches: x = -2.0 -> h(x) = -3.00 (branch = -3.00) x = -0.5 -> h(x) = 1.50 (branch = 1.50) x = 0.5 -> h(x) = 0.50 (branch = 0.50) x = 2.0 -> h(x) = 1.00 (branch = 1.00)
import math
# 1) Numerical parity check at x = 2
tests = [
("x² + 4", lambda x: x**2 + 4),
("x³ - 2x", lambda x: x**3 - 2 * x),
("x² + x", lambda x: x**2 + x),
("cos(x)", math.cos),
("sin(x)", math.sin),
]
print("1) Parity at x = 2:")
for name, fn in tests:
pos, neg = fn(2.0), fn(-2.0)
if math.isclose(neg, pos):
kind = "even"
elif math.isclose(neg, -pos):
kind = "odd"
else:
kind = "neither"
print(f" {name:<8} f(2) = {pos:7.4f} f(-2) = {neg:7.4f} -> {kind}")
# 2) Continuous join: g(x) = 3x - 1 (x < 2), a*x + 3 (x >= 2)
def g_piecewise(x, a):
return 3 * x - 1 if x < 2 else a * x + 3
print("\n2) One-sided limits at x = 2 for g(x):")
for a in (1, 2):
left = g_piecewise(2 - 1e-6, a)
right = g_piecewise(2 + 1e-6, a)
print(f" a = {a} -> left = {left:.6f}, right = {right:.6f}, g(2) = {g_piecewise(2.0, a):.1f}")
# 3) Simplifying |x² - 1| / (x + 1) for x != -1
h = lambda x: abs(x**2 - 1) / (x + 1)
print("\n3) |x² - 1| / (x + 1) vs. simplified branches:")
for x in (-2.0, -0.5, 0.5, 2.0):
expected = (1 - x) if (-1 < x < 1) else (x - 1)
print(f" x = {x:5.1f} -> h(x) = {h(x):6.2f} (branch = {expected:6.2f})")
1) Parity at x = 2: x² + 4 f(2) = 8.0000 f(-2) = 8.0000 -> even x³ - 2x f(2) = 4.0000 f(-2) = -4.0000 -> odd x² + x f(2) = 6.0000 f(-2) = 2.0000 -> neither cos(x) f(2) = -0.4161 f(-2) = -0.4161 -> even sin(x) f(2) = 0.9093 f(-2) = -0.9093 -> odd 2) One-sided limits at x = 2 for g(x): a = 1 -> left = 4.999997, right = 5.000001, g(2) = 5.0 a = 2 -> left = 4.999997, right = 7.000002, g(2) = 7.0 3) |x² - 1| / (x + 1) vs. simplified branches: x = -2.0 -> h(x) = -3.00 (branch = -3.00) x = -0.5 -> h(x) = 1.50 (branch = 1.50) x = 0.5 -> h(x) = 0.50 (branch = 0.50) x = 2.0 -> h(x) = 1.00 (branch = 1.00)
8. Core function families in Calculus
Recognizing a function’s family tells you its domain, range, and shape immediately — before taking a single limit, derivative, or integral.
Linear (affine) function: $f(x) = mx + b$
- Domain: $\mathbb{R}$.
- Range: if $m \neq 0$, the range is $\mathbb{R}$ and there is a unique zero at $x = -b/m$; if $m = 0$, the function is constant ($f(x) = b$) and its range is the singleton $\lbraceb\rbrace$.
- Graph: a straight line with slope $m$ and $y$-intercept $b$. (In linear algebra, “linear” is reserved for the case $b = 0$; in Calculus, $mx + b$ is routinely called a linear function.)
Example: $f(x) = -2x + 5$ ($m = -2 \neq 0$, $b = 5$).
- Zero: $-2x + 5 = 0 \implies 2x = 5 \implies x = \frac{5}{2} = 2.5$.
- Value at $x = 3$: $f(3) = -2(3) + 5 = -6 + 5 = -1$.
Quadratic function: $f(x) = ax^2 + bx + c$, with $a \neq 0$
- Domain: $\mathbb{R}$.
- Vertex form: completing the square (identity proved in Lean),
Because $\left(x + \frac{b}{2a}\right)^2 \geq 0$ everywhere and vanishes at $x_v = -\dfrac{b}{2a}$, the vertex lies at $(x_v, y_v)$ with $y_v = f(x_v) = c - \dfrac{b^2}{4a}$:
- if $a > 0$, the parabola opens upward, attains a global minimum at $x_v$ (proved in Lean), and has range $[y_v, +\infty)$;
- if $a < 0$, it opens downward, attains a global maximum at $x_v$, and has range $(-\infty, y_v]$.
Example: $f(x) = x^2 - 4x + 3$ ($a = 1 > 0$, $b = -4$, $c = 3$).
- Vertex: $x_v = -\dfrac{-4}{2 \cdot 1} = 2$ and $y_v = f(2) = 2^2 - 4(2) + 3 = 4 - 8 + 3 = -1$. Range: $[-1, +\infty)$.
- Zeros: factoring $x^2 - 4x + 3 = (x - 1)(x - 3) = 0$ (or using the quadratic formula) yields $x = 1$ and $x = 3$.
Integer power function: $f(x) = x^n$ ($n \in \mathbb{Z}$, $n \neq 0$)
The behavior depends on both the sign and the parity of the exponent $n$:
- Positive even integer ($2, 4, 6, \ldots$): domain $\mathbb{R}$, range $[0, +\infty)$, even function, global minimum at $x = 0$.
- Positive odd integer ($1, 3, 5, \ldots$): domain $\mathbb{R}$, range $\mathbb{R}$, odd function, strictly increasing on $\mathbb{R}$.
- Negative integer ($-1, -2, \ldots$): domain $\mathbb{R} \setminus \lbrace0\rbrace$, with asymptotes along both coordinate axes. For $n = -1$ ($f(x) = 1/x$), the graph is a rectangular hyperbola, odd and decreasing on each branch; for $n = -2$ ($f(x) = 1/x^2$), it is even with range $(0, +\infty)$ — it has no minimum at $x = 0$ because it is not even defined there.
Exponential function: $f(x) = a^x$, with $a > 0$ and $a \neq 1$
- Domain: $\mathbb{R}$. Range: $(0, +\infty)$ — so $a^x > 0$ for every $x \in \mathbb{R}$.
- Strictly increasing if $a > 1$; strictly decreasing if $0 < a < 1$.
- The central case in Calculus is base $e \approx 2.718$, namely $f(x) = e^x$.
Logarithmic function: $f(x) = \log_a x$, with $a > 0$ and $a \neq 1$
- Domain: $(0, +\infty)$. Range: $\mathbb{R}$.
- Inverse of the exponential (proved in Lean):
- $\ln x = \log_e x$ is the natural logarithm (base $e \approx 2.718$).
Main trigonometric functions (with $x$ in radians)
| Function | Domain | Range | Period |
|---|---|---|---|
| $\sin x$ | $\mathbb{R}$ | $[-1, 1]$ | $2\pi$ |
| $\cos x$ | $\mathbb{R}$ | $[-1, 1]$ | $2\pi$ |
| $\tan x$ | $\mathbb{R} \setminus \left\lbrace\dfrac{\pi}{2} + k\pi,\ k \in \mathbb{Z}\right\rbrace$ | $\mathbb{R}$ | $\pi$ |
In Calculus, angles are always measured in radians; in degrees, trigonometric limits and derivatives pick up extra factors of $\pi/180$.
9. What goes wrong in practice (common pitfalls)
- Confusing codomain with range: writing $f: \mathbb{R} \to \mathbb{R}$ for $f(x) = x^2$ does not put negative numbers into the range. That distinction decides whether $f$ is surjective and invertible.
- Simplifying before finding the domain: canceling $(x - 2)$ in $\dfrac{x^2 - 4}{x - 2}$ yields $x + 2$, yet $x = 2$ remains outside the domain.
- Forgetting $\text{Dom}(g)$ in a composition $f \circ g$: take $f(x) = x^2$ and $g(x) = \sqrt{x}$. The simplified expression is $(f \circ g)(x) = (\sqrt{x})^2 = x$, but the domain of $f \circ g$ is $[0, +\infty)$, not $\mathbb{R}$, because $g(x) = \sqrt{x}$ rejects negative inputs.
- Reading $f^{-1}(x)$ as $1/f(x)$: for $f(x) = 2x + 3$, the inverse is $f^{-1}(x) = (x - 3)/2$, while the reciprocal is $1/(2x + 3)$ — two completely different functions.
- Squaring without recording the sign condition: inverting $f(x) = \sqrt{x - 1}$ to $x^2 + 1$ without recording $x \geq 0$ produces a formula that breaks on negative inputs.
- Assuming every function is even or odd: unlike integers, functions such as $x^2 + x$, $e^x$, and $\sqrt{x}$ are neither even nor odd.
10. Summary (quick reference)
- A function $f: A \to B$ assigns each $x \in A$ to exactly one $f(x) \in B$; graphically, it passes the vertical line test.
- Natural domain: rule out zero denominators, negative radicands (even index), and logarithm arguments $\leq 0$ — always from the original expression, before simplifying.
- Difference quotient: $\dfrac{f(x + h) - f(x)}{h}$ ($h \neq 0$) gives the average rate of change and, as $h \to 0$, defines the derivative.
- Composition: $(f \circ g)(x) = f(g(x))$ (right to left), in general $f \circ g \neq g \circ f$, with domain $\lbracex \in \text{Dom}(g) \mid g(x) \in \text{Dom}(f)\rbrace$.
- Inverse: exists when $f$ is bijective; swap $x \leftrightarrow y$, solve, restrict to domain $\text{Im}(f)$, and verify both directions ($f(f^{-1}(y)) = y$ and $f^{-1}(f(x)) = x$).
- Parity (on a symmetric domain): even if $f(-x) = f(x)$ ($y$-axis symmetry); odd if $f(-x) = -f(x)$ (origin symmetry).
- Piecewise: identify the branch containing $x$ first; for continuity at a junction, the function value and both one-sided limits must agree.
11. References
- Stewart, J. (2016). Calculus: Early Transcendentals. 8th ed. Cengage Learning. (Ch. 1: Functions and Models — §1.1 Four Ways to Represent a Function and §1.5 Inverse Functions and Logarithms.)
- Guidorizzi, H. L. (2018). Um Curso de Cálculo, Vol. 1. 6th ed. LTC. (In Portuguese; Ch. 2: Funções — §2.1 to §2.4.)
- Spivak, M. (2008). Calculus. 4th ed. Publish or Perish. (Ch. 3: Functions.)
Comments