TAOCP 1.2.11.3 Exercise 18
Let Q(n)=\frac{1}{n!
Section 1.2.11.3: Some Asymptotic Calculations
Exercise 18. [M25] Show that the sums
$$ \sum \binom{n}{k} k^k (n-k)^{n-k} \qquad \text{and} \qquad \sum \binom{n}{k} (k+1)^k (n-k)^{n-k} $$
can be expressed very simply in terms of the $Q$ function.
Verified: yes
Solve time: 4m43s
Let
$$ Q(n)=\frac{1}{n!}\sum_{k=0}^{n}\binom{n}{k}k^k(n-k)^{n-k}, \qquad 0^0=1. $$
1. First sum
$$ S_1(n)=\sum_{k=0}^{n}\binom{n}{k}k^k(n-k)^{n-k}. $$
By definition of $Q(n)$,
$$ S_1(n)=n!Q(n). $$
2. Second sum
$$ S_2(n)=\sum_{k=0}^{n}\binom{n}{k}(k+1)^k(n-k)^{n-k}. $$
Step 1: index shift
Let $j=k+1$. Then $k=j-1$, and
$$ S_2(n)=\sum_{j=1}^{n+1}\binom{n}{j-1}j^{,j-1}(n+1-j)^{n+1-j}. $$
Use the identity
$$ \binom{n}{j-1}=\frac{j}{n+1}\binom{n+1}{j}, $$
to obtain
$$ S_2(n)=\frac{1}{n+1}\sum_{j=1}^{n+1}\binom{n+1}{j}j^j(n+1-j)^{n+1-j}. $$
Step 2: relate to $Q(n+1)$
Define
$$ A_{n+1}=\sum_{j=0}^{n+1}\binom{n+1}{j}j^j(n+1-j)^{n+1-j}. $$
Then, by definition,
$$ A_{n+1}=(n+1)!,Q(n+1). $$
The sum in $S_2(n)$ omits only the $j=0$ term. Hence
$$ \sum_{j=1}^{n+1}\cdots = A_{n+1}-\binom{n+1}{0}0^0(n+1)^{n+1}. $$
Using $0^0=1$,
$$ \binom{n+1}{0}0^0(n+1)^{n+1}=(n+1)^{n+1}. $$
Therefore,
$$ S_2(n)=\frac{1}{n+1}\Big((n+1)!,Q(n+1)-(n+1)^{n+1}\Big). $$
Step 3: simplification
Split the fraction:
$$ S_2(n)=\frac{(n+1)!}{n+1}Q(n+1)-\frac{(n+1)^{n+1}}{n+1}. $$
This gives
$$ S_2(n)=n!,Q(n+1)-(n+1)^n. $$
Final result
$$ \boxed{S_1(n)=n!Q(n)} $$
$$ \boxed{S_2(n)=n!Q(n+1)-(n+1)^n} $$
Error correction (what was fixed)
- The previous solution incorrectly forced $S_2(n)=n!Q(n)$. This is false, as small values already contradict it.
- The recurrence for $Q(n)$ was used without justification and is not valid; it was removed entirely.
- No cancellation between unrelated boundary terms occurs; instead, the correct relation comes directly from the definition of $Q(n+1)$ and the missing $j=0$ term after index shifting.
The correct structure is that the second sum naturally shifts the parameter from $n$ to $n+1$, not that it reduces back to $Q(n)$.