## Example 1.2.5(b):

Let

The preimage of *f(x) = 0*if*x*is rational and*f(x) = 1*if*x*is irrational. This function is called Dirichlet’s Function. The domain and range for*f*is R.- What is the preimage of R ? What is the preimage of [-1/2, 1/2] ?

**R**is the set of all elements such that

*f(x)*is contained in

**R**. Since

**R**includes the numbers 0 and 1, the preimage of

**R**under

*f*is everything in the domain, i.e.

**R**.

The preimage of [-1/2, 1/2] consists of all elements such that *f(x)*
is contained in [-1/2, 1/2]. This set does not contain 1, so the preimage of
that set can not contain any irrational number. Hence, the preimage of
[-1/2, 1/2] is the set of rational numbers **Q**.