mathematics competition training class notes elementary...

45
Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics 341 E E l l e e m m e e n n t t a a r r y y C C o o m m b b i i n n a a t t o o r r i i c c s s a a n n d d S S t t a a t t i i s s t t i i c c s s Combinatorics – All about Counting Introduction to Combinatorics* Combinatorics is the science of counting . This includes counting how many ways to arrange (permutation) some objects, how many ways (combinations) are there to do the same thing, or something like that. The underlying theory is set theory – we can treat objects we are working with as sets. These are all examples of enumerative combinatorics. Another branch of combinatorics is graph theory. This is the study of designs , such as how to move from a place to another within least time? How to connect computers into a network with least cables? Addition and Multiplication Principle* Although we knew how to count before we know how to calculate, the counting problem is still quite difficult to answer. This is mainly because we simply cannot count those big numbers. But we can have some techniques to know how to count big numbers from some patterns. The addition principle states that, if there are some sets that are pair-wise disjoint, and the size of unions of those sets are the sum of the size of all sets. ( ) 1 1 if , : n n k k i j k k A A ij A A = = = =∅ (34.1)

Upload: vanthien

Post on 30-Aug-2018

221 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

341

EElleemmeennttaarryy

CCoommbbiinnaattoorriiccss

aanndd SSttaattiissttiiccss Combinatorics – All about Counting

Introduction to Combinatorics*

Combinatorics is the science of counting. This includes counting how many ways to

arrange (permutation) some objects, how many ways (combinations) are there to do

the same thing, or something like that. The underlying theory is set theory – we can

treat objects we are working with as sets. These are all examples of enumerative

combinatorics.

Another branch of combinatorics is graph theory. This is the study of designs, such

as how to move from a place to another within least time? How to connect computers

into a network with least cables?

Addition and Multiplication Principle*

Although we knew how to count before we know how to calculate, the counting

problem is still quite difficult to answer. This is mainly because we simply cannot

count those big numbers. But we can have some techniques to know how to count big

numbers from some patterns.

The addition principle states that, if there are some sets that are pair-wise disjoint,

and the size of unions of those sets are the sum of the size of all sets.

( )11

if , :n n

k k i j

kk

A A i j A A==

= ∀ ∩ = ∅∑∪ (34.1)

Page 2: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

342

Example 34a: How many integers are there between 1 and 10 inclusively that is

divisible by 4 or 3?

Solution 34a:

There are 2 numbers that are divisible by 4 (4, 8) and 3 numbers that are divisible by

3 (3, 6, 9). Since they are disjoint sets, we can use the addition principle and so there

are 2 + 3 = 5 numbers suiting the requirement.

Multiplication principle states that the ways to choose an element from a set A1 and

then from A2 then A3… is:

1

n

k

k

A=∏ (34.2)

Example 34b: How many ways are there to pick two cards from a set of 52 poker

cards without replacement (placing back)?

Solution 34b:

There are 52 ways to pick the first card, and 51 ways to pick the second card. Hence

there are 52 × 51 = 2652 ways to pick two cards.

It is sometimes hard to choose between whether to use addition or multiplication

principle. Remember that addition is used when the word “or” appears, and

multiplication is used when “then” appears. Also, addition can be used only if the two

things connected by “or” are disjoint – they are independent from each other.

Unrepeated Combinations and Permutations

Permutations are methods to arrange a number of objects. For example, the

followings are examples of permutations of {1, 2, 3, 4, 5, 6}:

{6, 3, 5, 2, 4, 1}, etc. (34.2)

{1, 6, 2, 5, 3, 4}, etc. (34.3)

{2, 6, 3, 1, 4, 5}, etc. (34.4)

Example 34c: How many ways are there to permute k objects?

Solution 34c:

Let those objects be denoted by elements of Zk. We can choose elements in Zk and put

them into the blanks in

k

⋯����������� �� without repetition. We can pick one of the k

elements in Zk into the first blank, and then pick one of the k – 1 from the rest, and

then k – 2, … Therefore, there are totally k(k – 1)(k – 2) × … × 2 × 1 permutations.

Page 3: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

343

The value k(k – 1)(k – 2) × … × 2 × 1 is called the factorial of k, denoted as k!. We

also define 0! = 1, since there is only one method to permute nothing: to do nothing.

However, sometimes we don’t want to permute the whole set of objects. We may just

want to know the number of permutations of k objects out of n. There are clearly

k(k – 1)(k – 2) × … × (k – n + 1) ways. This number is denoted as ( )

!

!

n

k

nP

n k=

−.

Combinations are similar to permutations – except order is unimportant in

combinations. For example, the following two arrangements are considered to be

different in permutations:

{1, 2, 3, 4} and {4, 2, 3, 1} (34.5)

But they are the same in combinations. Therefore, the ways to combine k objects out

of n is the ways to permute k out of n divided by ways to permute k objects (to

remove effect of ordering). This number is denoted as ( )

!

! ! !

n

n k

k

P nC

k k n k= =

−.

Example 34d: How many distinct positive solutions are there in the Diophantine

equation x1 + x2 + … + x100 = 1000?

Solution 34d:

Assume there are a thousand blanks “�” to denote the number “1000” (So each blank

denote the unity). There are spaces between the blanks, and we can insert plus signs

“+” there to mimic an addition. So the original problem is equivalent to how many

ways to insert 99 “+” in the 999 spaces. Trivially, there are 999 138

99 6.38505 10C ≈ ×

solutions.

Example 34e: How many rectangles can be formed in an m × n grid?

__ __ __ __

4×3 grid

Solution 34e:

A rectangle needs 4 edges – 2 horizontal and 2 vertical. We are therefore required to

find the ways to choose those 4 edges. There are obviously 1

2

nC + ways to choose the

Page 4: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

344

horizontal edges and 1

2

mC + ways for the verticals. Hence, in total, there are

( )( )1 1

2 2

1 1

4

m nmn m n

C C+ + + += rectangles there.

Repeated Combinations and Permutations

The combinations and permutations we have introduced before have a common point:

every element chosen cannot be put back into the set. But this is not always applicable.

For example, if I rolled a dice and get a “6”, I cannot remove the face “6” from the

dice. Since the element is not removed, repetition may happen. For k objects out of n,

there are obviously nk permutations if duplication of element is allowed, using

multiplication principle.

Repeated combinations are trickier. We can do this in reverse: pick n boxes out of k.

Instead of putting balls (elements) into containers, we put containers on top of balls.

This is equivalent arrange k blanks in (n + k – 1) spaces (and fill the rest with “+”). So

there are totally 1n r

kC + − combinations.

�� + � + � + + + + = 4

Page 5: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

345

This value is denoted as:

