introduction to combinatorics - uniwersytet warszawski · introduction to combinatorics...

25
. . . . . . Introduction to combinatorics Factorials and permutations . Definition (Factorial) . . . . . n!=1 × 2 × 3 × ... × (n 2) × (n 1) × n Number of possible ordered arrangements of n objects is equal to n! . Example . . . . . We have to arrange the time schedule for 6 actions. In how many different ways we can order these actions? 6! = 6 × 5 × 4 × 3 × 2 × 1 = 720 Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 79 / 216

Upload: others

Post on 27-Jul-2020

13 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Introduction to combinatoricsFactorials and permutations

.Definition (Factorial)..

.

. ..

.

.

n! = 1 × 2 × 3 × . . . × (n − 2) × (n − 1) × n

Number of possible ordered arrangements of n objects is equal to n!

.Example..

.

. ..

.

.

We have to arrange the time schedule for 6 actions. In how many differentways we can order these actions?

6! = 6 × 5 × 4 × 3 × 2 × 1 = 720

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 79 / 216

Page 2: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Introduction to combinatoricsPermutations

A permutation is an ordered arrangement of k objects taken from theset of n objects

The number of different permutations is given by formula:

nPk =n!

(n − k)!= n × (n − 1) × . . . × (n − k − 1)

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 80 / 216

Page 3: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Introduction to combinatoricsExample, permutations

.Example..

.

. ..

.

.

How many different serial numbers can be generated if the serial numberof a product has 4 digits? How many of this serial numbers do have all thedigits different? What is the probability that randomly chosen serialnumber has all the digits different?

N = 104 = 10000

m = 10 × 9 × 8 × 7 = 5040

Probability =5040

10000≈ 0.5

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 81 / 216

Page 4: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Introduction to combinatoricsCombinations

A combination is an arrangement of objects for which the order is notimportant

The number of different combinations is given by formula:

nCk =

(n

k

)=

n!

(n − k)!k!

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 82 / 216

Page 5: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Introduction to combinatoricsExample, combinations

.Example..

.

. ..

.

.

Manager has to select 3 specialist of 6 he has in his firm into some taskgroup. In how many ways he do it? 4 specialist are men and 2 are women.What is the probability that the selected group consists only men?

N =

(6

3

)=

6!

3!3!=

6 × 5 × 4

1 × 2 × 3= 20

m =

(4

3

)=

4!

3!1!= 4

Probability =4

20=

1

5

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 83 / 216

Page 6: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Random variable

Random variable is a variable which value depends on a random event

The value of a random variable can not be predicted with certainty

A random variable can be:

qualitative: the value such variable have no quantitative interpretationbut is coding same attribute (e.g. sex, occupation, place of residence).quantitative

discrete: such random variable have integer values or can betransformed into variable with integer values (e.g. number of children,number of visits in a shop)continuous: can take any real value (e.g. spending for food, profit/lossof a firm)

We will denote the random variables with capital letters and thevalues of random variables by lowercase letters

So: Pr (X = x) denotes the probability of the event that randomvariable X is equal to x

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 84 / 216

Page 7: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Independent random variables

Random variables X and Y are independent if probability of an eventthat X = x and Y = y is given by

Pr (X = x ∪ Y = y) = Pr (X = x) Pr (Y = y)

for all possible values of y and x

.Example..

.

. ..

.

.

The results of two rolls of the dice can be considered independent if theprobabilities of the events are looking as follows

1 2 3 4 5 6

1 136

136

136

136

136

136

2 136

136

136

136

136

136

3 136

136

136

136

136

136

4 136

136

136

136

136

136

5 136

136

136

136

136

136

6 136

136

136

136

136

136

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 85 / 216

Page 8: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Expectation

.Definition (Expected value)..

.

. ..

.

.

For discrete random variable X that is taking values x1, x2, . . . , xn withprobabilities p1, p2, . . . , pn respectively, the expected value is equal to

E (X ) =n∑

i=1

xipi

Notice that as∑n

i=1 pi = 1 then the expected value is the weightedaverage with weights equal to probabilities

Expected value is the population mean of the random variable

The expected value can be interpreted (under some conditions) aswhat you expect to be an average value for X calculated for largenumber of observations

For any nonrandom number a expected value of y = a + bX is

E (Y ) = E (a + bX ) = a + b E (X )

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 86 / 216

Page 9: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

ExpectationExample

.Example..

