Drawing the graph of a function is a visual way of identifying its domain and often the most convenient way for determining its range.To figure out if a specific value is in the range of the function, we (imaginarily) draw a horizontal line passing through that specific $y$-value. If that line intersects the graph, then that $y$-value is in the range of the function. This means the horizontal projection of the graph onto the $y$-axis is the range of the function.

Similarly, to find out if a specific $x$-value is in the domain of the function, we draw a vertical line passing through that value of $x$. If this vertical line intersects the graph, then that specific value of $x$ is in the domain of the function. In other words, the domain of a function is the vertical projection of its graph onto the $x$-axis. The procedure for finding the domain and the range using the graph is shown in Figure 1.

Example 1
The functions $g(x)$ and $\phi(x)$ are graphed below. Find their domains and ranges.

Figure 2

Solution

Any vertical line intersects the graph of $g(x)$ except when $x=1$.This means $x=1$ is not in the domain of $g$. Horizontal lines hit its graph only when $y=1$ or $y=2$. Therefore

$Dom(g)=\{x|\ x\neq1\},\quad{\rm and}\quad Rng(g)=\{1,2\}.$

The domain of $g$ can also be rewritten as

$Dom(g)=\mathbb{R}-\{1\}$        or      $Dom(g)=(-\infty,1)\cup(1,\infty).$

For $\phi(x)$, any vertical line intersects the graph. Although a vertical line passing through $x=1$ does not intersect the right piece of the graph, it meets the left piece. Therefore, all real numbers are in the domain of $\phi$. Any horizontal line passing through $y\geq0$ or $y=1$ intersects the graph. Thus,

$Dom(\phi)=\mathbb{R}$  and   $Rng(\phi)=\{x|\ x\geq 0\ \text{or}\ x=-1\}=[0,\infty)\cup\{-1\}.$

Example 2
Find the range of $f$ if
$f:[-1,2]\rightarrow\mathbb{R},\quad{\rm and}\quad f(x)=x^{2}-3.$
Solution
To find the range of $f$, we first sketch its graph by constructing a table of $(x,f(x))$ values, plotting these points, and then connecting them. We make sure that the end values of the interval $[-1,2]$ are among the values that we choose for $x$ in our table:

The graph of $f$ is shown in Figure 3. If we look at this graph, we realize that the function never goes below $-3$ and beyond 1. That is, $Rng(f)=[-3,1]$. We will learn how to easily graph such a function later in this chapter.