16,453 views
65 65 votes
How many onto (or surjective) functions are there from an $n$-element $(n ≥ 2)$ set to a $2$-element set?

  1. $ 2^{n}$
  2. $2^{n} – 1$
  3. $2^{n} – 2$
  4. $2(2^{n} – 2)$

8 Answers

Best answer
57 57 votes

No. of onto (or surjective) functions are there from an $n$-element $(n\geq 2)$ set to a $2$-element set $=$ Total No of functions $-$ (No of functions with $1$ element from RHS not mapped) $+$ (No of functions with $2$ element from RHS not mapped)$\ldots$(So on Using Inclusion Excusion principle $= 2^{n}$ (Total no of functions ) $-$ $2 * 1^{n}$ ( No of functions in which one element is excluded) $+ 0$ (No element in RHS is selected) $= 2^{n} -2.$

Hence, Ans is (C).

alternate 

https://gateoverflow.in/8212/gate2015-2_40

• edited by
16 16 votes

$Onto function :\space$ $x$  $\longrightarrow$ $y$

$x\space is\space preimage\space of\space y\space ,\space y\space is\space image\space of\space x\space$

$\textbf {Step 1:}Find\space non\space onto\space function \space is\space relatively\space easythan\space find\space onto\space function\space so\space -\space$

$non\space onto\space function\space =\space Either\space a\space not\space mapped\space OR\space B\space not\space mapped\space OR\space C\space not\space mapped\space$

${So\space we\space need\space to\space find\space}$ $|$$S_a$ $\cup$ $S_b$ $\cup$  $S_c$$|$ $=\space ?$ 

$\textbf{Step 2:}\space According\space to\space \textbf{Principal of Mutual Inclusion and Exclusion}$

$|$ $S_a$ $\cup$  $S_b$ $|$ = $|$ $S_a$ $|$ $+$  $|$ $S_b$ $|$ $-$ $|$ $S_a$ $\cap$ $S_b$ $|$

$|$ $S_a$ $|$ $=$ $It$ $means\space a\space not\space mapped$ $=$ $1^n$ 

$|$ $S_b$ $|$ $=$ $It$ $means\space b\space not\space mapped$ $=$ $1^n$ 

$if\space both\space not\space mapped$ $=$ $0^n$

$|$ $S_a$ $\cup$  $S_b$ $|$ = $1\space +\space 1\space -\space 0\space =\space 2$

$\textbf{Step 3:}\space So\space Onto\space functions\space =\space Total\space functions\space -\space non\space onto\space functions $

$And\space as\space we\space know\space total\space functions\space =\space 2^n$

$So\space onto\space functions\space are\space =\space 2^n - 2$

$Hence\space Option\space C\space is\space right\space one$

• edited by
7 7 votes

Consider |A| = a, |B| = b, then Number of relations from A to B is $2^{a \times b }$, as each element is A can map to every element is B, and each mapping may exist or not.

Now in case of a function its one - one or many to one. Hence total functions possible is $b^{a}$, as each value in A can map to only one value in B, and this is applicable 'a' times.

With this information in mind, number of functions from A to B in this case is $2^n$ But two of the functions are not onto i.e. the ones where all map to only 1st or 2nd element in B.

Hence answer is C

2 2 votes

 

The number of onto functions from A→B where |A|=m and |B|=n is given by the formula


 

Here, m=3 and n=2
Substituting in above formula we get,
2^3−2C1(2−1)3^+2C2(2−2)^3

8-2 = 6

Hence answer is C

2^n-2 = 2^3-2 = 8-2=6

Answer:
Position:
Show:

Related questions

68 68 votes
7 answers 7 answers
18.2k
18.2k views
go_editor asked Apr 21, 2016
18,223 views
Consider the following C code segment.int a, b, c = 0; void prtFun(void); main() { static int a = 1; /* Line 1 */ prtFun(); a += 1; prtFun(); printf(“ \n %d %d ”, a, b); ...
71 71 votes
5 answers 5 answers
23.8k
23.8k views
go_editor asked Apr 21, 2016
23,771 views
Consider the following relations $A, B$ and $C:$ $$\overset{\textbf{A}}{\begin{array}{|c|c|c|}\hline\\\textbf{Id}& \textbf{Name}& \textbf{Age} \\\hline12& \text{A...
54 54 votes
6 answers 6 answers
26.3k
26.3k views
go_editor asked Apr 21, 2016
26,348 views
For the grammar below, a partial $LL(1)$ parsing table is also presented along with the grammar. Entries that need to be filled are indicated as $E1, E2,$ and $E3$. $\var...
54 54 votes
4 answers 4 answers
20.8k
20.8k views
go_editor asked Apr 21, 2016
20,806 views
A computer has a $256$-$\text{KByte}$, 4-way set associative, write back data cache with block size of $32$ $\text{Bytes}$. The processor sends $32$ $\text{bit}$ addresse...