.

. ..

.

.

What is the expected number of pips for a dice roll?

E (X ) = 1 × 1

6+ 2 × 1

6+ 3 × 1

6+ 4 × 1

6+ 5 × 1

6+ 6 × 1

6=

7

2

What is the expected value of the number of pips multiplied by 2 plus 1?

E (2X + 1) = 8

Notice that expected value of X can be equal to value which can notbe observed for X

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 87 / 216

Page 10: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Variance

.Definition (Variance)..

.

. ..

.

.

For discrete random variable X that is taking values x1, x2, . . . , xn withprobabilities p1, p2, . . . , pn respectively, the variance is equal to

Var (X ) =n∑

i=1

[xi − E (X )]2 pi

Notice that for any nonrandom numbers a, b variance of y = a+bX is

Var (Y ) = Var (a + bX ) = b2 E (X )

Standard deviation of the random variable is equal to√

Var (X )

Variance of a random variable can be taught of as the populationvariance of random variable

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 88 / 216

Page 11: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

VarianceExample

.Example..

.

. ..

.

.

What is the population variance of the number of pips for a dice roll?

Var (X ) =

(1 − 7

2

)2

× 1

6+

(2 − 7

2

)2

× 1

6+

(3 − 7

2

)2

× 1

6

+

(4 − 7

2

)2

× 1

6+

(5 − 7

2

)2

× 1

6+

(6 − 7

2

)2

× 1

6

=35

12

What is the variance of the number of pips multiplied by 2 plus 1?

Var (2X + 1) = 4Var (X ) =35

3

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 89 / 216

Page 12: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Expectation of the sum of random variables

The expected value of the sum is equal to the sum of expected values

E (aX + bY ) = a E (X ) + b E (Y )

This property also holds for a number of variables larger then 2

.Example..

.

. ..

.

.

What is the expected return from package of assets containing 0.2 of assetX and 0.8 of asset Y?

E (0.4 × X + 0.6 × Y ) = 0.4 E (X ) + 0.6 E (Y )

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 90 / 216

Page 13: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Variance of the sum of independent random variables

The variance of the sum of independent random is equal to the sumvariances

Var (aX + bY ) = a2 E (X ) + b2 E (Y )

This property also holds for a number of variables larger then 2

.Example..

.

. ..

.

.

What is the variance and standard deviation of return from package ofassets containing 0.2 of asset X and 0.8 of asset Y assuming that X andY are independent?

Var (0.4 × X + 0.6 × Y ) = 0.16Var (X ) + 0.36Var (Y )√Var (0.16 × X + 0.36 × Y ) =

√0.16 Var (X ) + 0.36Var (Y )

Notice that the standard deviation of the portfolio is smaller that standarddeviation of each of the assets being included in the portfolio

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 91 / 216

Page 14: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Probability distribution of discrete random variables

.Definition..

.

. ..

.

.

Probability distribution of a discrete random variable is a table, function orgraph which specifies the all the possible values of the random variable,along with their respective probabilities

.Example..

.

. ..

.

.

Probability distribution of number of pips being the result of the dice rollcan be specified as followsValue of X 1 2 3 4 5 6

Probability 16

16

16

16

16

16

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 92 / 216

Page 15: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

.Definition..

.

. ..

.

.

Cumulative distribution function (cdf) of the random variable is given byfunction F (x) = Pr (X ≤ x)

Cdf is equal to probability that the random variable X is smaller orequal to x

Cdf is equivalent to probability distribution as it is possible tocalculate the probability of all the events on the basis of Cdf

.Example..

.

. ..

.

.

Probability distribution of number of pips being the result of the dice rollcan be specified as followsValue of X 1 2 3 4 5 6

Probability 16

13

12

23

56 1

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 93 / 216

Page 16: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Probability distribution of discrete random variablesBernoulli distribution

Bernoulli distribution is the distribution of a variable X whichassumes only two values 1 and 0 with probabilities p and q = 1 − pUsually the variable in question is a qualitative variable and its valuesare related to some mutually exclusive outcomesThese outcomes can be related to success or failure of some action,product being not defective or defective etc.The expected values of X is

E (X ) = 1 × p + 0 × q = p

The variance of X is

Var (X ) = (1 − p)2 p + (0 − p)2 × q = q2p + p2q = (q + p) pq = pq

.Example..

.

. ..

.

.

