TITLE: Dealing with complicated sums - $\sum_{1\leq i < j \leq m}\sum_{1\leq k,l \leq n}\binom{n}{k}\binom{n-k}{l}(j-i-1)^{n-k-l}$
QUESTION [5 upvotes]: I'm preparing myself for discrete math exam, and I have no problem when dealing with simple sum, but when I see a monstrous one I totally don't know what to do. Here's an example:
$$\sum_{1\leq i < j \leq m}\sum_{1\leq k,l \leq n}[k+l\leq n]\binom{n}{k}\binom{n-k}{l}(j-i-1)^{n-k-l}$$ for $m,n > 0$.
I need to simplify this sum. Binomial coefficients suggest we can think of this cominatorically but I'm totally stuck. Are there any general techniques helpful when dealing with such sums?

REPLY [3 votes]: A combinatorial argument is actually rather straightforward.
Consider a function $f:[n]\to[m]$. Let $r_f=\min\operatorname{ran}f$, $s_f=\max\operatorname{ran}f$, $R_f=f^{-1}[\{r_f\}]$, and $S_f=f^{-1}[\{s_f\}]$. Let $R$ and $S$ be disjoint, non-empty subsets of $[n]$, $k=|R|$, and $\ell=|S|$, and let $i,j\in[m]$ be such that $i<j$. Then there are $(j-i-1)^{n-k-\ell}$ functions $f:[n]\to[m]$ such that $r_f=i$, $s_f=j$, $R_f=R$, and $S_f=S$. There are $\binom{n}k\binom{n-k}\ell$ ways to choose disjoint subsets $R$ and $S$ of $[n]$ so that $|R|=k$ and $|S|=\ell$, so there are
$$\binom{n}k\binom{n-k}\ell(j-i-1)^{n-k-\ell}$$
functions $f:[n]\to[m]$ such that $r_f=i$, $s_f=j$, $|R_f|=k$, and $|S_f|=\ell$. Call this set of functions $F(i,j,k,\ell)$. Then
$$\sum_{1\le i<j\le m}\sum_{1\le k,\ell\le n}\binom{n}k\binom{n-k}\ell(j-i-1)^{n-k-\ell}$$
is the cardinality of 
$$\bigcup_{1\le i<j\le m}\bigcup_{1\le k,\ell\le n}F(i,j,k,\ell)\;,$$
which is precisely the set of non-constant functions from $[n]$ to $[m]$. Thus,
$$\sum_{1\le i<j\le m}\sum_{1\le k,\ell\le n}\binom{n}k\binom{n-k}\ell(j-i-1)^{n-k-\ell}=m^n-m\;.$$