( ) ( ) ( )( )

11 2 1

!

n n r

k k

n n n n rH C

k

+ −+ + × × + −

= =…

(34.6)

It is worth comparable that:

( ) ( ) ( )( )1 2 1

!

n

k

n n n n rC

k

− − × × − −=

… (34.7)

Example 34f: How many distinct nonnegative solutions are there in the Diophantine

equation x1 + x2 + … + x100 = 1000?

Solution 34f:

The answer is 100 143

1000 1.29361 10H ≈ × distinct solutions. The working step is left to

readers as exercises.

Example 34g: How many ways can one roll 3 distinct die to give a total face value 6

or less?

Solution 34g:

This is equivalent to solving Diophantine equations for a + b + c ≤ 6 where a, b, c are

positive. This is also the same as nonnegative integral solutions to A + B + C ≤ 3.

Now let D be another nonnegative integer such that A + B + C + D = 3. Here, the

number of solutions is 4

3 20H = . This (20) corresponds to the number of ways.

Principle of Inclusion and Exclusion (PIE)

The addition principle works only when the sets are disjoint. But what happens if it

does not? Let’s consider the following two sets in Venn diagram:

Suppose the size of the red-set is R and that of blue-set is B. If the add R and B

directly, the element shared by both R and B will be over-counted. We have to subtract

these over-counted elements from R + B, which is size of the intersection of the two

sets. Therefore:

|A ∪ B| = |A| + |B| – |A ∩ B| (34.8)

This is known as the principle of inclusion and exclusion (PIE) for two sets. If A and

B are disjoint, then |A ∩ B| = 0. So PIE is a generalization of addition principle.

Page 6: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

346

What about three sets?

If we add the size of B, G and R together, the members of C, M and Y will be

over-counted. But if we subtract them, the members of W will not be counted. So we

have to add it back. Therefore:

|A ∪ B ∪ C| = |A| + |B| + |C| – |A ∩ B| – |B ∩ C| – |C ∩ A| + |A ∩ B ∩ C| (34.9)

This is PIE for three sets. In general, for n sets:

11 1

n nn

k k j k i j k k

k j k i j kk k

A A A A A A A A= < < <= =

= − ∩ + ∩ ∩ − ±∑ ∑ ∑ …∪ ∩ (34.10)

Example 34h: How many integers between 1 and 1000 are there that is divisible by 5

or 7?

Solution 34h:

( ) ( )( ) ( )

number divisible by 5 or 7 divisible by 5 divisible by 7

div. by 5 div. by 7 div. by 5 div. by 7

div. by 5 div. by 7 div. by 35

1000 1000 1000

5 7 35

200 142 28

314

= ∪

= + − ∩

= + −

= + − = + −

=

(34.11)

Example 34i: (Derangement problem) There are n letters and n envelopes, which will

be sent to different people. How many ways are there to put the all letters wrongly

into non-corresponding envelopes?

Solution 34i:

Name the letters as L1, L2, …, Ln and the envelopes as E1, E2, …, En. We write Li ∈ Ej

if the letter Li can be found in the envelope Ej. The problem required finding number

of ways of:

∀k: Lk ∉ Ek (34.12)

B

R G

C

Y

M W

Page 7: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

347

Let’s consider its opposite statement, i.e.,

∃k: Lk ∈ Ek (34.13)

If we force one Lk ∈ Ek, then for each k there are (n – 1)! ways to do so by permuting

the n – 1 letters except Lk. There are n ways to choose such a k. If we force Lk ∈ Ek

and Lj ∈ Ej for j ≠ k, then for each pair of (j, k) there are (n – 2)! ways, and there are

2

nC ways of choosing the pair. This is similar for other enforcements. So the ways of

(34.13) can be found using PIE:

( ) ( ) ( )1 2 31 ! 2 ! 3 !

1 1 1 1!

1! 2! 3! !

n n nC n C n C n

nn

− − − + − −

= − + − ±

… (34.14)

There are n! ways to permute n letters. So the number of ways that no letters go into

the right envelopes is:

( )

0

1 1 1 1 1 1 1 1! ! !

1! 2! 3! ! 0! 1! 2! !

1!

!

kn

k

n n nn n

nk=

− − + − ± = − + − ±

−= ∑

… …

(34.15)

The last number is called the subfactorial of n, denoted as !n. This can be calculated

easily by:

!

!n

ne

= (34.16)

Where [x] means the nearest integer of x (e.g., [3.14] = 3, [9.8] = 10) and e is the base

of natural logarithm, approximately 2.718281728459045… The reason of appearance

of this number will be taught in “Elementary Calculus and Analysis”.

Page 8: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

348

Polynomial Expansion

Polynomial Expansion vs. Combinatorics

Raising a polynomial by a power then expand this is a kind of polynomial expansion.

This seems to be an algebraic problem only – how combinatorics is involved? This

comes from the fact that the coefficient of a term after expansion is just the ways to

choose a combination of terms before expansion. This will be introduced in this

chapter.

Binomial Expansion

Consider the expansion of:

(1 + x)n (35.1)

Which must be of the form:

an xn + an-1 x

n-1 + … + a2 x2 + a1 x + a0 (35.2)

How to transform (35.1) into (35.2)? Writing (35.1) explicitly:

( )( )( ) ( )1 1 1 1

n

x x x x+ + + +…�������������

(35.3)

Expansion of (35.3) result in sums of the form

n

⋯����������� �� where each blank

can be filled with a “1” or an “x”. There are n

kC ways to fill k “x” into the blanks –

and so is the coefficient of xk. This means:

( )0

1n

n n k

k

k

x C x=

+ =∑ (35.4)

(35.4) is known as the binomial theorem. For the expansion of (x + y)n:

( )0

nn n n n k

k

k

x y C x y −

=

+ =∑ (35.5)

In algebra, however, we seldom write n

kC . Instead, we use the notation n

k

and the

name of it is binomial coefficient instead of combination. The binomial coefficients

satisfy the following relationships:

� Symmetry:

n n

k n k

= −

(35.6)

Page 9: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

349

� Addition:

1 1

1

n n n

k k k

− − = + −

(35.7)

Example 35a: Expand (5 – 3x)7 up to the cubic term (x3).

Solution 35a:

( ) ( ) ( ) ( )7 2 37 6 5 4

2 3

17 17 17 175 3 5 5 3 5 3 5 3

0 1 2 3

78125 796875 3825000 11475000

x x x x

x x x

− = + − + − + − +

= − + − +

(35.8)

Example 35b: What is the coefficient of x2 is the expansion of (6 + 3x + x2)(2 + x)10?

Solution 35b:

( ) ( )

( ) ( ) ( )( )( ) ( ) ( )

102

2 10 9 8 2

