The domain of a function f(x) is the set of all values for which the function is defined, and the range of the function is the set of all values that f takes.
(In grammar school, you probably called the domain the replacement set and the range the solution set. They may also have been called the input and output of the function.)
Example 1:
Consider the function shown in the diagram.
Here, the domain is the set {A, B, C, E}. D is not in the domain, since the function is not defined for D.
The range is the set {1, 3, 4}. 2 is not in the range, since there is no letter in the domain that gets mapped to 2.
Example 2:
The domain of the function
f(x) = 1/x
is all real numbers except zero (since at x = 0, the function is undefined: division by zero is not allowed!).
The range is also all real numbers except zero. You can see that there is some point on the curve for every y-value except y = 0.

Domains can also be explicitly specified, if there are values for which the function could be defined, but which we don't want to consider for some reason.
Example 3:
The following notation shows that the domain of the function is restricted to the interval (–1, 1).
f(x) = x2, –1
x
1
The graph of this function is as shown. Note the open circles, which show that the function is not defined at x = –1 and x = 1. The y-values range from 0 up to 1 (including 0, but not including 1). So the range of the function is
0
y < 1.
