How many ordered pairs $(A,B)$ there are if $A$ and $B$ are subsets of $\{ 1,2,3,4,5,\ldots,20 \}$ such that $A \cap B = \{2,5,6\}$? How many ordered pairs $(A,B)$ there are if $A$ and $B$ are subsets of $\{ 1,2,3,4,5,\ldots,20 \}$ such that $A \cap B = \{2,5,6\}$?
Solution  :
Any number from $\{ 1,3,4,7,\ldots,20 \}$
can go either to $A$  or $B$ or neither
So we have $3^{17}$ possible subsets
I need  further explanation of the solution "which is not mine" .... thanks
 A: A handy way to formulate the problem is through the so-called 'membership' function. Given the set $S=\{1,...,20\}$ and subsets $A,B\subset S$ define $$f_{AB} : s\in S \mapsto (1_A(s),1_B(s)) \in \{0,1\}^2.$$
Here, e.g. $1_A(s)$ is 1 or 0 depending upon $s\in A$ or not.
Conversely, given any map  $f : S \to \{0,1\}^2$ there are unique
subsets $A,B\subset S$ for which $f$ is the membership function.
We thus have a bijection between couple of subsets $(A,B)$ and
membership functions. In the present context the goal is to calculate the number of membership functions satisfying the constraint  $f^{-1}((1,1))=  \{2,5,6\}$
(i.e. specifying the intersection $A\cap B=\{2,5,6\}$). The values of $f$ at $s\in S\setminus\{2,5,6\}$ is any of the three other possible values of memberships and as these choices are independent there are in total $3^{17}$ such membership functions, as already deduced through a combinatorial argument in a comment to the post.
For the present problem, the membership function carries no
particular advantage over the straight-forward combinatorial argument. But consider e.g.  the similar problem for the number of ordered triples $(A,B,C) \subset S$ with the constraint that $A\cap B\cap C=\{2,5,6\}$. Using combinatorics is perhaps less obvious here whereas the membership function, now taking values in $\{0,1\}^3$ (which is of cardinality $8=1+7$) immediately yields the answer $7^{17}$.
A: Given that $A\cap B=\{2,4,6\}$
This mean $|A|,|B|\geq 3$
If $A=\{2,4,6\}$ then $B$ can be choose in $2^{17}$ ways then total number of ways of the type is $2^{17}$
If we choose $A=\{2,4,6,a\}$ where $a\in\{1,2,3,\dots,20\}-\{2,4,6\}$
Then we have $17 \choose 1$ choices of set $A$ and $2^{16}$ choices of set $B$
Total number of choices of this type are $2^{16}\binom{17}{1}$
Continuing in this way
We will get total number of choices are

$$\sum_{k=0}^{17}\binom{17}{k}2^{17-k}=3^{17}$$