2 2

2

6 3 2

6 3 2 10 2 45 2

6 11520 3 5120 1024

85504

x x x

x x x x

x x x x

x

+ + +

= + + + + +

= + + + + + + +

= + +

… … … … …

… …

(35.9)

Hence, the coefficient is 85504.

Example 35c: Find the constant term in the expansion of

6

2 75x

x

+

.

Solution 35c:

Let the kth term be the constant term. That term is:

( ) ( )( )( )6

2 6 3 66 67

5 5 7

kk

k k kx xk kx

−− − =

(35.10)

The term is constant if and only of the power of x is 0, i.e., 3k – 6 = 0, meaning k = 2.

So the constant term is ( )( )2 6 26

5 7 9003752

− =

.

Example 35d: Find the term with maximum coefficient in the expansion of

(5x + 2)100.

Solution 35d:

Notice that the coefficient will increase with power of x and reaches the peak then

decreases. Therefore we can consider the ratio of the kth and (k + 1)th term and check

for the least k such that the ratio is greater than 1 (for just passing the peak). The ratio

is:

Page 10: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

350

( )

( )

100100

1 100 1100

1

2 5 1 5

100 22 5

k k

k

k k

k

k

k

+ − −

+

+= ⋅

− (35.11)

If this is greater than 1:

( )

1 51

100 2

5 5 200 2 We always have 0 100

195

7

The maximum coefficient occurs when 28

k

k

k k k

k

k

+⋅ >

−⇔ + > − ≤ ≤

⇔ >

⇔ =

(35.12)

That term is then ( ) ( )100 2828 83 72100

2 5 2.8415 1028

x x−

≈ ×

Multinomial Expansion

Multinomial expansion deals with (x1 + x2 + x3 + … + xk)n. We also put the “x” into

the blanks of

n

⋯����������� �� . Suppose a term has a1 “x1”, a2 “x2”, …, ak “ak” such

that ∑a = n. We can put the “x1” first, then “x2”, then “x3”, … There are 1

n

aC ways for

putting x1, 1

2

n a

aC−

for x2, 1 2

3

n a a

aC− −

for x3… So the total number of ways is:

( )

( )1 21 1 2

1 2 3 1

1

1

!

!

n

n

n

jjn a an a n a an

a a a a n

jj

aC C C C

a

=− − −− − −

=

=∑∏

…⋯ (35.13)

The last value is called the multinomial coefficient. The expansion of multinomial is

given by:

1 0 1

Σ

!!

j

j

n akk

j

j

j a j ja n

xx n

a= ≥ ==

=

∑ ∑ ∏ (35.14)

For example, the expansion of (x + y + z)2 is x2 + y2 + z2 + 2xy + 2yz + 2zx. Even

though there is an explicit formula for multinomial expansion, we seldom use it

because of its complexity.

Page 11: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

351

Example 35e: (IMOPHK 2001 Q3) Find the coefficient of x17 in the expansion of

(1 + x5 + x7)20.

Solution 35e:

x17 can only be formed by (117)((x5)2)(x7), which means the coefficient is

( )17 1 2 !3420

17!1!2!

+ += .

Multinomial coefficient also has meaning in combinatorics. The value

( )1 2

1 2

!

! ! !

k

k

n n n

n n n

+ + +…

⋯ means the way to permute k objects on a line each with n1, n2, …,

nk copies. When n1 = n2 = … = nk = 1, the multinomial coefficient reduced to k! as

expected.

Example 35f: How many ways are there to rearrange the letters in the word

“MATHEMATICIAN”?

Solution 35f:

In this word:

Letter(s) Count

A 3

I, M, T 2

C, E, H, N 1

So the number of rearrangements is ( ) ( )( )

( ) ( ) ( )3 4

3 3 2 4 1 !129729600

3! 2! 1!

+ += .

Page 12: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

352

Probability

Introduction to Probability*

Probability is a measure for likelihood of happenings of things. For example, we say

there is 50% of chance getting a head while tossing a coin. So the probability of

getting a head is 0.5 (i.e., 50%). Suppose (I mean suppose) there is a coin with three

faces, one of them is a head. You will expect the probability is decreased to ⅓ now.

The probability of an event to be happened is defined by (assuming every outcome is

equally likely to happen):

( ) outcomes of "event"event

all possible outcomesP = (36.1)

For example, in a (normal) coin there is a “head” and a “tail”, so number of all

possible outcomes is 2. And for the event “getting a head”, there is one method for it

to happen: getting a head. So:

( ) 1getting a head

2P = (36.2)

(36.1) can be used only if:

1. All outcomes are really equally likely to happen.

2. All outcomes happen randomly.

Violation of any of the rules above can lead to wrong value of probability. For instant,

there are two outcomes in rolling a dice: “6” or “not 6”. So the probability of getting a

“6” is ½ – this is clearly wrong because it is much more likely for getting “not 6” over

“6” (violation of rule 1). Take another example; if you can press on the red square in

the table below you will be awarded $1. What is probability of you can win the prize?

___ ___ ___

(36.1) tells us that the probability is 1∕9, but in reality you can press that square for

almost certainty. This is because you intended (assuming you are greedy) and you can

easily press on that square, so the outcomes are not random anymore. All probability

is “concentrated” to the red square.

Page 13: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

353

The definition of probability tells us that if P(E) = 0 then E can never happen. If

P(E) = 1 then E must happen. But this is not true even the two rules hold. Consider

the event “picking the number ‘2’ from the set N”. It is possible for this event to

happen, but the probability is zero (1∕∞ = 0). We should treat probability carefully

when it comes into reality usage.

Theorems of Probabilities

The numerator of (36.1) involves counting. Therefore theorems of combinatorics can

be applied to probabilities readily.

� 0 ≤ P(E) ≤ 1 (36.3)

� Complementary principle

( ) ( )1P E P E= − (36.4)

� Addition principle

( ) ( )i iP E P E=∑ ∑ (36.5)

(Ei and Ej are mutually exclusive (disjoint) events for every i ≠ j)

� Multiplication principle

( ) ( )i iP E P E=∏ ∏ (36.6)

� PIE

( ) ( )1 1 1 1

nn n

i i i j i

i i i j n i

P E P E P E E P E= = ≤ < ≤ =

= − + ±

∑ ∑ ∑ ∏… (36.7)

(Ei and Ej are independent from each other for every i ≠ j)

Here, addition of events means “or” and multiplication means “and then” (e.g.,

E or F = E + F, E and then F = E × F) to make the properties of probability clearer.

Example 36a: There are three containers as shown. There are some balls in it.

Page 14: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

354

What is the probability that a person picked a yellow ball?

Solution 36a:

