[Math] Find the number of ways to distribute 5 balls into 8 boxes if at most one ball can go into each box

combinatoricsinteger-partitions

Because at most, we can only have 1 ball in each box, we know that the partition we will be working with is $1+1+1+1+1$.

I know that if we take away the rule of at most 1 ball per box, the answer would be $8^5$ ways to distribute the balls to the boxes, but i'm not sure how to calculate this.

At first, my thought is to take $8^5$ and subtract every other scenario where a box has more than one ball, but I feel like that would take longer than just counting how many will have one each?

EDIT: The balls and boxes are both identical.

Best Answer

If both boxes are identical, then there is only one distinct way.   Put one ball into each of the indistinguishable boxes.   It does not matter which ball goes into which box when you can not tell the difference.

If the boxes are distinguishable, you need to select $5$ from $8$ boxes and put the balls into them.

If the balls are also distinguishable, also you need to count ways to rearrange the 5 balls in their selected positions.