Two functions that look algebraically identical may not be equal if their domains differ. This section defines function equality precisely and uses examples to show why domain is an essential part of a function's identity.
Quick Reference
| Condition for $f = g$ | Requirement |
|---|---|
| Same domain | $\operatorname{Dom}(f) = \operatorname{Dom}(g)$ |
| Same outputs | $f(x) = g(x)$ for every $x$ in the common domain |
| Consequence | Graphs of $f$ and $g$ are identical |
When Are Two Functions Equal?
Consider $f(x) = x$ and $g(x) = x^2/x$.
Algebraically, $g(x) = x^2/x = x$ when $x \neq 0$. But $f(0) = 0$, while $g(0)$ is undefined (division by zero). So $0 \in \operatorname{Dom}(f)$ but $0 \notin \operatorname{Dom}(g)$. Their domains differ, and their graphs differ: the graph of $g$ has a hole at $(0, 0)$ that the graph of $f$ does not.


Two functions $f$ and $g$ are equal (or identical) if and only if:
- They have the same domain: $\operatorname{Dom}(f) = \operatorname{Dom}(g)$.
- $f(x) = g(x)$ for every $x$ in their domains.
If $f$ and $g$ are equal, their graphs are identical and their ranges are equal: $\operatorname{Rng}(f) = \operatorname{Rng}(g)$.
Examples
Consider $f(x) = x + 2$ and $g(x) = \dfrac{x^2 + 5x + 6}{x + 3}$. Are $f$ and $g$ equal?
Solution
Simplify $g(x)$: $g(x) = \frac{(x+3)(x+2)}{x+3} = x + 2 \quad \text{for } x \neq -3.$ So $g(x) = f(x)$ for all $x \neq -3$. However, the domains differ: $\operatorname{Dom}(f) = \mathbb{R}, \qquad \operatorname{Dom}(g) = \mathbb{R} - \{-3\}.$ Since their domains are not equal, $f$ and $g$ are not equal functions.
Let $f(x) = |x|$ and $g(x) = \sqrt{x^2}$. Are $f$ and $g$ equal?
Solution
For all real $x$: $g(x) = \sqrt{x^2} = |x| = f(x).$ Both functions have domain $\mathbb{R}$ and produce identical outputs. Therefore, $f$ and $g$ are equal.
Let $f(x) = \dfrac{(x-3)(x-2)}{(x-3)^2}$ and $g(x) = \dfrac{x-2}{x-3}$. Are $f$ and $g$ equal?