When do we call two functions equal? For example, are $f(x)=x$ and $g(x)=x^{2}/x$ equal? We should note that $f(0)=0$, but because division by zero is not allowed, $g(0)$ does not exist. In other words, $0\in Dom(f)$ but $0\not\in Dom(g)$. The graphs of $f$ and $g$ are shown in Figure 1. As we can see the point $(0,0)$ has been excluded from the graph of $y=g(x).$

(a): Graph of $ y=x $ (b) Graph of $y=x^{2}/x $

Figure 1

 

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

  1. $f$ and $g$ have the same domain, i.e. $Dom(f)=Dom(g)$,
  2. $f(x)=g(x)$ for every $x$ in their domains

If two functions $f$ and $g$ are equal, then

  •  the graphs of $f$ and $g$ are identical
  • $f$ and $g$ have the same range, i.e. $Rng(f)=Rng(g)$.
Example(1)

Determine whether or not $f(x)=x$ and $g(x)=\sqrt{x^{2}}$ are equal functions.

Solution
$f$ is defined for all values of $x$; that is, its domain is the entire set of real numbers $Dom(f)=\mathbb{R}$. The domain of $g$ is also the entire set of real numbers because $x^{2}$ is always nonnegative. Therefore the first condition for equality of two functions is satisfied:
\[
Dom(f)=Dom(g).
\] However, we know $\sqrt{x^{2}}=|x|$ (see Properties of the $n$th root in Section1.7). Therefore,
\[
g(x)=\sqrt{x^{2}}=|x|=\begin{cases}
x & \text{if }x\geq0\\
-x & \text{if }x<0
\end{cases}.
\] Because $f(x)\neq g(x)$ when $x$ is negative, these two functions are not equal. Graphs of $f$ and $g$ are illustrated in Figure 2(a,b).

(a) Graph of $f(x)=x $ (b) Graph of $g(x)=\sqrt{x^{2}} $

Figure 2

 

Example(2)
Determine whether or not $f(x)=2\ln x$ and $g(x)=\ln x^{2}$ are equal functions.
Solution
Recall that the only numbers that we can plug into a logarithm are positive numbers (plugging negative numbers will give imaginary results).Therefore, the function $f$ is defined for $x>0$; that is, $Dom(f)=\{x|\ x>0\}=(0,\infty)$.
Because always $x^{2}>0$ except when $x=0$, the domain of $g$ is $Dom(g)=\{x|\ x\neq0\}=(\infty,0)\cup(0,\infty)$, which can also be rewritten as $\mathbb{R-}\{0\}$. Note that $\ln(0)$ is not defined.
Because
\[
Dom(f)\neq Dom(g),
\] these two functions are not equal. However, the two functions will become equal if we restrict the domain of $g$ to positive numbers.
That is,
\[
2\ln x=\ln x^{2}\qquad\text{when }x>0.
\] Graphs of $f$and $g$ are depicted in Figure 3.

(a): Graph of $f(x)=2\ln x $ (b) Graph of $g(x)=\ln x^{2} $

Figure 3