0% found this document useful (0 votes)
33 views42 pages

07 Lesson

The document provides information about combinatorics and different ways of choosing items from a set. It discusses combinations with and without repetition, and whether order matters. Key formulas are presented for calculating the number of combinations in each scenario, such as n!/(n-k)! for k items chosen from n without repetition when order matters. Examples are given to illustrate each type of combination.

Uploaded by

w.p.j.5624
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views42 pages

07 Lesson

The document provides information about combinatorics and different ways of choosing items from a set. It discusses combinations with and without repetition, and whether order matters. Key formulas are presented for calculating the number of combinations in each scenario, such as n!/(n-k)! for k items chosen from n without repetition when order matters. Examples are given to illustrate each type of combination.

Uploaded by

w.p.j.5624
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

BM20A9200 - Mathematics A

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.

Also, if you want to check your exercise scores, check Moodle:

2 / 42
Learning objectives

• Know how to calculate in how many ways can we choose k


items from n options
formulas order matters order doesn’t  matter
n! n
no repetition
(n − k)!  k 
k n − 1+k
with repetition n
k
• Know which of the above option applies to a given problem
(in mathematics but also in real life).

3 / 42
Contents

Combinatorics

Ways of choosing
Repetition & order
No repetition & with order
No repetition & no order
Repetition & no order

Pascal’s triangle & binomial coefficients

4 / 42
Some early history of combinatorics

How many possible combinations of one, two or three


tastes are possible from a selection of six tastes (sweet,
pungent, astringent, sour, salty and bitter)?
in Bhagabadi Sutra, India, 300 BC

5 / 42
Some early history of combinatorics

Hexagrams: A permutation with repetitions of six lines


where each line can by one of two states: dashed (yin, 阴)
or solid (yang, 阳). There are 64 of them.
in Yi Jing, 易经, China, 1000–200 BC.
6 / 42
What is combinatorics?

It is a branch of mathematics that counts ways of things


happening.

7 / 42
Contents

Combinatorics

Ways of choosing
Repetition & order
No repetition & with order
No repetition & no order
Repetition & no order

Pascal’s triangle & binomial coefficients

8 / 42
Contents

Combinatorics

Ways of choosing
Repetition & order
No repetition & with order
No repetition & no order
Repetition & no order

Pascal’s triangle & binomial coefficients

9 / 42
Number of passwords

How many different combinations?

Image by Bill Ferngren from Pixabay.

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

Select k items from a set of n options with repetition allowed and


order mattering.

• First item has n options.


• Second item has n options.
..
.
• Item number k has n options.
The previous choices do not restrict our current choices. Each
selection produces a different outcome (order does matter).
In total
nk = n
| ×n×
{z· · · × n} .
k times

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

Pascal’s triangle & binomial coefficients

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.

• First item has n options.


• Second item has n − 1 options.
..
.
• Item number k has n − k + 1 options.
The previous choices restrict our current choice (we cannot pick
the same element). Each selection produces a different outcome
(order does matter).
In total
n × (n − 1) × · · · (n − k + 1)
n × (n − 1) × (n − 2) × · · · × 3 × 2 × 1 n!
= = .
(n − k) × (n − k − 1) × · · · × 3 × 2 × 1 (n − k)!
Notation: a! = a × (a − 1) × (a − 2) × · · · × 3 × 2 × 1
17 / 42
How many seconds are there in six weeks?

10!

It’s true: 10! = 60 × 60 × 24 × 7 × 6


18 / 42
Example: no repetition, order matters
Example 1: You have three tasks for this morning; check email
(E), do homework (H), go to class (C). In how many different
orders can you finish all of them?
Solution: First task has 3 options, second has 2, third has 1.
Hence 3! = 6 ways:

EHC ECH
HEC HCE
CEH CHE

Example 2: How many bijections f : A → B are there when


A = {a1 , a2 , a3 , a4 } and B = {b1 , b2 , b3 , b4 }?
There are 4 options for f (a1 ). After this there is 3 options for
f (a2 ). Then 2 options for f (a3 ), and lastly one options for f (a4 ).
Hence the answer is 4! = 24.

19 / 42
Mathematical fact about bijections and injections

There are n! bijection f : A → B if |A| = |B| = n.