What is the expected value and variance of a random variable X whichtakes value 1 if the number of pips for the dice roll is equal to 1 or 2 andzero otherwise?

E (X ) =1

3

Var (X ) =1

3× 2

3=

2

9

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 94 / 216

Page 17: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Probability distribution of discrete random variablesBernoulli process

The Bernoulli process is the sequence of independent trials withoutcomes coded into random variables Xi having Bernoulli distribution

The number of trials ended with success (Xi = 1) can be calculatedas Y =

∑ni=1 Xi

That expected number successes (Y ) is equal to

E (Y ) = E

(n∑

i=1

Xi

)=

n∑i=1

E (Xi ) = np

As trials are assumed to be independent the variance of Y is equal to

Var (Y ) = Var

(n∑

i=1

Xi

)=

n∑i=1

Var (Xi ) = npq

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 95 / 216

Page 18: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Probability distribution of discrete random variablesBernoulli process, example

.Example..

.

. ..

.

.

We know that the probability of our product being defective is 1100 and

that defects are independent. What is the expected value and the varianceof the number of defective products among 200 produced?Define the random variable Xi which is equal to 1 if product i is defectiveXi = 1 equal to 0 if product is not defective. The number of productswhich are defective is equal to Y =

∑200i=1 Xi . The expected number of

defective products is equal to

E (Y ) = 200 × 1

100= 2

Using the assumption that defects are independent we obtain the variance

Var (Y ) = 200 × 1

100

99

100=

99

50

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 96 / 216

Page 19: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Probability distribution of discrete random variablesBinomial distribution

.Definition (Binomial distribution)..

.

. ..

.

.

Pr (X = k) =

(n

k

)pkqn−k

Binomial distribution gives the probability of the number of successesin Bernoulli process

.Example..

.

. ..

.

.

Calculate the probability that the number of defective products among 5product is smaller or equal to 2 if the probability of defect is equal to 1

4and defects are independent.(

5

0

) (3

4

)5

+

(5

1

)(3

4

)4 1

4+

(5

2

)(3

4

)3 (1

4

)2

=243

1024+

405

1024+

135

512=

459

512

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 97 / 216

Page 20: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Probability distribution of continuous random variablesDensity function

Density function of a continuous random variable can be thought asan analogue of the relative frequency function

However, density function can not usually be interpreted asprobability of event Pr (X = x)

For continuous random variable probability of event that X = x isequal to zero

Density function is of X is often as f (x)

So the density function can be understood as intensity of probabilityin a given interval.

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 98 / 216

Page 21: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Probability distribution of continuous random variablesCumulative distribution function, continuous variable

Cumulative distribution function of a continuous random variable canbe thought as an analogue of cumulative relative frequency function

As cumulative distribution function of a discrete variable the cdf forcontinuous variable is define as F (x) = Pr (X ≤ x)

Some properties of F (x)

F (x) is nondecreasing for all xF (x) goes to 0 for x going to minus infinityF (x) goes to 1 for x going to infinityprobability of event X > x can calculated as follows

Pr (X > x) = 1 − Pr (X ≤ x) = 1 − F (x)

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 99 / 216

Page 22: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Normal distribution and related distributionsDensity of normal distribution

Density function of the normal distribution

φ (x) =1√

2πσ2e−

(x−µ)2

2σ2

where µ is the expected value of X and σ2 is the variance of X

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 100 / 216

Page 23: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Normal distribution and related distributionsStandard normal distribution

The normal distribution with µ = 0 and σ2 = 1 is called standardnormal distribution

Normal density, µ = 0, σ2 = 1

Normal distribution is the most important distribution in statistics

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 101 / 216

Page 24: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Normal distribution and related distributionsCumulated normal distribution function

Cdf of standard normal distribution is usually denoted as Φ (x)

normal cdf, µ = 1, σ2 = 1

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 102 / 216

Page 25: Introduction to combinatorics - Uniwersytet Warszawski · Introduction to combinatorics Permutations A permutation is an ordered arrangement of k objects taken from the set of n objects

. . . . . .

Normal distribution and related distributionsProperties of normal distribution

Normal distribution is symmetric

The shape of normal distribution is uniquely determined by itsexpected value µ and variance σ2

The sum of variables with normal distribution has also normaldistribution

Applications: for large number of observations the distribution of thesample mean can be approximated with normal distribution

Jerzy Mycielski (CMT) Quantitative Methods of Decision Making 2008 103 / 216