MA2011 / MA2211 โ€” Discrete Mathematics Week 8
Week 8

Counting & Combinatorics

MA2011 Discrete Mathematics for Computing  |  MA2211 Discrete Mathematics

8.1 Basic Counting 8.2 Permutations & Combinations 8.3 Complex Problems 8.4 Probability

Our running scenario today: Organising the JCU Hackathon ๐Ÿ†

MA2011 / MA2211 8.1 Basic Counting

What is Combinatorics?

Combinatorics

Combinatorics is the branch of mathematics that counts, arranges, and selects objects from finite sets. The big question is always: "How many ways can we do this?"

๐Ÿ† Hackathon Scenario
Running Example

The JCU Hackathon has 30 students registering. We need to:
โ€ข Assign them to rooms โ€” how many can fit?
โ€ข Pick a team of 5 โ€” how many possible teams?
โ€ข Award Gold / Silver / Bronze โ€” in how many orders?

  • Combinatorics uses precise counting techniques, not guessing or listing everything.
  • Unlike arithmetic, problems in combinatorics can look simple but require creative thinking.
  • Tools we'll learn: Multiplicative Principle, Pigeonhole, Inclusion-Exclusion, P(n,r), C(n,r)
MA2011 / MA2211 8.1 Basic Counting

The Multiplicative Principle

Multiplicative Principle

If task 1 can be done in m ways, and for each of those, task 2 can be done in n ways, then both tasks together can be done in m ร— n ways.

๐Ÿ† Hackathon: Designing Team T-Shirts
Example

Hackathon T-shirts come in 4 colours (Red, Blue, Green, Black) and 3 sizes (S, M, L).
How many distinct T-shirt options are there?

4 colours ร— 3 sizes = 12 options

Think of it as a grid:

SML
RedR-SR-MR-L
BlueB-SB-MB-L
GreenG-SG-MG-L
BlackK-SK-MK-L
Key Idea

Each extra independent choice multiplies the total. Three independent choices of sizes a, b, c gives a ร— b ร— c outcomes.

MA2011 / MA2211 8.1 Basic Counting

The Pigeonhole Principle

Pigeonhole Principle

If n + 1 or more objects are placed into n containers, then at least one container holds 2 or more objects.

๐Ÿ† Hackathon: Assigning Rooms

The hackathon has 3 rooms (Lab A, Lab B, Seminar). 13 students arrive โ€” by the pigeonhole principle, at least one room must hold at least 5 students.

๐Ÿง‘โ€๐Ÿ’ปLab A
๐Ÿง‘โ€๐Ÿ’ปLab B
๐Ÿง‘โ€๐Ÿ’ปSeminar
General Form

If n items go into k containers, at least one container holds at least โŒˆn/kโŒ‰ items.

MA2011 / MA2211 8.1 Basic Counting

Inclusion-Exclusion Principle

Inclusion-Exclusion (2 sets)

|A โˆช B| = |A| + |B| โˆ’ |A โˆฉ B|

๐Ÿ† Hackathon: Skill Survey
Problem

Of 30 students surveyed:
โ€ข 18 know Python
โ€ข 12 know JavaScript
โ€ข 7 know both

How many know Python or JavaScript (or both)?

Python 18 JS 12 both 7
18 + 12 โˆ’ 7 = 23
Why subtract the overlap?

Adding |A| + |B| counts students in both groups twice. We correct this by subtracting |A โˆฉ B| once.

MA2011 / MA2211 Quick Check

Quick Check โ€” Basic Counting

Question 1

At the hackathon, lunch has 3 choices of main, 4 choices of drink, and 2 choices of dessert. How many different lunch combinations are there?

Question 2

35 students must be assigned to 6 project themes. Can we guarantee that at least one theme gets 6 or more students?

MA2011 / MA2211 8.2 Permutations & Combinations

Permutations โ€” Order Matters

Permutation

A permutation is an ordered arrangement. The number of ways to arrange r objects chosen from n distinct objects is:

P(n, r) = n! / (n โˆ’ r)! = n ร— (nโˆ’1) ร— โ€ฆ ร— (nโˆ’r+1)
๐Ÿ† Hackathon: Awards Ceremony
Example

10 teams compete. We award Gold ๐Ÿฅ‡, Silver ๐Ÿฅˆ, Bronze ๐Ÿฅ‰.
Order matters โ€” 1st โ‰  2nd.

P(10, 3) = 10 ร— 9 ร— 8 = 720

  • 1Gold: 10 choices
  • 2Silver: 9 remaining
  • 3Bronze: 8 remaining
10 ร— 9 ร— 8 = 720
When do you use P(n,r)?

Use permutations when order matters: rankings, arranging in a row, assigning distinct roles to people.

MA2011 / MA2211 8.2 Permutations & Combinations