There is ⅓ probability of choosing a specific container. The probability of choosing a

yellow from the first container is ⅔, and that from the second one is 0, and that from

the third is ⅓. So the probability of choosing a yellow ball is:

( )1 2 1 1 1 10

3 3 3 3 3 3

+ + =

(36.8)

Tree Diagram*

To help calculation, we may use a tree diagram to list out all possible outcomes

systematically. Firstly, we list all possibilities that should be considered first. Then we

will list the events after, and so on. Take example 36a as example, the tree diagram

looks like:

Here, the numbers marked on the lines show the probability of using that to advance

to the next stage. We can clearly see the probability of getting a yellow ball is

1 2 1 1

3 3 3 3⋅ + ⋅ from the diagram.

Conditional Probability*

In example 36a, we calculated the probability of picking a yellow ball is ⅓. But this is

true only in the condition that the balls are arranged in the containers like figured. If

there are no containers and we can pick the balls randomly, the probability rises to ⅜.

First container

Second container

Third container

Green ball

Yellow ball

Green ball

Blue ball

½

½

Yellow ball ⅓

Blue ball ⅓

Red ball

The person

Page 15: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

355

Here, we see that the preamble condition is very important in probability measures.

Therefore we sometimes need to state the condition for that event. This is known as

the conditional probability. The probability for event B to be happen if A is already

happened is:

( )( )( )

|P AB

P B AP A

= (36.9)

The equality is given from the multiplication principle of probability. In fact, to make

the multiplication principle more rigorous we should state:

1

1 1 1

n n k

k k j

k k j

P A P A A−

= = =

=

∏ ∏ ∏ (36.10)

Example 36b: (Baye’s theorem) Prove that ( ) ( ) ( )1

|n

k k

k

P B P A P B A=

=∑ if

( )1

1n

k

k

P A=

=∑ .

Solution 36b:

Obviously A1, A2, …, An are mutually exclusive. Therefore A1B, A2B, …, AnB are also

mutually exclusive. Applying the addition principle and (36.9) we have:

( )

( )

( ) ( )

1 1

1

1

|

n n

k k

k k

n

k

k

n

k k

k

P A B P A B

P A B

P A P B A

= =

=

=

=

=

=

∑ ∑

(36.11)

Example 36c: What is the probability of choosing two integers between 1 and 100

inclusively such that their difference is a multiple of 3?

Solution 36c:

Divide the set {1, 2, 3, …, 100} into three sets: A = {3, 6, 9, …, 99}, B = {1, 4, 7,

10, …, 100} and C = {2, 5, 8, 11, …, 98}. Notice that the two numbers can have a

difference of 3k if and only if both of them can be found in the same set. Also we have

|A| = 33, |B| = 34 and |C| = 33. Hence the probability is:

33 32 34 33 33 32 49

100 99 100 99 100 99 150⋅ + ⋅ + ⋅ = (36.12)

Page 16: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

356

Simple Graph Theory

What are Graphs?

A graph is a collection of vertices. These vertices can be represented by points in the

space. There are also edges in a graph. An edge connects two vertices. The followings

are examples of graphs:

This is also K 4The complete bipartite graph K 2,4

TreeThe Seven Bridges

of Konigsberg

The complete graph K 4

In a graph, the position and the shape of the vertices and edges are not important. The

only essential thing is the structure: how the edge connects the vertices.

Sometimes the edges contain directions. Such graphs are called directed graphs, e.g.:

There are also colored graphs, labeled graphs, etc.

2

4

1

3

Vertex labeled and coloredEdge labeledVertex labeled

Vertex and Edge coloredEdge coloredVertex colored

34

21 1 2

4 3

Page 17: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

357

Nowadays, graph theory is widely used in networking (computers can be thought as

vertices and wires as edges), system engineering, economics, chemistry, etc.

In this chapter we are only concentrated in how to “walk” in a graph: the number of

ways and the most “efficient” way to do so.

Path-Counting Algorithm

One popular type of questions that often appears in competitions: how many ways are

there to walk from one vertex to another in a directed graph? (e.g. how many ways

one can move from A to H in the following graph?)

A

B C

D

G

F

H

E

Method of exhaustion is often practiced, but when the number of vertices and edges

become large this often exhausts the attempter first. The path-counting algorithm

can be used to compute this quite efficiently. The following is the algorithm.

Step 1: Label the starting vertex as “1”.

1

Page 18: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

358

Step 2: Spread this number along the movable path.

1

1

1

1

Step 3: Continue spreading the newly numbered vertices one by one. If the target

vertex already has a label on it, replace it with the sum of that number and

the spread one. (It is better to spread the one that won’t be affected by the

un-spread vertices first)

1

1

2

1

1

1

13

1

1

1

1

1

13

1

4

4

1

1

13

1

4

4

1

1

1

13

1

8

4

5

1

1

13

1

8

4

13

1

Page 19: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

359

Step 4: The number of ways to walk from the starting to the ending vertex is shown

on the ending vertex.

There are 13 ways as shown.

The path-counting algorithm can be used for any directed graphs, but for some

specific graphs a better method can be applied. If the graph forms a rectangular grid

and the directed edges all point to two directions only, e.g.,

And there are m vertices on every row and n vertices on every column, then there are

( ) ( ) ( ) ( ) ( )( ) ( )

1 1 1 1

1 1

2 !

1 ! 1 !

m n m n

m n

m nC C

m n

− + − − + −− −

+ −= =

− − (37.1)

Ways to walk. For example, there are ( )( ) ( )5 1 4 1 7

34 135C C

− + −− = = ways to walk on grid

above.

Example 37a: The following is the map of Australia. If a person could only moves

towards North or West, how many ways he/she can walk from Victoria to Western

Australia?

Page 20: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

360

Solution 37a:

The whole map can be converted to a directed graph:

Start

End

Here, vertices represent states/territories and edges represent boundaries. Using

path-counting algorithm we see that the number of ways is 7.

Dijkstra’s Algorithm*

When walking in a graph, we often want to know which path is the “best” to use –

this could take the least time, save the most money or made the greatest profit. For

example, it seems to be more timesaving by moving from Victoria to South Australia

then Western Australia than from Victoria to New South Wales then Queensland then

South Australia then Northern Territory then Western Australia. But if we assign the

cost for crossing each boundary:

$4

$9

$25

$19

$2

$10

$13

$30

$13

Start

End

Then the former path will cost $55 but the latter costs only $41! However, the latter is

still not the cheapest path. Besides, we may also want to find the “best” path from

Victoria to all other states. Finding the “best” path is quite difficult. Trial-and-error

usually won’t help. The Dijkstra’s algorithm can be employed to make a

systematical finding of the graph. The detail steps of the algorithm follow:

