Combinatorics & Constraint Solver

JJ Ben-Joseph headshot JJ Ben-Joseph

Solve permutation, combination, and constraint satisfaction problems. Calculate possible arrangements, team selections, scheduling scenarios, and probability-based outcomes. This calculator helps solve real-world discrete math problems.

Select Problem Type

Permutation Calculator: P(n, r)

Permutations: Calculate ordered arrangements where ORDER matters. Used for ranking, seating, or sequential selection.

Combination Calculator: C(n, r)

Combinations: Calculate unordered selections where ORDER doesn't matter. Used for team selection, lottery, or subset choosing.

Team Selection with Constraints

Select team members from a pool with role requirements: Forward, Midfielder, Defender, Goalkeeper positions.

Scheduling & Assignment Problem

Assign workers to shifts: Calculate possible shift assignments given constraints (max shifts per person, required coverage).

Solution & Analysis

Understanding Combinatorics

What is combinatorics? Combinatorics is the mathematical study of counting, arranging, and selecting objects under various constraints. It answers questions like "In how many ways can we arrange these items?" or "How many possible combinations are there?"

Key Concepts

1. Permutations: Order Matters

A permutation is an ordered arrangement of items. The number of permutations of n items taken r at a time is:

P ( n , r ) = n ! ( n r ) !

Example: Podium positions (1st, 2nd, 3rd place) in a race with 10 runners:

2. Combinations: Order Doesn't Matter

A combination is an unordered selection of items. The number of combinations of n items taken r at a time is:

C ( n , r ) = n ! r ! ( n r ) ! = P ( n , r ) r !

Example: Selecting 3 pizza toppings from 10 available:

3. Factorial

A factorial (n!) is the product of all positive integers up to n:

n ! = n × ( n 1 ) × ( n 2 ) × ... × 2 × 1

Example: 5! = 5 × 4 × 3 × 2 × 1 = 120

Real-World Applications

Team Selection Problem

A sports manager has 8 forwards, 10 midfielders, 9 defenders, and 3 goalkeepers. The manager must select a team of 11: 3 forwards, 4 midfielders, 3 defenders, and 1 goalkeeper. How many different teams can be formed?

Total Teams = C ( 8 , 3 ) × C ( 10 , 4 ) × C ( 9 , 3 ) × C ( 3 , 1 )

Calculation:

Scheduling Problem

Assign 5 workers to 3 shifts (morning, afternoon, evening), with 2 workers required per shift and maximum 2 shifts per worker. This is a constrained assignment problem solved using combinatorial methods.

Permutations vs Combinations Quick Reference

Aspect Permutation Combination
Order Importance Order matters (ABC ≠ BAC) Order doesn't matter (ABC = BAC)
Formula P(n, r) = n! / (n-r)! C(n, r) = n! / (r!(n-r)!)
Use Cases Rankings, seating, passwords, sequences Selections, teams, committees, subsets
Example: n=10, r=3 720 (much larger) 120 (smaller)

Worked Example: Lottery Problem

Scenario: A lottery requires selecting 6 numbers from 1-49. What are the odds of winning?

Solution:

Important Limitations

Embed this calculator

Copy and paste the HTML below to add the Combinatorics & Constraint Solver to your website.