07 Lesson
07 Lesson
Emilia Blåsten
LUT University
Schoolyear 2022–2023
Periods I-II
Lesson 7
1 / 42
Practical matters
Several exceptions to our usual schedule happen next week:
• There is no lesson (not even remote).
• There are no exercise sessions.
• There is still homework nbr 7 from this week!
• Do it for the week after: 31st October – 4th November.
• We do not have a mid-term exam.
• The course has a final exam in January.
• If you fail that you get 2 more chances to try.
2 / 42
Learning objectives
3 / 42
Contents
Combinatorics
Ways of choosing
Repetition & order
No repetition & with order
No repetition & no order
Repetition & no order
4 / 42
Some early history of combinatorics
5 / 42
Some early history of combinatorics
7 / 42
Contents
Combinatorics
Ways of choosing
Repetition & order
No repetition & with order
No repetition & no order
Repetition & no order
8 / 42
Contents
Combinatorics
Ways of choosing
Repetition & order
No repetition & with order
No repetition & no order
Repetition & no order
9 / 42
Number of passwords
10 / 42
Number of passwords
Option 1: the passwords are any number from 000 to 999. There
are 1000 of them.
Option 2:
11 / 42
In general: choices with repetition and order
12 / 42
Example: repetition + order
Example 1: You can mark any of the 6 exercises this week as done
’x’ or not done ’ ’. In how many different ways can you fill up your
row in the exercise score sheets?
Solution: Exercise 1, two options. Exercise 2, two options. Etc.
Whether an exercise is done or not will not affect any other
marking. Hence 2 × 2 × 2 × 2 × 2 × 2 = 26 = 64 ways.
(think of what are the possible listings, on whiteboard)
Example 2: Let A be a set of 12 elements. How many elements are
there in A3 = A × A × A?
Solution: x ∈ A3 if and only if x = (a1 , a2 , a3 ) where each of
a1 , a2 , a3 ∈ A. Order matters (it’s a vector), and repetition is
allowed (no restrictions on having an element multiple times).
First element has 12 options. Second element has 12 option. Last
element has 12 option. Hence 123 = 1728 elements in A3 .
13 / 42
Mathematical fact about Cartesian products
If |A| = n then
Ak = nk .
14 / 42
Contents
Combinatorics
Ways of choosing
Repetition & order
No repetition & with order
No repetition & no order
Repetition & no order
15 / 42
Top 3 spots
The Finnish Elite League of ice hockey has 15 teams (HPK, IFK,
ILV, JUK, JYP, KAL, KÄR, KOO, LUK, PEL, SAI, SPO, TAP,
TPS, ÄSS). In how many ways can the medals be given (gold,
silver, bronze)?
Let’s form all possible combinations in three steps:
1. Choose some team for gold: 15 option
2. Choose an unselected team for silver: 14 options
3. Choose an unselected team for bronze: 13 options
=⇒ In total 15 × 14 × 13 = 2730 ways
(HPK,IFK,ILV), (HPK,IFK,JUK), (HPK,IFK,JYP), (HPK,IFK,KAL), (HPK,IFK,KÄR), (HPK,IFK,KOO), (HPK,IFK,LUK),
(HPK,IFK,PEL), (HPK,IFK,SAI), (HPK,IFK,SPO), (HPK,IFK,TAP), (HPK,IFK,TPS), (HPK,IFK,ÄSS), (HPK,ILV,IFK),
(HPK,ILV,JUK), (HPK,ILV,JYP), (HPK,ILV,KAL), (HPK,ILV,KÄR), (HPK,ILV,KOO), (HPK,ILV,LUK), (HPK,ILV,PEL),
(HPK,ILV,SAI), (HPK,ILV,SPO), (HPK,ILV,TAP), (HPK,ILV,TPS), (HPK,ILV,ÄSS), (HPK,JUK,IFK), (HPK,JUK,ILV),
(HPK,JUK,JYP), (HPK,JUK,KAL), (HPK,JUK,KÄR), (HPK,JUK,KOO), (HPK,JUK,LUK), (HPK,JUK,PEL), (HPK,JUK,SAI),
(HPK,JUK,SPO), (HPK,JUK,TAP), (HPK,JUK,TPS), (HPK,JUK,ÄSS), (HPK,JYP,IFK), (HPK,JYP,ILV), (HPK,JYP,JUK),
(HPK,JYP,KAL), (HPK,JYP,KÄR), (HPK,JYP,KOO), (HPK,JYP,LUK), (HPK,JYP,PEL), (HPK,JYP,SAI), (HPK,JYP,SPO),
(HPK,JYP,TAP), (HPK,JYP,TPS), (HPK,JYP,ÄSS), (HPK,KAL,IFK), (HPK,KAL,ILV), (HPK,KAL,JUK), (HPK,KAL,JYP),
(HPK,KAL,KÄR), (HPK,KAL,KOO), (HPK,KAL,LUK), (HPK,KAL,PEL), (HPK,KAL,SAI), (HPK,KAL,SPO), (HPK,KAL,TAP),
(HPK,KAL,TPS), (HPK,KAL,ÄSS), (HPK,KÄR,IFK), (HPK,KÄR,ILV), (HPK,KÄR,JUK), (HPK,KÄR,JYP), (HPK,KÄR,KAL),
(HPK,KÄR,KOO), (HPK,KÄR,LUK), (HPK,KÄR,PEL), (HPK,KÄR,SAI), (HPK,KÄR,SPO), (HPK,KÄR,TAP), (HPK,KÄR,TPS),
(HPK,KÄR,ÄSS), (HPK,KOO,IFK), (HPK,KOO,ILV), (HPK,KOO,JUK), (HPK,KOO,JYP), (HPK,KOO,KAL), (HPK,KOO,KÄR),
(HPK,KOO,LUK), (HPK,KOO,PEL), (HPK,KOO,SAI), (HPK,KOO,SPO), (HPK,KOO,TAP), (HPK,KOO,TPS), (HPK,KOO,ÄSS),
(HPK,LUK,IFK), (HPK,LUK,ILV), (HPK,LUK,JUK), (HPK,LUK,JYP), (HPK,LUK,KAL), (HPK,LUK,KÄR), (HPK,LUK,KOO),
(HPK,LUK,PEL), (HPK,LUK,SAI), (HPK,LUK,SPO), (HPK,LUK,TAP), (HPK,LUK,TPS), (HPK,LUK,ÄSS), (HPK,PEL,IFK),
(HPK,PEL,ILV), (HPK,PEL,JUK), (HPK,PEL,JYP), (HPK,PEL,KAL), (HPK,PEL,KÄR), (HPK,PEL,KOO), (HPK,PEL,LUK),
(HPK,PEL,SAI), (HPK,PEL,SPO), (HPK,PEL,TAP), (HPK,PEL,TPS), (HPK,PEL,ÄSS), (HPK,SAI,IFK), ...
16 / 42
In general: choices without repetition but with order
Select k items from a set of n options without repetition but where
the order matters.
10!
EHC ECH
HEC HCE
CEH CHE
19 / 42
Mathematical fact about bijections and injections
20 / 42
Counting surjections is difficult
Counting surjections is not part of the course.
For an example see homework exercise 7.6.
21 / 42
Contents
Combinatorics
Ways of choosing
Repetition & order
No repetition & with order
No repetition & no order
Repetition & no order
22 / 42
How many tastes?
23 / 42
How many tastes?
Sweet, Pungent, Astringent, Sour, Salty, Bitter.
Ways to select top two: 6 × 5.
Sw Pu Pu Sw As Sw So Sw Sa Sw Bi Sw
Sw As Pu As As Pu So Pu Sa Pu Bi Pu
Sw So Pu So As So So As Sa As Bi As
Sw Sa Pu Sa As Sa So Sa Sa So Bi So
Sw Bi Pu Bi As Bi So Bi Sa Bi Bi Sa
Ways to order top two: First one has 2 options. Second one 1
option. Total 2 × 1 = 2!.
In total: 6 × 5/2 = 15.
Sw Pu Pu Sw As Sw So Sw Sa Sw Bi Sw
Sw As Pu As As Pu So Pu Sa Pu Bi Pu
Sw So Pu So As So So As Sa As Bi As
Sw Sa Pu Sa As Sa So Sa Sa So Bi So
Sw Bi Pu Bi As Bi So Bi Sa Bi Bi Sa
24 / 42
In general: choices without repetition, without order
25 / 42
Example: no repetition, no order
26 / 42
Mathematical fact about subsets
n
If |A| = n then it has k different subsets of cardinality k.
27 / 42
Contents
Combinatorics
Ways of choosing
Repetition & order
No repetition & with order
No repetition & no order
Repetition & no order
28 / 42
How many macaron plates?
In how many ways can you fill a plate with 6 macarons of 5 colours?
Image by Kris L from Pixabay
29 / 42
How many macaron plates?
Is there a difference?
31 / 42
Discussion code words
Do not use these:
• “You’re wrong”
• “I can’t do it”
• “You know better than I do”
Starting:
• “Do you want to think about this together?”
• “I didn’t understand the question. Did you?”
• “I don’t know what this word means. Let’s check its definition
from the lecture material.”
Making the discussion flow:
• “Please continue, I’m listening”
• “I didn’t quit get it, please explain again”
• “I have another idea”
• “I have a different opinion”
• “Let me think a little bit more”
32 / 42
Rules of discussion
33 / 42
Discuss: how many of what types of macarons?
111,,1,1,1
Vote at https://pingo.coactum.de/627296
(A) (C)
(B) (D) 34 / 42
How many macaron plates?
A selection of 6 macarons from 5 options can be encoded as
follows:
• A code of 6 ones and 4 commas (6 + 4 = 10 symbols).
• A comma switches to the next colour (have an arbitrary order
in advance).
• A one represents one macaron of the current colour.
35 / 42
In general: choices with repetition, without order
selections.
36 / 42
Example: repetition but no order
It is Black Friday! If you have exactly 6 items in your shopping cart
you get 50% off! The store has 200 types of items. The shopping
cart will list items alphabetically. How many different shopping
carts can get the sale?
Solution: The order we put items in the cart does not matter (the
cart sorts them alphabetically). We can take multiple of the same
items (like every shopping cart ever). Hence we make a selection
of k = 6 items from n = 200 options, with repetition allowed but
order does not matter. There are
n−1+k 205 205 × 204 × 203 × 202 × 201 × 200
= =
k 6 6×5×4×3×2×1
68 937 810 984 000
= = 95 746 959 700
720
different carts that get the sale.
37 / 42
Contents
Combinatorics
Ways of choosing
Repetition & order
No repetition & with order
No repetition & no order
Repetition & no order
38 / 42
Pascal’s triangle
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
..
.
Row n has the numbers
n n n n n
... (1)
0 1 2 n−1 n
An element is the sum of its two above neighbours. If (1) is true
then this corresponds to
n n−1 n−1
= + .
k k −1 k
This is true in general. Prove it by using the definition of kn .
39 / 42
Binomials
(a + b)n , n ∈ N.
40 / 42
Binomial coefficients
n
Why is k called binomial coefficient?
Proposition
For all n ∈ N
n n n n n−1 n n−1 n n
(a + b) = a + a b + ··· + ab + b .
0 1 n−1 n
41 / 42
Other topics if there is extra time
Review:
(A) Sets
(B) Relations and their properties
(C) Propositional logic
(D) Binary numbers
(E) Types of proofs
(F) Types of functions
Vote at https://pingo.coactum.de/627296
42 / 42