We have $r$ balls and $n$ boxes. We took all balls to boxes randomly. Find the average of empty boxes.
So I think there are two ways. When $r<n$ and $r\geq n$.
When $r<n$ thank can be $1,2,3,...,n-1$ boxes empty. Than average would be $\frac{\sum^{n-1}_{i=1}i}{n-1}$
When $r\geq n$ , then can be $0,1,2,...,n-1$ with average $\frac{\sum^{n-1}_{i=0}i}{n-1}$
And I don't know what to do next. To sum my given averages and divide from two? Or everything here is wrong? How to find the average than?
I preassume that "we took all balls to boxes randomly" can be interpreted as: for every ball the probability that it ends up in box $i$ is $\frac1n$.
For $i=1,\dots,n$ let $X_i$ take value $1$ if the box $i$ is empty after the placing, and let it take value $0$ otherwise.
Then $X=\sum_{i=1}^nX_i$ is the number of empty boxes after placing the balls and with linearity of expectation and symmetry we find:$$\mathbb EX=\sum_{i=1}^n\mathbb EX_i=n\mathbb EX_1=nP(X_1=1)$$
So it remains to find $P(X_1=1)$.
Give that a try.