Equal Functions

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.

Graph of f(x) = x, the line through the origin.
(a) Graph of $f(x) = x$.
Graph of g(x) = x²/x, the same line but with a hole at the origin.
(b) Graph of $g(x) = x^2/x$. There is a hole at $(0, 0)$ because $g$ is undefined there.

Two functions $f$ and $g$ are equal (or identical) if and only if:

  1. They have the same domain: $\operatorname{Dom}(f) = \operatorname{Dom}(g)$.
  2. $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?

Solution Simplify $f(x)$: $f(x) = \frac{(x-3)(x-2)}{(x-3)^2} = \frac{x-2}{x-3} \quad \text{for } x \neq 3.$ Both simplify to $\dfrac{x-2}{x-3}$, and crucially, their domains are identical: both are undefined only at $x = 3$. $\operatorname{Dom}(f) = \operatorname{Dom}(g) = \mathbb{R} - \{3\}.$ Since the domains match and $f(x) = g(x)$ for all $x \neq 3$, the functions $f$ and $g$ are equal.

Frequently Asked Questions

If two formulas simplify to the same expression, are the functions equal? Not necessarily. They are equal only if the domains also match. Simplifying can change the domain. For example, canceling a factor that is zero at some point removes that point from the domain, making the simplified function different from the original.

Can two functions be equal but their formulas look completely different? Yes. For example, $f(x) = |x|$ and $g(x) = \sqrt{x^2}$ look different but are equal because they have the same domain and the same output for every input.

Does equal domain guarantee equal functions? No. Equal domain is necessary but not sufficient. The functions must also produce the same output for every input in that domain.

What is the relationship between equal functions and their graphs? Two functions are equal if and only if their graphs are identical. A hole, break, or any difference in a single point makes the graphs (and therefore the functions) unequal.