分组计数:两类组合数公式的差异与适用场景问询
Hey there, great question—these two formulas are super easy to mix up, so let’s break them down clearly with concrete examples:
This is the go-to formula when you’re assigning distinct objects to labeled (distinct) groups with fixed sizes. Think of it as counting how many ways you can split a set of unique items into groups that have clear identities.
How it works:
Say you’ve got 10 distinct students, and you need to split them into a 3-person Math Team, 4-person English Debate Team, and 3-person Physics Lab Team. These groups are clearly different (they have different purposes/labels), so here’s the logic:
- Pick 3 students for Math: $\binom{10}{3}$ ways
- Pick 4 of the remaining 7 for English: $\binom{7}{4}$ ways
- The last 3 go to Physics: $\binom{3}{3}$ ways
Multiply these together, and the factorials cancel out to give you $\frac{10!}{3!4!3!}$—exactly the formula.
When to use it:
- Your groups have unique labels/distinct identities (e.g., different teams, categories, or positions)
- You’re working with distinct objects
- You only care which objects belong to which group, not the order within groups or the order of the groups themselves (since groups are already labeled, their order doesn’t matter)
This formula isn’t for counting grouping options—it’s for counting total permutations after you’ve already grouped the objects. Specifically, it calculates how many ways you can rearrange every object within its group and rearrange the order of the groups themselves.
How it works:
Let’s stick with the 10 students split into unlabeled groups (3,4,3) (no team names—just three random groups). Now say you want to:
- Order each group’s members (e.g., for a presentation lineup): each group of size $n_k$ has $n_k!$ permutations, so $3! \times 4! \times 3!$ total for all groups.
- Rearrange the order of the groups themselves (e.g., which group presents first): there are $r!=3!$ ways to shuffle the 3 groups.
Multiply those two numbers together, and you get $3! \times (3! \times 4! \times 3!) = r!n_1!\cdots n_r!$.
Important note:
This formula doesn’t include the initial grouping step. If you want to calculate the total number of ways to go from "no groups" to "ordered groups with ordered members", you’d multiply the unlabeled grouping count by this formula. For the 10-student example, unlabeled grouping is $\frac{10!}{3!4!3! \times 2!}$ (divide by $2!$ because the two 3-person groups are identical), then multiply by $r!n_1!\cdots n_r!$ to get the full count.
When to use it:
- You’ve already grouped the objects (and groups are unlabeled—since labeled groups don’t need their order rearranged)
- You need to count both internal group permutations and group order permutations
- You’re working with distinct objects (permutations don’t make sense for identical items)
| Aspect | $\frac{n!}{n_1!\cdots n_r!}$ | $r!n_1!\cdots n_r!$ |
|---|---|---|
| What it counts | Number of ways to group objects | Number of permutations after grouping |
| Group type | Labeled/distinct groups | Unlabeled groups |
| Includes permutations? | No (only group membership) | Yes (intra-group + inter-group) |
| Relationship to $n!$ | Splits $n!$ into group assignments | Extends grouping with extra permutations |
Let’s take $n=4$, $r=2$, $n_1=2$, $n_2=2$ (4 distinct balls split into two groups of 2):
- First formula: $\frac{4!}{2!2!}=6$ → This is the number of ways to put balls into a red box and blue box (labeled groups). e.g., {AB in red, CD in blue}, {AC in red, BD in blue}, etc.—6 total.
- Second formula: $2!×2!×2!=8$ → This is the number of permutations for one unlabeled group split (e.g., {AB, CD}): you can rearrange AB→BA, CD→DC, and swap the groups to {CD, AB}—8 total permutations for that one split.
内容的提问来源于stack exchange,提问作者JohnDD

