Let $A = \{1,2,3,\dots,10\}$ and $B = \{1,2,3,\dots,20\}$.
Find the number of non-decreasing functions from $A$ to $B$.
What I tried:
Number of non-decreasing functions = (Total functions) - (Number of decreasing functions)
Total functions are $20^{10}$. And I think there are ${20 \choose 10}$ decreasing functions. Since you choose any $10$ codomain numbers and there's just one way for them to be arranged so that the resultant is a decreasing function.
However my answer doesn't match. Where am I going wrong?
How can I directly compute the non-decreasing functions like without subtracting from total?