Reasoning for the Power Set Suppose we define a function $f:X\rightarrow Y$ . Since, for each $x\in X$ there are $\#Y$ possibilities for $x$ to be mapped onto $Y$, it's natural to understand that:
\begin{equation}
Y^X=\prod_{x\in X}Y
\end{equation}
denotes how many functions from $X$ to $Y$ there are. Thing is, in the specific case where $x$ has only $\textbf{2}$ possible mappings, one gets:
\begin{equation}
P(X)=2^X
\end{equation}
being defined as the power set of $X$. It can be defined via the statement:
\begin{equation}
x\in P(X)\iff x\subseteq X
\end{equation}
which yields the definition as the set of all subsets of $X$. I've been not able to understand that. I mean, why does restricting $x$ to two mappings immediately gives you that the number of different mappings are exactly the number of subsets of $X$?
 A: Any subset $Z \subseteq X$ has a unique indicator function $I_Z$ given by
$$ I_Z(w) = \begin{cases} 1 & \mbox{if } w \in Z \\
0 & \mbox{if } w \not\in Z\end{cases}$$
Clearly, if $Z_1 \neq Z_2$, then $I_{Z_1}$ and $I_{Z_2}$ cannot be the same function.
Conversely, any function $f : X \to \{ 0,1\}$ is the indicator function of the subset of $X$ given by $\{ w \in X \mid f(w) = 1 \}$.
A: A function $X \to Y$ where $|Y|=2$ is a matter of taking each element in $X$ and deciding if we map it to one element, or to not map it to that element (but map it to the other element instead).  Making a subset of $X$ is a matter of taking each elements in $X$ and deciding if we put it in the subset we are make, or whether we don't.  So in both cases there are $|X|$ elements and we have $2$ choices for each one to there are $2^{|X|}$ subsets and $2^{|X|}$ functions.
......
Just slightly more abstractly we can map each possible subset uniquely and surjectively in the following way:
If $A\subset X$ then we map $A\mapsto f_A$ where $f_A$ is the function $f_A:X \to \{a,b\}$ where $f_A(x) = \begin{cases}b&x\in A\\a&x\not \in A\end{cases}$.
And the function is invertible.  If we have a function $f:X\to \{a,b\}$ we can map $f\mapsto A_f$ where $A_f\subset X$ where $A_f = \{x\in X| f(x) = b\}$.
..... Perhaps to properly "get" this we do it for simple case....
Let $X = \{a,b,c\}$ and $Y = \{0, 1\}$.  Let $\phi:\mathscr P(X)\to Y^X$ via $\phi(A) = f_A$ where $f_A(x) = \begin{cases}1&x\in A\\ 0&x\not \in A\end{cases}$.
(And we can describe $\phi^{-1}:Y^X \to \mathscr P(X)$ via $\phi^{-1} f= A_f$ were $A_f = \{x\in X| f(x) = 1\}$)
Then we have the following bijective match ups of subsets to functions:
$\emptyset \leftrightarrow \begin{cases}f(a)=0\\f(b)=0\\f(c)=0\end{cases}$
$\{a\} \leftrightarrow \begin{cases}f(a)=1\\f(b)=0\\f(c)=0\end{cases}$
$\{b\} \leftrightarrow \begin{cases}f(a)=0\\f(b)=1\\f(c)=0\end{cases}$
$\{c\} \leftrightarrow \begin{cases}f(a)=0\\f(b)=0\\f(c)=1\end{cases}$
$\{a,b\} \leftrightarrow \begin{cases}f(a)=1\\f(b)=1\\f(c)=0\end{cases}$
$\{a,c\} \leftrightarrow \begin{cases}f(a)=1\\f(b)=0\\f(c)=1\end{cases}$
$\{b,c\} \leftrightarrow \begin{cases}f(a)=0\\f(b)=1\\f(c)=1\end{cases}$
$\{a,b,c\} \leftrightarrow \begin{cases}f(a)=1\\f(b)=1\\f(c)=1\end{cases}$
That is: Every possible subset mapped one to one to every possible function in a most natural and descriptive way-- Each subset matches to the function where $f(x) =1$ if and only if $x$ is an elements of the subset, and each function matches to the subset that consists precisely of the elements mapped to $1$.
