# Functions-3

### From Homeworkwiki

**If f: R → R be defined as follows:**

**f(x) = { 1 if x ∈ Q}**

**{ -1 if x ∉ Q}**

**Find (a) f(1/2), f(π), f(√2)**

**(b) Range of f**

**(c) Pre-images of 1 and -1.**

**Solution:** (a) It is evident from the definition of f that at every rational point, the function attains value 1 and at every

irrational point it attains value -1. So,

1/2 ∈ Q => f(1/2) = 1, π ∉ Q => f(π) = -1 and √2 ∉ Q => f(√2) = -1.

(b) We have, Range of f = {f(x) : x ∈ R}.

Also, by definition, f(x) attains values 1 or -1 according as x is rational or irrational and a real number is either rational or

irrational.

Therefore, Range of x = {1, -1}.

(c) Since f(x) = 1 for all x ∈ Q, therefore, pre-images of 1 are rational numbers i.e.

f^{-1} (1) = Q.

Also, -1 is the image of every real number which is not rational. So,

f^{-1} (-1) = R – Q = Set of irrational numbers.