newayz m posting here too
Let the function be represented by A--> B whr n(A) = n(B)= n
total no of distinct functions from A to B = nn
now no of ways in which yi (
B) is not the image of xi(
A) =no of into functions Let Ai denotes the event that ith element of B is not the image of any element of A (i.e. A1 is the event in which y1 is nt the image of any x
A ) thrfore no of ways in which atleast one element of B is not the image of any elemnt in A , (E)= n (A1
A2
A3
A4
.......An) now total no of functions when one element of B doesnt have any pre-image
= no of ways of selecting that elemnt X no of ways in which rest can have thr pre-images
= nC1 (n-1)n
similarly when 2 elemnts doesnt have pre-image then no of functions = nC2 (n-2)n
.....
thus n(E) = nC1 (n-1)n - nC2 (n-2)n + nC3 (n-3)n - ......upto n terms
this will be the no of into fucntions frm A to B
thrfore onto functions = nn - n(E)