What is the number of mappings? It is given that there are two sets of real numbers $A = \{a_1, a_2, ..., a_{100}\}$ and $B= \{b_1, b_2, ..., b_{50}\}.$ If there is a mapping $f$ from $A$ to $B$ such that every element in $B$ has an inverse image and
$f(a_1)\leq f(a_2) \leq ...\leq f(a_{100})$ 
Then, what is the number of such mappings?
I have started tackling the problem by supposing that $b_1<b_2<...<b_{50}$ and dividing elements $a_1, a_2, ..., a_{100}$ in $A$ into $50$ nonempty groups according to their order. Now the problem is... How do I compute the number of mappings defined as $f: A\rightarrow B$ given the observations above?

To come up with such a function $f$, you need to decide, for each element  $b_i \in B$, the number $n_i$ of elements of $A$ which are going to map to it. Once these numbers have been chosen, there is only one way to make the function $f$ because of the condition $f(a_1)\leq f(a_2) \leq ...\leq f(a_{100})$. So, how many ways are there to choose the numbers $n_i$? Well...


*

*Since each element of $B$ needs to have a nonempty preimage, you have the constraint $n_i \geq 1$. 

*Since every element of $A$ must map somewhere, you have the constraint $\sum_{i=1}^{50} n_i = 100$.


Counting the solutions to a constrained integer equation of this type is a a pretty common problem. Similar questions have been asked before on this website, for instance here. 