Combinations โ€” Order Doesn't Matter

Combination

A combination is an unordered selection. The number of ways to choose r objects from n distinct objects is:

C(n, r) = n! / (r! ร— (n โˆ’ r)!)  =  "n choose r"
๐Ÿ† Hackathon: Selecting a Committee
Example

Choose 5 judges from 30 registered participants. A committee has no "first judge" or "second judge" โ€” order doesn't matter.

C(30, 5) = 30! / (5! ร— 25!)
= 142,506 ways

Key insight: permutations over-count by the number of ways to reorder the chosen group:

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

Dividing by r! removes all orderings of the same selection.

P vs C โ€” The Key Question

Ask yourself: "Does swapping two chosen items give a different result?" If YES โ†’ permutation. If NO โ†’ combination.

MA2011 / MA2211 8.2 Pascal & Binomial

Pascal's Identity & the Binomial Theorem

Pascal's Identity

C(n+1, r) = C(n, rโˆ’1) + C(n, r)

Choosing from n+1 objects = include the new object or don't.

n\r0123
01
111
2121
31331
Binomial Theorem

(x + y)โฟ = ฮฃ C(n,k) xแต yโฟโปแต
for k = 0 to n

Example (n=3)

(x+y)ยณ = xยณ + 3xยฒy + 3xyยฒ + yยณ
Coefficients: 1, 3, 3, 1 โ€” row 3 of Pascal's triangle!

๐Ÿ† Hackathon: Subsets of judges

Total subsets of 3 judges from a group = 2ยณ = 8. Setting x=y=1 in the binomial theorem gives ฮฃ C(3,k) = 2ยณ.

MA2011 / MA2211 Quick Check

Quick Check โ€” Permutations & Combinations

Question 3

The hackathon shortlists 8 teams. We need to pick a 3-person group for a 'best presentation' showcase โ€” teams just appear together, no ranking. How many ways?

Question 4

A 4-digit PIN for the hackathon WiFi uses digits 0โ€“9, no repetition. How many PINs are possible?

MA2011 / MA2211 8.3 Complex Problems

Tackling Complex Counting Problems

There's no single formula โ€” you need a strategy.

  • 1Read carefully. What exactly is being counted? What are the constraints?
  • 2Identify the type. Does order matter? Are repetitions allowed? Are there restrictions?
  • 3Break it down. Use the multiplicative principle to split into independent stages.
  • 4Count, then check. Try small examples first to verify your formula.
๐Ÿ† Complex Hackathon Problem
Example: Forming teams with constraints

Form a 4-person team from 30 students where exactly 2 must be Computing students (there are 12 Computing students, 18 others).

Stage 1: Choose 2 from 12 Computing: C(12, 2) = 66
Stage 2: Choose 2 from 18 others: C(18, 2) = 153
Total: 66 ร— 153 = 10,098 teams

MA2011 / MA2211 8.4 Simple Probability

Combinatorics & Probability

Equally Likely Outcomes

If all outcomes are equally likely: P(event) = (# favourable outcomes) / (# total outcomes)

๐Ÿ† Hackathon Prize Draw
Example 1

30 students enter a draw for 1 prize. What is the probability a Computing student wins? (12 are Computing)

P = 12/30 = 2/5 = 0.4

Example 2

A 3-person team is randomly drawn from all 30. What is the probability that all 3 are Computing students?

P = C(12,3) / C(30,3)
= 220 / 4060 โ‰ˆ 0.054

Connection to Counting

Probability with equally likely outcomes reduces to a counting problem. Master 8.1โ€“8.3 and probability follows naturally.

MA2011 / MA2211 Week 8 โ€” Summary

Week 8 Summary

8.1 Basic Counting

Multiplicative: independent choices โ†’ multiply

Pigeonhole: n+1 items, n boxes โ†’ share

Inclusion-Exclusion: |AโˆชB| = |A|+|B|โˆ’|AโˆฉB|

8.2 Permutations & Combinations

P(n,r): ordered, no repeat
= n!/(nโˆ’r)!

C(n,r): unordered, no repeat
= n!/(r!(nโˆ’r)!)

Pascal's / Binomial

8.3 & 8.4

Complex: break into stages, multiply

Probability:
P = favourable / total

Always ask: does order matter?

๐Ÿ† Our Hackathon Journey

T-shirt options (multiplicative) โ†’ Room assignment (pigeonhole) โ†’ Skill overlap (inclusion-exclusion) โ†’ Awards (permutation) โ†’ Committee (combination) โ†’ Prize probability โ€” all from one event!

๐Ÿ“‹ Coming up: Online Quiz 8 (Nov-20) ยท Graded Problem Sheet 4 (Nov-26)

โ† โ†’ arrow keys also work