I am defining "duplicate" to mean drawing a ball that has already been drawn. I am interested in calculating the expected number of such duplicates.

I don't care how many times each ball has been drawn, just how many times a ball has been drawn that had been drawn previously.

Suppose I have 3 balls in my bag: 1, 2, & 3. Here are some sample draws and my definition of the number of duplicates:

Once all 3 balls have been drawn, every draw is a duplicate.

If I implemented it correctly, your formula seems to be calculating something else. Here's the results I get for the bag of 3 balls:

When I draw the first ball, the expected number of duplicates is zero, since there is only 1 ball.

When I draw the second ball, the expected number of duplicates is 1/3 or 0.3333. There is 1 chance that the new ball is the same as the first and 2 chances that it is different.

When I draw the third ball, it gets more complicated. I calculate the expected number of duplicates as 5/9 = 0.5555. If the second ball was a duplicate, there 1 chance that the third is as well. If not, there are 2 chances for each of the two scenarios.

After that, it gets a lot more complicated.

I ran a little simulation to check these values. Here's the data. The P(Dup) column is the probability of that draw being a duplicate. The Cum column is the cumulative probabilities, which is the estimated number of my kind of duplicates after that number of draws.

This agrees with my first two calculations.

Can your formula be adapted for