Answer
a) 2 if n=1
$\quad$2 if n=2
$\quad$0 if n$\geq$2
b) $2^{n-2}$ for n>1
$\quad$1 if n=1
c) 2(n-1) for n>1
$\quad$ 0 for n=1
Work Step by Step
a) Clearly, There is no one-to-one function from {1, 2, ... , n} to {0, 1} if n > 2.
If n = 1, then there are 2 such functions, the one that sends 1 to 0, and the one that sends 1 to 1 .
If n = 2 , then there are again 2 such functions, since one is that send 1 to 0 and 2 to 1 and the other one is that send 1 to 1 and 2 to 0.
b) If the function assigns 0 to both 1 and n, then there are n - 2 values remaining whose image has to be chosen.
Image of each value can be chosen in 2 ways( either 0 or 1). Therefore, by the product rule ,there are $2^{n-2}$ such functions, as long as n > 1.
If n = 1, then clearly there is just one such function i.e., assigning 0 to 1.
c) If n = 1, then there are no such functions, since there are no positive integers less than n.
So assume n > 1. In order to specify such a function, we have to decide which of the numbers from 1 to n - 1, will be sent to 1 . There are n - 1 ways to make this choice. Since they all other must be get sent to 0.
Finally, we are free to specify the value of the function at n, and this may be done in 2 ways (either 0 or 1).
Hence, by the product rule the final answer is 2(n - 1).