There are n!/(n − k)! injections f : A → B if k = |A| ≤ |B| = n.

20 / 42
Counting surjections is difficult
Counting surjections is not part of the course.
For an example see homework exercise 7.6.

exercise sessions teachers

21 / 42
Contents

Combinatorics

Ways of choosing
Repetition & order
No repetition & with order
No repetition & no order
Repetition & no order

Pascal’s triangle & binomial coefficients

22 / 42
How many tastes?

In how many ways is it possible to combine two out of the six


possible fundamental tastes in a food? (sweet, pungent,
astringent, sour, salty, bitter)
Cooking 101:
• No smartasses: sweet & sweet is just sweet. You must choose
2 different ones!
• Order does not matter: sweet & sour is the same as sour &
sweet.

Idea: take top 2 tastes! Then remove the effect of order by


division.

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

Select k items from a set of n options. Repetition is forbidden.


Two selections which differ only by the order are the same.
• First select k items without repetition but with order:
n!/(n − k)! ways.
• To each final selection there corresponds k! ordered versions.
Hence divide by k!.
In total  
n! n
= .
(n − k)! · k! k
n

The notation k is the binomial coefficient. Read it “n choose k”.

25 / 42
Example: no repetition, no order

Example 1: How many combinations of three out of the six tastes


are there?
Solution: Three tastes can be put in a queue in
6!/(6 − 3)! = 6 × 5 × 4 = 120 ways. Each selection of 3 tastes
appears there 3! = 3 × 2 × 1 = 6 times (e.g. Sw,So,Sa and
Sw,Sa,So and So,Sw,Sa and . . . ). Remove the extras by division:
120/6 = 20 choices.
Example 2: A set has 5 elements. How many subsets of 2 does it
have?
Solution: A subset is a type of selection of elements. No
repetition, order doesn’t matter. Hence
5

2 = 5!/(2! · 3!) = 5 × 4/2 = 10 different subsets.

26 / 42
Mathematical fact about subsets

n

If |A| = n then it has k different subsets of cardinality k.

(recall: no elements can be repeated in a set, and their order does


not matter)

27 / 42
Contents

Combinatorics

Ways of choosing
Repetition & order
No repetition & with order
No repetition & no order
Repetition & no order

Pascal’s triangle & binomial coefficients

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?

How to calculate the number of such plates?


How to describe such a plate? 30 / 42
How many macaron plates?
A plate can be described perfectly by telling how many green ones,
how many yellow ones, purple ones, red ones and blue ones. Their
sum must be equal to 6.
Example: each line is a different plate

Observation: each line has k = 6 macarons and 4 = n − 1


separators!

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

Make sure of the following during the discussion.


• everybody is being heard
• everybody can participate

33 / 42
Discuss: how many of what types of macarons?

How many and which kind of macarons the following code


corresponds to?

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.

111,,1,1,1 represents: 3 of the first colour, 0 of the next colour, 1


of colour nbr 3, 1 of colour nbr 4 and 1 of colour nbr 5.
10 symbols, any set of 4 of them as commas (and rest as ones) will
give a different selection.
6 plates of macarons from 5 colours:
 
10 10! 10 × 9 × 8 × 7
= = = 210.
4 4! · 6! 4×3×2×1

35 / 42
In general: choices with repetition, without order

Select k items from a set of n options. Repetition is allowed. The


order of items does not matter.
• Make a code of k ones and n − 1 commas (or other
separators).
• Out of these n − 1 + k slots select any subset of n − 1
commas (or k ones).
• The rest are ones (or commas, respectively).
In total
   
n−1+k n−1+k (n − 1 + k)!
= =
n−1 k k! · (n − 1)!

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

Pascal’s triangle & binomial coefficients

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 binomial is a polynomial of the following form:

(a + b)n , n ∈ N.

a and b can be variables or numbers (or anything that you allow in


polynomials).
Examples:
• (1 + x)2 = 1 + 2x + x 2
• (y + z)3 = y 3 + 3y 2 z + 3zy 2 + z 3
• (3 + a)5 = 35 + 5 · 34 a + 10 · 33 a2 + 10 · 32 a3 + 5 · 31 a4 + a5

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

Explanation on whiteboard or Jouni’s notes 5 page 6. For a formal


proof we will need mathematical induction (next time).

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

You might also like