Solving probability question using the inclusion exclusion principle

611 Views Asked by At

Question: $F$ is the set of all functions from a $n$-set to $B=\{a,b,c\}$. In a random experiment of selection of functions from $f$ assume that every $f\in F$ is equally likely. What is the probability that such a function has $a$ in its image?

I know the problem can be easily tackled by calculating the probability of selecting a function not having $a$ in its image ($=2^n/3^n$), and finding the desired probability by subtracting it from $1 (=\frac{3^n-2^n}{3^n})$. However I wanted to see if I could solve it using the Inclusion-Exclusion Principle too:

The total number of functions $f: \{a_1,a_2,a_3...a_n\} \to \{a,b,c\}$ would be $3^n$. Let $P_i$ be the property "$a_i$ doesnt map to $a$". Hence,

$$\sum_{1\leq i\leq n}|P_i| = \sum 2 \cdot 3^{n-1} = n\cdot2\cdot 3^{n-1}$$ (Choose from $\{b,c\}$ for $a_i$, $\{a,b,c\}$ for the rest)

$$\sum_{1\leq i \leq j \leq n}|P_i \cap P_j| = \sum 2^2 \cdot3^{n-2}n={n \choose 2}2^2\cdot3^{n-2}$$ (Choose from $\{b,c\}$ for ${n \choose 2}$ pairs of $(a_i, a_j)$)

Hence, $$\sum\left|\bigcap_{i=1}^{r} P_i\right|={n \choose r}2^r\cdot3^{n-r}$$ (Choose from $\{b,c\}$ for ${n\choose r}$ selections of $(a_i,a_j...a_{i+r})$)

By IEP, Number of functions which map having $a$ in its image= $$\left|\bigcap_{i=1}^n\overline{P_i}\right|=\left|\overline{\bigcup_{i=1}^n P_i}\right|=3^n -\left|\bigcup_{i=1}^n P_i\right|=3^n-2\cdot3^{n-1}n+{n \choose 2}2^2\cdot3^{n-2}\cdots+(-1)^n2^n = (3-2)^n=1$$ The number of functions which have $a$ in their image definitely isn't $1$. Is there something wrong with this approach?

1

There are 1 best solutions below

2
On BEST ANSWER

A good careful calculation, unfortunately of the wrong thing.

The Inclusion/Exclusion argument in the OP shows, in a correct but lengthy way, that there is exactly one function that maps all the $a_i$ to $a$.

For the union of the $P_i$ is the set of all functions that miss $a$ somewhere. Subtracting the cardinality of the union from $3^n$ counts the functions that miss $a$ nowhere. There is only one such function.