Courses / Computer Science I
Discrete Mathematics

Counting and Combinatorics

Computer Science I 265 words Free to read

How Many Ways?

Combinatorics answers "how many ways?" — how many passwords, how many committees, how many outcomes. It underpins probability, algorithm analysis, and cryptography. Two basic rules build everything:

Two headline formulas count arrangements and selections:

The single most important distinction is order. If rearranging the chosen items gives a different outcome (a race podium, a password), use permutations; if order is irrelevant (a committee, a hand of cards), use combinations. Combinations are smaller — dividing by k!k! removes the k!k! orderings of each selection that permutations counted separately.

Common pitfall: using a permutation where order does not matter (or vice versa), and mixing up the sum vs product rule. If order is irrelevant — a committee, a subset, a poker hand — use combinations (nk)\binom{n}{k}, not permutations. And "and" (sequential choices) multiplies while "or" (alternative choices) adds — reaching for the wrong one inflates or deflates the count by a lot.

Practise this lesson

The explanation above is free to read. The graded practice for this lesson lives in the Tryals app.

9practice questions
2interactive scenes
Start Computer Science I free

Discrete Mathematics