Stirling Number of the Second Kind CalculatorFree online math calculator — instant results, no sign-up
Count partitions of labeled objects into nonempty unlabeled groups.
Sign in to save results and favorites.
About the Stirling Number of the Second Kind Calculator
The Stirling Number of the Second Kind Calculator counts the ways to partition distinct, labeled objects into a specified number of nonempty, unlabeled groups. Group order and the order of objects within each group do not matter. With 8 objects and 3 groups, the calculator returns 966 partitions.
- Number of objects
- The number of distinct, labeled objects to partition, entered as a nonnegative whole-number count with no physical units; the default is 8.
- Number of groups
- The number of nonempty, unlabeled groups to form, entered as a nonnegative whole-number count with no physical units; the default is 3.
Formula and method
S(n, k) = (1/k!) × Σ[j=0 to k] (−1)^(k−j) × C(k, j) × j^n. For the default inputs: S(8, 3) = (3^8 − 3 × 2^8 + 3 × 1^8 − 0^8)/3! = (6561 − 768 + 3 − 0)/6 = 966.
- S(n, k)The Stirling number of the second kind: the number of partitions of n distinct objects into k nonempty, unlabeled groups.
- nThe number of objects; the default value is 8.
- kThe number of groups; the default value is 3.
- jThe summation index, taking every integer value from 0 through k.
- C(k, j)The binomial coefficient k!/[j!(k−j)!], counting the ways to choose j group labels from k.
- !The factorial operator; k! is the product of the positive integers through k, with 0! = 1.
- ΣThe instruction to add the expression over all indicated values of j.
Count assignments to temporarily labeled groups, then use inclusion–exclusion to remove assignments that leave any group empty. Divide by k! because each partition into nonempty groups has k! different labelings. For 8 objects and 3 groups, this gives 5796 assignments to nonempty labeled groups, then 5796/6 = 966 unlabeled partitions. Boundary cases are handled using S(0, 0) = 1, S(n, 0) = 0 for n > 0, and S(n, k) = 0 for k > n.
Worked example
These are the calculator's starting values and the results it actually produces for them.
Inputs
- Number of objects8
- Number of groups3
Results
- Partitions966
How to use the Stirling Number of the Second Kind Calculator
- 1Enter 8 in Number of objects for the worked example, treating each object as distinct.
- 2Enter 3 in Number of groups to require exactly 3 nonempty groups.
- 3Confirm that group names and the order of objects within groups should not affect the count.
- 4Run the calculation to evaluate S(8, 3).
- 5Read Partitions = 966 as the number of distinct ways to divide the 8 labeled objects into 3 nonempty, unlabeled groups.
Reading your result
The Partitions output row is an exact combinatorial count, not a probability or a count of arrangements within groups. For the default inputs, Partitions = 966 means there are 966 different groupings of the 8 distinct objects into exactly 3 nonempty groups. Swapping entire groups or reordering objects within a group does not create a new partition.
Limitations
Inputs must be nonnegative integers. Objects must be distinct, groups must be unlabeled and nonempty, and group sizes are unrestricted apart from being positive. This count does not enforce equal group sizes, capacity limits, or rules about which objects may share a group. More groups than objects gives zero partitions. Large inputs produce very large integers; exact evaluation requires suitable integer arithmetic, and practical input or display limits depend on the implementation.
Common questions
Why is the result for 8 objects and 3 groups not simply 3^8?+
The expression 3^8 counts assignments to 3 labeled groups and allows groups to be empty. Requiring every group to be occupied leaves 5796 assignments; removing group labels by dividing by 3! gives 966 partitions.
Does the calculator require the 3 groups to have equal sizes?+
No. It counts every partition into 3 nonempty groups, regardless of their sizes. In the default example, 8 objects cannot be split into 3 equal-size groups, but there are still 966 valid partitions with unrestricted positive group sizes.
What if the groups have distinct names or roles?+
For distinct, labeled groups that must all be nonempty, multiply the result by k!. With 8 objects and 3 labeled groups, the count is 966 × 3! = 5796.
How are impossible or empty cases defined?+
There are zero partitions when the number of groups exceeds the number of objects, or when a positive number of objects is assigned to zero groups. By convention, S(0, 0) = 1: the empty set has one partition into zero groups.
Does the calculator save my information?+
Calculations run in your browser. While signed in, inputs and results are automatically recorded in account history; saving a result creates a separate saved record.
You might also like
Scientific Calculator
Full scientific calculator with trig, logs, powers, memory and degree/radian modes.
Fraction Calculator
Add, subtract, multiply and divide fractions.
Percentage Calculator
Percent of a number, what percent, and percent change.
Random Number Generator
Generate random integers in a range.
Percent Error Calculator
Error between an observed and true value.
Exponent Calculator
Raise a base to any power.
Results are estimates for informational purposes and are not financial, medical or legal advice.