Page 21: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

361

Step 1: Initialization.

From the start, we only know one fact: it costs nothing staying in the starting vertex.

So mark it with the optimized value, 0.

$4

$9

$25

$19$2

$10

$13

$30

$13

V $0

Step 2: Pick the most “optimized” vertex. Update the cost for the adjacent vertices.

The only choice is V. The available adjacencies are S and N.

$4

$9

$25

$19$2

$10

$13

$30

$13

V $0

N $4

S $25

Step 3: Pick the most “optimized” paths to the adjacencies.

Those are VN and VS.

$4

$9

$25

$19$2

$10

$13

$30

$13

V $0

N $4

S $25

Step 4: Repeat step 2 and 3 until all edges are considered.

$4

$9

$25

$19$2

$10

$13

$30

$13

V $0

N $4 Q $13

S $23

$4

$9

$25

$19$2

$10

$13

$30

$13

V $0

N $4 Q $13T $23

S $15

Page 22: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

362

$4

$9

$25

$19$2

$10

$13

$30

$13

V $0

N $4 Q $13T $23

S $15W $45

$4

$9

$25

$19$2

$10

$13

$30

$13

V $0

N $4 Q $13T $23

S $15W $36

$4

$9

$25

$19$2

$10

$13

$30

$13

V $0

N $4 Q $13T $23

S $15W $36

Step 5: Done.

The optimized paths are the green ones.

$4

$9

$25

$19$2

$10

$13

$30

$13

V $0

N $4 Q $13T $23

S $15W $36

Page 23: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

363

Statistics*

What is Statistics?

Statistics is a branch of mathematics that analyzes a (large) set of data. Usually,

before we do statistical calculation we need to collect data. The data may be height of

a group of people, the quality of products made by some machines, etc. Facing these

data, statisticians usually ask: what is the most common height range? Which is the

most reliable machine? These are the main topics of statistics.

Organization of Data

In order to get a brief scenario of what the data describe, we need to organize them

neatly – usually sorting helps.

88 8

77 32

97 37

32 39

64 53

8

64

75 � . 75

92 77

39 83

37 88

53 91

91 92

83

97

After sorting, we can immediately see the minimum and maximum of the data.

Data with Frequency

Data are in forms of numbers, but they can also come in ordered pairs: (x, f). The

number “x” is the data, and “f” is the frequency of the appearance of “x” in the whole

set of data. So, if the data is:

Data (x) Freq. (f)

2 8

3 9

Page 24: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

364

Then there are eight copies of “2” and nine copies of “3” in the data set, or explicitly

2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3

Grouped Data

Data collected in real life usually contains little variations. The following is an

example of data of height of some people:

172 173 163 171 168 163

159 181 176 177 156 182

173 169 164 166 172 159

163 164 169 173 177 180

If we reorganize the data without classification, the result will be:

156 159

159 163

163 163

164 164

166 168

169 169

171 172

172 173

173 173

176 177

177 180

181 182

It is pretty a mess and the “structure” of the data is not obvious. We should divide the

data into groups, such as 155 – 159, 160 – 164, 165 – 169, 170 – 174, 175 – 179 and

180 – 184.

Page 25: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

365

Group name Freq.

155 – 159 3

160 – 164 5

165 – 169 4

170 – 174 6

175 – 179 3

180 – 184 3

By this mean we can see that most people fall into the 170 – 174 group.

Class Boundary and Class Mark

The method to divide group above is not complete. Assume we had a better

instrument and measures 164.4 – which group should it falls to, 160 – 164 or

165 – 169? We cannot tell. Therefore we should extend the range of the group to

include all (expected to appear) real numbers. This extension confirms the class

boundaries of the group. The values of class boundaries are usually taken to be the

midpoint of the endpoints of two successive pre-extended groups. So:

Group name Class boundaries Class mark

155 – 159 [154.5, 159.5) 157

160 – 164 [159.5, 164.5) 162

165 – 169 [164.5, 169.5) 167

170 – 174 [169.5, 174.5) 172

175 – 179 [174.5, 179.5) 177

180 – 184 [179.5, 184.5) 182

Anything falls inside the class boundaries means this is inside the corresponding

group. (Therefore 164.4 is in 160 – 164.)

There is also a measure for the approximate values of the data inside the group. This

is known as the class mark, which is the midpoint of the group.

Cumulative Frequency

The cumulative frequency is used to indicate how many data are there less/more

than a certain value. For example:

Page 26: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

366

Group name Freq. Cumulative Freq.

155 – 159 3 3

160 – 164 5 8 (= 5 + 3)

165 – 169 4 12 (= 8 + 4)

170 – 174 6 18 (= 12 + 6)

175 – 179 3 21 (= 18 + 3)

180 – 184 3 24 (= 21 + 3)

This means there are 3 people are on or below the 155 – 159 group, 8 are on or below

the 160 – 164 group, and so on. The final cumulative frequency should show the total

number of data.

Graphing Data with Frequency

To obtain an even clearer view of data, we graph it. We graph data with frequency on

a graph paper similar to graphing equations. The x-axis usually represents the class

mark of the group and the y-axis is the frequency. Usually the two groups beyond the

largest and smallest ones are also included.

Histogram

A histogram is exactly the same as a bar chart except the spaces between the bars are

eliminated.

Height of some people

0

1

2

3

4

5

6

7

152 157 162 167 172 177 182 187

Height (x )

Freq.

Page 27: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

367

Frequency Polygon and Curve

Frequency polygon is exactly the same as a line graph. Frequency curve is a

smoothed version of frequency polygon.

Height of some people

0

1

2

3

4

5

6

7

152 157 162 167 172 177 182 187

Height (x )

Freq.

Polygon

Curve

Cumulative Frequency Polygon and Curve

Cumulative frequency polygon and curve are essentially the same as their

frequency counterparts except the y-axis marks the cumulative frequency instead of

frequency. Also, the largest null group is ignored.

Height of some people

0

5

10

15

20

25

152 157 162 167 172 177 182

Height (x )

Cumulative Freq.

Page 28: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

368

Measures of Central Tendency

There are three measures of central tendency. The first is the familiar arithmetic

mean (average), or simply mean. It is defined as:

ix

xn

= ∑ (37.2)

Where xi are the data and n is the number of data. For grouped data, the mean is:

i i

i

f xx

f= ∑∑

(37.3)

The median is the middle value of the group of data when sorted.

8

32

37

39

53

64

75

77

83

88

91

92

97

If the middle lies between two data, the median is the mean of them.

5

6

9

13

14

19

For grouped data, the median is the value of that the cumulative frequency

curve/polygon corresponds to half of the total frequencies.

Median

Median = (9 + 13) / 2 = 11

