Search the complete library

What do you want to learn or calculate?

Quick linksAll calculatorsMath subjectsPractice questionsFormula library
← Back to calculators

Discrete Math Calculator

Solve discrete math problems with clear steps, notation, and a final check.

Calculate without using AI.

Evaluate the governing formula locally in your browser. Define each known quantity once, then change values to test another case instantly.

Local result

Choose an example or enter a formula.

Show your work Step-by-step method
  1. No account, AI request, or paid token is used.

Recent calculations

No calculations yet.

Discrete math

Discrete Math Calculator explained

The short version

  • Discrete math counts things you can list: arrangements, subsets, routes, and truth values.
  • The first question is always whether order matters. Order matters means permutation, order does not means combination.
  • The second question is whether repeats are allowed, and that changes the formula again.

The formula this page uses

P(n, r) = n! / (n − r)! C(n, r) = n! / ( r! · (n − r)! ) |A ∪ B| = |A| + |B| − |A ∩ B|

What each part means

SymbolWhat it means
n — Size of the poolHow many different items are available to pick from.
r — How many you pickMust be no larger than n unless repeats are allowed.
n! — Factorialn × (n−1) × … × 1, and 0! is defined to be 1.
|A ∩ B| — OverlapHow many items are in both sets, which is what inclusion-exclusion subtracts once.

Show your work: a full example

  1. The setup10 people, choose 3
  2. If the three jobs are different, order mattersP(10, 3) = 10 × 9 × 8
  3. Multiply720 ordered ways
  4. If they are just a committee, order does not mattereach committee of 3 was counted 3! = 6 times
  5. So divideC(10, 3) = 720 ÷ 6
  6. The answer120 committees
  7. Read itthe same 3 people give 6 different podium orders but only 1 committee, which is exactly the factor of 6

A second, different case

  1. A different case: counting overlapping groups100 students, 60 take maths, 45 take physics, 25 take both
  2. Adding naively double-counts the overlap60 + 45 = 105, which is already more than the 100 students
  3. Inclusion-exclusion fixes it|M ∪ P| = 60 + 45 − 25
  4. At least one subject80 students
  5. Neither subject100 − 80 = 20
  6. Only maths, and only physics60 − 25 = 35 and 45 − 25 = 20
  7. Check the four groups add back35 + 25 + 20 + 20 = 100 ✓
Copy-ready example

10 people, choose 3

The setup

Which counting formula to use, with n = 10 and r = 3

SituationFormulaValueExample
Order matters, no repeatsn! / (n − r)!720gold, silver and bronze from 10 runners
Order does not matter, no repeatsn! / (r!(n − r)!)120a 3-person committee from 10 people
Order matters, repeats allowedn^r1000a 3-digit PIN using digits 0–9
Order does not matter, repeats allowedC(n + r − 1, r)2203 scoops chosen from 10 ice-cream flavours
Arrange all of themn!3,628,800shuffling a 10-card deck

Three mistakes to check for

What students writeWhy it's wrongDo this instead
C(10, 3) = 10! / 3! = 604800The (n − r)! in the denominator was dropped, so the seven people who were not chosen are still being arranged.C(10, 3) = 10!/(3!·7!) = 120.
Using P(10, 3) for a committeePermutations count Ann-Bob-Cara as different from Cara-Bob-Ann, but a committee does not care.Divide by 3!: 720 ÷ 6 = 120.
60 + 45 = 105 students take at least one subjectThe 25 who take both were counted twice, and 105 exceeds the 100 students available.Subtract the overlap once: 60 + 45 − 25 = 80.

Questions about the Discrete Math Calculator

How do I decide between a permutation and a combination?

Ask whether swapping two chosen items gives a genuinely different outcome. Gold and silver medals: yes, so permutation. Two seats on the same committee: no, so combination. The combination is always the smaller number.

Why is 0! defined as 1?

Because there is exactly one way to arrange nothing, and because it keeps the formulas working. C(10, 10) should be 1, and 10!/(10!·0!) only gives 1 if 0! = 1.

What is the pigeonhole principle?

If you put more items than boxes, some box holds at least two. With 13 people, two must share a birth month, because there are only 12 months. It proves things exist without ever finding them.

Where is discrete math actually used?

Anywhere the objects come in whole units: hashing and password strength use n^r, network routing uses graphs, and program correctness uses logic and induction. Continuous calculus has almost nothing to say about any of it.

Where to go next

Continue from this result

Turn one calculation into understanding.

Compare another tool, review the underlying idea, then solve a fresh problem without copying the example.