I'm trying to prove that the number of surjective function from a set [k] to [n] is :
$$\sum_{i=0}^{n} {n \choose i}(-1)^{i}(n-i)^{k}$$
So I've started to create a set A which contains the number of functions from [k] to [n] and I have $|A|=n^{k}$ and then I have the sets $B_{I}$ which are the sets that contains the functions that missed i elements form [n]. I know now that I have to alternatively subtract and add them all up but I don't know how to make a formal proof that's shows that this is in fact the formula that we were looking for.