Page 29: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

369

Height of some people

0

5

10

15

20

25

152 157 162 167 172 177 182

Height (x )

Cumulative Freq.

The median is often denoted as xɶ .

The mode of some data is the data that appears the most, i.e., having the highest

frequency. The modal class of some grouped data is the group with the highest

frequency. The mode (and also modal class) is not necessary unique. For example, the

following data have two modes: 5 and 6.

1 2 5 5 5 6 6 6 7 8 8

For the three measures, the mean is easiest to calculate, but can easily be affect by

extreme values. For example, the following two sets of data looks very similar and

thus one will expect they have similar average. But the mean given is quite different:

1 2 5 6 7 9 10 12

1 2 5 6 7 9 10 100000

The median does not have this problem. Therefore median is often used in statistical

research that should not be affected by extreme values, such as the rage of people. But

since the calculation of median is harder, it is seldom used in normal statistical

calculations. The mode is even harder, and because of its multi-valued nature, it has

almost no use in statistics.

12.5

Median = 167.64

Page 30: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

370

Quantiles

The n% quantile of a set of data is a value that any data below that makes up

(approximately) n% of the whole set of data. One quantile we have introduced before

is the median, which is actually a 50% quantile. Also, the minimum point is the 0%

quantile and the maximum point is the 100% quantile. The quantiles can be found

form the cumulative frequency curve/polygon similar to that of median.

There are two types of quantiles often used: the quartiles and percentiles. A

percentile is a quantile that can be represented by integral percentage value (e.g. 99%).

A quartile is a 0%, 25%, 50%, 75% or 100% quantile.

An n% percentile is written as nth percentile. Similarly, a (25n)% quartile is written as

nth quartile. The nth quartile is denoted with the symbol Qn. They have names too.

Quartile Name

Q0 Minimum

Q1 Lower quartile

Q2 Median

Q3 Upper quartile

Q4 Maximum

Q1 is actually the median of the upper-half data and Q3 is of the lower-half one.

The calculation of quartiles for grouped data is very easy: just refer to the graphs. But

this is not so for ungrouped data. There is some difficulties in choosing the upper-half

and lower half data. If the median lies between two numbers, the halves are separated

by the median.

1 2 5 7 9 10 12 14

But if the median is one of the data, then that number will not be counted in the

halves.

Median

Lower half Upper half

Page 31: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

371

1 2 5 7 8 9 10 12 14

Measure of Dispersion

The measures of central tendency can measure where the data concentrate, but not

how disperse they are. Take the following two sets of data:

2 8 14 23 25 35 35 48 60 65 70

32 33 33 34 35 35 35 35 36 37 40

They have the same mean, median and mode but obviously the first set is more

“disperse”. Thus there is a need for measure of dispersion. There are four main types

of such measures: range, inter-quartile range (IQR), mean deviation and standard

deviation.

The range is simply the difference of the maximum and minimum value:

range = max – min (37.4)

This is simple, but can easily be affected by extreme values. One slight modification

is the IQR, where the different of Q3 and Q1 is taken:

IQR = Q3 – Q1 (37.5)

However, both of them only involves a particular number of data, which cannot truly

reflect how disperse all data are. The mean deviation overcomes this by considering

all data. The mean deviation is the arithmetic mean of all the “distances” between

each data and the mean, i.e.,

MDix x

n

−= ∑ (37.6)

For grouped data,

MDi i

i

f x x

f

−= ∑

∑ (37.7)

The disadvantage of mean deviation is that the absolute value is hard to compute. We

can change the absolute sign to squaring, however, for easy manipulation. This is the

Median

Lower half Upper half

Page 32: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

372

definition of variance.

( )2ix x

n

−∑ (37.8)

But the unit of variance is doubled in dimension, e.g., if the unit of data is cm, then

the unit of variance will become cm2. To get rid of the extra dimensions we just take

square root to it. The result is the standard deviation:

( ) ( )22 2 1

i inix xx x

σn n

−−= =

∑ ∑∑ (37.9)

All measures of dispersion have a common point: their value will become larger as

the data get more disperse. They will be zero if all data are the same. Usually getting

the value of measure alone is useless – it is only useful in comparing with others.

The standard deviation is the most commonly used measure because it is simple and

involves all data required. Therefore it has many uses in statistics.

Other Uses of Standard Deviation

Standard Score

A student gets 89 marks in English Literature and 38 in Geography. You will think he

performed very well in Literature and badly in Geography in the class. But you cannot

conclude this without data of other students. But even with that we cannot compare

the two subjects directly because they are simply different things. To compare we

introduce the standard score (z-score):

x x

−= (37.10)

The standard score is dimensionless and therefore this can be used to compare

different systems. For example, if the mean and standard deviation of Literature are

85 and 1.77 and those of Geography are 36 and 0.57 respectively, we have:

Literature of student

Geography of student

89 852.26

1.77

38 363.51

0.57

z

z

−= =

−= =

(37.11)

By comparing the standard scores, the student made better in Geography than

Literature.

Normal Curve

The normal curve is a type of frequency curve that appears in many natural data sets.

Page 33: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

373

In a normal curve, the three central tendency measures: mean, median and mode are

the same. The curve is symmetric about the mean. It is bell-shaped.

Data (x)

Freq. (f)

0

If the data is normal curve-like, then it has the following nice properties:

� In the range [ ],x σ x σ− + , about 68% of data can be found.

� In the range [ ]2 , 2x σ x σ− + , about 95% of data can be found.

� In the range [ ]3 , 3x σ x σ− + , about 99.7% of data can be found.

These are important in statistical analysis because most data appears as a normal

curve.

Page 34: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

374

Summary � Combinatorics – All about Counting

� Addition principle: ( )11

if , :n n

k k i j

kk

A A i j A A==

= ∀ ∩ = ∅∑∪

� Multiplication principle: 1 2 3

1

n

n k

k

A A A A A=

× × × × =∏…

� To pick k things from n of them:

Order not important

(Combinations)

Order is important

(Permutations)

Cannot repeat ( )!

! !

n

k

nC

k n k=

( )!

!

n

k

nP

n k=

Can repeat 1n n k

k kH C + −= nk

� PIE:

� |A ∪ B| = |A| + |B| – |A ∩ B|

� 11 1

n nn

k k j k i j k k

k j k i j kk k

A A A A A A A A= < < <= =

= − ∩ + ∩ ∩ − ±∑ ∑ ∑ …∪ ∩

� Subfactorial: To derange n objects, ways !

!n

ne

= =

� Polynomial Expansion

� Binomial theorem:

� ( )0

1n

n n k

k

k

x C x=

+ =∑

� ( )0

nn n n n k

k

k

x y C x y −

=

+ =∑

