Question

The number of surjections from $A=1,2,....,n;n\le 2$ onto B = {a, b} is(a) $P_{2}^{n}$ (b) ${{2}^{n}}-2$ (c) ${{2}^{n}}-1$ (d) None of these

Hint: First count all the possible functions which can be formed between A and B. Then try to eliminate those in which the co-domain and range of the function are not equal to get the desired result.

In the question we need to find the number of subjection from A = {1,2……n} to B={a,b}
In mathematics a function ‘f’ from a set A to a set B is surjective also known as onto or a surjection, if for every element ‘y’ in the co-domain B of ‘f’, there is at least one element ‘x’ in domain A of ‘f’ such that f(x) = y. It is not required that ‘x’ be unique; the function ‘f’ may map one or more elements of A to the same element of B.
As we know that there are ‘n’ elements in A and ‘2’ elements in B, then for each element in A there will be two possible elements in B.
So, total number of possible functions are,
$2\times 2\times .........\times 2$ {Here ‘2’ is multiplied ‘n’ times}
$={{2}^{n}}$
But in these all possible ${{2}^{n}}$ functions there will be cases where functions will not exist such as:
A function where all the inputs of elements A gives only one output that is ‘a’. Here the range will be {a} but co-domain will be {a,b}.
A function where all the inputs of elements B, gives only one output that is ‘b’. Here the range will be {b} but co-domain will be {a,b}.
So, these two cases won’t be counted.
So the total number of surjective is ${{2}^{n}}-2$.
Hence the correct answer is option (b).

Note: Students usually make mistakes while finding the number of surjections that try to eliminate these surjections which are not onto.
Onto functions are those functions in which co-domain and range are equal. So first find all the possible functions and then subtract those which are many to one or not onto.