## Example 1.2.5(a):

Let

*f(x) = 0*if*x*is rational and*f(x) = 1*if*x*is irrational. This function is called Dirichlet’s Function. The range for*f*is R. Find the image of the domain of the Dirichlet Function when:- the domain of
*f*is Q - the domain of
*f*is R - the domain of
*f*is [0, 1] (the closed interval between 0 and 1)

- When the domain is
**Q**, we have that*f(x) = 0*for any*x*, because*x*must be a rational number. Hence, the image of the domain**Q**is the set consisting of the single element {0}. - When the domain is
**R**, we have that*f(x)*could be 0 or 1, because*x*could be rational or irrational.*f(x)*can not be any other number. Hence, the image of the domain**R**is the set consisting of the two elements {0, 1}. - The interval [0, 1] contains irrationals as well as rational numbers.
Therefore,
*f(x)*could be equal to 0 or 1, and the image of [0, 1] under*f*is the set with the two elements {0, 1}.