� Binomial coefficient:

� n

k

nC

k

=

� n n

k n k

= −

� 1 1

1

n n n

k k k

− − = + −

� Multinomial expansion:

*

Page 35: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

375

� 1 0 1

Σ

!!

j

j

n akk

j

j

j a j ja n

xx n

a= ≥ ==

=

∑ ∑ ∏

� Multinomial coefficient: ( )

( )1

1

!

!

n

jj

n

jj

a

a

=

=

∑∏

� This is the coefficient of a term in multinomial expansion.

� In combinatorics, this is number of ways to permute k objects on a

line each with a1, a2, a3, …, an copies.

� Probability

� Probability is measure for likelihood of happenings.

� If all outcomes are equally likely to happen,

( ) outcomes of "event"event

all possible outcomesP =

� 0 ≤ P(E) ≤ 1

� ( ) ( )1P E P E= −

� ( ) ( ) ( )( ): i j i ii j E E P E P E∀ ≠ = ∅ ⇒ =∑ ∑

� ( ) ( )i iP E P E=∏ ∏

� ( ) ( )1 1 1 1

nn n

i i i j i

i i i j n i

P E P E P E E P E= = ≤ < ≤ =

= − + ±

∑ ∑ ∑ ∏…

� Use tree diagram to list out all outcomes.

� Conditioned probability:

� ( )( )( )

|P AB

P B AP A

=

� 1

1 1 1

n n k

k k j

k k j

P A P A A−

= = =

=

∏ ∏ ∏

� ( ) ( ) ( ) ( )1 1

1 |n n

k k k

k k

P A P B P A P B A= =

= ⇒ =

∑ ∑

� Simple Graph Theory

� Graph is collection of vertices and edges that connect vertices.

*

*

*

*

*

*

Page 36: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

376

� Path-counting theorem: Spreading numbers from the start, sum up if

obstacle appears, the ways in found in the end. (See P.357 – 359 for detail).

� In a m × n grid (m, n count the lines), ways to move in two perpendicular

direction only ( ) ( ) ( ) ( ) ( )( ) ( )

1 1 1 1

1 1

2 !

1 ! 1 !

m n m n

m n

m nC C

m n

− + − − + −− −

+ −= = =

− −.

� Dijkstra’s algorithm: to find shortest way from one vertex. See P.361 – 362.

� Statistics

� Sorting data helps.

� Frequency: Number of copies of specific data.

� Group data is good.

� Class boundary: Extending groups to whole real line.

� Class mark: Midpoint of a group.

� Cumulative frequency: Number of data below/above a value.

� Statistical graphs:

� Histogram: Bar chart without spaces in-between.

� Frequency polygon: Line chart start and end with extended zero.

� Frequency curve: Smoothed frequency polygon.

� Cumulative frequency polygon/curve: Frequency polygon/curve with

frequency replaced by cumulative frequency.

� Central tendency:

� Mean: ix

xn

= ∑

� Median: Middle of sorted data.

� Mode/Modal class: Data/Group with highest frequency.

� Quantile:

� n% quantile = n% data below this.

� nth Percentile = n% quantile.

� nth Quartile (Qn) = (25n)% quantile.

� Q1 = Median of lower half. Q3 = Median of upper half.

� Dispersion:

� Range = Maximum – Minimum.

� IQR = Q3 – Q1.

� Mean deviationix x

n

−= ∑

� ( ) ( )22 2 1

i inix xx x

σn n

−−= =

∑ ∑∑

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

Page 37: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

377

� Uses of σ:

� Standard score: x x

−= . Use this to compare data from different

sources.

� Normal curve: Frequency curve often appears in natural data.

� 68% data in [ ],x σ x σ− +

� 95% data in [ ]2 , 2x σ x σ− +

� 99.7% data in [ ]3 , 3x σ x σ− +

*

*

*

*

*

*

Page 38: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

378

Self Assessment Exercises

Level 1

1) n people sit around a table. How many ways are there to sit if rotation is not

important?

2) There are five red balls, three green balls and six blue balls.

a) Two balls are chosen at random. What is the probability that they are of the

same color?

b) How many ways are there to arrange the balls on a ring if rotation is not

important?

3) How many three-digit integers are there such that the sum of all digits is multiple

of 8? What is the probability of choosing this kind of number from the set of all

three-digit integers?

4) Prove that the standard deviation is always greater than or equal to the mean

deviation.

5) In a competition, there are two teams: A and B. Both of the teams have n

representing competitors. The first competitor of both teams will start the match

first. The loser will be replaced by the following competitor of the losing team and

the match will restart. This will continue until all representatives of a team lose.

How many different competition processes are there?

6) The Mark Six lottery is a lottery game in Hong Kong. People will try to guess the

six (distinct) “number balls” drawn from 49 of them. There is also an “Extra

Number ball” drawn after the six.

a) The first prize will be offered if all six number balls match the guess (order

is not important). What is the probability for this?

b) The sixth prize will be offered if three drawn balls and the Extra ball

(together four of them) match the guess. What is the probability for this?

c) A fair coin has a probability of ½ of getting a head. At least how many

consecutive heads have to be got so that the probability of this is lower than

that of winning the first prize of Mark Six?

7) (HKMO 2000/FG Q3i) A point is located at the origin (0, 0) of the coordinate

plane. When a dice is thrown and the number n shown is even, it moves to the

right by n units. Otherwise, it moves upward by n units. How many ways are there

to move the point to (4, 4)?

*

Page 39: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

379

8) (HKMO 1995/HG Q9) How many triangles are there below?

Level 2

9) (HKMHASC 1999/Q10 Modified) Let E be an integral function that returns the

sum of all odd digits of the input, e.g., E(1235) = 1 + 3 + 5 = 9. Find ( )9999

1k

E k=∑ .

10) (PCMSIMC 2004/2 Q13) The following is the street map of Square City. The

edges are corresponding to the streets. The side length of each square is exactly

one kilometer long. Mr. Smith runs a pizza shop at point A and provides pizza

delivery service.

N

C

B

A

a) One day, Mr. Smith received two orders from B and C respectively. Starting

from A, he had to deliver the pizzas to points B and C (order is not

important) and returns to point A via the streets. What is the minimal

distance he must travel?

b) How many different ways are there for Mr. Smith to travel from A to B if he

can travel towards North or East only?

c) Mr. Smith noticed that the current location of the shop (at the Southwestern

tip) was not ideal. Whenever orders from remote Northeastern area are

received, the distant to travel will be long and the transportation cost is very

high. As a result, he decided to close down the shop and chooses two other

locations for the new shops. The shops must lie on the intersection of streets

and the distance from everywhere to one of the shops must be at most 6 km

