Question related to Pascal Triangles and Counting Patterns
For problem nr1:
A function can be thought of as a subset of the so called Cartesian product between two sets. That is $$ f: A\to B, \ f(a)=b $$ can be thought of as a subset of $\{(a,b)\mid a\in A, b\in B\}$ so what you are actually counting here is the number of ways you can create these pairs with some particular restrictions say you would like everything to be mapped to only one specific member of the target domain, that is $B$.
For problem nr2:
You are counting "how many ways can I pick $0$ elements from a set having $n$ elements" this is usually expressed as a so called binomial coefficient $$ \binom{n}{0}=\frac{n!}{0!(n-0)!}=1 $$ for exaample.
How this is tied to the pascal triangle is as follows:
If you number the rows of the triangle starting from $0$ then the $k$th element in $n$th row is $$ \binom{n}{k}=\frac{n!}{k!(n-k)!}. $$
The name binomial coefficient comes from the fact that these numbers represent the coefficients in $$ (a+b)^n. $$ Let us look at an example:
$$ (a+b)^3=1\cdot a^3+3\cdot a^2b+3\cdot ab^2+1\cdot b^3 $$
How come? Well, we are actually counting the number of ways we can pick factors from the sums:
$$ (a+b)^3=(a+b)(a+b)(a+b) $$
so $a^3$ has coefficeint $1$ since there is only one way to pick $3$ "a"s. $a^2b$ has coefficient $3$ since we can pick $2$ "a"s and $1$ "b" in three different ways $$ (\underline{a}+b)(\underline{a}+b)(a+\underline{b}) $$ $$ (\underline{a}+b)(a+\underline{b})(\underline{a}+b) $$ and $$ (a+\underline{b})(\underline{a}+b)(\underline{a}+b). $$
I hope this clarified a bit :)
Yes. Both follow from the binomial theorem:
$$2^n = (1+1)^n = {n \choose 0}1^n + {n \choose 1}1^{n-1}1 + {n \choose 2} 1^{n-2}1^2\dots + {n \choose n}1^n$$
Since the rows of Pascal's triangle correspond to the binomial coefficients, then the sum of the $n$-th row is $2^n$ (numbering the topmost row that only has one 1 with 0).
$2^n$ is indeed the number of functions describes, or the size of the power set.