Discrete math problem confusion. I found another post regarding this here,
but I'm still confused how we are going to write the final answer.
Your help will be appreciated.

 A: In order to construct a function $f:A\to B$ with $|f[A]|=4$, you must first choose $4$ elements of $B$ to be the range of $f$; this can be done in $\binom74$ ways. Once you’ve chosen a set $S$ of four target elements, there are $4^{10}$ from $A$ to $S$. Unfortunately, that figure includes a lot of functions that you don’t want, because they map $A$ to a proper subset of $S$. You need to subtract those functions that map to at most $3$ elements of $S$. There are $3^{10}$ functions from $A$ to any $3$-element subset of $S$, and $S$ has $\binom43=4$ $3$-element subsets, so you have $4\cdot3^{10}$ unwanted functions included in the original figure of $4^{10}$. Thus, a second approximation to the desired result is $$4^{10}-4\cdot3^{10}\;.\tag{1}$$
Unfortunately, if $S=\{s_1,s_2,s_3,s_4\}$, say, a function from $A$ to $\{s_1,s_2\}$ will be counted once in the term $4^{10}$ and twice in the term $4\cdot3^{10}$, once as a function from $A$ to $\{s_1,s_2,s_3\}$ and once as a function from $A$ to $\{s_1,s_2,s_4\}$. Thus, $(1)$ counts such a function $-1$ times instead of the correct $0$ times. You’ll have to add such functions back in. I’ll let you try to finish the job; what you’re using here is an inclusion-exclusion argument.
