### Graphical representation of the domain and range of real functions

A function specifies a rule by which an input is converted to a unique output.

More precisely:

A function $f$ is a rule that assigns to each element $x$ in a set $D$ exactly one element, called $f(x)$, in a set $E$.

The domain of a function is the set of all possible $x$ values that can be used as inputs, and the range is the set of all possible $f(x)$ values that arise as outputs.

It's helpful to think of a function as a machine (see Figure 1). If $x$ is in the domain of the function then when enters the machine, it is accepted as an input and the machine produces an output according to the rule of the function. Thus we can think of the domain as the set of all possible inputs $x$ and the range as the set of all possible outputs  $f(x)$.

 Figure 1.
The most common method for visualising a function is its graph; which consists of all points $(x,y)$ in the coordinate plane such  that  $y=f(x)$ and $x$ is in the domain of $f$.

The graph of a function $f$ gives us a useful picture of the behaviour of the function. Since the $y$-coordinate of any point $(x,y)$ on the graph is $y=f(x)$, we can read the value of $f(x)$ from the graph as being the height of the graph above the point $x$ (see Figure 2).

 Figure 2

The graph of $f$ also allows us to picture the domain of $f$ on the $x$-axis and its range on the $y$-axis as in Figure 3.

 Figure 3
For the domain of the function we need to ask: What is the set of all the valid inputs $x$?

Meanwhile, for the range of a the function we need to ask: What is the set of all the valid outputs $f(x)$?

In the next applet you can see a graphic representation of the domain and range of functions. In this case, the green horizontal line represents the domain and the salmon vertical line represents the range. The function is represented with the dotted curve.

Type your function and see how the domain and range change. Selecting the asymptotes will show you particular cases where the function you typed is whether defined or not, in particular values of $x$.

Some particular cases: x^2 for $x^2$, exp(x) for $e^x$, abs(x) for $|x|$, 1/(x^2+1) for $\frac{1}{x^2+1}$, ln(x) for $\ln x$ and sqrt(x) for $\sqrt{x}$.

Follow the next link for opening the applet in an external window: