TITLE: Find a bijection
QUESTION [5 upvotes]: Let $A$ be any set and let $C = \{0, 1, 2\}$. Denote $C^A$  the set of functions from $A$ to $C$. Find a bijection between $C^A$ and the set of all pairs $(X, Y)$ of subsets of $A$ such that $X$ is subset of $Y$.

REPLY [2 votes]: Let $S$ be the set of all pairs $(X, Y)$ of subsets of $A$ such that $X$ is subset of $Y$.
Let $f \in C^A$.
Then $(f^{-1}(\{1\}),f^{-1}(\{1, 2\})) \in S$.
We define a map $\lambda\colon C^A \rightarrow S$ by $\lambda(f) = (f^{-1}(\{1\}),f^{-1}(\{1, 2\}))$.
Conversely, let $(X, Y) \in S$.
Define $f \in C^A$ as follows.
If $x \in X$, $f(x) = 1$.
If $x \in Y - X$, $f(x) = 2$.
If $x \in A - Y$, $f(x) = 0$.
We denote this $f$ by $\mu((X, Y))$.
Then we get a map: $\mu\colon S \rightarrow C^A$.
It's easy to see that $\lambda$ and $\mu$ are inverses of each other.