along the streets. How many different combinations are there for the

Page 40: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

380

locations of the new shops?

d) For sake of convenience, Mr. Smith colored the small square in the map

with red, green or blue such that no two squares in the same row or column

have the same color. How many distinct coloring schemes are there?

11) (PCMSIMC 2004/S Q7; Monty Hall Problem variant) Peter puts two coins into

any two of five identical boxes. Then John chooses a box randomly and Peter

opens an empty box from the boxes John not chosen. If John suddenly changes his

mind and choose another closed box instead, find the probability he can pick the

box with coins after switching.

12) Prove that there are exactly ( )3

2

n n − diagonals in an n-gon.

13) The following shows a cube.

H

G

F

B

A

D

C

E

a) How many diagonals are there in the cube?

b) How many ways are there to move from point A to F, if moving to the same

point twice is not allowed (i.e., A → B → C → B → G → F is invalid)?

c) The inscribed sphere of the cube has a surface area of 64π cm2. What is the

shortest distant from the point C to the sphere?

d) (IMOPHK 2004 Q13 Modified) Eight numbers are written on the vertices.

Let f be a function that f(X) is the average of the numbers on X’s three

adjacent vertices. It is known that f(A) = 1, f(B) = 2, f(C) = 3, f(D) = 4,

f(E) = 5, f(F) = 6, f(G) = 7 and f(H) = 8. Find the number written on each

vertex originally.

e) The absolute values of the numbers written on the vertices indicate the cost

of traveling through that vertex. What is the minimum cost for moving from

the midpoint of AD to that of FG?

14) (PCMSIMC 2004/4 Q6) In the individual papers of PCMSIMC 2003, there are 20

questions with four 3-, 4-, 5-, 6- and 7-marked questions respectively. If a

contestant answered a question correctly, he/she will get the score allocated to that

question. Otherwise, he/she will get zero marks. How many different possible

values of median of the scores of all constants are there?

*

*

*

*

Page 41: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

381

15) (HKMHASC 2004 Q13) The mean, median, unique mode and range of some ten

integers are all equal to 10. Find the largest integers of these ten numbers.

16) (ISMC 2003/I Q5) Find the sum of all coefficients of xk, where k is an odd number,

in the expansion of (x4 – x3 – 5x2 + 4)10.

17) Do the followings:

a) Prove that 0

2n

n n

k

k

C=

=∑ .

b) Prove that ( )22

0

nn n

n k

k

C C=

=∑ .

c) Hence find the standard deviation of 0 11 2, , , , ,2 2 2 2 2

n n nn n

n n

n n n n n

C C CC C −… .

*

*

Page 42: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

382

Answers

1) (n – 1)!

2) a) 4∕13. b) 12012.

3) 112; 28∕225.

5) ( )( )

2

2

2 !

!

n

n

nC

n=

6) a) 49

6

1 1

13983816C= .

b) 6

3

6 5 4 3 3 3 3 2051 1 1

49 48 47 46 45 44 43 166474C

⋅ ⋅ − − − ⋅ ⋅ =

. c) 24.

7) 18.

8) 116

9) 100000.

10) a) 36 km. b) 6561. c) 87. d) 1542.

11) 8∕15.

13) a) 16. b) 18. c) ( )2 3 1− .

d) A: -3.5, B: 1, C: -9.5, D: -5, E: 8.5, F: 13, G: 19, H: 7. e) 23.5.

14) 197.

15) 18.

16) 0.

17) c)

2 1

2

n

n

n

nC

n

−.

Page 43: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

383

Chinese Translation of Important Terms Addition principle 加法原理

Arithmetic mean 算術平均數

Binomial coefficient 二項式係數

Binomial theorem 二項式定理

Central tendency 集中趨勢

Class boundary 組界

Class mark 組中點

Combination 組合

Combinatorics 組合數學

Complementary principle 互補性原理

Cumulative frequency 累積頻數

Cumulative frequency curve 累積頻數曲線

Cumulative frequency polygon 累積頻數多邊形

Data (sing. Datum) 數據

Derangement 亂序

Dijkstra’s algorithm 狄格斯特算法

Directed graph 有向圖

Dynamic programming 動態規劃

Edge 邊

Enumerative combinatorics 列舉組合學

Factorial 階乘

Frequency 頻數

Frequency curve 頻數曲線

Frequency polygon 頻數多邊形

Graph 圖

Graph theory 圖論

Histogram 直方圖

Inter-quartile range 四分位差

Lower quartile 下四分位數

Maximum 最大值

Mean 平均數

Mean deviation 平均偏差

Median 中位數

Method of exhaustion 窮舉法

Minimum 最小值

Page 44: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

384

Modal class 眾數組

Mode 眾數

Multinomial coefficient 多項式係數

Multiplication principle 乘法原理

Mutually exclusive 互斥

Normal curve 常態曲線

Ordered pairs 有序對

Percentile 百分位數

Permutation 排列

PIE 容斥原理

Principle of inclusion and exclusion 容斥原理

Probability 概率

Quantile 分位點

Quartile 四分位數

Range 分佈域

Sorting 排序

Standard deviation 標準偏差

Standard score 標準分

Statistics 統計學

Subfactorial 亂序階乘

Tree diagram 樹形圖

Upper quartile 上四分位數

Variance 方差

Vertex 頂點

z-score 標準分

Page 45: Mathematics Competition Training Class Notes Elementary …ylmass.edu.hk/~mathsclub/MCTCN/ece.pdf · Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

Mathematics Competition Training Class Notes Elementary Combinatorics and Statistics

385

References:

� Mathematical Atlas. [http://www.math-atlas.org/welcome.html]

� Wikipedia, the Free Encyclopedia. [http://en.wikipedia.org/]

� ICS Math 6A – Discrete Mathematics for Computer Science.

[http://www.ics.uci.edu/~welling/teaching/Math6A/Math6A.html]

� Mathematics Database. [http://www.mathdb.org/]

� MathWorld. [http://mathworld.wolfram.com/]

� UWA PLDS 210 – Data Structures and Algorithms.

[http://ciips.ee.uwa.edu.au/~morris/Year2/PLDS210/index.html]

� Hong Kong Jockey Club. [http://www.hongkongjockeyclub.com/]

Original documents:

� Combinatorics – All about Counting: Chapter 10 “Binomial Theorem” Section

1, 2; Chapter 12 “Probability and Graph Theory” Section 2.

� Polynomial Expansion: Chapter 10 “Binomial Theorem” Section 3, 4, 5.

� Probability: Chapter 12 “Probability and Graph Theory” Section 1.

� Simple Graph Theory: Chapter 12 “Probability and Graph Theory” Section 4.

� Statistics: Chapter 27 “Statistics”.