A function is f:A

B is said to be injective or one-one if different elements of A have different images in B. This means that for a
1, a
2 ∈ A and f(a
1), f(a
2) ∈ B,
f(a
1) = f(a
2) then a
1= a
2. or, a
1
a
2 
f(a
1)

f(a
2).
A function f:A

B is said to be onto or surjective if each element in B is the f-image of atleast one element in A.
f:A

B is onto iff for every b ∈ B, ∃ some a ∈ A such that f(a) = b.
An easy way to determine whether a function is onto or not is to check whether the range = codomain. if yes, then the function is onto else not.
A function which is one-one as well as onto is said to be bijective.
Eg: f(x) = x, if x is rational
0, if x is irrational
g(x) =0, if x is rational
x, if x is irrational
Then find whether (f-g) is one-one or onto?
Let s(x) = f(x) – g(x) = x, if x is rational
= -x, if x is irrational
To check one-one:
Take any straight line parallel to x-axis. This line intersects s(x) at only one point and hence the function is one-one.
Similarly, to check onto:
s(x) = f(x) – g(x) = x, if x is rational
= -x, if x is irrational
This shows that y = x and y = -x for rational and irrational values. Hence, y belongs to the set of real numbers.
This means that the range = codomain.
This means that the function is onto.
Hence, the function is one-one as well as onto. This means that the function is bijective.
For more clalrity, please refer the study material.
Thanks & Regards
Latika Leekha
askIITians Faculty