Reference Material
E1 222 Stochastic Models and
Applications
◮ V.K. Rohatgi and A.K.Md.E. Saleh, An Introduction to
probability and Statistics, Wiley, 2nd edition, 2018
◮ S.Ross, ‘Introduction to Probability Models’, Elsevier,
12th edition, 2019.
◮ P G Hoel, S Port and C Stone, Introduction to
Probability Theory, 1971.
◮ P G Hoel, S Port and C Stone, Introduction to Stochastic
Processes, 1971.
P.S. Sastry
sastry@iisc.ac.in
1/13
Course Prerequisites / Background needed
2/13
Course grading
◮ Calculus
◮ continuity, differentiability, derivatives, functions of
several variables, partial derivatives, integration, multiple
integrals or integration over ℜn , convergence of
sequences and series, Taylor series
◮ Mid-Term Tests and Assignments: 70%
Final Exam: 30%
◮ Three mid-term tests for 20 marks each. We will have 2-3
assignments for 10 marks. (Tentative)
◮ Please remember this is essentially a Maths course
◮ Matrix theory
◮ vector spaces, linear independence, linear
transformations, matrices, rank, determinant, eigen
values and eigen vectors
◮ In addition, knowledge of basic probability is assumed. I
assume all students are familiar with the following:
Random experiment, sample space, events, conditional probability, independent events, simple combinatorial probability computations
But we would review the basic probability in the first two
classes.
3/13
4/13
Probability Theory
◮ In many engineering problems one needs to deal with
random inputs where probability models are useful
◮ Probability Theory – branch of mathematics that deals
with modeling and analysis of random phenomena.
◮ Random Phenomena – “individually not predictable but
have a lot of regularity at a population level”
◮ E.g., Recommender systems are useful for Amazon or
Netflix because at a population level customer behaviour
can be predicted well.
◮ Example random phenomena: Tossing a coin, rolling a
dice etc – familiar to you all
◮ It is also useful in many engineering systems, e.g., for
taking care of noise.
◮ Probability theory is also needed for Statistics that deals
with making inferences from data.
◮ Dealing with dynamical systems subjected to noise (e.g.,
Kalman filter)
◮ Policies for decision making under uncertainty
◮ Pattern Recognition, prediction from data
..
.
◮ We may use probability models for analysing algorithms.
(e.g., average case complexity of algorithms)
◮ We may deliberately introduce randomness in an
algorithm
(e.g., ALOHA protocol, Primality testing)
..
.
This is only a ‘sample’ of possible application scenarios!
6/13
Review of basic probability
7/13
Probability axioms
Probability (or probability measure) is a function that assigns
a number to each event and satisfies some properties.
We assume all of you are familiar with the terms:
random experiment, outcomes of random experiment,
sample space, events etc.
Formally, P : F → ℜ satisfying
A1 Non-negativity: P(A) ≥ 0, ∀A ∈ F
A2 Normalization: P(Ω) = 1
A3 σ-additivity: If A1 , A2 , · · · ∈ F satisfy Ai ∩ Aj = φ, ∀i 6= j
then
∞
X
∞
P(∪i=1 Ai ) =
P(Ai )
We use the following Notation:
◮ Sample space – Ω
Elements of Ω are the outcomes of the random
experiment
We write Ω = {ω1 , ω2 , · · · } when it is countable
◮ An event is, by definition, a subset of Ω
◮ Set of all possible events – F ⊂ 2Ω (power set of Ω)
Each event is a subset of Ω
i=1
Events satisfying Ai ∩ Aj = φ, ∀i 6= j are said to be
mutually exclusive
8/13
9/13
Probability axioms
Simple consequences of the axioms
◮ Notation: Ac is complement of A.
C = A + B implies A, B are mutually exclusive and C
is their union.
◮ Let A ⊂ B be events. Then B = A + (B − A).
Now we can show P(A) ≤ P(B):
P : F → ℜ, F ⊂ 2Ω (Events are subsets of Ω)
A1 P(A) ≥ 0, ∀A ∈ F
A2 P(Ω) = 1
P∞
A3 If Ai ∩ Aj = φ, ∀i 6= j then P(∪∞
i=1 Ai ) =
i=1 P(Ai )
P(B) = P (A + (B − A)) = P(A) + P(B − A) ≥ P(A)
◮ For these axioms to make sense, we are assuming
This also shows P(B − A) = P(B) − P(A) when A ⊂ B.
(i). Ω ∈ F and (ii). A1 , A2 , · · · ∈ F ⇒ (∪i Ai ) ∈ F
When F = 2Ω this is true.
10/13
11/13
Case of finite Ω – Example
◮ There are many such properties (I assume familiar to you)
that can be derived from the axioms.
◮ Here are a few important ones. (Proof is left to you as an
exercise!)
◮ Let Ω = {ω1 , · · · , ωn }, F = 2Ω , and P is specified
through ‘equally likely’ assumption.
◮ That is, P({ωi }) = n1 . (Note the notation)
◮ Suppose A = {ω1 , ω2 , ω3 }. Then
P(A) = P({ω1 }∪{ω2 }∪{ω3 }) =
3
X
i=1
P({ωi }) =
|A|
3
=
n
|Ω|
◮ We can easily see this to be true for any event, A.
◮ This is the usual familiar formula: number of favourable
outcomes by total number of outcomes.
◮ Thus, ‘equally likely’ is one way of specifying the
probability function (in case of finite Ω).
◮ An obvious point worth remembering: specifying P for
singleton events fixes it for all other events.
12/13
13/13
Review of basic probability
Probability axioms
We use the following Notation:
◮ Sample space – Ω
Elements of Ω are the outcomes of the random
experiment
We write Ω = {ω1 , ω2 , · · · } when it is countable
◮ An event is, by definition, a subset of Ω
◮ Set of all possible events – F ⊂ 2Ω (power set of Ω)
Each event is a subset of Ω
For now, we take F = 2Ω (power set of Ω)
Probability (or probability measure) is a function that assigns
a number to each event and satisfies some properties.
P : F → ℜ, F ⊂ 2Ω
A1 P(A) ≥ 0, ∀A ∈ F
A2 P(Ω) = 1
P∞
A3 If Ai ∩ Aj = φ, ∀i 6= j then P(∪∞
i=1 Ai ) =
i=1 P(Ai )
1/38
Some consequences of the axioms
2/38
Case of finite Ω – Example
◮ Let Ω = {ω1 , · · · , ωn }, F = 2Ω , and P is specified
through ‘equally likely’ assumption.
◮ That is, P({ωi }) = n1 . (Note the notation)
◮ Suppose A = {ω1 , ω2 , ω3 }. Then
◮ 0 ≤ P(A) ≤ 1
◮ P(Ac ) = 1 − P(A)
◮ If A ⊂ B then, P(A) ≤ P(B)
◮ If A ⊂ B then, P(B − A) = P(B) − P(A)
◮ P(A ∪ B) = P(A) + P(B) − P(A ∩ B)
P(A) = P({ω1 }∪{ω2 }∪{ω3 }) =
3
X
i=1
P({ωi }) =
|A|
3
=
n
|Ω|
◮ We can easily see this to be true for any event, A.
◮ This is the usual familiar formula: number of favourable
outcomes by total number of outcomes.
◮ Thus, ‘equally likely’ is one way of specifying the
probability function (in case of finite Ω).
◮ An obvious point worth remembering: specifying P for
singleton events fixes it for all other events.
3/38
4/38
Case of Countably infinite Ω
Example: countably infinite Ω
◮ Consider a random experiment of tossing a biased coin
repeatedly till we get a head. We take the outcome of the
experiment to be the number of tails we had before the
first head.
◮ Here we have Ω = {0, 1, 2, · · · }.
◮ A (reasonable) probability assignment is:
◮ Let Ω = {ω1 , ω2 , · · · }.
◮ Once again, any A ⊂ Ω can be written as mutually
exclusive union of singleton sets.
◮ Let qi , i = 1, 2, · · · be numbers such that qi ≥ 0 and
P
i qi = 1.
◮ We can now set P({ωi }) = qi , i = 1, 2, · · · .
(Assumptions on qi needed to satisfy P(A) ≥ 0 and
P(Ω) = 1).
P
◮ This fixes P for all events: P(A) = ω∈A P({ω})
◮ This is how we normally define a probability measure on
countably infinite Ω.
◮ This can be done for finite Ω too.
P({k}) = (1 − p)k p, k = 0, 1, · · ·
where p is the probability of head and 0 < p < 1.
(We assume you understand the idea of ‘independent’
tosses here).
◮ In the notation of previous slide, qi = (1 − p)i p
P
◮ Easy to see we have qi ≥ 0 and ∞
i=0 qi = 1.
6/38
5/38
Case of uncountably infinite Ω
Example: Uncountably infinite Ω
◮ We would mostly be considering only the cases where Ω
is a subset of ℜd for some d.
◮ Note that now an event need not be a countable union of
singleton sets.
◮ For now we would only consider a simple intuitive
extension of the ‘equally likely’ idea.
◮ Suppose Ω is a finite interval of ℜ. Then we will take
m(A)
where m(A) is length of the set A.
P(A) = m(Ω)
◮ We can use this in higher dimensions also by taking m(·)
to be an appropriate ‘measure’ of a set.
◮ For example, in ℜ2 , m(A) denotes area of A, in ℜ3 it
would be volume and so on.
Problem: A rod of unit length is broken at two random
points. What is the probability that the three pieces so formed
would make a triangle.
◮ Let us take left end of the rod as origin and let x, y
denote the two successive points where the rod is broken.
◮ Then the random experiment is picking two numbers x, y
with 0 < x < y < 1.
◮ We can take Ω = {(x, y ) : 0 < x < y < 1} ⊂ ℜ2 .
◮ For the pieces to make a triangle, sum of lengths of any
two should be more than the third.
(There are many issues that need more attention here).
7/38
8/38
◮ We have
◮ The lengths are: x, (y − x), (1 − y ). So we need
Ω = {(x, y ) : 0 < x < y < 1}
A = {(x, y ) : y > 0.5; x < 0.5; y < x + 0.5}
x + (y − x) > (1 − y ) ⇒ y > 0.5
x + (1 − y ) > (y − x) ⇒ y < x + 0.5;
(y − x) + 1 − y > x ⇒ x < 0.5
◮ So the event of interest is:
A = {(x, y ) : y > 0.5; x < 0.5; y < x + 0.5}
◮ We can visualize it as follows
◮ The required probability is area of A divided by area of Ω
which gives the answer as 0.25
9/38
10/38
Conditional Probability
◮ Let B be an event with P(B) > 0. We define conditional
probability, conditioned on B, of any event, A, as
◮ Everything we do in probability theory is always in
reference to an underlying probability space: (Ω, F, P)
where
P(A | B) =
◮ Ω is the sample space
◮ F ⊂ 2Ω set of events; each event is a subset of Ω
◮ P : F → [0, 1] is a probability (measure) that assigns a
number between 0 and 1 to every event (satisfying the
three axioms).
P(A ∩ B)
P(AB)
=
P(B)
P(B)
◮ The above is a notation. “A | B” does not represent any
set operation! (This is an abuse of notation!)
◮ Given a B, conditional probability is a new probability
assignment to any event.
◮ That is, given B with P(B) > 0, we define a new
probability PB : F → [0, 1] by
PB (A) =
11/38
P(AB)
P(B)
12/38
◮ Conditional probability is a probability. What does this
mean?
◮ The new function we defined, PB : F → [0, 1],
,
PB (A) = P(AB)
P(B)
satisfies the three axioms of probability.
◮ PB (A) ≥ 0 and PB (Ω) = 1.
◮ If A1 , A2 are mutually exclusive then A1 B and A2 B are
also mutually exclusive and hence
P(A | B) =
P(AB)
P(B)
◮ Note P(B|B) = 1 and P(A|B) > 0 only if P(AB) > 0.
◮ Now the ‘new’ probability of each event is determined by
what it has in common with B.
◮ If we know the event B has occurred, then based on this
knowledge we can readjust probabilities of all events and
that is given by the conditional probability.
◮ Intuitively it is as if the sample space is now reduced to B
because we are given the information that B has occurred.
◮ This is a useful intuition as long as we understand it
properly.
◮ It is not as if we talk about conditional probability only
for subsets of B. Conditional probability is also with
respect to the original probability space. Every element of
F has conditional probability defined.
P(A1 B + A2 B)
P ((A1 + A2 )B)
=
P(B)
P(B)
P(A1 B) + P(A2 B)
=
= PB (A1 ) + PB (A2 )
P(B)
PB (A1 + A2 ) =
◮ Once we understand condional probability is a new
probability assignment, we go back to the ‘standard
notation’
13/38
P(A | B) =
14/38
P(AB)
P(B)
◮ In a conditional probability, the conditioning event can be
any event (with positive probability)
◮ In particular, it could be intersection of events.
◮ We think of that as conditioning on multiple events.
◮ Suppose P(A | B) > P(A)
Does it mean “B causes A”?
P(A | B) > P(A) ⇒ P(AB) > P(A)P(B)
P(AB)
⇒
> P(B)
P(A)
⇒ P(B | A) > P(B)
P(A | B, C ) = P(A | BC ) =
P(ABC )
P(BC )
◮ Hence, conditional probabilities cannot actually capture
causal influences.
◮ There are probabilistic methods to capture causation (but
far beyond the scope of this course!)
15/38
16/38
◮ Let B1 , · · · , Bm be events such that ∪m
i=1 Bi = Ω and
Bi Bj = φ, ∀i 6= j.
◮ Such a collection of events is said to be a partition of Ω.
(They are also sometimes said to be mutually exclusive
and collectively exhaustive).
◮ Given this partition, any other event can be represented
as a mutually exclusive union as
◮ The conditional probability is defined by
P(A | B) =
P(AB)
P(B)
◮ This gives us a useful identity
P(AB) = P(A | B)P(B)
A = AB1 + · · · + ABm
◮ We can iterate this for multiple events
To explain the notation again
P(ABC ) = P(A | BC )P(BC ) = P(A | BC )P(B | C )P(C )
A = A∩Ω = A∩(B1 ∪· · ·∪Bm ) = (A∩B1 )∪· · ·∪(A∩Bm )
Hence, A = AB1 + · · · + ABm
18/38
17/38
Total Probability rule
Example: Polya’s Urn
An urn contains r red balls and b black balls. We draw a ball
at random, note its color, and put back that ball along with c
balls of the same color. We keep repeating this process. Let
Rn (Bn ) denote the event of drawing a red (black) ball at the
nth draw. We want to calculate the probabilities of all these
events.
b
r
◮ It is easy to see that P(R1 ) = r +b
and P(B1 ) = r +b
.
◮ For R2 we have, using total probability rule,
◮ Let B1 , · · · , Bm be a partition of Ω.
◮ Then, for any event A, we have
P(A) = P(AB1 + · · · + ABm )
= P(AB1 ) + · · · + P(ABm )
= P(A |B1 )P(B1 ) + · · · + P(A |Bm )P(Bm )
◮ The formula (where Bi form a partition)
X
P(A) =
P(A | Bi )P(Bi )
P(R2 ) = P(R2 | R1 )P(R1 ) + P(R2 | B1 )P(B1 )
r
r
b
r +c
=
+
r +c +b r +b
r +b+c r +b
r
r (r + c + b)
=
= P(R1 )
=
(r + c + b)(r + b)
r +b
i
is known as total probability rule or total probability
law or total probability formula.
◮ This is a very useful in many situations. (“arguing by
cases”)
19/38
20/38
Bayes Rule
◮ Another important formula based on conditional
probability is Bayes Rule:
P(A | B) =
◮ Similarly we can show that P(B2 ) = P(B1 ).
◮ One can show by mathematical induction that
P(Rn ) = P(R1 ) and P(Bn ) = P(B1 ) forall n.
(Left as an exercise for you!)
◮ This does not depend on the value of c!
P(AB)
P(B | A)P(A)
=
P(B)
P(B)
◮ This allows one to calculate P(A | B) if we know
P(B | A).
◮ Useful in many applications because one conditional
probability may be more easier to obtain (or estimate)
than the other.
◮ Often one uses total probability rule to calculate the
denominator in the RHS above:
P(A | B) =
P(B | A)P(A)
P(B |A)P(A) + P(B |Ac )P(Ac )
21/38
◮ Let us take some specific numbers
◮ Let: P(D) = 0.5, P(T+ |D) = 0.99, P(T+ |D c ) = 0.05.
Example: Bayes Rule
Let D and D c denote someone being diagnosed as having a
disease or not having it. Let T+ and T− denote the events of
a test for it being positive or negative. (Note that T+c = T− ).
We want to calculate P(D|T+ ).
◮ We have, by Bayes rule,
P(D|T+ ) =
22/38
P(D|T+ ) =
0.99 ∗ 0.5
= 0.95
0.99 ∗ 0.5 + 0.05 ∗ 0.5
That is pretty good.
◮ But taking P(D) = 0.5 is not realistic. Let us take
P(D) = 0.1.
0.99 ∗ 0.1
P(D|T+ ) =
= 0.69
0.99 ∗ 0.1 + 0.05 ∗ 0.9
P(T+ |D)P(D)
P(T+ |D)P(D) + P(T+ |D c )P(D c )
◮ Now suppose we can improve the test so that
P(T+ |D c ) = 0.01
0.99 ∗ 0.1
P(D|T+ ) =
= 0.92
0.99 ∗ 0.1 + 0.01 ∗ 0.9
◮ The probabilities P(T+ |D) and P(T+ |D c ) can be
obtained through, for example, laboratory experiments.
◮ P(T+ |D) is called the true positive rate and P(T+ |D c ) is
called false positive rate.
◮ We also need P(D), the probability of a random person
having the disease.
◮ These different cases are important in understanding the
role of false positives rate.
23/38
24/38
◮ In many applications of Bayes rule the same generic
situation exists
◮ Based on a measurement we want to predict (what may
be called) the state of nature.
◮ For another example, take a simple communication
system.
◮ P(D) is the probability that a random person has the
disease. We call it the prior probability.
◮ P(D|T+ ) is the probability of the random person having
disease once we do a test and it came positive. We call it
the posterior probability.
◮ Bayes rule essentially transforms the prior probability to
posterior probability.
◮ D can represent the event that the transmitter sent bit 1.
◮ T+ can represent an event about the measurement we
made at the receiver.
◮ We want the probability that bit 1 is sent based on the
measurement.
◮ The knowledge we need is P(T+ |D), P(T+ |D c ) which
can be determined through experiment or modelling of
channel.
26/38
25/38
P(D|T+ ) =
P(T+ |D)P(D)
P(T+ |D)P(D) + P(T+ |D c )P(D c )
P(D|T+ ) =
◮ Not all applications of Bayes rule involve a ‘binary’
situation
◮ Suppose D1 , D2 , D3 are the (exclusive) possibilities and T
is an event about a measurement.
P(T+ |D)P(D)
P(T+ |D)P(D) + P(T+ |D c )P(D c )
◮ In the binary situation we can think of Bayes rule in a
slightly modified form too.
P(T+ |D) P(D)
P(D|T+ )
=
P(D c |T+ )
P(T+ |D c ) P(D c )
P(T |D1 )P(D1 )
P(T )
P(T |D1 )P(D1 )
=
P(T |D1 )P(D1 ) + P(T |D2 )P(D2 ) + P(T |D3 )P(D3 )
P(T |D1 )P(D1 )
= P
i P(T |Di )P(Di )
P(D1 |T ) =
◮ This is called the odds-likelihood form of Bayes rule
(The ratio of P(A) to P(Ac ) is called odds for A)
27/38
28/38
Independent Events
Example: Independence
A class has 20 female and 30 male course (MTech) students
and 6 female and 9 male research (PhD) students. Are gender
and degree independent?
◮ Let F , M, C , R denote events of female, male, course,
research students
◮ From the given numbers, we can easily calculate the
following:
◮ Two events A, B are said to be independent if
P(AB) = P(A)P(B)
◮ Note that this is a definition. Two events are independent
if and only if they satisfy the above.
◮ Suppose P(A), P(B) > 0. Then, if they are independent
P(A|B) =
P(F ) =
P(AB)
= P(A); similarly P(B|A) = P(B)
P(B)
26
2
50
10
20
4
= ; P(C ) =
= ; P(FC ) =
=
65
5
65
13
65
13
◮ Hence we can verify
2 10
4
=
= P(FC )
5 13
13
and conclude that F and C are independent.
Similarly we can show for others.
◮ This gives an intuitive feel for independence.
◮ Independence is an important (often confusing!) concept.
P(F )P(C ) =
29/38
30/38
◮ If A and B are independent then so are A and B c .
◮ Using A = AB + AB c , we have
◮ In this example, if we keep all other numbers same but
change the number of male research students to, say, 12
then the independence no longer holds.
26 50
6= 20
)
( 68
68
68
◮ One needs to be careful about independence!
◮ We always have an underlying probability space (Ω, F, P)
◮ Once that is given, the probabilities of all events are fixed.
◮ Hence whether or not two events are independent is a
matter of ‘calculation’
P(AB c ) = P(A)−P(AB) = P(A)(1−P(B)) = P(A)P(B c )
◮ This also shows that Ac and B are independent and so
are Ac and B c .
◮ For example, in the previous problem, once we saw that F
and C are independent, we can conclude M and C are
also independent (because in this example we are taking
F c = M).
31/38
32/38
◮ Consider the random experiment of tossing two fair coins
(or tossing a coin twice).
◮ Ω = {HH, HT , TH, TT }.
Suppose we employ ‘equally likely idea’.
◮ That is, P({HH}) = 14 , P({HT }) = 41 and so on
◮ Let A = ‘H on 1st toss’ = {HH, HT } (P(A) = 12 )
Let B = ‘T on second toss’ = {HT , TT } (P(B) = 21 )
◮ We have P(AB) = P({HT }) = 0.25
◮ Since P(A)P(B) = 12 21 = 41 = P(AB),
A, B are independent.
◮ Hence, in multiple tosses, assuming all outcomes are
equally likely implies outcome of one toss is independent
of another.
◮ In multiple tosses, assuming all outcomes are equally
likely is alright if the coin is fair.
◮ Suppose we toss a biased coin two times.
◮ Then the four outcomes are, obviously, not ‘equally likely’
◮ How should we then assign these probabilities?
◮ If we assume tosses are independent then we can assign
probabilities easily.
33/38
◮ Consider toss of a biased coin:
Ω1 = {H, T }, P({H}) = p and P({T }) = 1 − p.
◮ If we toss this twice then Ω2 = {HH, HT , TH, TT } and
we assign
P({HH}) = p 2 , P({HT }) = p(1 − p),
P({TH}) = (1 − p)p, P({TT }) = (1 − p)2 .
◮ P({HH, HT }) = p 2 + p(1 − p) = p
◮ This assignment ensures that P({HH}) equals product of
probability of H on 1st toss and H on second toss.
◮ Essentially, Ω2 is a cartesian product of Ω1 with itself and
essentially we used products of the corresponding
probabilities.
◮ For any independent repetitions of a random experiment
we follow this.
(We will look at it more formally when we consider
multiple random variables).
34/38
◮ In many situations calculating probabilities of intersection
of events is difficult.
◮ One often assumes A and B are independent to calculate
P(AB).
◮ As we saw, if A and B are independent, then
P(A|B) = P(A)
◮ This is often used, at an intuitive level, to justify
assumption of independence.
35/38
36/38
Independence of multiple events
Pair-wise independence
◮ Events A1 , A2 , · · · , An are said to be pair-wise
independent if
◮ Events A1 , A2 , · · · , An are said to be (totally)
independent if for any k, 1 ≤ k ≤ n, and any indices
i1 , · · · , ik , we have
P(Ai Aj ) = P(Ai )P(Aj ), ∀i 6= j
P(Ai1 · · · Aik ) = P(Ai1 ) · · · P(Aik )
◮ Events may be pair-wise independent but not (totally)
independent.
◮ Example: Four balls in a box inscribed with ‘1’, ‘2’, ‘3’
and ‘123’. Let Ei be the event that number ‘i’ appears on
a radomly drawn ball, i = 1, 2, 3.
◮ Easy to see: P(Ei ) = 0.5, i = 1, 2, 3.
◮ P(Ei Ej ) = 0.25 (i 6= j) ⇒ pairwise independent
◮ But, P(E1 E2 E3 ) = 0.25 6= (0.5)3
◮ For example, A, B, C are independent if
P(AB) = P(A)P(B); P(AC ) = P(A)P(C );
P(BC ) = P(B)P(C ); P(ABC ) = P(A)P(B)P(C )
38/38
37/38
Recap
Recap
◮ Everything we do in probability theory is always in
reference to an underlying probability space: (Ω, F, P)
where
◮ Ω is the sample space
◮ F ⊂ 2Ω set of events; each event is a subset of Ω
◮ P : F → [0, 1] is a probability (measure) that satisfies
the three axioms:
A1 P(A) ≥ 0, ∀A ∈ F
A2 P(Ω) = 1
P∞
A3 If Ai ∩ Aj = φ, ∀i 6= j then P(∪∞
i=1 Ai ) =
i=1 P(Ai )
PS Sastry, IISc, Bangalore, 2020 1/34
◮ When Ω = {ω1 , ω2 , · · · } (is countable), then probability is
generally assigned by
X
P({ωi }) = qi , i = 1, 2, · · · , with qi ≥ 0,
qi = 1
i
◮ When Ω is finite with n elements, a special case is
qi = n1 , ∀i. (All outcomes equally likely)
PS Sastry, IISc, Bangalore, 2020 2/34
Recap
Recap
◮ Conditional probability of A given (or conditioned on) B is
P(A|B) =
P(AB)
P(B)
◮ Bayes Rule
◮ This gives us the identity: P(AB) = P(A|B)P(B)
◮ This holds for multiple event, e.g.,
P(ABC ) = P(A|BC )P(B|C )P(C )
◮ Given a partition, Ω = B1 + B2 + · · · + Bm , for any event,
A,
P(A) =
m
X
P(D|T ) =
P(T |D)P(D)
P(T |D)P(D) + P(T |D c )P(D c )
◮ Bayes rule can be viewed as transforming a prior
probability into a posterior probability.
P(A|Bi )P(Bi ) (Total Probability rule)
i=1
PS Sastry, IISc, Bangalore, 2020 3/34
Recap: Independence
PS Sastry, IISc, Bangalore, 2020 4/34
Independence of multiple events
◮ Two events A, B are said to be independent if
P(AB) = P(A)P(B)
◮ Suppose P(A), P(B) > 0. Then, if they are independent
P(AB)
P(A|B) =
= P(A); similarly P(B|A) = P(B)
P(B)
◮ If A, B are independent then so are A&B c , Ac &B and
Ac &B c .
PS Sastry, IISc, Bangalore, 2020 5/34
◮ Events A1 , A2 , · · · , An are said to be (totally)
independent if for any k, 1 ≤ k ≤ n, and any indices
i1 , · · · , ik , we have
P(Ai1 · · · Aik ) = P(Ai1 ) · · · P(Aik )
◮ For example, A, B, C are independent if
P(AB) = P(A)P(B); P(AC ) = P(A)P(C );
P(BC ) = P(B)P(C ); P(ABC ) = P(A)P(B)P(C )
PS Sastry, IISc, Bangalore, 2020 6/34
Pair-wise independence
Conditional Independence
◮ Events A1 , A2 , · · · , An are said to be pair-wise
independent if
P(Ai Aj ) = P(Ai )P(Aj ), ∀i 6= j
◮ Events may be pair-wise independent but not (totally)
independent.
◮ Example: Four balls in a box inscribed with ‘1’, ‘2’, ‘3’
and ‘123’. Let Ei be the event that number ‘i’ appears on
a radomly drawn ball, i = 1, 2, 3.
◮ Easy to see: P(Ei ) = 0.5, i = 1, 2, 3.
◮ P(Ei Ej ) = 0.25 (i 6= j) ⇒ pairwise independent
◮ But, P(E1 E2 E3 ) = 0.25 6= (0.5)3
◮ Events A, B are said to be (conditionally) independent
given C if
P(AB|C ) = P(A|C )P(B|C )
◮ If the above holds
P(A|BC ) =
=
P(ABC )
P(AB|C )P(C )
=
P(BC )
P(BC )
P(A|C ) P(B|C )P(C )
= P(A|C )
P(BC )
◮ Events may be conditionally independent but not
independent. (e.g., ‘independent’ multiple tests for
confirming a disease)
◮ It is also possible that A, B are independent but are not
conditionally independent given some other event C .
PS Sastry, IISc, Bangalore, 2020 7/34
PS Sastry, IISc, Bangalore, 2020 8/34
Use of conditional independence in Bayes rule
◮ We can write Bayes rule with multiple conditioning
events.
P(A|BC ) =
P(BC |A)P(A)
P(BC |A)P(A) + P(BC |Ac )P(Ac )
◮ The above gets simplified if we assume
P(BC |A) = P(B|A)P(C |A),
P(BC |Ac ) = P(B|Ac )P(C |Ac )
◮ Consider the old example, where now we repeat the test
for the disease.
◮ Take: A = D, B = T+1 , C = T+2 .
◮ Assuming conditional independence we can calculate the
new posterior probability using the same information we
had about true positive and false positive rate.
PS Sastry, IISc, Bangalore, 2020 9/34
◮ Let us consider the example with P(T+ |D) = 0.99,
P(T+ |D c ) = 0.05. P(D) = 0.1.
◮ Recall that we got P(D|T+ ) = 0.69.
◮ Let us suppose the same test is repeated.
P(T+1 T+2 | D)P(D)
P(T+1 T+2 | D)P(D) + P(T+1 T+2 | D c )P(D c )
P(T+1 | D)P(T+2 | D)P(D)
=
P(T+1 | D)P(T+2 | D)P(D) + P(T+1 | D c )P(T+2 | D c )P(D c )
0.99 ∗ 0.99 ∗ 0.1
=
= 0.97
0.99 ∗ 0.99 ∗ 0.1 + 0.05 ∗ 0.05 ∗ 0.9
P(D | T+1 T+2 ) =
PS Sastry, IISc, Bangalore, 2020 10/34
Sequential Continuity of Probability
◮ For function, f : ℜ → ℜ, it is continuous at x if and only
if xn → x implies f (xn ) → f (x).
◮ Thus, for continuous functions,
f lim xn = lim f (xn )
n→∞
n→∞
◮ We want to ask whether the probability, which is a
function whose domain is F, is also continuous like this.
◮ That is, we want to ask the question
?
P lim An = lim P(An )
n→∞
n→∞
◮ For this, we need to first define limit of a sequence of sets.
PS Sastry, IISc, Bangalore, 2020 11/34
◮ For now we define limits of only monotone sequences.
(We will look at the general case later in the course)
◮ A sequence, A1 , A2 , · · · , is said to be monotone
decreasing if
An+1 ⊂ An , ∀n (denoted as An ↓)
◮ A sequence, A1 , A2 , · · · , is said to be monotone increasing
if
An ⊂ An+1 , ∀n (denoted as An ↑)
PS Sastry, IISc, Bangalore, 2020 12/34
◮ Let An ↓. Then we define its limit as
lim An = ∩∞
k=1 Ak
n→∞
◮ This is reasonable because, when An ↓, we have
An ⊂ An−1 ⊂ An−2 · · · and hence, An = ∩nk=1 Ak .
◮ Similarly, when An ↑, we define the limit as
lim An = ∪∞
k=1 Ak
n→∞
An ↓
An ↑
PS Sastry, IISc, Bangalore, 2020 13/34
PS Sastry, IISc, Bangalore, 2020 14/34
◮ Let us look at simple examples of monotone sequences of
subsets of ℜ.
◮ Consider a sequence of intervals:
An = [a, b + n1 ), n = 1, 2, · · · with a, b ∈ ℜ, a < b.
[
a
...
b
)
)
b+0.5
b+1
◮ We have shown that ∩n [a, b + n1 ) = [a, b]
◮ Similarly we can get ∩n (a − n1 , b] = [a, b]
◮ Now consider An = [a, b − n1 ].
[
]
]
a
b-1
b-0.5
...
)
b
◮ Now, An ↑ and lim An = ∪n An = [a, b).
◮ Why? – because
◮ We have An ↓ and lim An = ∩i Ai = [a, b]
◮ Why? – because
◮ b ∈ An , ∀n ⇒ b ∈ ∩i Ai , and
◮ ∀ǫ > 0, b + ǫ ∈
/ An after some n ⇒ b + ǫ ∈
/ ∩i Ai .
1
For example, b + 0.01 ∈
/ A101 = [a, b + 101
).
◮ ∀ǫ > 0, ∃n s.t. b − ǫ ∈ An ⇒ b − ǫ ∈ ∪n An ;
◮ but b ∈
/ An , ∀n ⇒ b ∈
/ ∪n An .
◮ These examples also show how using countable unions or
intersections we can convert one end of an interval from
‘open’ to ‘closed’ or vice versa.
PS Sastry, IISc, Bangalore, 2020 15/34
◮ To summarize, limits of monotone sequences of events
are defined as follows
An ↓
PS Sastry, IISc, Bangalore, 2020 16/34
Theorem: Let An ↑. Then P(limn An ) = limn P(An )
◮ Since An ↑, An ⊂ An+1 .
◮ Define sets Bi , i = 1, 2, · · · , by
B1 = A1 , Bk = Ak − Ak−1 , k = 2, 3, · · ·
lim An = ∩∞
k=1 Ak
n→∞
A2
An ↑
lim An = ∪∞
k=1 Ak
n→∞
A3
◮ Having defined the limits, we now ask the question
?
P lim An = lim P(An )
n→∞
n→∞
B2
A1
where we assume the sequence is monotone.
B3
PS Sastry, IISc, Bangalore, 2020 17/34
PS Sastry, IISc, Bangalore, 2020 18/34
Theorem: Let An ↑. Then P(limn An ) = limn P(An )
◮ Since An ↑, An ⊂ An+1 .
◮ Define sets Bi , i = 1, 2, · · · , by
B1 = A1 , Bk = Ak − Ak−1 , k = 2, 3, · · ·
◮ Note that Bk are mutually exclusive. Also note that
n
X
n
P(Bk )
An = ∪k=1 Bk and hence P(An ) =
k=1
◮ We also have
∞
∪nk=1 Ak = ∪nk=1 Bk , ∀n and hence ∪∞
k=1 Ak = ∪k=1 Bk
◮ We showed that when An ↑, P(limn An ) = limn P(An )
◮ We can show this for the case An ↓ also.
◮ Note that if An ↓, then Acn ↑. Using this and the theorem
we can show it. (Left as an exercise)
◮ This property is known as monotone sequential continuity
of the probability measure.
◮ Thus we get
∞
P(lim An ) = P(∪∞
k=1 Ak ) = P(∪k=1 Bk )
n
=
∞
X
k=1
P(Bk ) = lim
n
n
X
k=1
P(Bk ) = lim P(An )
n
PS Sastry, IISc, Bangalore, 2020 19/34
◮ We can think of a simple example to use this theorem.
◮ We keep tossing a fair coin. (We take tosses to be
independent). We want to show that never getting a
head has probability zero.
◮ The basic idea is simple. ((0.5)n → 0)
◮ But to formalize this we need to specify what is our
probability space and then specify what is the event (of
never getting a head).
◮ If we toss the coin for any fixed N times then we know
the sample space can be {0, 1}N .
◮ But for our problem, we can not put any fixed limit on
the number of tosses and hence our sample space should
be for infinite tosses of a coin.
PS Sastry, IISc, Bangalore, 2020 21/34
PS Sastry, IISc, Bangalore, 2020 20/34
◮ We take Ω as set of all infinite sequences of 0’s and 1’s:
Ω = {(ω1 , ω2 , · · · ) : ωi ∈ {0, 1}, ∀i}
◮ This would be uncountably infinite.
◮ We would not specify F fully. But assume that any
subset of Ω specifiable through outcomes of finitely many
coin tosses would be an event.
◮ Thus “no head in the first n tosses” would be an event.
PS Sastry, IISc, Bangalore, 2020 22/34
◮ What P should we consider for this uncountable Ω?
We are not sure what to take.
◮ So, let us ask only for some consistency.
For any subset of this Ω that is specified only through
outcomes of first n tosses, that event should have the
same probability as in the finite probability space
corresponding to n tosses.
◮ Consider an event here;
A = {(ω1 , ω2 , ....) : ω1 = ω2 = 0} ⊂ Ω
A is the event of tails on first two tosses.
◮ We are saying we must have P(A) = (0.5)2 .
◮ Now we can complete problem
PS Sastry, IISc, Bangalore, 2020 23/34
◮ The Ω we considered can be corresponded with the
interval [0, 1].
◮ Each element of Ω is an infinite sequence of 0’s and 1’s
ω = (ω1 , ω2 , · · · ), ωi ∈ {0, 1} ∀i
◮ We can put a ‘binary point’ in front and thus consider ω
to be a real number between 0 and 1.
◮ That is, we correspond ω with the real number:
ω1 2−1 + ω2 2−2 + · · ·
◮ For example, the sequence (0, 1, 0, 1, 0, 0, 0, · · · ) would be
the number: 2−2 + 2−4 = 5/16.
◮ Essentially, every number in [0, 1] can be represented by a
binary sequence like this and every binary sequence
corresponds to a real number between 0 and 1.
◮ Thus, our Ω can be thought of as interval [0, 1].
◮ So, uncountable Ω arise naturally if we want to consider
infinite repetitions of a random experiment
PS Sastry, IISc, Bangalore, 2020 25/34
◮ For n = 1, 2, · · · , define
An = {(ω1 , ω2 , ....) : ωi = 0, i = 1, · · · , n}
◮ An is the event of no head in the first n tosses
and we know P(An ) = (0.5)n .
◮ Note that ∩∞
k=1 Ak is the event we want.
◮ Note that An ↓ because An+1 ⊂ An .
◮ Hence we get
n
P(∩∞
k=1 Ak ) = P(lim An ) = lim P(An ) = lim(0.5) = 0
n
n
n
PS Sastry, IISc, Bangalore, 2020 24/34
◮ The P we considered would be such that probability of an
interval would be its length.
◮ Consider the example event we considered earlier
A = {(ω1 , ω2 , ....) : ω1 = ω2 = 0} ⊂ Ω
◮ When we view the Ω as the interval [0, 1], the above is
the set of all binary numbers of the form 0.00xxxxxx · · · .
◮ What is this set of numbers?
◮ It ranges from 0.000000 · · · to 0.0011111 · · · .
◮ That is the interval [0, 0.25].
◮ As we already saw, the probability of this event is (0.5)2
which is the length of this interval
PS Sastry, IISc, Bangalore, 2020 26/34
◮ We looked at this probability space only for an example
where we could use monotone sequential continuity of
probability.
◮ But this probability space is important and has lot of
interesting properties.
Ω = {(ω1 , ω2 , · · · ) : ωi ∈ {0, 1}, ∀i}
P
◮ Here, n1 ni=1 ωi the fraction of heads in the first n tosses.
◮ Since we are tossing a fair coin repeatedly, we should
expect
n
1
1X
ωi =
lim
n→∞ n
2
i=1
◮ We expect this to be true for ‘almost all’ sequences in Ω.
◮ That means ‘almost all’ numbers in [0, 1] when expanded
as infinite binary fractions, satisfy this property.
◮ This is called Borel’s normal number theorem and is an
interesting result about real numbers.
Probability Models
◮ As mentioned earlier, everything in probability theory is
with reference to an underlying probability space:
(Ω, F, P).
◮ Probability theory starts with (Ω, F, P)
◮ We can say that different P correspond to different
models.
◮ Theory does not tell you how to get the P.
◮ The modeller has to decide what P she wants.
◮ The theory allows one to derive consequences or
properties of the model.
PS Sastry, IISc, Bangalore, 2020 28/34
PS Sastry, IISc, Bangalore, 2020 27/34
◮ Consider the random experiment of tossing a fair coin
three times.
◮ We can take Ω = {0, 1}3 and can use the following P1 .
ω
000
001
010
011
100
101
110
111
P1 ({ω})
1/8
1/8
1/8
1/8
1/8
1/8
1/8
1/8
◮ Now consider a P2 (different from P1 ) on the same Ω
ω
000
001
010
011
100
101
110
111
P2 ({ω})
1/4
1/12
1/12
1/12
1/12
1/12
1/12
1/4
◮ The consequences now change
◮ Now probability theory can derive many consequences:
◮ The tosses are independent
◮ Probability of 0 or 3 heads is 1/8 while that of 1 or 2
heads is 3/8
PS Sastry, IISc, Bangalore, 2020 29/34
◮ The probability that number of heads is 0 or 1 or 2 or 3
are all same and all equal 1/4.
◮ The tosses are not independent
PS Sastry, IISc, Bangalore, 2020 30/34
◮ We can not ask which is the ‘correct’ probability model
here.
◮ Such a question is meaningless as far as probability theory
is concerned.
◮ One chooses a model based on application.
◮ If we think tosses are independent then we choose P1 .
But if we need to model some dependence among tosses,
we choose a model like P2 .
◮ The model P2 accommodates some dependence among
tosses.
◮ Outcomes of previous tosses affect the current toss.
ω
000
001
010
011
100
101
110
111
P2 ({ω})
1/4 (= (1/2)(2/3)(3/4))
1/12 (= (1/2)(2/3)(1/4))
1/12 (= (1/2)(1/3)(2/4))
1/12
1/12
1/12
1/12
1/4
◮ It is also a useful model.
PS Sastry, IISc, Bangalore, 2020 32/34
PS Sastry, IISc, Bangalore, 2020 31/34
Random Variable
We next consider the concept of random variables. These
allow one to specify and analyze different probability models.
This entire course can be considered as studying different
random variables.
PS Sastry, IISc, Bangalore, 2020 33/34
◮ A random variable is a real-valued function on Ω:
X :Ω→ℜ
◮ For example, Ω = {H, T }, X (H) = 1, X (T ) = 0.
◮ Another example: Ω = {H, T }3 , X (ω) is numbers of H’s.
◮ A random variable maps each outcome to a real number.
◮ It essentially means we can treat all outcomes as real
numbers.
◮ We can effectively work with ℜ as sample space in all
probability models
PS Sastry, IISc, Bangalore, 2020 34/34
Recap: Monotone Sequences of Sets
◮
Recap: Monotone Sequential Continuity
A sequence, A1 , A2 , · · · , is said to be monotone
decreasing if
An+1 ⊂ An , ∀n (denoted as An ↓)
◮
Limit of a monotone decreasing sequence is
An ↓:
◮
◮
lim An = ∩∞
k=1 Ak
We showed that
P
n→∞
A sequence, A1 , A2 , · · · , is said to be monotone
increasing if
lim An = lim P (An )
n→∞
n→∞
when An ↓ or An ↑
An ⊂ An+1 , ∀n (denoted as An ↑)
◮
Limit of monotone increasing sequence is
An ↑:
lim An = ∪∞
k=1 Ak
n→∞
PS Sastry, IISc, Bangalore, 2020 1/41
PS Sastry, IISc, Bangalore, 2020 2/41
Random Variable
Let (Ω, F, P ) be our probability space and let X be a
random variable defined in this probability space.
◮ We know X maps Ω into ℜ.
◮ This random variable results in a new probability space:
◮
A random variable is a real-valued function on Ω:
X:Ω→ℜ
◮ For example, Ω = {H, T }, X(H) = 1, X(T ) = 0.
◮ Another example: Ω = {H, T }3 , X(ω) is numbers of H’s.
◮ A random variable maps each outcome to a real number.
◮ It essentially means we can treat all outcomes as real
numbers.
◮ We can effectively work with ℜ as sample space in all
probability models
◮
PS Sastry, IISc, Bangalore, 2020 3/41
X
(Ω, F, P ) → (ℜ, B, PX )
where ℜ is the new sample space and B ⊂ 2ℜ is the new
set of events and PX is a probability defined on B.
◮ For now we will assume that any set of ℜ that we want
would be in B and hence is an event.
◮ PX is a new probability measure (which depends on P
and X) that assigns probability to different subsets of ℜ.
PS Sastry, IISc, Bangalore, 2020 4/41
◮
◮
X
(Ω, F, P ) → (ℜ, B, PX )
Given a probability space (Ω, F, P ), a random variable X
◮
X
(Ω, F, P ) → (ℜ, B, PX )
◮
Given a probability space (Ω, F, P ), a random variable X
PX (B) = P ({ω ∈ Ω : X(ω) ∈ B}) , B ∈ B
We define PX :
◮
PX (B) = P ({ω ∈ Ω : X(ω) ∈ B}) , B ∈ B
We use the notation
[X ∈ B] = {ω ∈ Ω : X(ω) ∈ B}
◮
X
Sample Space
We define PX :
So, now we can write
Real Line
PX (B) = P ([X ∈ B]) = P [X ∈ B]
B
For the definition of PX to be proper, for each B ∈ B, we
must have [X ∈ B] ∈ F.
We will assume that. (This is trivially true if F = 2Ω ).
◮ We can easily verify PX is a probability measure. It
satisfies the axioms.
◮
PS Sastry, IISc, Bangalore, 2020 6/41
PS Sastry, IISc, Bangalore, 2020 5/41
Given a probability space (Ω, F, P ), a random variable X
◮ We define PX :
◮
PX (B) = P [X ∈ B] = P ({ω ∈ Ω : X(ω) ∈ B})
Let us look at a couple of simple examples.
◮ Let Ω = {H, T } and P (H) = p.
Let X(H) = 1; X(T ) = 0.
◮
[X ∈ {0}]
[X ∈ [−3.14, 0.552] ]
[X ∈ (0.62, 15.5)]
[X ∈ [−2, 2) ]
Easy to see: PX (B) ≥ 0, ∀B and PX (ℜ) = 1
◮ If B1 ∩ B2 = φ then PX (B1 ∪ B2 ) = P [X ∈ B1 ∪ B2 ] =?
◮
◮
=
=
=
=
{ω : X(ω) = 0} = {T }
{ω : −3.14 ≤ X(ω) ≤ 0.552} = {T }
{ω : 0.62 < X(ω) < 15.5} = {H}
Ω
Hence we get
PX ({0}) = (1 − p) = PX ([−3.14, 0.552])
P [X ∈ B1 ∪B2 ] = P [X ∈ B1 ]+P [X ∈ B2 ] = PX (B1 )+PX (B2 )
PS Sastry, IISc, Bangalore, 2020 7/41
PX ((0.6237, 15.5)) = p; PX ([−2, 2)) = 1
PS Sastry, IISc, Bangalore, 2020 8/41
Let Ω = {H, T }3 = {HHH, HHT, · · · , T T T }.
Let P be specified through ‘equally likely’ assignment.
Let X(ω) be number of H’s in ω. Thus, X(T HT ) = 1.
(X takes one of the values: 0, 1, 2, or 3)
◮ We can once again write down [X ∈ B] for different
B⊂ℜ
◮
[X ∈ (0, 1] ] = {HT T, T HT, T T H};
[X ∈ (−1.2, 2.78) ] = Ω − {HHH}
◮
Hence
A random variable defined on (Ω, F, P ) results in a new
or induced probability space (ℜ, B, PX ).
◮ The Ω may be countable or uncountable (even though we
looked at only examples of finite Ω).
◮ Thus, we can study probability models by taking ℜ as
sample space through the use of random variables.
◮ However there are some technical issues regarding what B
we should consider.
◮ We briefly consider this and then move on to studying
random variables.
◮
7
3
PX ((0, 1]) = ; PX ((−1.2, 2.78)) =
8
8
PS Sastry, IISc, Bangalore, 2020 9/41
PS Sastry, IISc, Bangalore, 2020 10/41
Let us consider Ω = [0, 1].
◮ This is the simplest example of uncountable Ω we
considered.
◮ We also saw that this sample space comes up when we
consider infinite tosses of a coin.
◮ The simplest extension of the idea of ‘equally likely’ is to
say probability of an event (subset of Ω) is the length of
the event (subset).
◮ But not all subsets of [0, 1] are intervals and length is
defined only for intervals.
◮ We can define length of countable union of disjoint
intervals to be sum of the lengths of individual intervals.
◮ But what about subsets that may not be countable
unions of disjoint intervals ?
◮ Well, we say those can be assigned probability by using
the axioms.
◮
We want to look at the probability space (ℜ, B, PX ).
◮ If we could take B = 2ℜ then everything would be simple.
But that is not feasible.
◮ What this means is that if we want every subset of real
line to be an event, we cannot construct a probability
measure (to satisfy the axioms).
◮
PS Sastry, IISc, Bangalore, 2020 11/41
PS Sastry, IISc, Bangalore, 2020 12/41
σ-algebra
Thus the question is the following:
◮ Can we construct a function
m : 2[0,1] → [0, 1] such that
◮
◮
1. m(A) = length(A)
if A ⊂ [0, 1] is an interval
P
2. m(∪i Ai ) = i m(Ai ) where Ai ∩ Aj = φ whenever
i 6= j, (A1 , A2 , · · · ⊂ [0, 1])
The surprising answer is ‘NO’
◮ This is a fundamental result in real analysis.
◮ Hence for the probability space (ℜ, B, PX ) we cannot
take B = 2ℜ .
(Recall that for countable Ω we can take F = 2Ω ).
◮ Now the question is what is the best B we can have?
◮
1. Ω ∈ F
2. A ∈ F ⇒ Ac ∈ F
3. A1 , A2 , · · · ∈ F ⇒ ∪i Ai ∈ F
Thus a σ-algebra is a collection of subsets of Ω that is
closed under complements and countable unions (and
hence countable intersections because ∩i Ai = (∪i Aci )c ).
◮ Note that 2Ω is obviously a σ-algebra
◮ In a Probability space (Ω, F, P ), if F =
6 2Ω then we want
it to be a σ-algebra. (Why?)
◮
PS Sastry, IISc, Bangalore, 2020 13/41
◮
For example, with Ω = {1, 2, 3, 4, 5, 6},
F = {Ω, φ, {1, 3, 5}, {2, 4, 6}} is a σ-algebra
◮
Suppose on this Ω we want to make a σ-algebra
containing {1, 2} and {3, 4}.
{Ω, φ, {1, 2}, {3, 4}, {3, 4, 5, 6}, {1, 2, 5, 6}, {1, 2, 3, 4}, {5, 6}}
◮
PS Sastry, IISc, Bangalore, 2020 14/41
Easy to construct examples of σ-algebras
Let A ⊂ Ω.
F = {Ω, φ, A, Ac } is a σ-algebra
◮
An F ⊂ 2Ω is called a σ-algebra (also called σ-field) on Ω
if it satisfies the following:
Let F1 , F2 be σ-algebras on Ω.
◮ Then, so is F1 ∩ F2 .
◮ It is simple to show.
(E.g., A ∈ F1 ∩ F2 ⇒ A ∈ F1 , A ∈ F2 ⇒ Ac ∈
F1 , Ac ∈ F2 ⇒ Ac ∈ F1 ∩ F2 )
◮ Let G ⊂ 2Ω . We denote by σ(G) the smallest σ-algebra
containing G.
◮ It is defined as the intersection of all σ-algebras
containing G (and hence is well defined).
◮
This is the ‘smallest’ σ-algebra containing {1, 2}, {3, 4}
PS Sastry, IISc, Bangalore, 2020 15/41
PS Sastry, IISc, Bangalore, 2020 16/41
Borel σ-algebra
Let us get back to the question we started with.
◮ In the probability space (ℜ, B, P ) what is the B we
should choose.
◮ We can choose it to be the smallest σ-algebra containing
all intervals
◮ That is called Borel σ-algebra, B.
◮ It contains all intervals, all complements, countable
unions and intersections of intervals and all sets that can
be obtained through complements, countable unions
and/or intersections of such sets and so on.
◮
Let G = {(−∞, x] : x ∈ ℜ}
◮ We can define the Borel σ-algebra, B, as the smallest
σ-algebra containing G.
◮ We can see that B would contain all intervals.
◮
1. (−∞, x) ∈ B because (−∞, x) = ∪n (−∞, x − n1 ]
2. (x, ∞) ∈ B because (x, ∞) = (−∞, x]c
3. [x, ∞) ∈ B because [x, ∞) = ∩n (x − n1 , ∞)
4. (x, y] ∈ B because (x, y] = (−∞, y] ∩ (x, ∞)
5. [x, y] ∈ B because [x, y] = ∩n (x − n1 , y]
6. [x, y), (x, y) ∈ B, similarly
◮
Thus, σ(G) is also the smallest σ-algebra containing all
intervals.
PS Sastry, IISc, Bangalore, 2020 18/41
PS Sastry, IISc, Bangalore, 2020 17/41
Borel σ-algebra
Random Variables
Given a probability space (Ω, F, P ), a random variable is
a real-valued function on Ω.
◮ It essentially results in an induced probability space
◮
◮
We have defined B as
B = σ ({(−∞, x] : x ∈ ℜ})
X
It is also the smallest σ-algebra containing all intervals.
◮ Elements of B are called Borel sets
◮ Intervals (including singleton sets), complements of
intervals, countable unions and intersections of intervals,
countable unions and intersections of such sets on so on
are all Borel sets.
◮ Borel σ-algebra contains enough sets for our purposes.
◮ Are there any subsets of real line that are not Borel?
◮ YES!! Infinitely many non-Borel sets would be there!
(Ω, F, P ) → (ℜ, B, PX )
◮
where B is the Borel σ-algebra.
◮ We define PX as: for all Borel sets, B ⊂ ℜ,
PX (B) = P [X ∈ B] = P ({ω ∈ Ω : X(ω) ∈ B})
◮
[X ∈ B] = {ω ∈ Ω : X(ω) ∈ B} ∈ F, ∀B ∈ B
◮
PS Sastry, IISc, Bangalore, 2020 19/41
For X to be a random variable, the folowing should also
hold
We always assume this.
PS Sastry, IISc, Bangalore, 2020 20/41
Distribution function of a random variable
◮
Let X be a random variable.
◮ It represents a probability model with ℜ as the sample
space.
◮ The probability assigned to different events (Borel subsets
of ℜ) is
◮
PX (B) = P [X ∈ B] = P ({ω ∈ Ω : X(ω) ∈ B})
◮
How does one represent this probability measure
Let X be a random variable. It distribution function is
FX : ℜ → ℜ defined by
FX (x) = P [X ∈ (−∞, x]] = P ({ω ∈ Ω : X(ω) ≤ x})
We write the event {ω : X(ω) ≤ x} as [X ≤ x].
We follow this notation with any such relation statement
involving X
e.g., [X 6= 3] represents the event {ω ∈ Ω : X(ω) 6= 3}.
◮ Thus we have
◮
FX (x) = P [X ≤ x] = P ({ω ∈ Ω : X(ω) ≤ x}) = PX ( (−∞, x] )
◮
The distribution function, FX completely specifies the
probability measure, PX .
PS Sastry, IISc, Bangalore, 2020 21/41
PS Sastry, IISc, Bangalore, 2020 22/41
Consider tossing of a fair coin: Ω = {T, H},
P ({T }) = P ({H}) = 0.5.
◮ Let X(T ) = 0 and X(H) = 1. We want to calculate FX
◮ For this we want the event [X ≤ x], for different x
◮ Let us first look at some examples:
◮
◮
The distribution function of X is given by
FX (x) = P [X ≤ x] = P ({ω ∈ Ω : X(ω) ≤ x})
This is also sometimes called the cumulative distribution
function.
◮ FX is a real-valued function of a real variable.
◮ Let us look at a simple example.
[X ≤ −0.5] = {ω : X(ω) ≤ −0.5} = φ
[X ≤ 0.25] = {ω : X(ω) ≤ 0.25} = {T }
[X ≤ 1.3] = {ω : X(ω) ≤ 1.3} = Ω
◮
◮
Thus we get
[X ≤ x] = {ω : X(ω) ≤ x}
φ if x < 0
Ω if x ≥ 1
=
{T } if 0 ≤ x < 1
PS Sastry, IISc, Bangalore, 2020 23/41
PS Sastry, IISc, Bangalore, 2020 24/41
We are considering: Ω = {T, H},
P ({T }) = P ({H}) = 0.5.
◮ X(T ) = 0 and X(H) = 1. We want to calculate FX
◮ We showed
◮
We are considering: Ω = {T, H},
P ({T }) = P ({H}) = 0.5.
◮ X(T ) = 0 and X(H) = 1. We want to calculate FX
◮ We showed
◮
[X ≤ x] = {ω : X(ω) ≤ x}
φ if x < 0
{T } if 0 ≤ x < 1
=
Ω if x ≥ 1
◮
Hence FX (x) = P [X ≤ x] is given by
0 if x < 0
0.5 if 0 ≤ x < 1
FX (x) =
1 if x ≥ 1
[X ≤ x] = {ω : X(ω) ≤ x}
φ if x < 0
{T } if 0 ≤ x < 1
=
Ω if x ≥ 1
◮
Please note that x is a ‘dummy variable’
PS Sastry, IISc, Bangalore, 2020 25/41
◮
Hence FX (y) = P [X ≤ y] is given by
0 if y < 0
0.5 if 0 ≤ y < 1
FX (y) =
1 if y ≥ 1
PS Sastry, IISc, Bangalore, 2020 26/41
A plot of this distribution function:
Let us look at another example.
◮ Let Ω = [0, 1] and take events to be Borel subsets of
[0, 1]. (That is, F = {B ∩ [0, 1] : B ∈ B}).
◮ We take P to be such that probability of an interval is its
length.
◮ This is the ‘usual’ probability space whenever we take
Ω = [0, 1].
◮ Let X(ω) = ω.
◮ We want to find the distribution function of X.
◮
PS Sastry, IISc, Bangalore, 2020 27/41
PS Sastry, IISc, Bangalore, 2020 28/41
Once again we need to find the event [X ≤ x] for
different values of x.
◮ Note that the function X takes values in [0, 1] and
X(ω) = ω.
◮
◮
The plot of this distribution function:
[X ≤ x] = {ω ∈ Ω : X(ω) ≤ x} = {ω ∈ [0, 1] : ω ≤ x}
φ if x < 0
Ω if x ≥ 1
=
[0, x] if 0 ≤ x < 1
◮
Hence FX (x) = P [X ≤ x] is given by
0 if x < 0
x if 0 ≤ x < 1
FX (x) =
1 if x ≥ 1
PS Sastry, IISc, Bangalore, 2020 30/41
PS Sastry, IISc, Bangalore, 2020 29/41
Properties of Distribution Functions
◮
Right continuity of FX : xn ↓ x ⇒ FX (xn ) → FX (x)
◮
◮
xn ↓ x implies the sequence of events (−∞, xn ] is
monotone decreasing.
The distribution function of random variable X is given by
x
x2
...
x1
FX (x) = P [X ≤ x] = P ({ω : X(ω) ≤ x})
◮
◮
Any distribution function should satisfy the following:
1. 0 ≤ FX (x) ≤ 1, ∀x
2. FX (−∞) = 0; FX (∞) = 1
3. FX is non-decreasing: x1 ≤ x2 ⇒ FX (x1 ) ≤ FX (x2 )
x1 ≤ x2 ⇒ (−∞, x1 ] ⊂ (−∞, x2 ] ⇒
PX ((−∞, x1 ]) ≤ PX ((−∞, x2 ] ⇒ FX (x1 ) ≤ FX (x2 )
4. FX is right continuous and has left-hand limits.
◮
lim PX ((−∞, xn ]) = PX (lim(−∞, xn ]) = PX ((−∞, x])
n
◮
n
This in turn implies
lim FX (xn ) = FX (x)
xn ↓x
◮
PS Sastry, IISc, Bangalore, 2020 31/41
Also, limn (−∞, xn ] = ∩n (−∞, xn ] = (−∞, x]
This implies
Using the usual notation for right limit of a function, we
can write FX (x+ ) = FX (x), ∀x.
PS Sastry, IISc, Bangalore, 2020 32/41
FX is right-continuous at all x.
◮ Next, let us look at the lefthand limits: limx ↑x FX (xn )
n
◮ When xn ↑ x, the sequence of events (−∞, xn ] is
monotone increasing and
◮
lim(−∞, xn ] = ∪n (−∞, xn ] = (−∞, x)
FX is right-continuous:
FX (x+ ) = FX (x) = PX ( (−∞, x] )
◮ It has left limits: FX (x− ) = PX ( (−∞, x) )
◮ If A ⊂ B then P (B − A) = P (B) − P (A)
◮ We have (−∞, x] − (−∞, x) = {x}. Hence
◮
n
◮
By sequential continuity of probability, we have
lim PX ((−∞, xn ]) = PX (lim(−∞, xn ] ) = PX ( (−∞, xn ) )
n
◮
◮
Thus we get
n
FX (x+ ) − FX (x− ) = P [X = x] = P ({ω : X(ω) = x})
Hence we get
FX (x− ) = lim FX (xn ) = lim PX ((−∞, xn ]) = PX ( (−∞, xn ) )
xn ↑x
◮
PX ( (−∞, x] )−PX ( (−∞, x) ) = PX ({x}) = P ({ω : X(ω) = x})
n
Thus, at every x the left limit of FX exists.
When FX is discontinuous at x the height of discontinuity
is the probability that X takes that value.
◮ And, if FX is continuous at x then P [X = x] = 0
◮
PS Sastry, IISc, Bangalore, 2020 33/41
PS Sastry, IISc, Bangalore, 2020 34/41
Distribution Functions
FX (x) = P [X ≤ x] = P [X ∈ (−∞, x] ]
◮ Given FX , we can, in principle, find P [X ∈ B] for all
Borel sets.
◮ In particular, for a < b,
◮
Let X be a random variable.
◮ Its distribution function, FX : ℜ → ℜ is given by
FX (x) = P [X ≤ x]
◮ The distribution function satisfies
◮
1. 0 ≤ FX (x) ≤ 1, ∀x
2. FX (−∞) = 0; FX (∞) = 1
3. FX is non-decreasing: x1 ≤ x2 ⇒ FX (x1 ) ≤ FX (x2 )
4. FX is right continuous and has left-hand limits.
We also have FX (x+ ) − FX (x− ) = P [X = x]
◮ Any real-valued function of a real variable satisfying the
above four properties would be a distribution function of
some random variable.
◮
PS Sastry, IISc, Bangalore, 2020 35/41
P [a < X ≤ b] =
=
=
=
P [X ∈ (a, b] ]
P [X ∈ ( (−∞, b] − (−∞, a] ) ]
P [X ∈ (−∞, b] ] − P [X ∈ (−∞, a] ]
FX (b) − FX (a)
PS Sastry, IISc, Bangalore, 2020 36/41
Discrete Random Variables
There are two classes of random variables that we would
study here.
◮ These are called discrete and continuous random
variables.
◮ There can be random variables that are neither discrete
nor continuous.
◮ But these two are important classes of random variables
that we deal with in this course.
◮ Note that the distribution function is defined for all
random variables.
◮
A random variable X is said to be discrete if it takes only
countably many distinct values.
◮ Countably many means finite or countably infinite.
◮ If X : Ω → ℜ is discrete, its (strict) range is countable
◮ Any random variable that is defined on finite or countable
Ω would be discrete.
◮ Thus the family of discrete random variables includes all
probability models on finite or countably infinite sample
spaces.
◮
PS Sastry, IISc, Bangalore, 2020 37/41
Discrete Random Variable Example
PS Sastry, IISc, Bangalore, 2020 38/41
FX (x) = P [X ≤ x] (Recall X ∈ {0, 1, 2, 3})
◮ The event [X ≤ x] for different x can be seen to be
φ
x<0
0≤x<1
{T T T }
{T T T, HT T, T HT, T T H} 1 ≤ x < 2
[X ≤ x] =
Ω − {HHH}
2≤x<3
Ω
x≥3
◮
Consider three independent tosses of a fair coin.
◮ Ω = {H, T }3 and X(ω) is the number of H’s in ω.
◮ This rv takes four distinct values, namely, 0, 1, 2, 3.
◮ We denote this as X ∈ {0, 1, 2, 3}
◮ Let us find the distribution function of this rv
◮ Let us take some examples of [X ≤ x]
◮
[X ≤ 0.72] = {ω : X(ω) ≤ 0.72} = {ω : X(ω) = 0} = [X = 0]
[X ≤ 1.57] = {ω : X(ω) ≤ 1.57}
= {ω : X(ω) = 0} ∪ {ω : X(ω) = 1} = [X = 0 or 1]
PS Sastry, IISc, Bangalore, 2020 39/41
◮
So, we get the distribution function as
0 x<0
1
0≤x<1
8
4
1≤x<2
FX (x) =
8
7
2≤x<3
8
1 x≥3
PS Sastry, IISc, Bangalore, 2020 40/41
◮
Recap: Random Variables
The plot of this distribution function is:
Given a probability space (Ω, F, P ), a random variable is
a real-valued function on Ω.
◮ It essentially results in an induced probability space
◮
X
(Ω, F, P ) → (ℜ, B, PX )
where B is the Borel σ-algebra and
This is a stair-case function.
◮ It has jumps at x = 0, 1, 2, 3, which are the values that X
takes. In between these it is constant.
◮ The jump at, e.g., x = 2 is 3/8 which is the probability of
X taking that value.
◮
PX (B) = P [X ∈ B] = P ({ω ∈ Ω : X(ω) ∈ B})
PS Sastry, IISc, Bangalore, 2020 41/41
Recap: σ-algebra
◮
PS Sastry, IISc, Bangalore, 2020 1/52
Recap: Distribution function of a random variable
An F ⊂ 2Ω is called a σ-algebra (also called σ-field) on Ω
if it satisfies
1. Ω ∈ F
2. A ∈ F ⇒ Ac ∈ F
3. A1 , A2 , · · · ∈ F ⇒ ∪i Ai ∈ F
◮
Thus a σ-algebra is a collection of subsets of Ω that is
closed under complements and countable unions (and
hence countable intersections).
◮ The Borel σ-algebra (on ℜ), B, is the smallest σ-algebra
containing all intervals.
◮ We also have B = σ({(−∞, x] : x ∈ ℜ}
FX (x) = P [X ≤ x] = P ({ω ∈ Ω : X(ω) ≤ x})
◮
PS Sastry, IISc, Bangalore, 2020 2/52
Let X be a random variable. It distribution function,
FX : ℜ → ℜ, is defined by
◮
The distribution function, FX , completely specifies the
probability measure, PX .
PS Sastry, IISc, Bangalore, 2020 3/52
Recap: Properties of distribution function
◮
The distribution function satisfies
1. 0 ≤ FX (x) ≤ 1, ∀x
2. FX (−∞) = 0; FX (∞) = 1
3. FX is non-decreasing: x1 ≤ x2 ⇒ FX (x1 ) ≤ FX (x2 )
4. FX is right continuous and has left-hand limits.
Any real-valued function of a real variable satisfying the
above four properties would be a distribution function of
some random variable.
◮ We also have
FX (x+ ) − FX (x− ) = FX (x) − FX (x− ) = P [X = x]
P [a < X ≤ b] = FX (b) − FX (a).
◮
There are two classes of random variables that we would
study here.
◮ These are called discrete and continuous random
variables.
◮ Note that the distribution function is defined for all
random variables.
◮
PS Sastry, IISc, Bangalore, 2020 4/52
Discrete Random Variables
PS Sastry, IISc, Bangalore, 2020 5/52
Discrete Random Variable Example
Consider three independent tosses of a fair coin.
◮ Ω = {H, T }3 and X(ω) is the number of H’s in ω.
◮ This rv takes four distinct values, namely, 0, 1, 2, 3.
◮ We denote this as X ∈ {0, 1, 2, 3}
◮ Let us find the distribution function of this rv
◮ Let us take some examples of [X ≤ x]
◮
A random variable X is said to be discrete if it takes only
countably many distinct values.
◮ Countably many means finite or countably infinite.
◮
[X ≤ 0.72] = {ω : X(ω) ≤ 0.72} = {ω : X(ω) = 0} = [X = 0]
[X ≤ 1.57] = {ω : X(ω) ≤ 1.57}
= {ω : X(ω) = 0} ∪ {ω : X(ω) = 1} = [X = 0 or 1]
PS Sastry, IISc, Bangalore, 2020 6/52
PS Sastry, IISc, Bangalore, 2020 7/52
FX (x) = P [X ≤ x] (Recall X ∈ {0, 1, 2, 3})
◮ The event [X ≤ x] for different x can be seen to be
φ
x<0
{T
T
T
}
0≤x<1
{T T T, HT T, T HT, T T H} 1 ≤ x < 2
[X ≤ x] =
Ω − {HHH}
2≤x<3
Ω
x≥3
◮
◮
So, we get the distribution function as
0 x<0
1
0≤x<1
8
4
1≤x<2
FX (x) =
8
7
2≤x<3
8
1 x≥3
◮
The plot of this distribution function is:
This is a stair-case function.
◮ It has jumps at x = 0, 1, 2, 3, which are the values that X
takes. In between these it is constant.
◮ The jump at, e.g., x = 2 is 3/8 which is the probability of
X taking that value.
◮
PS Sastry, IISc, Bangalore, 2020 9/52
PS Sastry, IISc, Bangalore, 2020 8/52
We know that FX (x) − FX (x− ) = P [X = x].
◮ For example,
◮
FX (2) − FX (2− ) = P [X = 2] = P ({ω : X(ω) = 2})
3
= P ({T HH, HT H, HHT }) =
8
The FX is a stair-case function.
◮ It has jumps at each value assumed by X (and is
constant in between)
◮ The height of the jump is equal to the probability of X
taking that value.
◮ All discrete random variables would have this general form
of distribution function.
◮
PS Sastry, IISc, Bangalore, 2020 10/52
Let X be a dicrete rv and let X ∈ {a1 , a2 , · · · , an }
◮ As a notation we assume: a1 < a2 < · · · < an
◮ Let [X = ai ] = {ω : X(ω) = ai } = Bi and let
P (Bi ) = qi .
◮ Since X is a function on Ω, B1 , · · · , Bn form a partition
of Ω.
Pn
◮ Note that qi ≥ 0 and
i=1 qi = 1.
◮ If x < a1 then [X ≤ x] = φ.
◮ If a1 ≤ x < a2 then [X ≤ x] = [X = a1 ] = B1
◮ If a2 ≤ x < a3 then
[X ≤ x] = [X = a1 ] ∪ [X = a2 ] = B1 + B2
◮
PS Sastry, IISc, Bangalore, 2020 11/52
◮
◮
Hence we can write the distribution function as
0
x < a1
P (B1 )
a1 ≤ x < a2
P
(B
)
+
P
(B
)
a2 ≤ x < a3
1
2
..
.
FX (x) =
P
k
ak ≤ x < ak+1
i=1 P (Bi )
.
..
1
x ≥ an
We can write this compactly as
X
qk
FX (x) =
Let X be a discrete rv with X ∈ {x1 , x2 , · · · }.
◮ Let qi = P [X = xi ] (= P ({ω : X(ω) = xi }) )
P
◮ We have qi ≥ 0 and
i qi = 1.
◮ If X is discrete then there is a countable set E such that
P [X ∈ E] = 1.
◮ The distribution function of X is specified completely by
these qi
◮
k:ak ≤x
◮
Note that all this holds even when X takes countably
infinitely many values.
PS Sastry, IISc, Bangalore, 2020 12/52
probability mass function, fX
PS Sastry, IISc, Bangalore, 2020 13/52
Properties of pmf
Let X be a discrete rv with X ∈ {x1 , x2 , · · · }.
◮ The probability mass function (pmf) of X is defined by
◮
◮
fX (xi ) = P [X = xi ]; fX (x) = 0, for all other x
fX is also a real-valued function of a real variable.
◮ We can write the definition compactly as
fX (x) = P [X = x]
◮ The distribution function (df) and the pmf are related as
X
FX (x) =
fX (xi )
◮
i:xi ≤x
fX (x) = FX (x) − FX (x− )
◮
The probability mass function of a discrete random
variable X ∈ {x1 , x2 , · · · } satisfies
1. fP
X (x) ≥ 0, ∀x and fX (x) = 0 if x 6= xi for some i
2.
i fX (xi ) = 1
Any function satisfying the above two would be a pmf of
some discrete random variable.
◮ We can specify a discrete random variable by giving either
FX or fX .
◮ Please remember that we have defined distribution
function for any random variable. But pmf is defined only
for discrete random variables
◮
We can get pmf from df and df from pmf.
PS Sastry, IISc, Bangalore, 2020 14/52
PS Sastry, IISc, Bangalore, 2020 15/52
Computations of Probabilities for discrete rv’s
A discrete random variable is specified by giving either df
or pmf. One can be obtained from the other.
◮ We normally specify it through the pmf.
◮ Given X ∈ {x1 , x2 , · · · } and fX , we can (in principle)
compute probability of any event
X
P [X ∈ B] =
fX (xi )
◮
◮
Any discrete random variable can be specified by
◮
◮
giving the set of values of X, {x1 , x2 , · · · }, and
numbers qi such that qi = P [X = xi ] = fX (xi )
P
Note that we must have qi ≥ 0 and i qi = 1.
◮ As we saw this is how we can specify a probability
assignment on any countable sample space.
◮
i:
xi ∈B
◮
For example, if X ∈ {0, 1, 2, 3} then
P [X ∈ [0.5, 1.32] ∪ [2.75, 5.2] ] = fX (1) + fX (3)
◮
PS Sastry, IISc, Bangalore, 2020 16/52
Bernoulli Distribution
◮
We next look at some standard discrete random variable
models
PS Sastry, IISc, Bangalore, 2020 17/52
One of the df examples we saw earlier is that of Bernoulli
Bernoulli random variable: X ∈ {0, 1} with
fX (1) = p; fX (0) = 1−p; where 0 < p < 1 is a parameter
This fX is easily seen to be a pmf
◮ Consider (Ω, F, P ) with B ∈ F. (The Ω here may be
uncountable).
◮ Consider the random variable
0 if ω ∈
/B
IB (ω) =
1 if ω ∈ B
◮
It is called indicator (random variable) of B.
◮ P [IB = 1] = P ({ω : IB (ω) = 1}) = P (B)
◮ Thus, this indicator rv has Bernoulli distribution with
p = P (B)
◮
PS Sastry, IISc, Bangalore, 2020 18/52
PS Sastry, IISc, Bangalore, 2020 19/52
One of the df examples we considered was that of Binomial
Binomial Distribution
◮
X ∈ {0, 1, · · · , n} with pmf
fX (k) = n Ck pk (1 − p)n−k , k = 0, 1, · · · , n
where n, p are parameters (n is a +ve integer and
0 < p < 1).
◮ This is easily seen to be a pmf
n
X
n
Ck pk (1 − p)n−k = (p + 1 − p)n = 1
k=0
Consider n independent tosses of coin whose probability
of heads is p. If X is the number of heads then X has
the above binomial distribution.
(Number of successes in n bernoulli trials)
◮ Any one outcome (a seq of length n) with k heads would
have probability pk (1 − p)n−k . There are n Ck outcomes
with exactly k heads.
◮
PS Sastry, IISc, Bangalore, 2020 20/52
Poisson Distribution
◮
Geometric Distribution
X ∈ {0, 1, 2, · · · } with pmf
k
fX (k) =
−λ
λ e
k!
◮
, k = 0, 1, 2, · · ·
where λ > 0 is a parameter.
◮ We can see this to be a pmf by
∞
X
λk
k=0
◮
PS Sastry, IISc, Bangalore, 2020 21/52
k!
e−λ = eλ e−λ = 1
X ∈ {1, 2, · · · } with pmf
fX (k) = (1 − p)k−1 p, k = 1, 2, · · ·
where 0 < p < 1 is a parameter.
◮ Consider tossing a coin (with prob of H being p)
repeatedly till we get a head. X is the toss number on
which we got the first head.
◮ In general waiting for ‘success’ in independent Bernoulli
trials.
Poisson distribution is also useful in many applications
PS Sastry, IISc, Bangalore, 2020 22/52
PS Sastry, IISc, Bangalore, 2020 23/52
Memoryless property of geometric distribution
◮
P [X > m + n, X > m]
P [X > m]
P [X > m + n]
=
P [X > m]
(1 − p)m+n
=
= (1 − p)n
m
(1 − p)
⇒ P [X > m + n|X > m] = P [X > n]
P [X > m + n|X > m] =
Suppose X is a geometric rv. Let m, n be positive
integers.
◮ We want to calculate P ( [X > m + n] | [X > m] )
(Remember that [X > m] etc are events)
◮ Let us first calculate P [X > n] for any positive integer n
◮
P [X > n] =
∞
X
k=n+1
= p
P [X = k] =
∞
X
(1 − p)k−1 p
k=n+1
(1 − p)n
= (1 − p)n
1 − (1 − p)
Now we can compute the required conditional probability
This is known as the memoryless property of geometric
distribution
◮ Same as
◮
P [X > m + n] = P [X > m]P [X > n]
(Does this also tell us what is df of geometric rv?)
PS Sastry, IISc, Bangalore, 2020 25/52
PS Sastry, IISc, Bangalore, 2020 24/52
Memoryless property defines geometric rv
◮
If X is a geometric random variable, it satisfies
P [X > m + n|X > m] = P [X > n]
◮
◮
Suppose X ∈ {0, 1, · · · } is a discrete rv satisfying, for all
non-negative integers, m, n
This is same as
P [X > m + n] = P [X > m]P [X > n]
P [X > m + n] = P [X > m]P [X > n]
We will show that X has geometric distribution
◮ First, note that
P [X > 0] = P [X > 0 + 0] = (P [X > 0])2
⇒ P [X > 0] is either 1 or 0.
◮ Let us take P [X > 0] = 1 (and hence P [X = 0] = 0).
◮
Does it say that [X > m] is independent of [X > n]
◮ NO!
Because [X > m + n] is not equal to intersection of
[X > m] and [X > n]
◮
PS Sastry, IISc, Bangalore, 2020 26/52
PS Sastry, IISc, Bangalore, 2020 27/52
◮
Continuous Random Variables
We have, for any m,
P [X > m] = P [X > (m − 1) + 1]
= P [X > m − 1]P [X > 1]
= P [X > m − 2] (P [X > 1])2
◮
Let q = P [X > 1]. Iterating on the above, we get
◮
P [X > m] = P [X > 0] (P [X > 1])m = q m
◮
A rv, X, is said to be continuous (or of continuous type)
if its distribution function, FX is absolutely continuous.
Using this, we can get pmf of X as
P [X = m] = P [X > m−1]−P [X > m] = q m−1 −q m = q m−1 (1−q)
◮
This is pmf of geometric (with q = (1 − p))
PS Sastry, IISc, Bangalore, 2020 28/52
Absolute Continuity
PS Sastry, IISc, Bangalore, 2020 29/52
Continuous Random Variables
A function g : ℜ → ℜ is absolutely continuous on an
interval, I, if given any ǫ > 0 there is a δ > 0 such that
for any finite sequence of pair-wise disjoint
P subintervals,
(xk , yk ), P
with xk , yk ∈ I, ∀k, satisfying k (yk − xk ) < δ,
we have k |f (yk ) − f (xk )| < ǫ
◮ A function that is absolutely continuous on a (finite)
closed interval is uniformly continuous.
◮ If g is absolutely continuous on [a, b] then there exists an
integrable function h such that
Z x
h(t) dt, ∀x ∈ [a, b]
g(x) = g(a) +
◮
a
◮
In the above, g would be differentiable almost everywhere
and h would be its derivative (wherever g is
differentiable).
PS Sastry, IISc, Bangalore, 2020 30/52
A rv, X, is said to be continuous (or of continuous type)
if its distribution function, FX is absolutely continuous.
◮ That is, if there exists a function fX : ℜ → ℜ such that
Z x
FX (x) =
fX (t) dt, ∀x
◮
−∞
fX is called the probability density function (pdf) of X.
◮ Note that FX here is continuous
◮ By the fundamental theorem of claculus, we have
◮
dFx (x)
= fX (x), ∀x where fX is continuous
dx
PS Sastry, IISc, Bangalore, 2020 31/52
Continuous Random Variables
Continuous Random Variables
If X is a continuous rv then its distribution function, FX ,
is continuous.
◮ Hence a discrete random variable is not a continuous rv!
◮ If a rv takes countably many values then it is discrete.
◮ However, if a rv takes uncoutably infinitely many distinct
values, it does not necessarily imply it is of continuous
type.
◮ As mentioned earlier, there would be many random
variables that are neither discrete nor continuous.
◮
The df of a continuous rv is continuous.
◮ This implies
FX (x) = FX (x+ ) = FX (x− )
◮ Hence, if X is a continuous random variable then
◮
P [X = x] = FX (x) − FX (x− ) = 0, ∀x
PS Sastry, IISc, Bangalore, 2020 33/52
PS Sastry, IISc, Bangalore, 2020 32/52
Continuous Random Variables
Probability Density Function
A rv, X, is said to be continuous (or of continuous type)
if its distribution function, FX is absolutely continuous.
◮ The df of a continuous random variable can be written as
Z x
fX (t) dt, ∀x
FX (x) =
◮
◮
−∞
◮
This fX is the probability density function (pdf) of X.
dFx (x)
= fX (x), ∀x where fX is continuous
dx
PS Sastry, IISc, Bangalore, 2020 34/52
The pdf of a continuous rv is defined to be the fX that
satisfies
Z x
fX (t) dt, ∀x
FX (x) =
−∞
R∞
Since FX (∞) = 1, we must have −∞ fX (t) dt = 1
◮ For x1 ≤ x2 we need FX (x1 ) ≤ FX (x2 ) and hence we
need
Z x2
Z x2
Z x1
fX (t) dt ≥ 0, ∀x1 < x2
fX (t) dt ⇒
fX (t) dt ≤
◮
−∞
−∞
x1
⇒ fX (x) ≥ 0, ∀x
PS Sastry, IISc, Bangalore, 2020 35/52
Properties of pdf
◮
Continuous rv – example
The pdf, fX : ℜ → ℜ, of a continuous rv satisfies
A1. fX (x) ≥ 0, ∀x
R∞
A2. −∞ fX (t) dt = 1
Any fX that satisfies the above two would be the
probability density function of a continuous rv
◮ Given fX satifying the above two, define
Z x
FX (x) =
fX (t) dt, ∀x
◮
−∞
This FX satisfies
1. FX (−∞) = 0; FX (∞) = 1
2. FX is non decreasing.
3. FX is continuous (and hence right continuous with left
limits)
◮
This shows the the FX is a df and hence fX is a pdf
Consider a probability space with Ω = [0, 1] and with the
‘usual’ probability assignment (where probability of an
interval is its length)
◮ Earlier we considered the rv X(ω) = ω on this probability
space.
◮ We found that the df for this is
0 if x < 0
x if 0 ≤ x < 1
FX (x) =
1 if x ≥ 1
◮
This is absolutely continuous and we can get the pdf as
fX (x) = 1 if 0 < x < 1; (fX (x) = 0, otherwise)
On the same probability space, consider rv Y (ω) = 1 − ω.
◮ Let us find FY and fY .
◮
PS Sastry, IISc, Bangalore, 2020 36/52
PS Sastry, IISc, Bangalore, 2020 37/52
Let X be a continuous rv.
It can be specified by giving either FX or the pdf, fX .
◮ We can, in principle, compute probability of any event as
Z
P [X ∈ B] =
fX (t) dt, ∀B ∈ B
◮
◮
◮
Y (ω) = 1 − ω.
◮
[Y ≤ y] = {ω : Y (ω) ≤ y} = {ω ∈ [0, 1] : 1 − ω ≤ y}
= {ω ∈ [0, 1] : ω ≥ 1 − y}
if y < 0
φ
Ω
if y ≥ 1
=
[1 − y, 1] if 0 ≤ y < 1
Hence the df of Y is
B
◮
P [X
‘ ∈ [a, b]] = P [a ≤ X ≤ b] =
◮
◮
0
y
FY (y) =
1
if y < 0
if 0 ≤ y < 1
if y ≥ 1
We have FX = FY and thus fX = fY . (However, note
that X(ω) 6= Y (ω) except at ω = 0.5).
PS Sastry, IISc, Bangalore, 2020 38/52
In particular, we have
Z b
fX (t) dt = FX (b)−FX (a)
a
Since the integral over the open or closed intervals is the
same, we have, for continuous rv,
P [a ≤ X ≤ b] = P [a < X ≤ b] = P [a ≤ X < b] etc.
◮
Recall that for a general rv
FX (b) − FX (a) = P [a < X ≤ b]
PS Sastry, IISc, Bangalore, 2020 39/52
◮
◮
If X is a continuous rv, we have
Z b
fX (t) dt
P [a ≤ X ≤ b] =
a
◮
Thus
P [x ≤ X ≤ x + ∆x] =
◮
Z x+∆x
x
fX (t) dt ≈ fX (x) ∆x
That is why fX is called probability density function.
For any random variable, the df is defined and it is given
by
FX (x) = P [X ≤ x] = P [X ∈ (−∞, x] ]
The value of FX (x) at any x is probability of some event.
◮ The pmf is defined only for discrete random variables as
fX (x) = P [X = x]
◮ The value of pmf is also a probability
◮ We use the same symbol for pdf (as for pmf), defined by
Z x
fX (x) dx
FX (x) =
◮
−∞
Note that the value of pdf is not a probability.
◮ We can say fX (x) dx ≈ P [x ≤ X ≤ x + dx]
◮
PS Sastry, IISc, Bangalore, 2020 40/52
PS Sastry, IISc, Bangalore, 2020 41/52
A note on notation
A continuous random variable is a probability model on
uncountably infinite Ω.
◮ For this, we take ℜ as our sample space.
◮ We can specify a continuous rv either through the df or
through the pdf.
◮ The df, FX , of a cont rv allows you to (consistently)
assign probabilities to all Borel subsets of real line.
◮ We next consider a few standard continuous random
variables.
◮
The df, FX , and the pmf or pdf, fX , are all functions
defined on ℜ.
◮ Hence you should not write FX (X ≤ 5).
You should write FX (5) to denote P [X ≤ 5].
◮ For a discrete rv, X, one should not write fX (X = 5).
It is fX (5) which gives P [X = 5].
◮ Writing fX (X = 5) when fX is a pdf, is particularly bad.
Note that for a continuous rv, P [X = 5] = 0 and
fX (5) 6= P [X = 5].
◮
PS Sastry, IISc, Bangalore, 2020 42/52
PS Sastry, IISc, Bangalore, 2020 43/52
Uniform distribution
◮
◮
X is uniform over [a, b] when its pdf is
fX (x) =
A plot of density and distribution functions of a uniform
rv is given below
1
, a≤x≤b
b−a
(fX (x) = 0 for all other values of x).
◮ Uniform distribution over open or closed interval is
essentially the same.
◮ When X has this distribution, we say X ∼ U [a, b]
◮ By integrating the above, we can see the df as
Rx
Rx
f (x) dx = −∞ 0 dx = 0 if x < a
−∞ X
Ra
Rx 1
0
dx
+
dx = x−a
if a ≤ x < b
FX (x) =
b−a
a b−a
−∞
Rb 1
dx + 0 = 1
if x ≥ b
0 + a b−a
PS Sastry, IISc, Bangalore, 2020 45/52
PS Sastry, IISc, Bangalore, 2020 44/52
Exponential distribution
◮
1
Let X ∼ U [a, b]. Then fX (x) = b−a
, a≤x≤b
◮ Let [c, d] ⊂ [a, b].
Rd
d−c
◮ Then P [X ∈ [c, d]] =
f (t) dt = b−a
c X
◮ Probability of an interval is proportional to its length.
◮ The earlier examples we considered are uniform over
[0, 1].
fX (x) = λ e−λx , x > 0, (λ > 0 is a parameter)
◮
(By our notation, fX (x) = 0 for x ≤ 0)
R∞
◮ It is easy to verify
fX (x) dx = 1.
0
◮ It is easy to see that Fx (x) = 0 for x ≤ 0.
◮ For x > 0 we can compute FX by integrating fX :
Z x
x
e−λx
−λx
λe
dx = λ
FX (x) =
= 1 − e−λx
−λ 0
0
◮
PS Sastry, IISc, Bangalore, 2020 46/52
The pdf of exponential distribution is
This also gives us: P [X > x] = 1 − FX (x) = e−λx for
x > 0.
PS Sastry, IISc, Bangalore, 2020 47/52
◮
A plot of density and distribution functions of an
exponential rv is given below
exponential distribution is memoryless
◮
If X has exponential distribution, then, for t, s > 0,
P [X > t+s] = e−λ(t+s) = e−λt e−λs = P [X > t] P [X > s]
◮
This gives us the memoryless property
P [X > t + s | X > t] =
[P [X > t + s]
= P [X > s]
P [X > t]
Exponential distribution is a useful model for, e.g.,
life-time of components.
◮ If the distribution of a non-negative continuous random
variable is memory less then it must be exponential.
◮
PS Sastry, IISc, Bangalore, 2020 48/52
PS Sastry, IISc, Bangalore, 2020 49/52
Gaussian Distribution
◮
◮
A plot of Gaussian density functions is given below
The pdf of Gaussian distribution is given by
(x−µ)2
1
fX (x) = √ e− 2σ2 , −∞ < x < ∞
σ 2π
where σ > 0 and µ ∈ ℜ are parameters.
◮ We write X ∼ N (µ, σ 2 ) to denote that X has Gaussian
density with parameters µ and σ.
◮ This is also called the Normal distribution.
◮ The special case where µ = 0 and σ 2 = 1 is called
standard Gaussian (or standard Normal) distribution.
PS Sastry, IISc, Bangalore, 2020 50/52
PS Sastry, IISc, Bangalore, 2020 51/52
Recap: Random Variable
(x−µ)2
−
2σ 2
fX (x) = σ√12π e
, −∞ < x < ∞
◮ Showing that the density integrates to 1 is not trivial.
R∞
◮ Take µ = 0, σ = 1. Let I =
f (x) dx. Then
−∞ X
◮
I
◮
2
Given a probability space (Ω, F, P ), a random variable is
a real-valued function on Ω.
◮ It essentially results in an induced probability space
◮
Z ∞
Z ∞
1 −0.5x2
1
2
√ e
√ e−0.5y dy
=
dx
2π
2π
−∞
Z−∞
∞ Z ∞
1 −0.5(x2 +y2 )
=
e
dx dy
−∞ −∞ 2π
Now converting the above integral into polar coordinates
would allow you to show I = 1.
(Left as an exercise for you!)
X
(Ω, F, P ) → (ℜ, B, PX )
where B is the Borel σ-algebra and
PX (B) = P [X ∈ B] = P ({ω ∈ Ω : X(ω) ∈ B})
◮
For X to be a random variable
{ω ∈ Ω : X(ω) ∈ B} ∈ F, ∀B ∈ B
PS Sastry, IISc, Bangalore, 2020 1/43
PS Sastry, IISc, Bangalore, 2020 52/52
Recap: Distribution Function
◮
Recap: Discrete Random Variable
Let X be a random variable. It distribution function,
FX : ℜ → ℜ, is defined by
FX (x) = P [X ≤ x] = P ({ω ∈ Ω : X(ω) ≤ x})
The distribution function, FX , completely specifies the
probability measure, PX .
◮ The distribution function satisfies
◮
1. 0 ≤ FX (x) ≤ 1, ∀x
2. FX (−∞) = 0; FX (∞) = 1
3. FX is non-decreasing: x1 ≤ x2 ⇒ FX (x1 ) ≤ FX (x2 )
4. FX is right continuous and has left-hand limits.
◮
A random variable X is said to be discrete if it takes only
finitely many or countably infinitely many distinct values.
◮ Let X ∈ {x1 , x2 , · · · }
◮ Its distribution function, FX is a stair-case function with
jump discontinuities at each xi and the magnitude of the
jump at xi is equal to P [X = xi ]
◮
We also have
FX (x+ ) − FX (x− ) = FX (x) − FX (x− ) = P [X = x]
P [a < X ≤ b] = FX (b) − FX (a).
PS Sastry, IISc, Bangalore, 2020 2/43
PS Sastry, IISc, Bangalore, 2020 3/43
Recap: probability mass function
Recap: continuous random variable
Let X ∈ {x1 , x2 , · · · }.
◮ The probability mass function (pmf) of X is defined by
◮
◮
fX (xi ) = P [X = xi ]; fX (x) = 0, for all other x
◮
It satisfies
1. fP
X (x) ≥ 0, ∀x and fX (x) = 0 if x 6= xi for some i
2.
i fX (xi ) = 1
We have P
FX (x) = i:xi ≤x fX (xi )
fX (x) = FX (x) − FX (x− )
◮ We can calculate the probability of any event as
X
fX (xi )
P [X ∈ B] =
◮
X is said to be a continuous random variable if there
exists a function fX : ℜ → ℜ satisfying
Z x
fX (x) dx
FX (x) =
−∞
The fX is called the probability density function.
◮ Same as saying FX is absolutely continuous.
◮ Since FX is continuous here, we have
P [X = x] = FX (x) − FX (x− ) = 0, ∀x
◮
i:
xi ∈B
A continuous rv takes uncountably many distinct values.
However, not every rv that takes uncountably many
values is a continuous rv
PS Sastry, IISc, Bangalore, 2020 4/43
Recap: probability density function
◮
◮
◮
Recap: some discrete random variables
The pdf of a continuous rv is defined to be the fX that
satisfies
Z x
fX (t) dt, ∀x
FX (x) =
−∞
It satisfies
PS Sastry, IISc, Bangalore, 2020 5/43
◮
fX (1) = p; fX (0) = 1 − p
◮
1. fX (x) ≥ 0, ∀x
R∞
2. −∞ fX (t) dt = 1
Binomial: X ∈ {0, 1, · · · , n}; Parameters: n, p
fX (x) = n Cx px (1 − p)n−x , x = 0, · · · , n
We can, in principle, compute probability of any event as
Z
P [X ∈ B] =
fX (t) dt, ∀B ∈ B
◮
In particular,
◮
P [a ≤ X ≤ b] =
Z b
fX (t) dt
a
PS Sastry, IISc, Bangalore, 2020 6/43
Poisson: X ∈ {0, 1, · · · }; Parameter: λ > 0.
fX (x) = e−λ
B
◮
Bernoulli: X ∈ {0, 1}; parameter: p, 0 < p < 1
λx
, x = 0, 1, · · ·
x!
Geometric: X ∈ {1, 2, · · · }; Parameter: p, 0 < p < 1.
fX (x) = p(1 − p)x−1 , x = 1, 2, · · ·
PS Sastry, IISc, Bangalore, 2020 7/43
Recap: Some continuous random variables
◮
Uniform over [a, b]: Parameters: a, b, b > a.
fX (x) =
◮
Functions of a random variable
1
, a ≤ x ≤ b.
b−a
exponential: Parameter: λ > 0.
◮
fX (x) = λe−λx , x ≥ 0.
◮
We next look at random variables defined in terms of
other random variables.
Gaussian (Normal): Parameters: σ > 0, µ.
(x−µ)2
1
fX (x) = √ e− 2σ2 , −∞ < x < ∞
σ 2π
PS Sastry, IISc, Bangalore, 2020 8/43
Let X be a rv on some probability space (Ω, F, P ).
◮ Recall that X : Ω → ℜ.
◮ Also recall that
◮
[X ∈ B] , {ω : X(ω) ∈ B} ∈ F, ∀B ∈ B
PS Sastry, IISc, Bangalore, 2020 10/43
PS Sastry, IISc, Bangalore, 2020 9/43
Functions of a Random Variable
Let X be a rv on some probability space (Ω, F, P ).
(Recall X : Ω → ℜ)
◮ Consider a function g : ℜ → ℜ
◮ Let Y = g(X). Then Y also maps Ω into real line.
◮ If g is a ‘nice’ function, Y would also be a random variable
◮ We need: g −1 (B) , {z ∈ ℜ : g(z) ∈ B} ∈ B, ∀B ∈ B
◮
PS Sastry, IISc, Bangalore, 2020 11/43
Example
Let Y = aX + b, a > 0.
◮ Then we have
◮
Let X be a rv and let Y = g(X).
◮ The distribution function of Y is given by
◮
FY (y) =
=
=
=
FY (y) = P [Y ≤ y]
= P [aX + b ≤ y]
= P [aX ≤ y − b]
y−b
= P X≤
,
a
y−b
= FX
a
P [Y ≤ y]
P [g(X) ≤ y]
P [g(X) ∈ (−∞, y] ]
P [X ∈ {z : g(z) ≤ y}]
This probability can be obtained from distribution of X.
◮ Thus, in principle, we can find the distribution of Y if we
know that of X
◮
PS Sastry, IISc, Bangalore, 2020 12/43
In many examples we would be using uniform random
variables.
◮ Let X ∼ U [0, 1]. Its pdf is fX (x) = 1, 0 ≤ x ≤ 1.
◮ Integrating this we get the df: FX (x) = x, 0 ≤ x ≤ 1
◮
PS Sastry, IISc, Bangalore, 2020 14/43
since a > 0
This tells us how to find df of Y when it is an affine
function of X.
y−b
◮ If X is continuous rv, then, fY (y) = 1 fX
a
a
◮
PS Sastry, IISc, Bangalore, 2020 13/43
Let X ∼ U [−1, 1]. The pdf would be
fX (x) = 0.5, −1 ≤ x ≤ 1.
◮ Integrating this, we get the df: FX (x) = 1+x for
2
−1 ≤ x ≤ 1.
◮ These are plotted below
◮
PS Sastry, IISc, Bangalore, 2020 15/43
Suppose X ∼ U [0, 1] and Y = aX + b
◮ The df for Y would be
y−b
0
≤0
a
y−b
y−b
=
FY (y) = FX
0 ≤ y−b ≤ 1
a y−b a
a
1
≥1
a
◮
◮
Thus we get the df for Y as
y≤b
0
y−b
FY (y) =
b≤y ≤a+b
a
1
y ≥a+b
Hence fY (y) = a1 , y ∈ [b, a + b] and Y ∼ U [b, a + b].
◮ If X ∼ U [0, 1] then Y = aX + b, (a > 0), is uniform
over [b, a + b].
◮
◮
(x−µ)2
Recall that Gaussian density is f (x) = σ√12π e− 2σ2
We denote this as N (µ, σ 2 )
◮ Let Y = aX + b where X ∼ N (0, 1). The df of Y is
y−b
FY (y) = FX
a
Z y−b
a
x2
1
√ e− 2 dx
=
2π
−∞
1
t−b
, and dx = dt
we make a substitution: t = ax + b ⇒ x =
a
a
Z y
(t−b)2
1
√ e− 2a2 dt
FY (y) =
−∞ a 2π
◮
◮
This shows that Y ∼ N (b, a2 )
PS Sastry, IISc, Bangalore, 2020 16/43
Suppose X is a discrete rv with X ∈ {x1 , x2 , · · · }.
◮ Suppose Y = g(X).
◮ Then Y is also discrete and Y ∈ {g(x1 ), g(x2 ), · · · }.
◮ Though we use this notation, we should note:
PS Sastry, IISc, Bangalore, 2020 17/43
◮
1. these values may not be distinct (it is possible that
g(xi ) = g(xj ));
2. g(x1 ) may not be the smallest value of Y and so on.
◮
Let X ∈ {1, 2, · · · , N } with fX (k) = N1 , 1 ≤ k ≤ N
◮ Let Y = aX + b, (a > 0).
◮ Then Y ∈ {b + a, b + 2a, · · · , b + N a}.
◮ We get the pmf of Y as
◮
We can find the pmf of Y as
fY (b + ka) = fX (k) =
fY (y) = p[Y = y] = P [g(X) = y]
= P [X ∈ {xi : g(xi ) = y}]
X
fX (xi )
=
1
, 1≤k≤N
N
i:
g(xi )=y
PS Sastry, IISc, Bangalore, 2020 18/43
PS Sastry, IISc, Bangalore, 2020 19/43
Suppose X is geometric:
fX (k) = (1 − p)k−1 p, k = 1, 2, · · · .
◮ Let Y = X − 1
◮ We get the pmf of Y as
◮
Suppose X is geometric. (fX (k) = (1 − p)k−1 p)
◮ Let Y = max(X, 5) ⇒ Y ∈ {5, 6, · · · }
◮ We can calculate the pmf of Y as
◮
fY (j) = P [X − 1 = j]
= P [X = j + 1]
= (1 − p)j p, j = 0, 1, · · ·
fY (5) = P [max(X, 5) = 5] =
5
X
k=1
fX (k) = 1 − (1 − p)5
fY (k) = P [max(X, 5) = k] = P [X = k] = (1 − p)k−1 p, k = 6, 7, · · ·
PS Sastry, IISc, Bangalore, 2020 21/43
PS Sastry, IISc, Bangalore, 2020 20/43
Let X ∼ U [−1, 1]: FX (x) = 1+x
for −1 ≤ x ≤ 1.
2
◮ Let Y = X + . That is,
X if X > 0
+
Y =X =
0
otherwise
◮
◮
◮
We next consider Y = h(X) where
x if x > 0
h(x) =
0
otherwise
For y < 0, FY (y) = P [Y ≤ y] = 0 because Y ≥ 0.
◮ FY (0) = P [Y ≤ 0] = P [X ≤ 0] = 0.5.
1+y
◮ For 0 < y < 1, FY (y) = P [Y ≤ y] = P [X ≤ y] =
2
◮ For y ≥ 1, FY (y) = 1.
◮ Thus, the df of Y is
0
if y < 0
0.5 if y = 0
FY (y) =
1+y
if 0 < y < 1
2
1
if y ≥ 1
◮
This is written as Y = X + to indicate the function only
keeps the positive part.
PS Sastry, IISc, Bangalore, 2020 22/43
PS Sastry, IISc, Bangalore, 2020 23/43
◮
FY (y) =
◮
Let Y = X 2 .
◮ For y < 0, FY (y) = P [Y ≤ y] = 0 (since Y ≥ 0)
◮ For y ≥ 0, we can get FY (y) as
◮
The df of Y is
This is plotted below
0
1+y
2
1
if y < 0
if 0 ≤ y < 1
if y ≥ 1
FY (y) = P [Y ≤ y] = P [X 2 ≤ y]
√
√
= P [− y ≤ X ≤ y]
√
√
√
= FX ( y) − FX (− y) + P [X = − y]
◮
If X is a continuous random variable, then we get
d
√
√
(FX ( y) − FX (− y))
dy
1
√
√
= √ [fX ( y) + fX (− y)]
2 y
fY (y) =
◮
This is neither a continuous rv nor a discrete rv.
◮
This is the general formula for density of X 2 when X is
continuous rv.
PS Sastry, IISc, Bangalore, 2020 24/43
◮
◮
Let Y = X 2 . Then we know fY (y) = 0 for y < 0.
For y ≥ 0,
=
=
=
◮
Gamma density
x2
Let X ∼ N (0, 1): fX (x) = √12π e− 2
fY (y) =
PS Sastry, IISc, Bangalore, 2020 25/43
1
√
√
√ [fX ( y) + fX (− y)]
2 y
1
1
1
− y2
− y2
√ √ e +√ e
2 y
2π
2π
y
2
1
√ √ e− 2
2 y 2π
0.5
1
1
1
√
y −0.5 e− 2 y
π 2
This is an example of gamma density.
PS Sastry, IISc, Bangalore, 2020 26/43
◮
The Gamma function is given by
Z ∞
xα−1 e−x dx
Γ(α) =
0
It can be easily verified that Γ(α + 1) = αΓ(α).
◮ The Gamma density is given by
f (x) =
1
1
λα xα−1 e−λx =
(λx)α−1 λe−λx , x > 0
Γ(α)
Γ(α)
Here α, λ > 0 are parameters.
◮ The earlier density we saw corresponds to α = λ = 0.5:
0.5
1
1
1
fY (y) = √
y −0.5 e− 2 y , y > 0
π 2
◮
PS Sastry, IISc, Bangalore, 2020 27/43
Let X ∼ U (0, 1).
◮ Let Y = −1 ln(1 − X), where λ > 0.
λ
◮ Note that Y ≥ 0. We can find its df:
−1
FY (y) = P [Y ≤ y] = P
ln(1 − X) ≤ y
λ
= P [− ln(1 − X) ≤ λy]
= P [ln(1 − X) ≥ −λy]
= P [1 − X ≥ e−λy ]
= P [X ≤ 1 − e−λy ]
= 1 − e−λy , y ≥ 0 (since X ∼ U (0, 1))
◮
◮
The gamma density with parameters α, λ > 0 is given by
f (x) =
1
λα xα−1 e−λx , x > 0
Γ(α)
If X ∼ N (0, 1) then X 2 has gamma density with
parameters α = λ = 0.5.
◮ When α is a positive integer then the gamma density is
known as the Erlang density.
◮ If α = 1, gamma density becomes exponential density.
◮
Thus Y has exponential density
◮ If X ∼ U (0, 1), −1 ln(1 − X) has exponential density
λ
◮
PS Sastry, IISc, Bangalore, 2020 28/43
If X ∼ U (0, 1), −1
ln(1 − X) has exponential density
λ
◮ This is actually a special case of a general result.
◮ The exponential distribution fn is F (x) = 1 − e−λx .
◮ This is continuous, strictly monotone and hence is
invertible. The inverse function maps [0, 1] to ℜ+ .
We derive its inverse:
PS Sastry, IISc, Bangalore, 2020 29/43
◮
z = 1 − e−λx ⇒ e−λx = 1 − z ⇒ x =
◮
We can visualize this as shown below
−1
ln(1 − z)
λ
Thus, the inverse of F is F −1 (z) = −1
ln(1 − z)
λ
−1
◮ So, we had Y = F
(X) and the df of Y was F
◮
PS Sastry, IISc, Bangalore, 2020 30/43
PS Sastry, IISc, Bangalore, 2020 31/43
Let G be a continuous invertible distribution function.
◮ Let X ∼ U [0, 1] and let Y = G−1 (X).
◮ We can get the df of Y as
◮
FY (y) = P [Y ≤ y] = P [G−1 (X) ≤ y] = P [X ≤ G(y)] = G(y)
Thus, starting with uniform rv, we can generate a rv with
a desired distribution.
◮ Very useful in random number generation. Known as the
inverse function method.
◮ Can be generalized to handle discrete rv also. It only
involves defining an ‘inverse’ when F is a stair-case
function. (Left as an exercise!)
◮
Let X be a cont rv with an invertible distribution
function, say, F .
◮ Define Y = F (X).
◮ Since range of F is [0, 1], we know 0 ≤ Y ≤ 1.
◮ For 0 ≤ y ≤ 1 we can obtain FY (y) as
◮
FY (y) = P [Y ≤ y] = P [F (X) ≤ y] = P [X ≤ F −1 (y)] = F (F −1 (y)) = y
This means Y has uniform density.
◮ Has interesting applications.
E.g., histogram equalization in image processing
◮
PS Sastry, IISc, Bangalore, 2020 33/43
PS Sastry, IISc, Bangalore, 2020 32/43
Let us sum-up the last two examples
◮ If X ∼ U [0, 1] and Y = F −1 (X), then Y has df F .
◮ If df of X is F and Y = F (X) then Y is uniform over
[0, 1].
◮
PS Sastry, IISc, Bangalore, 2020 34/43
If Y = g(X), we can compute distribution of Y , knowing
the function g and the distribution of X.
◮ We have seen a number of examples.
◮ Finally, we look at a theorem that gives a formula for pdf
of Y in certain special cases
◮
PS Sastry, IISc, Bangalore, 2020 35/43
Let g : ℜ → ℜ be differentiable with g ′ (x) > 0, ∀x.
◮ Let X be a continuous rv with pdf fX .
◮ Let Y = g(X)
◮ Theorem: With the above, Y is a continuous rv with pdf
d −1
fY (y) = fX (g −1 (y))
g (y), g(−∞) ≤ y ≤ g(∞)
dy
◮ Proof: Since g ′ (x) > 0, g is strictly monotonically
increasing and hence is invertible and g −1 would also be
monotone and differentiable.
◮ So, range of Y is [g(−∞), g(∞)].
◮ Now we have
◮
FY (y) = P [Y ≤ y] = P [g(X) ≤ y] = P [X ≤ g −1 (y)] = FX (g −1 (y))
Since g −1 is differentiable, so is FY and we get the pdf as
d −1
d
(FX (g −1 (y))) = fX (g −1 (y))
g (y)
fY (y) =
dy
dy
◮ This completes the proof.
PS Sastry, IISc, Bangalore, 2020 36/43
◮
Let g : ℜ → ℜ be differentiable with g ′ (x) > 0, ∀x or
g ′ (x) < 0, ∀x.
◮ Let X be a continuous rv and let Y = g(X).
◮ Then Y is a continuous rv with pdf
◮
fY (y) = fX (g −1 (y))
d −1
g (y) , a ≤ y ≤ b
dy
Now, suppose g ′ (x) < 0, ∀x. Even then the theorem
essentially holds.
◮ Now, g is strictly monotonically decreasing. So, we get
◮
FY (y) = P [g(X) ≤ y] = P [X ≥ g −1 (y)] = 1−FX (g −1 (y))
◮
Once again, by differentiating
fY (y) = −fX (g −1 (y))
d −1
d −1
g (y) = fX (g −1 (y))
g (y)
dy
dy
because g −1 is also monotone decreasing.
◮ The range of Y here is [g(∞), g(−∞)]
◮ We can combine both cases into one result.
PS Sastry, IISc, Bangalore, 2020 37/43
For an example, take g(x) = ax + b.
y−b
◮ This satisfies the conditions and g −1 (y) =
a
◮ Hence we get
d −1
y−b 1
−1
fY (y) = fX (g (y))
g (y) = fX
dy
a
a
◮
This is an example we saw earlier.
◮ We need to find the range of Y based on range of X.
◮
where a = min(g(∞), g(−∞)) and
b = max(g(∞), g(−∞))
PS Sastry, IISc, Bangalore, 2020 38/43
PS Sastry, IISc, Bangalore, 2020 39/43
◮
The function g(x) = x2 does not satisfy the conditions of
the theorem.
◮ The utility of the theorem is somewhat limited.
◮ However, we can extend the theorem.
◮ Essentially, what we need is that for a any y, the equation
g(x) = y would have finite solutions and the derivative of
g is not zero at any of these points.
◮ There are multiple ‘g −1 (y)’ and we can get density of Y
by summing all the terms.
If Y = g(x) and g is monotone,
◮
fY (y) = fX (g −1 (y))
Let xo (y) be the solution of g(x) = y; then
g −1 (y) = xo (y).
◮ Also, the derivative of g −1 is reciprocal of the derivative
of g.
◮ Hence, we can also write the above as
◮
fY (y) = fX (xo (y)) |g ′ (xo (y))|
◮
PS Sastry, IISc, Bangalore, 2020 40/43
We can now extend the theorem as follows.
◮ Suppose, for a given y, g(x) = y has multiple solutions.
◮ Call them x1 (y), · · · , xm (y). Assume the derivative of g
is not zero at any of these points.
◮ Then we have
◮
fY (y) =
m
X
k=1
fX (xk (y)) |g ′ (xk (y))|
PS Sastry, IISc, Bangalore, 2020 42/43
However, the notation in the above may be confusing.
Consider the old example g(x) = x2 .
√
√
◮ For y > 0, x2 = y has two solutions:
y and − y.
◮ At both these points, the absolute value of derivative of g
√
is 2 y which is non-zero.
◮ Hence we get
◮
√
√
√
fY (y) = (2 y)−1 (fX ( y) + fX (− y))
−1
If g(x) = y has no solution (or no solution satisfying
g ′ (x) 6= 0), then at that y, fY (y) = 0.
−1
PS Sastry, IISc, Bangalore, 2020 41/43
◮
◮
d −1
g (y)
dy
This is same as what we derived from first principles
earlier.
PS Sastry, IISc, Bangalore, 2020 43/43
Recap: Function of a random variable
Recap
Let X be a rv and let Y = g(X).
◮ The distribution function of Y is given by
◮
If X is a random variable and g : ℜ → ℜ is a function,
then Y = g(X) is a random variable.
◮ More formally, Y is a random variable if g is a Borel
measurable function.
◮ We can determine distribution of Y given the function g
and the distribution of X
◮
FY (y) = P [g(X) ≤ y]
= P [X ∈ {z : g(z) ≤ y}]
This probability can be obtained from distribution of X.
◮ We have seen many specific examples of this.
◮
PS Sastry, IISc, Bangalore, 2020 1/45
Recap
PS Sastry, IISc, Bangalore, 2020 2/45
Recap
Suppose X is a discrete rv with X ∈ {x1 , x2 , · · · }.
◮ Suppose Y = g(X).
◮ Then Y is also discrete and Y ∈ {g(x1 ), g(x2 ), · · · }.
◮ We can find the pmf of Y as
◮
fY (y) = p[Y = y] = P [g(X) = y]
= P [X ∈ {xi : g(xi ) = y}]
X
=
fX (xi )
i:
g(xi )=y
PS Sastry, IISc, Bangalore, 2020 3/45
Let g : ℜ → ℜ be differentiable with g ′ (x) > 0, ∀x or
g ′ (x) < 0, ∀x.
◮ Let X be a continuous rv and let Y = g(X).
◮ Then Y is a continuous rv with pdf
◮
fY (y) = fX (g −1 (y))
d −1
g (y) , a ≤ y ≤ b
dy
where a = min(g(∞), g(−∞)) and
b = max(g(∞), g(−∞))
◮ This theorem is useful in some cases to find the densities
of functions of continuous random variables
PS Sastry, IISc, Bangalore, 2020 4/45
Expectation and Moments of a random variable
Expectation of a discrete rv
Let X be a discrete rv with X ∈ {x1 , x2 , · · · }
◮ We define its expectation by
X
E[X] =
xi fX (xi )
◮
◮
We next consider the important notion of expectation of
a random variable
i
Expectation is essentially a weighted average.
◮ To make the above finite and well defined, we can
stipulate the following as condition for existence of
expectation
X
|xi | fX (xi ) < ∞
◮
i
PS Sastry, IISc, Bangalore, 2020 6/45
PS Sastry, IISc, Bangalore, 2020 5/45
Expectation of a Continuous rv
◮
If X is a continuous random variable with pdf, fX , we
define its expectation as
Z ∞
E[X] =
x fX (x) dx
Let us look at a couple of simple examples.
◮ Let X ∈ {1, 2, 3, 4, 5, 6} and fX (k) = 1 , 1 ≤ k ≤ 6.
6
◮
21
1
= 3.5
EX = (1 + 2 + 3 + 4 + 5 + 6) =
6
6
−∞
◮
Once again we can use the following as condition for
existence of expectation
Z ∞
|x| fX (x) dx < ∞
◮
−∞
◮
Sometimes we use the following notation to denote
expectation of both kinds of rv
Z ∞
E[X] =
x dFX (x)
−∞
◮
Let X ∼ U [0, 1]
Z ∞
Z 1
EX =
x fX (x) dx =
x dx = 0.5
−∞
◮
0
When an rv takes only finitely many values or when the
pdf is non-zero only on a bounded set, the expectation is
always finite.
Though we consider only discrete or continuous rv’s,
expectation is defined for all random variables.
PS Sastry, IISc, Bangalore, 2020 7/45
PS Sastry, IISc, Bangalore, 2020 8/45
The way we have defined existence of expectation, implies
that expectation is always finite (when it exists).
◮ This may be needlessly restrictive in some situations.
We redefine it as follows.
◮ Let X be a non-negative (discrete or continuous) random
variable.
◮ We define its expectation by
Z ∞
X
x fX (x) dx
EX =
xi fX (xi ) or EX =
◮
i
−∞
depending on whether it is discrete or continuous
(In this course we will consider only discrete or continuous
rv’s)
◮ Note that the expectation may be infinite.
◮ But it always exists for non-negative random variables.
PS Sastry, IISc, Bangalore, 2020 9/45
This is the formal way of defining expectation of a
random variable.
P
+
◮ We first note that if
i |xi | fX (xi ) < ∞ then both EX
and EX − would be finite
P and we can simply take the
expectation as EX = i xi fX (xi ).
◮ Also note that if X takes only finitely many values, the
above always holds.
◮ Similar comments apply for a continuous random variable.
◮ This is what we do in this course because we deal with
only discrete and continuous rv’s.
◮ But to get a feel for the more formal definition, we look
at a couple of examples.
◮
PS Sastry, IISc, Bangalore, 2020 11/45
◮
◮
Now let X be a rv that may not be non-negative.
We define positive and negative parts of X by
X if X > 0
+
X =
0
otherwise
−
X =
−X
0
if X < 0
otherwise
Note that both X + and X − are non-negative. Hence
their expectations exist. (Also,
X(ω) = X + (ω) − X − (ω), ∀ω).
◮ Now we define expectation of X by
◮
EX = EX + − EX − ,
if at least one of them is finite
Otherwise EX does not exist.
◮ Now, expectation does not exist only when
EX + = EX − = ∞
PS Sastry, IISc, Bangalore, 2020 10/45
Let X ∈ {1, 2, · · · }.
◮ Suppose fX (k) = C2 .
k
P
P 1
◮ Since
<
∞,
we can find C so that k fX (k) = 1.
k k2
P
2
( k k12 = π6 and hence C = π62 ).
◮ Hence we get
◮
X
k
|xk | fX (xk ) =
X
k
xk fX (xk ) =
X
k
k
XC
C
=
=∞
k2
k
k
Here the expectation is infinity.
◮ But by the formal definition it exists.
(Note that here X + = X and X − = 0).
◮
PS Sastry, IISc, Bangalore, 2020 12/45
Now suppose X takes values 1, −2, 3, −4, · · · with
probabilities 1C2 , 2C2 , 3C2 and so on.
P
◮ Once again
k |xk |fX (xk ) = ∞.
P
◮ But
k xk fX (xk ) is an alternating series.
◮ Here X + would take values 2k − 1 with probability
C
, k = 1, 2, · · ·
(2k−1)2
(and the value 0 with remaining probability).
◮ Similarly, X − would take values 2k with probability C 2 ,
(2k)
k = 1, 2, · · · (and the value 0 with remaining probability).
◮
EX + =
X
k
◮
C
= ∞,
2k − 1
and
EX − =
XC
k
2k
◮
fX (x) =
This is called (standard) Cauchy density. We can verify it
integrates to 1
Z ∞
1
1 π −π
1
1
∞
−1
=1
dx =
tan (x) −∞ =
−
2
π
π 2
2
−∞ π 1 + x
◮
What would be EX?
Z a
Z ∞
x
1
1
?
x
dx
=
0
because
= 0?
EX =
2
π 1 + x2
−a 1 + x
−∞
=∞
Hence EX does not exist.
PS Sastry, IISc, Bangalore, 2020 14/45
The question was
EX =
Z ∞
−∞
◮
1
1
, −∞ < x < ∞
π 1 + x2
◮
PS Sastry, IISc, Bangalore, 2020 13/45
◮
Consider a continuous random variable X with pdf
x
1
1
?
dx = 0
2
π 1+x
This depends on the definition of infinite integrals
Z ∞
Z d
g(x) dx ,
lim
g(x) dx
c→∞,d→∞
−∞
=
lim
c→∞
Z 0
−c
g(x) dx + lim
d→∞
−c
This is not same as
lim
a→∞
Z a
Here we have
Z d
Z 0
x
x
dx = −∞; lim
dx = ∞
lim
2
c→∞ −c 1 + x
d→∞ 0 1 + x2
R∞
1
◮ Hence EX =
x π1 1+x
2 dx does not exist.
−∞
◮ Essentially, both halves of the integral are infinite and
hence we get ∞ − ∞ type expression which is undefined.
Ra
1
◮ However, lima→∞
x π1 1+x
2 dx = 0.
−a
◮
Z d
g(x) dx
0
g(x) dx,
−a
which is known as Cauchy principal value
PS Sastry, IISc, Bangalore, 2020 15/45
PS Sastry, IISc, Bangalore, 2020 16/45
Expectation of a random variable
◮
Binary random variable
Let X be a discrete rv with X ∈ {x1 , x2 , · · · }. Then
X
E[X] =
xi fX (xi )
i
◮
◮
If X is a continuous random variable with pdf, fX ,
Z ∞
x fX (x) dx
E[X] =
◮
EX = 0 × fX (0) + 1 × fX (1) = P [X = 1]
−∞
Sometimes we use the following notation to denote
expectation of both kinds of rv
Z ∞
E[X] =
x dFX (x)
Expectation of a binary rv (e.g., Bernoulli):
Expectation of a binary random variable is same as the
probability of the rv taking value 1.
◮ Thus, for example, EIA = P (A).
◮
−∞
We take the expectation to exist when the sum or
integral above is absolutely convergent
◮ Note that expectation is defined for all random variables
◮ Let us calculate expectations of some of the standard
distributions.
PS Sastry, IISc, Bangalore, 2020 17/45
◮
Expectation of Binomial rv
◮
Expectation of Poisson rv
Let fX (k) = n Ck pk (1 − p)n−k , k = 0, 1, · · · , n.
n
X
n!
n!
k
n−k
k
p (1 − p)
=
pk (1 − p)n−k
k
EX =
k!(n
−
k)!
k!(n
−
k)!
k=1
k=0
n
X
=
=
PS Sastry, IISc, Bangalore, 2020 18/45
n
X
n
X
n!
pk (1 − p)n−k
(k
−
1)!(n
−
k)!
k=1
n
X
(n − 1)!
pk−1 (1 − p)(n−1)−(k−1)
(k − 1)!((n − 1) − (k − 1))!
k=1
= np
n−1
X
k′ =0
(n − 1)!
k ′ !((n − 1) − k ′ )!
′
k
fX (k) = λk! e−λ , k = 0, 1, · · ·
EX =
n(n − 1)!
p pk−1 (1 − p)(n−1)−(k−1)
(k
−
1)!((n
−
1)
−
(k
−
1))!
k=1
= np
◮
∞
X
k=0
k
λk −λ
e
k!
= λ
(Left as an exercise for you!)
′
pk (1 − p)(n−1)−k = np
PS Sastry, IISc, Bangalore, 2020 19/45
PS Sastry, IISc, Bangalore, 2020 20/45
Expectation of Geometric rv
◮
fX (k) = (1 − p)k−1 p, k = 1, 2, · · ·
EX =
∞
X
k=1
◮
We have
∞
X
k=1
◮
◮
1
, a≤x≤b
Let X ∼ U [a, b]. fX (x) = b−a
k (1 − p)k−1 p
(1 − p)k =
EX =
=
1−p
1
= −1
p
p
k=1
k (1 − p)k−1 =
Z ∞
x fX (x) dx
−∞
Z b
x
a
1
dx
b−a
b
x2
1
=
b−a 2 a
1 b2 − a2
=
b−a
2
b+a
=
2
Term-wise differentiation of the above gives
∞
X
◮
Expectation of uniform density
1
p2
This gives us EX = p1
PS Sastry, IISc, Bangalore, 2020 21/45
Expectation of exponential density
◮
Expectation of Gaussian density
fX (x) = λ e−λx , x > 0.
Z ∞
EX =
x λ e−λx dx
0
Z ∞
∞
e−λx
e−λx
= xλ
λ
dx
−
−λ 0
−λ
0
Z ∞
e−λx dx
=
0
PS Sastry, IISc, Bangalore, 2020 22/45
∞
e−λx
=
−λ 0
1
=
λ
PS Sastry, IISc, Bangalore, 2020 23/45
◮
(x−µ)2
fX (x) = σ√12π e− 2σ2 , −∞ < x < ∞
EX =
Z ∞
(x−µ)2
1
−
√
x
e 2σ2 dx
σ 2π
−∞
x−µ
make a change of variable y =
σ
Z ∞
y2
1
√ (σy + µ)e− 2 dy
=
2π
−∞
Z ∞
Z ∞
2
y2
1
1
− y2
√ e− 2 dy
= σ√
ye
dy + µ
2π −∞
2π
−∞
= µ
PS Sastry, IISc, Bangalore, 2020 24/45
Expectation of a function of a random variable
Let X be a rv and let Y = g(X).
R
R
◮ Theorem: EY =
y dFY (y) = g(x) dFX (x)
◮ That is, if X is discrete, then
X
X
g(xi )fX (xi )
yj fY (yj ) =
EY =
◮
◮
i
j
◮
◮
If X and Y are continuous
Z
Z
EY = y fY (y) dy = g(x) fX (x) dx
Theorem: Let X ∈ {x1 , x2 , · · · xn } and let Y = g(X).
Then
X
EY =
g(xi ) fX (xi )
i
Proof: Let Y ∈ {y1 , y2 , · · · , ym }.
Each yj would be equal to g(xi ) for one or more i.
◮ Let Bj = {xi : g(xi ) = yj }. Thus,
X
fY (yj ) = P [Y = yj ] = P [X ∈ Bj ] =
fX (xi )
◮
i:
xi ∈Bj
◮
This theorem is true for all rv’s. But we will prove it in
only some special cases.
Note that
◮
◮
Bj are disjoint
each xi would be in one (and only one) of the Bj
PS Sastry, IISc, Bangalore, 2020 26/45
PS Sastry, IISc, Bangalore, 2020 25/45
◮
Now we have
EY
=
=
m
X
j=1
m
X
j=1
=
=
yj fY (yj )
X
yj
n
X
fX (xi )
i:
−∞
xi ∈Bj
m X
X
j=1
Suppose X is a continuous rv and suppose g is a
differentiable function with g ′ (x) > 0, ∀x. Let Y = g(X)
R
◮ Once again we can show EY =
g(x) fX (x) dx
Z ∞
y fY (y) dy
EY =
◮
=
g(xi )fX (xi )
g(−∞)
i:
g(xi )fX (xi )
i=1
PS Sastry, IISc, Bangalore, 2020 27/45
y fX (g −1 (y))
d −1
g (y) dy,
dy
d −1
change the variable to x = g −1 (y) ⇒ dx =
g (y) dy
dy
Z ∞
g(x) fX (x) dx
=
xi ∈Bj
That completes the proof.
◮ The proof goes through even when X (and Y ) take
countably infinitely many values (because we assume the
expectation sum is absolutely convergent).
Z g(∞)
−∞
◮
We can similarly show this for the case where
g ′ (x) < 0, ∀x
PS Sastry, IISc, Bangalore, 2020 28/45
Some Properties of Expectation
We proved the theorem only for discrete rv’s and for some
restricted case of continuous rv’s.
◮ However, this theorem is true for all random variables.
◮ Now, for any function, g, we can write
Z ∞
X
E[g(X)] =
g(xi )fX (xi ) or E[g(X)] =
g(x) fX (x) dx
◮
−∞
i
E[g(X)] =
i
g(xi )fX (xi ) or E[g(X)] =
Z ∞
g(x) fX (x) dx
−∞
If X ≥ 0 then EX ≥ 0
◮ E[b] = b where b is a constant
◮ E[ag(X)] = aE[g(X)] where a is a constant
◮ E[aX + b] = aE[X] + b where a, b are constants.
◮ E[ag1 (X) + bg2 (X)] = aE[g1 (X)] + bE[g2 (X)]
◮
PS Sastry, IISc, Bangalore, 2020 30/45
PS Sastry, IISc, Bangalore, 2020 29/45
Consider the problem: minc E[(X − c)2 ]
◮ We are asking what is the best constant to approximate a
rv with
◮ We are trying to minimize (weighted) average, over all
values X can take, of the square of the error
◮ We are interested in the best mean-square approximation
of X by a constant.
X
◮
◮
We can derive this in an alternate manner too
E[(X − c)2 ] = E[(X − EX + EX − c)2 ]
= E[(X − EX)2 + (EX − c)2 + 2(EX − c)(X − EX)]
= E[(X − EX)2 ] + (EX − c)2 + 2(EX − c)E[(X − EX)]
= E[(X − EX)2 ] + (EX − c)2 + 2(EX − c)(EX − EX)
= E[(X − EX)2 ] + (EX − c)2
≥ E[(X − EX)2 ]
E[(X − c)2 ] = E[X 2 + c2 − 2cX] = E[X 2 ] + c2 − 2cE[X]
Thus E[(X − c)2 ] ≥ E[(X − EX)2 ], ∀c
◮ So, E[(X − c)2 ] is minimized when c = EX and the
minimum value is E[(X − EX)2 ]
◮
◮
We differentiate this and equate to zero to get the best c
2c∗ = 2E[X] ⇒ c∗ = E[X]
PS Sastry, IISc, Bangalore, 2020 31/45
PS Sastry, IISc, Bangalore, 2020 32/45
Variance of a Random variable
Some properties of variance
We define variance of X as E[(X − EX)2 ] and denote it
as Var(X).
◮ By definition, Var(X) ≥ 0.
◮
Var(X) =
=
=
=
◮
E[(X − EX)2 ]
E X 2 + (EX)2 − 2X(EX)
E[X 2 ] + (EX)2 − 2(EX)E[X]
E[X 2 ] − (EX)2
Var(X + c) = Var(X) where c is a constant
Var(X+c) = E {(X + c) − E[X + c]}2 = E (X − EX)2 = Var(X)
◮
Var(cX) = c2 Var(X) where c is a constant
Var(cX) = E (cX − E[cX])2 = E (cX − cE[X])2 = c2 Var(X)
◮
This also implies: E[X 2 ] ≥ (EX)2
PS Sastry, IISc, Bangalore, 2020 34/45
PS Sastry, IISc, Bangalore, 2020 33/45
Variance of uniform rv
Variance of uniform rv
2
E[X ] =
2
2
. Earlier we showed EX = b+a
We got E[X 2 ] = b +ab+a
3
2
◮ Now we can calculate Var(X) as
◮
◮ fX (x) = 1 , a ≤ x ≤ b
b−a
Z b
a
x2
1
dx
b−a
b
x3
1
=
b−a 3 a
1 b 3 − a3
=
b−a
3
b2 + ab + a2
=
3
PS Sastry, IISc, Bangalore, 2020 35/45
Var(X) = EX 2 − (EX)2
b2 + ab + a2
(b + a)2
=
−
3
4
4(b2 + ab + a2 ) − 3(b2 + 2ab + a2 )
=
12
(b2 − 2ab + a2 )
=
12
(b − a)2
=
12
PS Sastry, IISc, Bangalore, 2020 36/45
Variance of exponential rv
◮
◮
Variance of Gaussian rv
fX (x) = λ e−λx , x > 0
Z ∞
2
E[X ] =
x2 λ e−λx dx
0
Z ∞
∞
e−λx
e−λx
2
2x dx
−
λ
= x λ
−λ 0
−λ
0
Z ∞
2
x λ e−λx dx
=
λ 0
2
=
λ2
◮
x2
◮
Hence the variance is now given by
2
1
2
1
Var(X) = 2 −
= 2
λ
λ
λ
PS Sastry, IISc, Bangalore, 2020 37/45
◮ Let fX (x) = √1 e
2π
, −∞ < x < ∞.
fX (x) = √12π e− 2 , −∞ < x < ∞.
We know EX = 0. Hence Var(X) = EX 2 .
Z ∞
x2
1
2
Var(X) = EX =
x2 √ e− 2 dx
2π
Z ∞ −∞
1 − x2
dx
=
x x√ e 2
2π
−∞
Z ∞
∞
x2
−1 − x2
1
2
√ e− 2 dx
= x √ e
+
2π
2π
−∞
−∞
= 1
PS Sastry, IISc, Bangalore, 2020 38/45
◮
2
− x2
Let X ∼ N (0, 1). That is,
Here is a plot of Gaussian densities with different
variances
Let g(x) = σx + µ and hence g −1 (y) = y−µ
.
σ
◮ Take σ > 0 and Y = g(X). By the theorem,
(y−µ)2
1 1
d −1
g (y) fX (g −1 (y)) = √ e− 2σ2
fY (y) =
dy
σ 2π
◮
◮
Since Y = σX + µ, we get
◮
◮
◮
EY = σEX + µ = µ
Var(Y ) = σ 2 Var(X) = σ 2
When Y ∼ N (µ, σ 2 ), EY = µ and Var(Y ) = σ 2 .
PS Sastry, IISc, Bangalore, 2020 39/45
PS Sastry, IISc, Bangalore, 2020 40/45
Variance of Binomial rv
n!
fX (k) = k!(n−k)!
pk (1 − p)n−k , k = 0, 1, · · · , n
◮ Here we use the identity, EX 2 = E[X(X − 1)] + EX
◮
E[X(X − 1)] =
=
n
X
k=0
n
X
k=2
k(k − 1)
n!
pk (1 − p)n−k
k!(n − k)!
k(k − 1)
n!
pk (1 − p)n−k
k!(n − k)!
n
X
n(n − 1)(n − 2)!
p2 pk−2 (1 − p)(n−2)−(k−2)
=
(k − 2)!((n − 2) − (k − 2))!
k=2
= n(n − 1)p
2
When X is binomial rv, we showed,
E[X(X − 1)] = n(n − 1)p2
◮ Hence,
◮
EX 2 = E[X(X−1)]+EX = n(n−1)p2 +np = n2 p2 +np(1−p)
◮
Now we can calculate the variance
Var(X) = EX 2 −(EX)2 = n2 p2 +np(1−p)−(np)2 = np(1−p)
n−2
X
(n − 2)!
k′
(n−2)−k′
p
(1
−
p)
k ′ !((n − 2) − k ′ )!
k′ =0
= n(n − 1)p2
PS Sastry, IISc, Bangalore, 2020 41/45
Variance of a geometric random variable
PS Sastry, IISc, Bangalore, 2020 42/45
moments of a random variable
X ∈ {1, 2, · · · } and fX (k) = (1 − p)k−1 p, k = 1, 2, · · ·
◮ Here also, it is easier to calculate E[X(X − 1)]
◮
E[X(X−1)] =
∞
X
k(k−1)(1−p)
p = p(1−p)
∞
X
k(k−1)(1−p)k−2
k=1
k=1
◮
k−1
We define the k th order moment of a rv, X, by
Z
k
mk = E[X ] = xk dFX (x)
m1 = EX and m2 = EX 2 and so on
◮ We define the k th central moment of X by
Z
k
sk = E[(X − EX) ] = (x − EX)k dFX (x)
◮
We know
∞
X
◮
∞
X
1−p
d2 1 − p
k−2
(1−p) =
k(k−1)(1−p)
= 2
⇒
p
dp
p
k=1
k=1
k
2
Now you can compute E[X(X − 1)] and hence E[X ]
and hence Var(X) and show it to be equal to 1−p
.
p2
(Left as an exercise)
PS Sastry, IISc, Bangalore, 2020 43/45
s1 = 0 and s2 = Var(X).
◮ Not all moments may exist for a given random variable.
(For example, m1 does not exist for Cauchy rv)
◮
PS Sastry, IISc, Bangalore, 2020 44/45
Theorem: If E |X|k < ∞ then E [|X|s ] < ∞ for
0 < s < k.
◮ For example, if third order moment exists then so do first
and second order moments
◮ Proof: We prove it when X is continuous rv. Proof for
discrete case is similar.
Z ∞
s
E [|X| ] =
|x|s fX (x) dx
Z−∞
Z
s
=
|x| fX (x) dx +
|x|s fX (x) dx
|x|≥1
Z|x|<1
Z
≤
fX (x) dx +
|x|s fX (x)
|x|<1
|x|≥1
Z
≤ P [|X|s < 1] +
|x|k fX (x)
◮
|x|≥1
since for |x| ≥ 1, |x|s < |x|k when s < k
R∞
< ∞ because E |X|k = ∞ |x|k fX (x) dx < ∞
Recap: Expectation
◮
Let X be a discrete rv with X ∈ {x1 , x2 , · · · }. Then
X
E[X] =
xi fX (xi )
i
◮
If X is a continuous random variable with pdf, fX ,
Z ∞
x fX (x) dx
E[X] =
−∞
◮
Sometimes we use the following notation to denote
expectation of both kinds of rv
Z ∞
x dFX (x)
E[X] =
−∞
We take the expectation to exist when the sum or
integral above is absolutely convergent
◮ Note that expectation is defined for all random variables
◮
PS Sastry, IISc, Bangalore, 2020 1/45
PS Sastry, IISc, Bangalore, 2020 45/45
Recap: Expectation of a function of a random
variable
Let X be a rv and let Y = g(X). Then,
R
R
◮ EY =
y dFY (y) = g(x) dFX (x)
◮ That is, if X is discrete, then
X
X
EY =
yj fY (yj ) =
g(xi )fX (xi )
Recap: Properties of Expectation
◮
j
i
◮
If X and Y are continuous
Z
Z
EY = y fY (y) dy = g(x) fX (x) dx
◮
This is true for all rv’s.
PS Sastry, IISc, Bangalore, 2020 2/45
E[g(X)] =
X
i
g(xi )fX (xi ) or E[g(X)] =
Z ∞
g(x) fX (x) dx
−∞
If X ≥ 0 then EX ≥ 0
◮ E[b] = b where b is a constant
◮ E[ag(X)] = aE[g(X)] where a is a constant
◮ E[aX + b] = aE[X] + b where a, b are constants.
◮ E[ag1 (X) + bg2 (X)] = aE[g1 (X)] + bE[g2 (X)]
◮ E [(X − c)2 ] ≥ E [(X − EX)2 ] , ∀c
◮
PS Sastry, IISc, Bangalore, 2020 3/45
Recap: Variance of random variable
Recap: Moments of a random variable
◮
The k th (order) moment of X is
Z
k
mk = E[X ] = xk dFX (x)
◮
The k th central moment of X is
Z
k
sk = E[(X − EX) ] = (x − EX)k dFX (x)
◮
If moment of order k is finite then so is moment of order
s for s < k.
Var(X) = E (X − EX)2 = E[X 2 ] − (EX)2
◮
Properties of Variance:
Var(X) ≥ 0
Var(X + c) = Var(X)
◮ Var(cX) = c2 Var(X)
◮
◮
PS Sastry, IISc, Bangalore, 2020 4/45
PS Sastry, IISc, Bangalore, 2020 5/45
Moment generating function
The mgf of X is: MX (t) = E[etX ].
◮ If MX (t) exists (for t ∈ [−a, a] for some a > 0) then all
its derivatives also exist.
◮ Then we can get the moments of X by successive
differentiation of MX (t).
◮
◮
The moment generating function (mgf) of rv X,
MX : ℜ → ℜ, is defined by
Z
X
tX
txi
MX (t) = Ee =
e fX (xi ) or
etx fX (x) dx, t ∈ ℜ
dMX (t)
d = E[XetX ] t=0 = EX
= E etX
dt
dt
t=0
t=0
i
We say the mgf exists if E[etX ] < ∞ for t in some
interval around zero
◮ The mgf may not exist for some random variables.
◮
PS Sastry, IISc, Bangalore, 2020 6/45
◮
In general
dk MX (t)
= E[X k ]
dtk
t=0
PS Sastry, IISc, Bangalore, 2020 7/45
◮
◮
◮
We can easily see this by expanding etX in Taylor series:
tX t2 X 2 t3 X 3 t4 X 4
tX
MX (t) = Ee = E 1 +
+
+
+
+ ···
1!
2!
3!
4!
t2
t3
t4
t
= 1 + EX + EX 2 + EX 3 + EX 4 + · · ·
1!
2!
3!
4!
Example – Moment generating function for Poisson
◮
k
fX (k) = λk! e−λ , k = 0, 1, · · ·
tX
MX (t) = E[e ] =
∞
X
etk
k=0
λk −λ
e
k!
∞
X
k
1
λet
k!
k=0
Now we can do term-wise differentiation. For example
= e−λ
3 ∗ 2 ∗ 1 ∗ t0
d3 MX (t)
3 4∗3∗2∗t
=
0+0+0+
EX
+
EX 4 +· · ·
3
dt
3!
4!
= e−λ eλe = eλ(e −1)
t
◮
Hence we get
Now, by differentiating it we can find EX
EX =
d3 MX (t)
= E[X 3 ]
3
dt
t=0
t
dMX (t)
t
=λ
= eλ(e −1) λet
dt
t=0
t=0
(Exercise: Differentiate it twice to find EX 2 and hence
show that variance is λ).
PS Sastry, IISc, Bangalore, 2020 8/45
PS Sastry, IISc, Bangalore, 2020 9/45
mgf of exponential rv
◮
fX (x) = λe−λx , x > 0
Z ∞
etx λe−λx dx
MX (t) = E[e ] =
0
Z ∞
λe−x(λ−t) dx
=
tX
0
This is finite if t < λ
−x(λ−t) ∞
λe
−(λ − t) 0
λ
=
, t<λ
λ−t
=
◮
For mgf to exist we need E[etX ] < ∞ for t ∈ [−a, a] for
some a > 0.
◮ If MX (t) exists then all moments of X are finite.
◮ However, all moments may be finite but the mgf may not
exist.
◮ When mgf exists, it uniquely determines the df
◮ We are not saying moments uniquely determine the
distribution; we are saying mgf uniquely determines the
distribution
◮
We can use this to compute EX
1
d
λ
λ
dMX (t)
=
=
=
EX =
2
dt
dt λ − t t=0
(λ − t) t=0
λ
t=0
PS Sastry, IISc, Bangalore, 2020 10/45
PS Sastry, IISc, Bangalore, 2020 11/45
Characteristic Function
◮
◮
Generating function
The characteristic function of X is defined by
Z
√
itX
φX (t) = E[e ] = eitx dFX (x) (i = −1)
Let X ∈ {0, 1, 2, · · · }
◮ The (probability) generating function of X is defined by
◮
If X is continuous rv,
φX (t) = E[eitX ] =
Z ∞
PX (s) =
eitx fX (x) dx
∞
X
k=0
fX (k)sk , s ∈ ℜ
−∞
Characteristic function always exists because
|eitx | = 1, ∀t, x
◮ For example,
Z ∞
Z ∞
Z ∞
itx
itx
|fX (x)| dx =
e
fX (x) dx = 1
e fX (x) dx ≤
◮
−∞
−∞
◮
This infinite sum converges (absolutely) for |s| ≤ 1.
◮ We have
◮
PX (s) = fX (0) + fX (1)s + fX (2)s2 + fX (3)s3 + · · ·
◮
The pmf can be obtained from the generating function
−∞
We would consider φX later in the course
PS Sastry, IISc, Bangalore, 2020 12/45
◮
◮
◮
PX (s) = fX (0) + fX (1)s + fX (2)s2 + fX (3)s3 + · · ·
PS Sastry, IISc, Bangalore, 2020 13/45
◮
X (s)
and so on
Let PX′ (s) , dPds
We get
PX′ (s) =
PX′ (s) = 0 + fX (1) + fX (2) 2s + fX (3) 3s2 + · · ·
PX′′ (s) =
∞
X
k=0
Hence, we get
PS Sastry, IISc, Bangalore, 2020 14/45
∞
X
k=0
PX′′ (s) = 0 + 0 + fX (2) 2 ∗ 1 + fX (3) 3 ∗ 2s1 + · · ·
P ′′ (0)
P ′ (0)
fX (0) = PX (0); fX (1) = X ; fX (2) = X
1!
2!
The moments (when they exist)
be obtained from the
Pcan
∞
generating function: PX (s) = k=0 fX (k)sk
◮
k fX (k) sk−1 ⇒ PX′ (1) = EX
k(k−1) fX (k) sk−2 ⇒ PX′′ (1) = E[X(X−1)]
For (positive integer valued) discrete random variables, it
is more convenient to deal with generating functions than
mgf.
PS Sastry, IISc, Bangalore, 2020 15/45
Example – Generating function for binomial rv
◮
◮
Let p ∈ (0, 1). The number x ∈ ℜ that satisfies
n!
pk (1 − p)n−k , k = 0, 1, · · · , n
fX (k) = k!(n−k)!
n
X
n!
PX (s) =
pk (1 − p)n−k sk
k!(n − k)!
k=0
=
n
X
n!
(sp)k (1 − p)n−k
k!(n
−
k)!
k=0
P [X ≤ x] ≥ p and P [X ≥ x] ≥ 1 − p
is called the quantile of order p or the 100pth percentile of
rv X.
◮ Suppose x is a quantile of order p. Then we have
◮
◮
= (sp + (1 − p))n = (1 + p(s − 1))n
From the above, we get PX′ (s) = n(sp + (1 − p))n−1 p
◮ Thus,
◮
EX = PX′ (1) = np;
fX (1) = PX′ (0) = n(1 − p)n−1 p
◮
p ≤ P [X ≤ x] = FX (x)
1 − p ≤ 1 − P [X < x] = 1 − (P [X ≤ x] − P [X = x])
⇒ 1 − p ≤ 1 − FX (x) + P [X = x]
⇒ FX (x) ≤ p + P [X = x]
Thus, x satisfies (if it is quantile of order p)
p ≤ FX (x) ≤ p + P [X = x]
◮
PS Sastry, IISc, Bangalore, 2020 16/45
Note that for a given p there can be multiple values for x
to satisfy the above.
PS Sastry, IISc, Bangalore, 2020 17/45
Let X be continuous rv.
◮ If the df is strictly monotone then FX (x) = p would have
a unique solution.
◮
◮
If x is a quantile of order p then
p ≤ FX (x) ≤ p + P [X = x]
If X is continuous rv, we need to satisfy p = FX (x).
◮ In general, for a given p, there may be multiple x that
satisfy the above.
◮ Let us see some examples.
◮
PS Sastry, IISc, Bangalore, 2020 18/45
PS Sastry, IISc, Bangalore, 2020 19/45
For continuous rv, X, FX need not be strictly monotone.
◮ Consider a pdf: fX (x) = 0.5, x ∈ [1, 2] ∪ [3, 4]
◮ The pdf and the corresponding df are:
◮
◮
For this df, for p = 0.5, the quantile of order p is not
unique because there many x with FX (x) = 0.5
But for p = 0.75 it is unique.
PS Sastry, IISc, Bangalore, 2020 20/45
PS Sastry, IISc, Bangalore, 2020 21/45
◮
This situation is illustrated below
Let X ∈ {x1 , x2 , · · · }
◮ Given a p we want to calculate quantile of order p
◮ Suppose there is a xi such that FX (xi ) = p.
◮ Then, for xi ≤ x < xi+1 , FX (x) = p
◮ For xi ≤ x ≤ xi+1 , we have p ≤ FX (x) ≤ p + P [X = x]
◮ So, quantile of order p is not unique and all such x qualify.
◮
PS Sastry, IISc, Bangalore, 2020 22/45
PS Sastry, IISc, Bangalore, 2020 23/45
Now suppose p is such that FX (xi−1 ) < p < FX (xi ).
◮ Let FX (xi−1 ) = p − δ1 and FX (xi ) = p + δ2 . (Note that
δ1 , δ2 > 0)
◮ Then P [X = xi ] = FX (xi ) − FX (xi−1 ) = δ2 + δ1
◮ Hence we have
◮
◮
This situation is illustrated below
p < p + δ2 = FX (xi ) < p + δ2 + δ1 = p + P [X = xi ]
Hence, xi is quantile of order p.
◮ For any x < xi we would have FX (x) ≤ FX (xi−1 ) < p.
◮ For any x, with xi < x < xi+1 we have
p + P [X = x] = p < FX (x) = p + δ2 .
◮ Similarly, for x ≥ xi+1 we have FX (x) > p + P [X = x].
◮ Thus quantile of order p is unique here.
◮
PS Sastry, IISc, Bangalore, 2020 24/45
PS Sastry, IISc, Bangalore, 2020 25/45
Median of a distribution
For p = 0.5 quantile of order p is called the median.
◮ For a continuous rv, median, x satisfies: FX (x) = 0.5.
◮ For a discrete rv, it satisfies:
0.5 ≤ FX (x) ≤ 0.5 + P [X = x].
◮ As we saw, median need not be unique.
◮ Recall that the (standard) Cauchy density is given by
◮
fX (x) =
◮
1 1
, −∞ < x < ∞
π 1 + x2
If we want to find c to minimize E [(X − c)2 ] then the
solution is c = EX.
◮ We saw this earlier.
◮ Suppose we want to find c to minimize E [|(X − c)|]
◮ Then we would get c to be the median.
(Exercise: Show this for discrete and continuous rv)
◮
R0
One can show that −∞ fX (x) dx = 0.5 and hence the
median is at the origin.
PS Sastry, IISc, Bangalore, 2020 26/45
PS Sastry, IISc, Bangalore, 2020 27/45
Markov Inequality
Markov Inequality
Let g : ℜ → ℜ be a non-negative function. Then
E[g(X)]
P [g(X) > c] ≤
, (c > 0)
c
◮ Proof: We prove it for continuous rv. Proof is similar for
discrete rv
Z ∞
E[g(X)] =
g(x) fX (x) dx
−∞
Z
Z
=
g(x) fX (x) dx +
g(x) fX (x) dx
g(x)≤c
g(x)>c
Z
≥
g(x) fX (x) dx because g(x) ≥ 0
g(x)>c
Z
≥ c
fX (x) dx = c P [g(X) > c]
◮
P [g(X) > c] ≤
E[g(X)]
,
c
(c > 0)
In all such results an underlying assumption is that the
expectation is finite.
◮ Let g(x) = |x|k where k is a positive integer. We have
g(x) ≥ 0, ∀x. Let c > 0.
◮ We know that |x| > c ⇒ |x|k > ck and vice versa.
◮ Now we get,
k
E
|X|
P [|X| > c] = P [|X|k > ck ] ≤
ck
◮
g(x)>c
Thus, P [g(X) > c] ≤ E[g(X)]
c
◮
Markov inequality is often used in this form.
PS Sastry, IISc, Bangalore, 2020 28/45
PS Sastry, IISc, Bangalore, 2020 29/45
Chebyshev Inequality
◮
◮
Markov Inequality:
P [|X − EX| > c] ≤
E |X|k
P [|X| > c] ≤
ck
◮
Var(X)
c2
Let EX = µ and let Var(X) = σ 2 . Take c = kσ
◮ We call, σ, square root of variance, as standard deviation.
◮ Now, Chebyshev inequality gives us
◮
Take |X| as |X − EX| and take k = 2
E [|X − EX|2 ]
Var(X)
=
P [|X − EX| > c] ≤
2
c
c2
σ2
1
P [|X − µ| > kσ] ≤ 2 2 = 2
k σ
k
◮
◮
The Chebyshev inequality is
This is known as the Chebyshev inequality.
PS Sastry, IISc, Bangalore, 2020 30/45
This is true for all random variables and the RHS above
does not depend on the distribution of X.
PS Sastry, IISc, Bangalore, 2020 31/45
◮
Markov inequality: For a non-negative function, g,
P [g(X) > c] ≤
◮
E[g(X)]
c
A specific instance of this is
E |X|k
P [|X| > c] ≤
ck
◮
Chebyshev inequality
P [|X − EX| > c] ≤
◮
Var(X)
c2
With EX = µ and Var(X) = σ 2 , we get
P [|X − µ| > kσ] ≤
1
k2
PS Sastry, IISc, Bangalore, 2020 32/45
PS Sastry, IISc, Bangalore, 2020 33/45
A pair of random variables
Just as in the case of a single rv, we can think of the
induced probability space for the case of a pair of rv’s too.
◮ That is, by defining the pair of random variables, we
essentially create a new probability space with sample
space being ℜ2 .
◮ The events now would be the Borel subsets of ℜ2 .
◮ Recall that ℜ2 is cartesian product of ℜ with itself.
◮ So, we can create Borel subsets of ℜ2 by cartesian
product of Borel subsets of ℜ.
◮
Let X, Y be random variables on the same probability
space (Ω, F, P )
◮ Each of X, Y maps Ω to ℜ.
◮ We can think of the pair of radom variables as a
vector-valued function that maps Ω to ℜ2 .
◮
[ XY ]
B 2 = σ ({B1 × B2 : B1 , B2 ∈ B})
Sample Space
R
2
PS Sastry, IISc, Bangalore, 2020 34/45
where B is the Borel σ-algebra we considered earlier, and
B 2 is the set of Borel sets of ℜ2 .
PS Sastry, IISc, Bangalore, 2020 35/45
Recall that B is the smallest σ-algebra containing all
intervals.
◮ Let I1 , I2 ⊂ ℜ be intervals. Then I1 × I2 ⊂ ℜ2 is known
as a cylindrical set.
◮
[a, b] X [c, d]
y
Let X, Y be random variables on the probability space
(Ω, F, P )
◮ This gives rise to a new probability space (ℜ2 , B 2 , PXY )
with PXY given by
◮
PXY (B) = P [(X, Y ) ∈ B], ∀B ∈ B 2
= P ({ω : (X(ω).Y (ω)) ∈ B})
d
c
◮
a
b
x
Recall that for a single rv, the resulting probability space
is (ℜ, B, PX ) with
PX (B) = P [X ∈ B] = P ({ω : X(ω) ∈ B})
B 2 is the smallest σ-algebra containing all cylindrical sets.
◮ We saw that B is also the smallest σ-algebra containing
all intervals of the form (−∞, x].
◮ Similarly B 2 is the smallest σ-algebra containing
cylindrical sets of the form (−∞, x] × (−∞, y].
◮
PS Sastry, IISc, Bangalore, 2020 36/45
PS Sastry, IISc, Bangalore, 2020 37/45
Joint distribution of a pair of random variables
In the case of a single rv, we define a distribution
function, FX which essentailly assigns probability to all
intervals of the form (−∞, x].
◮ This FX uniquely determines PX (B) for all Borel sets, B.
◮ In a similar manner we define a joint distribution function
FXY for a pair of random varibles.
◮ FXY (x, y) would be PXY ((−∞, x] × (−∞, y]).
◮ FXY fixes the probability of all cylindrical sets of the form
(−∞, x] × (−∞, y] and hence uniquely determines the
probability of all Borel sets of ℜ2 .
◮
PS Sastry, IISc, Bangalore, 2020 38/45
Let X, Y be random variables on the same probability
space (Ω, F, P )
◮ The joint distribution function of X, Y is FXY : ℜ2 → ℜ,
defined by
◮
FXY (x, y) = P [X ≤ x, Y ≤ y] (= PXY ((−∞, x] × (−∞, y]))
= P ({ω : X(ω) ≤ x} ∩ {ω : Y (ω) ≤ y})
◮
The joint distribution function is the probability of the
intersection of the events [X ≤ x] and [Y ≤ y].
PS Sastry, IISc, Bangalore, 2020 39/45
Properties of Joint Distribution Function
Recall that, for the case of a single rv, the probability of
X being in any interval is given by the difference of FX
values at the end points of the interval.
◮ Let x1 < x2 . Then
◮
◮
Joint distribution function:
FXY (x, y) = P [X ≤ x, Y ≤ y]
FXY (−∞, y) = FXY (x, −∞) = 0, ∀x, y;
FXY (∞, ∞) = 1
(These are actually limits: limx→−∞ FXY (x, y) = 0, ∀y)
◮ F
XY is non-decresing in each of its arguments
◮ F
XY is right continuous and has left-hand limits in each
of its arguments
P [x1 < X ≤ x2 ] = FX (x2 ) − FX (x1 )
◮
These are straight-forward extensions of single rv case
◮ But there is another crucial property satisfied by FXY .
◮
The LHS above is a probability.
The RHS is non-negative because FX is non-decreasing.
◮ We will now derive a similar expression in the case of two
random variables.
◮ Here, the probability we want is that of the pair of rv’s
being in a cylindrical set.
◮
PS Sastry, IISc, Bangalore, 2020 40/45
Let x1 < x2 and y1 < y2 . We want
P [x1 < X ≤ x2 , y1 < Y ≤ y2 ].
◮ Consider the Borel set B = (−∞, x2 ] × (−∞, y2 ].
PS Sastry, IISc, Bangalore, 2020 41/45
y
◮
y
B3
2
B1
y
1
x2
x1
x
2
B1
1
x2
x1
x
B2
,
=
=
=
=
y
B2
y
y
B
B1
B2
B3
B2 ∩ B3
B3
(−∞, x2 ] × (−∞, y2 ] = B1 + (B2 ∪ B3 )
(x1 , x2 ] × (y1 , y2 ]
(−∞, x2 ] × (−∞, y1 ]
(−∞, x1 ] × (−∞, y2 ]
(−∞, x1 ] × (−∞, y1 ]
PS Sastry, IISc, Bangalore, 2020 42/45
P [(X, Y ) ∈ B] = P [X ≤ x2 , Y ≤ y2 ] = FXY (x2 , y2 )
= P [(X, Y ) ∈ B1 + (B2 ∪ B3 )]
= P [(X, Y ) ∈ B1 ] + P [(X, Y ) ∈ (B2 ∪ B3 )]
P [(X, Y ) ∈ B2 ] = P [X ≤ x2 , Y ≤ y1 ] = FXY (x2 , y1 )
P [(X, Y ) ∈ B3 ] = P [X ≤ x1 , Y ≤ y2 ] = FXY (x1 , y2 )
P [(X, Y ) ∈ B2 ∩ B3 ] = P [X ≤ x1 , Y ≤ y1 ] = FXY (x1 , y1 )
P [(X, Y ) ∈ B1 ] = FXY (x2 , y2 ) − P [(X, Y ) ∈ (B2 ∪ B3 )]
= FXY (x2 , y2 ) − FXY (x2 , y1 ) − FXY (x1 , y2 ) + FXY (x1 , y1 )
PS Sastry, IISc, Bangalore, 2020 43/45
Properties of Joint Distribution Function
What we showed is the following.
◮ For x1 < x2 and y1 < y2
◮
◮
P [x1 < X ≤ x2 , y1 < Y ≤ y2 ] = FXY (x2 , y2 ) − FXY (x2 , y1 )
−FXY (x1 , y2 ) + FXY (x1 , y1 )
◮
FXY (x, y) = P [X ≤ x, Y ≤ y]
◮
It satisfies
1. FXY (−∞, y) = FXY (x, −∞) = 0, ∀x, y;
FXY (∞, ∞) = 1
2. FXY is non-decreasing in each of its arguments
3. FXY is right continuous and has left-hand limits in each
of its arguments
4. For all x1 < x2 and y1 < y2
This means FXY should satisfy
FXY (x2 , y2 )−FXY (x2 , y1 )−FXY (x1 , y2 )+FXY (x1 , y1 ) ≥ 0
for all x1 < x2 and y1 < y2
◮ This is an additional condition that a function has to
satisfy to be the joint distribution function of a pair of
random variables
FXY (x2 , y2 )−FXY (x2 , y1 )−FXY (x1 , y2 )+FXY (x1 , y1 ) ≥ 0
◮
Any F : ℜ2 → ℜ satisfying the above would be a joint
distribution function.
PS Sastry, IISc, Bangalore, 2020 45/45
PS Sastry, IISc, Bangalore, 2020 44/45
Recap: Random Variables
Joint distribution function: FXY : ℜ2 → ℜ
Recap: Distribution function of a random variable
Given a probability space (Ω, F, P ), a random variable is
a real-valued function on Ω.
◮ It essentially results in an induced probability space
◮
◮
X
(Ω, F, P ) → (ℜ, B, PX )
Let X be a random variable. It distribution function,
FX : ℜ → ℜ, is defined by
FX (x) = P [X ≤ x] = P ({ω ∈ Ω : X(ω) ≤ x})
where B is the Borel σ-algebra and
◮
PX (B) = P [X ∈ B] = P ({ω ∈ Ω : X(ω) ∈ B})
PS Sastry, IISc, Bangalore, 2020 1/57
The distribution function, FX , completely specifies the
probability measure, PX .
PS Sastry, IISc, Bangalore, 2020 2/57
Recap: Properties of distribution function
◮
Recap: Discrete Random Variable
The distribution function satisfies
1. 0 ≤ FX (x) ≤ 1, ∀x
2. FX (−∞) = 0; FX (∞) = 1
3. FX is non-decreasing: x1 ≤ x2 ⇒ FX (x1 ) ≤ FX (x2 )
4. FX is right continuous and has left-hand limits.
Any real-valued function of a real variable satisfying the
above four properties would be a distribution function of
some random variable.
◮ We also have
FX (x+ ) − FX (x− ) = FX (x) − FX (x− ) = P [X = x]
P [a < X ≤ b] = FX (b) − FX (a).
◮
A random variable X is said to be discrete if it takes only
finitely many or countably infinitely many distinct values.
◮ Let X ∈ {x1 , x2 , · · · }
◮ Its distribution function, FX is a stair-case function with
jump discontinuities at each xi and the magnitude of the
jump at xi is equal to P [X = xi ]
◮
PS Sastry, IISc, Bangalore, 2020 4/57
PS Sastry, IISc, Bangalore, 2020 3/57
Recap: probability mass function
Recap: continuous random variable
Let X ∈ {x1 , x2 , · · · }.
◮ The probability mass function (pmf) of X is defined by
◮
◮
fX (xi ) = P [X = xi ]; fX (x) = 0, for all other x
◮
It satisfies
−∞
1. fP
X (x) ≥ 0, ∀x and fX (x) = 0 if x 6= xi for some i
2.
i fX (xi ) = 1
We have P
FX (x) = i:xi ≤x fX (xi )
fX (x) = FX (x) − FX (x− )
◮ We can calculate the probability of any event as
X
fX (xi )
P [X ∈ B] =
◮
X is said to be a continuous random variable if there
exists a function fX : ℜ → ℜ satisfying
Z x
fX (x) dx
FX (x) =
i:
xi ∈B
PS Sastry, IISc, Bangalore, 2020 5/57
The fX is called the probability density function.
◮ Same as saying FX is absolutely continuous.
◮ Since FX is continuous here, we have
P [X = x] = FX (x) − FX (x− ) = 0, ∀x
◮
A continuous rv takes uncountably many distinct values.
However, not every rv that takes uncountably many
values is a continuous rv
PS Sastry, IISc, Bangalore, 2020 6/57
Recap: probability density function
◮
Recap: Function of a random variable
The pdf of a continuous rv is defined to be the fX that
satisfies
Z x
fX (t) dt, ∀x
FX (x) =
−∞
◮
◮
It satisfies
1. fX (x) ≥ 0, ∀x
R∞
2. −∞ fX (t) dt = 1
We can, in principle, compute probability of any event as
Z
P [X ∈ B] =
fX (t) dt, ∀B ∈ B
If X is a random variable and g : ℜ → ℜ is a function,
then Y = g(X) is a random variable.
◮ More formally, Y is a random variable if g is a Borel
measurable function.
◮ We can determine distribution of Y given the function g
and the distribution of X
◮
B
◮
In particular,
P [a ≤ X ≤ b] =
Z b
fX (t) dt
a
PS Sastry, IISc, Bangalore, 2020 8/57
PS Sastry, IISc, Bangalore, 2020 7/57
Recap
Recap
Suppose X is a discrete rv with X ∈ {x1 , x2 , · · · }.
◮ Suppose Y = g(X).
◮ Then Y is also discrete and Y ∈ {g(x1 ), g(x2 ), · · · }.
◮ We can find the pmf of Y as
◮
Let X be a rv and let Y = g(X).
◮ The distribution function of Y is given by
◮
FY (y) = P [g(X) ≤ y]
= P [X ∈ {z : g(z) ≤ y}]
◮
This probability can be obtained from distribution of X.
fY (y) = p[Y = y] = P [g(X) = y]
= P [X ∈ {xi : g(xi ) = y}]
X
=
fX (xi )
i:
g(xi )=y
PS Sastry, IISc, Bangalore, 2020 9/57
PS Sastry, IISc, Bangalore, 2020 10/57
Recap
Recap: Expectation
◮
Let g : ℜ → ℜ be differentiable with g ′ (x) > 0, ∀x or
g ′ (x) < 0, ∀x.
◮ Let X be a continuous rv and let Y = g(X).
◮ Then Y is a continuous rv with pdf
◮
fY (y) = fX (g −1 (y))
d −1
g (y) , a ≤ y ≤ b
dy
where a = min(g(∞), g(−∞)) and
b = max(g(∞), g(−∞))
◮ This theorem is useful in some cases to find the densities
of functions of continuous random variables
Let X be a discrete rv with X ∈ {x1 , x2 , · · · }. Then
X
E[X] =
xi fX (xi )
i
◮
If X is a continuous random variable with pdf, fX ,
Z ∞
x fX (x) dx
E[X] =
−∞
◮
Sometimes we use the following notation to denote
expectation of both kinds of rv
Z ∞
x dFX (x)
E[X] =
−∞
We take the expectation to exist when the sum or
integral above is absolutely convergent
◮ Note that expectation is defined for all random variables
◮
PS Sastry, IISc, Bangalore, 2020 12/57
PS Sastry, IISc, Bangalore, 2020 11/57
Recap: Expectation of a function of a random
variable
Let X be a rv and let Y = g(X). Then,
R
R
◮ EY =
y dFY (y) = g(x) dFX (x)
◮ That is, if X is discrete, then
X
X
EY =
yj fY (yj ) =
g(xi )fX (xi )
Recap: Properties of Expectation
◮
j
i
◮
If X and Y are continuous
Z
Z
EY = y fY (y) dy = g(x) fX (x) dx
◮
This is true for all rv’s.
PS Sastry, IISc, Bangalore, 2020 13/57
E[g(X)] =
X
i
g(xi )fX (xi ) or E[g(X)] =
Z ∞
g(x) fX (x) dx
−∞
If X ≥ 0 then EX ≥ 0
◮ E[b] = b where b is a constant
◮ E[ag(X)] = aE[g(X)] where a is a constant
◮ E[aX + b] = aE[X] + b where a, b are constants.
◮ E[ag1 (X) + bg2 (X)] = aE[g1 (X)] + bE[g2 (X)]
◮ E [(X − c)2 ] ≥ E [(X − EX)2 ] , ∀c
◮
PS Sastry, IISc, Bangalore, 2020 14/57
Recap: Variance of random variable
Recap: Moments of a random variable
◮
The k th (order) moment of X is
Z
k
mk = E[X ] = xk dFX (x)
◮
The k th central moment of X is
Z
k
sk = E[(X − EX) ] = (x − EX)k dFX (x)
◮
If moment of order k is finite then so is moment of order
s for s < k.
◮
◮
Var(X) = E (X − EX)2 = E[X 2 ] − (EX)2
Properties of Variance:
Var(X) ≥ 0
◮ Var(X + c) = Var(X)
◮ Var(cX) = c2 Var(X)
◮
PS Sastry, IISc, Bangalore, 2020 15/57
Recap: Moment Generating function
PS Sastry, IISc, Bangalore, 2020 16/57
Generating function
◮
◮
The moment generating function – MX : ℜ → ℜ
Z
X
txi
tX
e fX (xi ) or
etx fX (x) dx, t ∈ ℜ
MX (t) = Ee =
PX (s) =
i
◮
We get the pmf from it as
PX′ (0)
P ′′ (0)
; fX (2) = X
1!
2!
We can also get the moments:
PX′ (1) = EX,
PS Sastry, IISc, Bangalore, 2020 17/57
fX (k)sk , s ∈ ℜ
fX (0) = PX (0); fX (1) =
◮
dk MX (t)
= E[X k ]
k
dt
t=0
∞
X
k=0
tX
We say the mgf exists if E[e ] < ∞ for t in some
interval around zero
◮ If MX (t) exists (for t ∈ [−a, a] for some a > 0) then all
its derivatives also exist and
◮
For X ∈ {0, 1, 2, · · · } the (probability) generating
function of X is defined by
PX′′ (1) = E[X(X − 1)]
PS Sastry, IISc, Bangalore, 2020 18/57
quantiles of a distribution
Recap: some moment inequalities
◮
◮
Let p ∈ (0, 1). The number x ∈ ℜ that satisfies
P [X ≤ x] ≥ p and p[X ≥ x] ≥ 1 − p
is called the quantile of order p or the 100p
rv X.
◮ If x is quantile of order p, it satisfies
th
percentile of
P [g(X) > c] ≤
◮
E[g(X)]
c
A specific instance of this is
E |X|k
P [|X| > c] ≤
ck
◮ Chebyshev inequality
p ≤ FX (x) ≤ p + P [X = x]
For a given p there can be multiple values for x to satisfy
the above.
◮ For p = 0.5, it is called the median.
Markov inequality: For a non-negative function, g,
P [|X − EX| > c] ≤
◮
◮
Var(X)
c2
With EX = µ and Var(X) = σ 2 , we get
P [|X − µ| > kσ] ≤
1
k2
PS Sastry, IISc, Bangalore, 2020 19/57
PS Sastry, IISc, Bangalore, 2020 20/57
Recap: A pair of random variables
Let X, Y be random variables on the probability space
(Ω, F, P )
◮ We can think of X, Y together as a vector-valued
function mapping Ω to ℜ2 .
◮ This gives rise to a new probability space (ℜ2 , B 2 , PXY )
with PXY given by
◮
PXY (B) = P [(X, Y ) ∈ B], ∀B ∈ B 2
= P ({ω : (X(ω).Y (ω)) ∈ B})
PS Sastry, IISc, Bangalore, 2020 21/57
PS Sastry, IISc, Bangalore, 2020 22/57
Recap: Joint distribution function
Recap: Properties of Joint Distribution Function
◮
Let X, Y be random variables on the same probability
space (Ω, F, P )
◮ The joint distribution function of X, Y is FXY : ℜ2 → ℜ,
defined by
Joint distribution function: FXY : ℜ2 → ℜ
FXY (x, y) = P [X ≤ x, Y ≤ y]
◮
◮
1. FXY (−∞, y) = FXY (x, −∞) = 0, ∀x, y;
FXY (∞, ∞) = 1
2. FXY is non-decreasing in each of its arguments
3. FXY is right continuous and has left-hand limits in each
of its arguments
4. For all x1 < x2 and y1 < y2
FXY (x, y) = P [X ≤ x, Y ≤ y] (= PXY ((−∞, x] × (−∞, y]))
= P ({ω : X(ω) ≤ x} ∩ {ω : Y (ω) ≤ y})
◮
It satisfies
The joint distribution function is the probability of the
intersection of the events [X ≤ x] and [Y ≤ y].
FXY (x2 , y2 )−FXY (x2 , y1 )−FXY (x1 , y2 )+FXY (x1 , y1 ) ≥ 0
◮
Any F : ℜ2 → ℜ satisfying the above would be a joint
distribution function.
PS Sastry, IISc, Bangalore, 2020 23/57
PS Sastry, IISc, Bangalore, 2020 24/57
Example
Let X, Y be two discrete random variables (defined on
the same probability space).
◮ Let X ∈ {x1 , · · · xn } and Y ∈ {y1 , · · · , ym }.
◮ We define the joint probability mass function of X and Y
as
fXY (xi , yj ) = P [X = xi , Y = yj ]
◮
(fXY (x, y) is zero for all other values of x, y)
◮ The fXY would satisfy
◮
◮
fXY (x, y) ≥ 0, ∀x, y and
P P
i
j fXY (xi , yj ) = 1
This is a straight-forward extension of the pmf of a single
discrete rv.
PS Sastry, IISc, Bangalore, 2020 25/57
Let Ω = (0, 1) with the ‘usual’ probability.
◮ So, each ω is a real number between 0 and 1
◮ Let X(ω) be the digit in the first decimal place in ω and
let Y (ω) be the digit in the second decimal place.
◮ If ω = 0.2576 then X(ω) = 2 and Y (ω) = 5
◮ Easy to see that X, Y ∈ {0, 1, · · · , 9}.
◮ We want to calculate the joint pmf of X and Y
◮
PS Sastry, IISc, Bangalore, 2020 26/57
Example
◮
Example
[X = 4] = {ω : X(ω) = 4} = [0.4, 0.5)
◮
What is the event [Y = 3]?
[Y = 3] = [0.03, 0.04) ∪ [0.13, 0.14) ∪ · · · ∪ [0.93, 0.94)
◮
What is the event [X = 4, Y = 3]?
It is the intersection of the above
[X = m, Y = n] = {(ω1 , ω2 ) ∈ Ω : max(ω1 , ω2 ) = m, ω1 +ω2 = n}
For this to be a non-empty set, we must have
m < n ≤ 2m
◮ Then [X = m, Y = n] = {(m, n − m), (n − m, m)}
◮ Is this always true? No! What if n = 2m?
[X = 3, Y = 6] = {(3, 3)},
[X = 4, Y = 6] = {(4, 2), (2, 4)}
◮ So, P [X = m, Y = n] is either 2/36 or 1/36 (assuming
m, n satisfy other requirements)
PS Sastry, IISc, Bangalore, 2020 28/57
◮
[X = 4, Y = 3] = [0.43, 0.44)
◮
Consider the random experiment of rolling two dice.
Ω = {(ω1 , ω2 ) : ω1 , ω2 ∈ {1, 2, · · · , 6}}
◮ Let X be the maximum of the two numbers and let Y be
the sum of the two numbers.
◮ Easy to see X ∈ {1, 2, · · · , 6} and Y ∈ {2, 3, · · · , 12}
◮ What is the event [X = m, Y = n]? (We assume m, n
are in the correct range)
◮
What is the event [X = 4]?
Hence the joint pmf of X and Y is
fXY (x, y) = P [X = x, Y = y] = 0.01, x, y ∈ {0, 1, · · · , 9}
PS Sastry, IISc, Bangalore, 2020 27/57
Example
Joint Probability mass function
We can now write the joint pmf.
◮ Assume 1 ≤ m ≤ 6 and 2 ≤ n ≤ 12. Then
( 2
if m < n < 2m
36
fXY (m, n) =
1
if n = 2m
36
◮
◮
(fXY (m, n) is zero in all other cases)
Does this satisfy requirements of joint pmf?
6
X
2m−1
X
6
X
2
1
fXY (m, n) =
+
36 m=1 36
m,n
m=1 n=m+1
X
6
1
2 X
(m − 1) + 6
=
36 m=1
36
=
Let X ∈ {x1 , x2 , · · · } and Y ∈ {y1 , y2 , · · · } be discrete
random variables.
◮ The joint pmf: fXY (x, y) = P [X = x, Y = y].
◮ The joint pmf satisfies:
◮
◮
◮
◮
fP
(x, y) ≥ 0, ∀x, y and
XYP
i
j fXY (xi , yj ) = 1
Given the joint pmf, we can get the joint df as
X X
FXY (x, y) =
fXY (xi , yj )
i:
j:
xi ≤x yj ≤y
6
2
(21 − 6) +
=1
36
36
PS Sastry, IISc, Bangalore, 2020 29/57
PS Sastry, IISc, Bangalore, 2020 30/57
◮
Given sets {x1 , x2 , · · · } and {y1 , y2 , · · · }.
◮ Suppose fXY : ℜ2 → [0, 1] be such that
◮
fXY (x, y) = 0 unless x = xi for some i and y = yj for
some
P
Pj, and
◮
i
j fXY (xi , yj ) = 1
◮
Then fXY is a joint pmf.
◮ This is because, if we define
X X
fXY (xi , yj )
FXY (x, y) =
◮
i:
Given the joint pmf, we can (in principle) compute the
probability of any event involving the two discrete random
variables.
X
fXY (xi , yj )
P [(X, Y ) ∈ B] =
i,j:
(xi ,yj )∈B
◮
Now, events can be specified in terms of relations
between the two rv’s too
[X < Y + 2] = {ω : X(ω) < Y (ω) + 2}
j:
xi ≤x yj ≤y
then FXY satisfies all properties of a df.
◮ We normally specify a pair of discrete random variables by
giving the joint pmf
◮
Thus,
P [X < Y + 2] =
Take the example: 2 dice, X is max and Y is sum
◮ fXY (m, n) = 0 unless m = 1, · · · , 6 and n = 2, · · · , 12.
For this range
( 2
if m < n < 2m
36
fXY (m, n) =
1
if n = 2m
36
◮
i,j:
P [Y = X + 2] =
X
fXY (m, n) =
m,n:
n=m+2
=
6
X
6
X
fXY (m, m + 2)
m=1
fXY (m, m + 2) since we need m + 2 ≤ 2m
m=2
=
PS Sastry, IISc, Bangalore, 2020 32/57
Joint density function
Let X, Y be two continuous rv’s with df FXY .
◮ If there exists a function fXY that satisfies
Z x Z y
fXY (x′ , y ′ ) dy ′ dx′ , ∀x, y
FXY (x, y) =
◮
−∞
Suppose we want P [Y = X + 2].
1
2
9
+4
=
36
36
36
PS Sastry, IISc, Bangalore, 2020 33/57
fXY (xi , yj )
xi <yj +2
PS Sastry, IISc, Bangalore, 2020 31/57
◮
X
−∞
then we say that X, Y have a joint probability density
function which is fXY
◮ Please note the difference in the definition of joint pmf
and joint pdf.
◮ When X, Y are discrete we defined a joint pmf
◮ We are not saying that if X, Y are continuous rv’s then a
joint density exists.
◮ We use joint density to mean joint pdf
PS Sastry, IISc, Bangalore, 2020 34/57
properties of joint density
◮
properties of joint density
The joint density (or joint pdf) of X, Y is fXY that
satisfies
Z x Z y
FXY (x, y) =
fXY (x′ , y ′ ) dy ′ dx′ , ∀x, y
−∞
◮
−∞
Since FXY is non-decreasing in each argument, we must
have fXY (x, y) ≥ 0.
R∞ R∞
◮
f (x′ , y ′ ) dy ′ dx′ = 1 is needed to ensure
−∞ −∞ XY
FXY (∞, ∞) = 1.
◮
◮
The joint density fXY satisfies the following
1. fXY (x, y) ≥ 0, ∀x, y
R∞ R∞
2. −∞ −∞ fXY (x′ , y ′ ) dy ′ dx′ = 1
These are very similar to the properties of the density of a
single rv
PS Sastry, IISc, Bangalore, 2020 35/57
Example: Joint Density
◮
PS Sastry, IISc, Bangalore, 2020 36/57
properties of joint density
Consider the function
f (x, y) = 2, 0 < x < y < 1 (f (x, y) = 0, otherwise)
◮
The joint density fXY satisfies the following
1. fXY (x, y) ≥ 0, ∀x, y
Let us show this is a density
Z 1
Z 1
Z 1Z y
Z ∞Z ∞
y
2y dy = 1
2 x|0 dy =
2 dx dy =
f (x, y) dx dy =
◮
−∞
0
−∞
◮
0
0
0
We can say this density is uniform over the region
y
R∞ R∞
′ ′
′
′
−∞ −∞ fXY (x , y ) dy dx = 1
◮ Any function fXY : ℜ2 → ℜ satisfying the above two is a
2.
joint density function.
◮ Given fXY satisfying the above, define
Z x Z y
FXY (x, y) =
fXY (x′ , y ′ ) dy ′ dx′ , ∀x, y
−∞
1.0
◮
0.5
0.5
1.0
−∞
Then we can show FXY is a joint distribution.
x
PS Sastry, IISc, Bangalore, 2020 37/57
PS Sastry, IISc, Bangalore, 2020 38/57
R∞ R∞
fXY (x, y) ≥ 0 and −∞ −∞ fXY (x′ , y ′ ) dy ′ dx′ = 1
◮ Define
Z x Z y
FXY (x, y) =
fXY (x′ , y ′ ) dy ′ dx′ , ∀x, y
◮
−∞
−∞
Then, FXY (−∞, y) = FXY (x, −∞) = 0, ∀x, y and
FXY (∞, ∞) = 1
◮ Since fXY (x, y) ≥ 0, FXY is non-decreasing in each
argument.
◮ Since it is given as an integral, the above also shows that
FXY is continuous in each argument.
◮ The only property left is the special property of FXY we
mentioned earlier.
◮
∆ , FXY (x2 , y2 ) − FXY (x1 , y2 ) − FXY (x2 , y1 ) + FXY (x1 , y1 ).
We need to show ∆ ≥ 0 if x1 < x2 and y1 < y2 .
◮ We have
Z x 1 Z y2
Z x 2 Z y2
∆ =
fXY dy dx
fXY dy dx −
−∞ −∞
−∞ −∞
Z x 1 Z y1
Z x 2 Z y1
fXY dy dx
−
fXY dy dx +
−∞ −∞
−∞ −∞
Z x 2 Z y2
Z y1
=
fXY dy −
fXY dy dx
−∞
−∞
−∞
Z x 1 Z y2
Z y1
−
fXY dy −
fXY dy dx
◮
−∞
−∞
−∞
PS Sastry, IISc, Bangalore, 2020 40/57
PS Sastry, IISc, Bangalore, 2020 39/57
◮
◮
Thus we have
Z y1
Z x 2 Z y2
fXY dy −
∆ =
fXY dy dx
−∞
−∞
−∞
Z y1
Z x 1 Z y2
fXY dy dx
−
fXY dy −
−∞
−∞
−∞
Z x1 Z y2
Z x 2 Z y2
fXY dy dx
fXY dy dx −
=
−∞ y1
−∞ y1
Z x 2 Z y2
=
fXY dy dx ≥ 0
x1
◮
y1
This actually shows
P [x1 ≤ X ≤ x2 , y1 ≤ Y ≤ y2 ] =
◮
What we showed is the following
Any function fXY : ℜ2 → ℜ that satisfies
fRXY (x,
y) ≥ 0, ∀x, y
∞ R∞
◮
−∞ −∞ fXY (x, y) dx dy = 1
◮
is a joint density function.
◮ This is because now
Ry Rx
FXY (x, y) = −∞ −∞ fXY (x, y) dx dy
would satisfy all conditions for a df.
◮ Convenient to specify joint density (when it exists)
◮ We also showed
Z x 2 Z y2
P [x1 ≤ X ≤ x2 , y1 ≤ Y ≤ y2 ] =
fXY dy dx
x1
Z x 2 Z y2
x1
◮
In general
fXY dy dx
y1
PS Sastry, IISc, Bangalore, 2020 41/57
y1
P [(X, Y ) ∈ B] =
Z
fXY (x, y) dx dy, ∀B ∈ B 2
B
PS Sastry, IISc, Bangalore, 2020 42/57
◮
Let us consider the example
f (x, y) = 2, 0 < x < y < 1
◮
◮
Suppose wee want probability of [Y > X + 0.5]
We can look at it geometrically
y
P [Y > X + 0.5] = P [(X, Y ) ∈ {(x, y) : y > x + 0.5}]
Z
=
fXY (x, y) dx dy
1.0
0.5
{(x,y) : y>x+0.5}
=
=
Z 1 Z y−0.5
Z0.51
0.5
2 dx dy
◮
0
2(y − 0.5)dy
x
1.0
The probability of the event we want is the area of the
small triangle divided by that of the big triangle.
0.5
1
y2
=2
− y|10.5 = 1 − 0.25 − 1 + 0.5 = 0.25
2 0.5
PS Sastry, IISc, Bangalore, 2020 44/57
PS Sastry, IISc, Bangalore, 2020 43/57
Marginal Distributions
Marginal mass functions
Let X ∈ {x1 , x2 , · · · } and Y ∈ {y1 , y2 , · · · }
◮ Let fXY be their joint mass function.
◮ Then
X
X
P [X = xi ] =
P [X = xi , Y = yj ] =
fXY (xi , yj )
◮
Let X, Y be random variables with joint distribution
function FXY .
◮ We know FXY (x, y) = P [X ≤ x, Y ≤ y].
◮ Hence
◮
FXY (x, ∞) = P [X ≤ x, Y ≤ ∞] = P [X ≤ x] = FX (x)
◮
We define the marginal distribution functions of X, Y by
FX (x) = FXY (x, ∞);
◮
FY (y) = FXY (∞, y)
These are simply distribution functions of X and Y
obtained from the joint distribution function.
PS Sastry, IISc, Bangalore, 2020 45/57
j
j
(This is because
P [Y = yj ], j = 1, · · · , form a partition
and P (A) = i P (ABi ) when Bi is a partition)
◮ We define the marginal mass functions of X and Y as
X
X
fX (xi ) =
fXY (xi , yj ); fY (yj ) =
fXY (xi , yj )
j
◮
i
These are mass functions of X and Y obtained from the
joint mass function
PS Sastry, IISc, Bangalore, 2020 46/57
marginal density functions
Example
Let X, Y be continuous rv with
R x joint
R y density fXY .
Then we know FXY (x, y) = −∞ −∞ fXY (x′ , y ′ ) dy ′ dx′
◮ Hence, we have
Z x Z ∞
fXY (x′ , y ′ ) dy ′ dx′
FX (x) = FXY (x, ∞) =
−∞
Z−∞
x Z ∞
′ ′
′
fXY (x , y ) dy dx′
=
◮
◮
−∞
◮
−∞
Since X is a continuous rv, this means
Z ∞
fXY (x, y) dy
fX (x) =
−∞
◮
We call this the marginal density of X.
Similarly, marginal density of Y is
Z ∞
fXY (x, y) dx
fY (y) =
Rolling two dice, X is max, Y is sum
◮ We had, for 1 ≤ m ≤ 6 and 2 ≤ n ≤ 12,
( 2
if m < n < 2m
36
fXY (m, n) =
1
if n = 2m
36
◮
P
We know, fX (m) = n fXY (m, n), m = 1, · · · , 6.
◮ Given m, for what values of n, fXY (m, n) > 0 ?
We can only have n = m + 1, · · · , 2m.
◮ Hence we get
◮
fX (m) =
n=m+1
−∞
◮
2m
X
fXY (m, n) =
2m−1
X
2 1
2
1
2m − 1
+ = (m−1)+ =
36 36
36
36
36
n=m+1
These are pdf’s of X and Y obtained fromPS the
Sastry, joint
IISc, Bangalore, 2020 47/57
PS Sastry, IISc, Bangalore, 2020 48/57
Example
◮
Consider the joint density
fXY (x, y) = 2, 0 < x < y < 1
◮
The marginal density of X is: for 0 < x < 1,
Z ∞
Z 1
fX (x) =
fXY (x, y) dy =
2 dy = 2(1 − x)
−∞
x
Thus, fX (x) = 2(1 − x), 0 < x < 1
◮ We can easily verify this is a density
Z 1
Z ∞
1
2(1 − x) dx = (2x − x2 ) 0 = 1
fX (x) dx =
−∞
We have: fXY (x, y) = 2, 0 < x < y < 1
◮ We can similarly find density of Y .
◮ For 0 < y < 1,
Z y
Z ∞
2 dx = 2y
fXY (x, y) dx =
fY (y) =
0
−∞
◮
Thus, fY (y) = 2y, 0 < y < 1 and
Z 1
1
y2
2y dy = 2
=1
2 0
0
0
PS Sastry, IISc, Bangalore, 2020 49/57
PS Sastry, IISc, Bangalore, 2020 50/57
Conditional distributions
If we are given the joint df or joint pmf/joint density of
X, Y , then the individual df or pmf/pdf are uniquely
determined.
◮ However, given individual pdf of X and Y , we cannot
determine the joint density. (same is true of pmf or df)
◮ There can be many different joint density functions all
having the same marginals
◮
Let X, Y be rv’s on the same probability space
◮ We define the conditional distribution of X given Y by
◮
FX|Y (x|y) = P [X ≤ x|Y = y]
(For now ignore the case of P [Y = y] = 0).
◮ Note that FX|Y : ℜ2 → ℜ
◮ FX|Y (x|y) is a notation. We could write FX|Y (x, y).
PS Sastry, IISc, Bangalore, 2020 52/57
PS Sastry, IISc, Bangalore, 2020 51/57
◮
Conditional distribution of X given Y is
◮
Let: X ∈ {x1 , x2 , · · · } and Y ∈ {y1 , y2 , · · · }. Then
FX|Y (x|y) = P [X ≤ x|Y = y]
It is the conditional probability of [X ≤ x] given (or
conditioned on) [Y = y].
◮ Consider example: rolling 2 dice, X is max, Y is sum
P [X ≤ 4|Y = 3] = 1; P [X ≤ 4|Y = 9] = 0
This is what conditional distribution captures.
◮ For every value of y, FX|Y (x|y) is a distribution function
in the variable x.
◮ It defines a new distribution for X based on knowing the
value of Y .
◮
PS Sastry, IISc, Bangalore, 2020 53/57
FX|Y (x|yj ) = P [X ≤ x|Y = yj ] =
P [X ≤ x, Y = yj ]
P [Y = yj ]
(We define FX|Y (x|y) only when y = yj for some j).
◮ For each yj , FX|Y (x|yj ) is a df of a discrete rv in x.
◮ Since X is a discrete rv, we can write the above as
P
P [X ≤ x, Y = yj ]
i:xi ≤x P [X = xi , Y = yj ]
FX|Y (x|yj ) =
=
P [Y = yj ]
P [Y = yj ]
X fXY (xi , yj ) =
fY (yj )
i:x ≤x
i
PS Sastry, IISc, Bangalore, 2020 54/57
◮
Conditional mass function
The conditional mass function is
fX|Y (xi |yj ) = P [X = xi |Y = yj ] =
◮
We got
◮
FX|Y (x|yj ) =
X i:xi ≤x
fXY (xi , yj )
fY (yj )
Since X is a discrete rv, what is inside the summation
above is the pmf corresponding to the df, FX|Y .
◮ We define the conditional mass function of X given Y as
◮
fXY (xi , yj )
= P [X = xi |Y = yj ]
fX|Y (xi |yj ) =
fY (yj )
fXY (xi , yj )
fY (yj )
This gives us the useful identity
fXY (xi , yj ) = fX|Y (xi |yj )fY (yj )
◮
( P [X = xi , Y = yj ] = P [X = xi |Y = yj ]P [Y = yj ])
This gives us the total proability rule for rv’s
X
X
fX (xi ) =
fXY (xi , yj ) =
fX|Y (xi |yj )fY (yj )
j
◮
j
This is same as
P [X = xi ] =
X
P [X = xi |Y = yj ]P [Y = yj ]
j
(P (A) =
partition)
PS Sastry, IISc, Bangalore, 2020 55/57
P
j P (A|Bj )P (Bj ) when B1 , · · ·
form a
PS Sastry, IISc, Bangalore, 2020 56/57
Recap: Joint Distribution Function
◮
We have
◮
fXY (xi , yj ) = fX|Y (xi |yj )fY (yj ) = fY |X (yj |xi )fX (xi )
Given X, Y rv on same probability space, joint
distribution function: FXY : ℜ2 → ℜ
FXY (x, y) = P [X ≤ x, Y ≤ y]
◮
◮
This gives us Bayes rule for discrete rv’s
fY |X (yj |xi )fX (xi )
fX|Y (xi |yj ) =
fY (yj )
fY |X (yj |xi )fX (xi )
P
=
i fXY (xi , yj )
fY |X (yj |xi )fX (xi )
= P
i fY |X (yj |xi )fX (xi )
PS Sastry, IISc, Bangalore, 2020 57/57
It satisfies
1. FXY (−∞, y) = FXY (x, −∞) = 0, ∀x, y;
FXY (∞, ∞) = 1
2. FXY is non-decreasing in each of its arguments
3. FXY is right continuous and has left-hand limits in each
of its arguments
4. For all x1 < x2 and y1 < y2
FXY (x2 , y2 )−FXY (x2 , y1 )−FXY (x1 , y2 )+FXY (x1 , y1 ) ≥ 0
◮
Any F : ℜ2 → ℜ satisfying the above would be a joint
distribution function.
PS Sastry, IISc, Bangalore, 2020 1/36
Recap: Joint Probability mass function
X ∈ {x1 , x2 , · · · }, Y ∈ {y1 , y2 , · · · }
◮ The joint pmf: fXY (x, y) = P [X = x, Y = y].
◮ The joint pmf satisfies:
◮
◮
A1 P
fXYP
(x, y) ≥ 0, ∀x, y and non-zero only for xi , yj pairs
A2
i
j fXY (xi , yj ) = 1
Given the joint pmf, we can get the joint df as
X X
FXY (x, y) =
fXY (xi , yj )
i:
xi ≤x
j:
yj ≤y
Any fXY : ℜ2 → [0, 1] satisfying A1 and A2 above is a
joint pmf. (The FXY satisfies all properties of df).
◮ Given the joint pmf, we can (in principle) compute the
probability of any event involving the two discrete random
variables.
X
fXY (xi , yj )
P [(X, Y ) ∈ B] =
◮
Recap joint density
◮
−∞
◮
◮
Marginal distribution functions of X, Y are
FY (y) = FXY (∞, y)
X, Y discrete with joint pmf fXY . The marginal pmfs are
X
X
fX (x) =
fXY (x, y); fY (y) =
fXY (x, y)
y
◮
x
If X, Y have joint pdf fXY then the marginal pdf are
Z ∞
Z ∞
fX (x) =
fXY (x, y) dy fY (y) =
fXY (x, y) dx
−∞
1. fXY (x, y) ≥ 0, ∀x, y
R∞ R∞
2. −∞ −∞ fXY (x′ , y ′ ) dy ′ dx′ = 1
y1
and, in general,
P [(X, Y ) ∈ B] =
Z
B
fXY (x, y) dx dy, ∀B ∈ B 2
PS Sastry, IISc, Bangalore, 2020 3/36
Recap Conditional distribution
FX (x) = FXY (x, ∞);
◮
The joint density fXY satisfies the following
x1
PS Sastry, IISc, Bangalore, 2020 2/36
Recap Marginals
−∞
Any function fXY : ℜ2 → ℜ satisfying the above two is a
joint density function. (Then the above FXY can be
shown to be a joint df).
◮ We also have
Z x 2 Z y2
fXY dy dx
P [x1 ≤ X ≤ x2 , y1 ≤ Y ≤ y2 ] =
◮
i,j:
(xi ,yj )∈B
Two cont rv X, Y have a joint density fXY if
Z x Z y
fXY (x′ , y ′ ) dy ′ dx′ , ∀x, y
FXY (x, y) =
◮
Let: X ∈ {x1 , x2 , · · · } and Y ∈ {y1 , y2 , · · · }. Then
FX|Y (x|yj ) = P [X ≤ x|Y = yj ] =
P [X ≤ x, Y = yj ]
P [Y = yj ]
(We define FX|Y (x|y) only when y = yj for some j).
◮ For each yj , FX|Y (x|yj ) is a df of a discrete rv in x.
◮ The pmf corresponding to this df is called conditional pmf
fX|Y (xi |yj ) = P [X = xi |Y = yj ] =
fXY (xi , yj )
fY (yj )
−∞
PS Sastry, IISc, Bangalore, 2020 4/36
PS Sastry, IISc, Bangalore, 2020 5/36
Recap Bayes rule for discrete rv’s
◮
The conditional mass function is
fXY (xi , yj )
fY (yj )
This gives us the useful identity
fXY (xi , yj ) = fX|Y (xi |yj )fY (yj )
◮
fY |X (k|1) = P [Y = k|X = 1] =
This gives us the total probability rule for rv’s
X
X
fX (xi ) =
fXY (xi , yj ) =
fX|Y (xi |yj )fY (yj )
j
◮
Consider the random experiment of tossing a coin n
times.
◮ Let X denote the number of heads and let Y denote the
toss number on which the first head comes.
◮ For 1 ≤ k ≤ n
◮
fX|Y (xi |yj ) = P [X = xi |Y = yj ] =
◮
Example: Conditional pmf
p(1 − p)n−1
n C p(1 − p)n−1
1
1
=
n
=
j
Also gives us Bayes rule for discrete rv
fY |X (yj |xi )fX (xi )
fX|Y (xi |yj ) = P
i fY |X (yj |xi )fX (xi )
P [Y = k, X = 1]
P [X = 1]
◮
Given there is only one head, it is equally likely to occur
on any toss.
PS Sastry, IISc, Bangalore, 2020 6/36
PS Sastry, IISc, Bangalore, 2020 7/36
◮
FX|Y (x|y) = lim P [X ≤ x|Y ∈ [y, y + δ]]
Let X, Y be continuous rv’s with joint density, fXY .
◮ We once again want to define conditional df
δ→0
◮
P [X ≤ x, Y ∈ [y, y + δ]
δ→0
P [Y ∈ [y, y + δ]]
R x R y+δ
fXY (x′ , y ′ ) dy ′ dx′
−∞ y
= lim
R y+δ
δ→0
fY (y ′ ) dy ′
y
Rx
f (x′ , y) δ dx′
−∞ XY
= lim
δ→0
fY (y) δ
Z x
fXY (x′ , y) ′
dx
=
fY (y)
−∞
= lim
FX|Y (x|y) = P [X ≤ x|Y = y]
But the conditioning event, [Y = y] has zero probability.
◮ Hence we define conditional df as follows
◮
FX|Y (x|y) = lim P [X ≤ x|Y ∈ [y, y + δ]]
δ→0
This is well defined if the limit exists.
◮ The limit exists for all y where fY (y) > 0 (and for all x)
The conditional df is given by (assuming fY (y) > 0)
◮
◮
We define conditional density of X given Y as
fX|Y (x|y) =
PS Sastry, IISc, Bangalore, 2020 8/36
fXY (x, y)
fY (y)
PS Sastry, IISc, Bangalore, 2020 9/36
Let X, Y have joint density fXY .
◮ The conditional df of X given Y is
Example
◮
FX|Y (x|y) = lim P [X ≤ x|Y ∈ [y, y + δ]]
δ→0
◮
This exists if fY (y) > 0 and then it has a density:
Z x
FX|Y (x|y) =
fX|Y (x′ |y) dx′
−∞
◮
This conditional density is given by
fX|Y (x|y) =
◮
fXY (x, y)
fY (y)
fXY (x, y) = 2, 0 < x < y < 1
◮
We saw that the marginal densities are
fX (x) = 2(1 − x), 0 < x < 1;
fY (y) = 2y, 0 < y < 1
Hence the conditional densities are given by
fXY (x, y)
1
fX|Y (x|y) =
= , 0<x<y<1
fY (y)
y
1
fXY (x, y)
=
, 0<x<y<1
fY |X (y|x) =
fX (x)
1−x
◮ We can see this intuitively like this
◮
We (once again) have the useful identity
y
fXY (x, y) = fX|Y (x|y) fY (y) = fY |X (y|x)fX (x)
1.0
0.5
PS Sastry, IISc, Bangalore, 2020 10/36
0.5
1.0
x
PS Sastry, IISc, Bangalore, 2020 11/36
Example
Let X be uniform over (0, 1) and let Y be uniform over
0 to X. Find the density of Y .
◮ What we are given is
1
fX (x) = 1, 0 < x < 1; fY |X (y|x) = , 0 < y < x < 1
x
◮ Hence the joint density is:
fXY (x, y) = x1 , 0 < y < x < 1.
◮ Hence the density of Y is
Z 1
Z ∞
1
fXY (x, y) dx =
fY (y) =
dx = − ln(y), 0 < y < 1
y x
−∞
◮
The identity fXY (x, y) = fX|Y (x|y)fY (y) can be used to
specify the joint density of two continuous rv’s
◮ We can specify the marginal density of one and the
conditional density of the other given the first.
◮ This may actually be the model of how the the rv’s are
generated.
◮
◮
PS Sastry, IISc, Bangalore, 2020 12/36
We can verify it to be a density
Z 1
Z 1
1
1
y dy = 1
ln(y) dy = −y ln(y)|0 +
−
y
0
0
PS Sastry, IISc, Bangalore, 2020 13/36
◮
We have the identity
fXY (x, y) = fX|Y (x|y) fY (y)
◮
◮
By integrating both sides
Z ∞
Z ∞
fXY (x, y) dy =
fX (x) =
fX|Y (x|y) fY (y) dy
−∞
We have the identity
fXY (x, y) = fX|Y (x|y) fY (y) = fY |X (y|x)fX (x)
−∞
This is a continuous analogue of total probability rule.
◮ But note that, since X is continuous rv, fX (x) is NOT
P [X = x]
◮ In case of discrete rv, the mass function value fX (x) is
equal to P [X = x] and we had
X
fX (x) =
fX|Y (x|y)fY (y)
◮
◮
This gives rise to Bayes rule for continuous rv
fY |X (y|x)fX (x)
fY (y)
fY |X (y|x)fX (x)
= R∞
f (y|x)fX (x) dx
−∞ Y |X
fX|Y (x|y) =
y
It is as if one can simply replace pmf by pdf and
summation by integration!!
◮ While often that gives the right result, one needs to be
very careful
◮
◮
This is essentially identical to Bayes rule for discrete rv’s.
We have essentially put the pdf wherever there was pmf
PS Sastry, IISc, Bangalore, 2020 15/36
PS Sastry, IISc, Bangalore, 2020 14/36
◮
To recap, we started by defining conditional distribution
function.
FX|Y (x|y) = P [X ≤ x|Y = y]
When X, Y are discrete, we define this only for y = yj .
That is, we define it only for all values that Y can take.
◮ When X, Y have joint density, we defined it by
Now, let X be a continuous rv and let Y be discrete rv.
◮ We can define FX|Y as
◮
FX|Y (x|y) = P [X ≤ x|Y = y]
◮
FX|Y (x|y) = lim P [X ≤ x|Y ∈ [y, y + δ]]
δ→0
This limit exists and FX|Y is well defined if fY (y) > 0.
That is, essentially again for all values that Y can take.
◮ In the discrete case, we define fX|Y as the pmf
corresponding to FX|Y . This conditional pmf can also be
defined as a conditional probability
◮ In the continuous case fX|Y is the density corresponding
to FX|Y .
◮ In both cases we have: fXY (x, y) = fX|Y (x|y)fY (y)
◮ This gives total probability rule and Bayes rule for random
variables
PS Sastry, IISc, Bangalore, 2020 16/36
This is well defined for all values that y takes. (We
consider only those y)
◮ Since X is continuous rv, this df would have a density
Z x
FX|Y (x|y) =
fX|Y (x′ |y) dx′
−∞
◮
Hence we can write
P [X ≤ x, Y = y] = FX|Y (x|y)P [Y = y]
Z x
=
fX|Y (x′ |y) fY (y) dx′
−∞
PS Sastry, IISc, Bangalore, 2020 17/36
◮
We now get
FX (x) = P [X ≤ x] =
=
=
X
y
P [X ≤ x, Y = y]
X Z x
fX|Y (x′ |y) fY (y) dx′
Z x X
fX|Y (x′ |y) fY (y) dx′
y
−∞
◮
When X, Y are discrete we have
X
X
P [X = x|Y = y]P [Y = y]
fX|Y (x|y)fY (y) (P [X = x] =
fX (x) =
◮
−∞
y
This gives us
fX (x) =
X
y
y
When X is continuous and Y is discrete, we defined
fX|Y (x|y) to be the density corresponding to
FX|Y (x|y) = P [X ≤ x|Y = y]
◮ Then we once again get
X
fX (x) =
fX|Y (x|y)fY (y)
◮
y
fX|Y (x|y)fY (y)
y
◮
This is another version of total probability rule.
Earlier we derived this when X, Y are discrete.
◮ The formula is true even when X is continuous
Only difference is we need to take fX as the density of X.
◮
Now, fX is density (and not a mass function).
Suppose Y ∈ {1, 2, 3} and fY (i) = λi ; let
fX|Y (x|i) = fi (x)
◮
fX (x) = λ1 f1 (x) + λ2 f2 (x) + λ3 f3 (x)
Called a mixture density model
PS Sastry, IISc, Bangalore, 2020 18/36
◮
Continuing with X continuous rv and Y discrete. We
have
Z x
FX|Y (x|y) = P [X ≤ x|Y = y] =
fX|Y (x′ |y) dx′
PS Sastry, IISc, Bangalore, 2020 19/36
Continuing with X continuous rv and Y discrete
◮ Can we define fY |X (y|x)?
◮ Since Y is discrete, this (conditional) mass function is
◮
fY |X (y|x) = P [Y = y|X = x]
−∞
◮
But the conditioning event has zero prob
We now know how to handle it
We also have
P [X ≤ x, Y = y] =
◮
Z x
−∞
fY |X (y|x) = lim P [Y = y|X ∈ [x, x + δ]]
fX|Y (x′ |y) fY (y) dx′
δ→0
◮
Hence we can define a ‘joint density’
fXY (x, y) = fX|Y (x|y)fY (y)
This is a kind of mixed density and mass function.
◮ We will not be using such ‘joint densities’ here
For simplifying this we note the following:
Z x
P [X ≤ x, Y = y] =
fX|Y (x′ |y) fY (y) dx′
−∞
◮
PS Sastry, IISc, Bangalore, 2020 20/36
⇒ P [X ∈ [x, x+δ], Y = y] =
Z x+δ
x
fX|Y (x′ |y) fY (y) dx′
PS Sastry, IISc, Bangalore, 2020 21/36
First let us look at the total probability rule possibilities
◮ When X is continuous rv and Y is discrete rv, we derived
◮
◮
We have
fY |X (y|x) = lim P [Y = y|X ∈ [x, x + δ]]
fY |X (y|x)fX (x) = fX|Y (x|y) fY (y)
δ→0
P [Y = y, X ∈ [x, x + δ]]
δ→0
P [X ∈ [x, x + δ]]
R x+δ
fX|Y (x′ |y) fY (y) dx′
x
= lim
R x+δ
δ→0
fX (x′ ) dx′
x
fX|Y (x|y)δ fY (y)
= lim
δ→0
fX (x) δ
fX|Y (x|y) fY (y)
=
fX (x)
= lim
◮
This gives us further versions of total probability rule and
Bayes rule.
Note that fY is mass fn, fX is density and so on.
◮ Since fX|Y is a density (corresponding to FX|Y ),
Z ∞
fX|Y (x|y) dx = 1
−∞
◮
Hence we get
fY (y) =
Z ∞
−∞
◮
fY |X (y|x)fX (x) dx
Earlier we derived the same formula when X, Y have a
joint density.
PS Sastry, IISc, Bangalore, 2020 22/36
PS Sastry, IISc, Bangalore, 2020 23/36
◮
◮
Let us review all the total probability formulas
X
1. fX (x) =
fX|Y (x|y)fY (y)
y
We first derived this when X, Y are discrete.
◮ But now we proved this holds when Y is discrete
If X is continuous the fX , fX|Y are densities; If X is also
discrete they are mass functions
Z ∞
2. fY (y) =
fY |X (y|x)fX (x) dx
When X is continuous rv and Y is discrete rv, we derived
fY |X (y|x)fX (x) = fX|Y (x|y) fY (y)
◮
This once again gives rise to Bayes rule:
◮
−∞
◮
We first proved it when X, Y have a joint density
We now know it holds also when X is cont and Y is
discrete. In that case fY is a mass function
PS Sastry, IISc, Bangalore, 2020 24/36
fY |X (y|x) =
fY |X (y|x)fX (x)
fX|Y (x|y) fY (y)
fX|Y (x|y) =
fX (x)
fY (y)
Earlier we showed this hold when X, Y are both discrete
or both continuous.
◮ Thus Bayes rule holds in all four possible scenarios
◮ Only difference is we need to interpret fX or fX|Y as
mass functions when X is discrete and as densities when
X is a continuous rv
◮ In general, one refers to these always as densities since
the actual meaning would be clear from context.
◮
PS Sastry, IISc, Bangalore, 2020 25/36
Example
We need fX|Y . What does our model say?
◮ fX|Y (x|1) is Gaussian with mean 5 and variance σ 2 and
fX|Y (x|0) is Gaussian with mean zero and variance σ 2
◮
Consider a communication system. The transmitter puts
out 0 or 5 volts for the bits of 0 and 1, and, volage
measured by the receiver is the sent voltage plus noise
added by the channel.
◮ We assume noise has Gaussian density with mean zero
and variance σ 2 .
◮ We may want the probability that the sent bit is 1 when
measured voltage at the receiver is x to decide what is
sent.
◮ Let X be the measured voltage and let Y be sent bit.
◮ We want to calculate fY |X (1|x).
◮ We want to use the Bayes rule to calculate this
◮
P [Y = 1|X = x] = fY |X (1|x) =
fX|Y (x|1) fY (1)
fX (x)
We need fY (1), fY (0). Let us take them to be same.
◮ In practice we only want to know whether
fY |X (1|x) > fY |X (0|x)
◮ Then we do not need to calculate fX (x).
We only need ratio of fY |X (1|x) and fY |X (0|x).
◮
PS Sastry, IISc, Bangalore, 2020 26/36
◮
PS Sastry, IISc, Bangalore, 2020 27/36
The ratio of the two probabilities is
fX|Y (x|1) fY (1)
fY |X (1|x)
=
fY |X (0|x)
fX|Y (x|0) fY (0)
=
1
2
√1 e− 2σ2 (x−5)
σ 2π
1
2
√1 e− 2σ2 (x−0)
σ 2π
−0.5σ −2 (x2 −10x+25−x2 )
We did not calculate fX (x) in the above.
◮ We can calculate it if we want.
◮ Using total probability rule
X
fX (x) =
fX|Y (x|y)fY (y)
◮
y
= e
We are only interested in whether the above is greater
than 1 or not.
◮ The ratio is greater than 1 if 10x > 25 or x > 2.5
◮ So, if X > 2.5 we will conclude bit 1 is sent. Intuitively
obvious!
= fX|Y (x|1)fY (1) + fX|Y (x|0)fY (0)
(x−5)2
x2
1 1
1 1
−
√
√ e− 2σ2
e 2σ2 +
=
2 σ 2π
2 σ 2π
◮
PS Sastry, IISc, Bangalore, 2020 28/36
◮
It is a mixture density
PS Sastry, IISc, Bangalore, 2020 29/36
As we saw, given the joint distribution we can calculate
all the marginals.
◮ However, there can be many joint distributions with the
same marginals.
◮ Let F1 , F2 be one dimensional df’s of continuous rv’s with
f1 , f2 being the corresponding densities.
Define a function f : ℜ2 → ℜ by
◮
f (x, y) = f1 (x)f2 (y) [1 + α(2F1 (x) − 1)(2F2 (y) − 1)]
where α ∈ (−1, 1).
◮ First note that f (x, y) ≥ 0, ∀α ∈ (−1, 1).
For different α we get different functions.
◮ We first show that f (x, y) is a joint density.
◮ For this, we note the following
∞
Z ∞
1
(F1 (x))2
=
f1 (x) F1 (x) dx =
2
2
−∞
f (x, y) = f1 (x)f2 (y) [1 + α(2F1 (x) − 1)(2F2 (y) − 1)]
Z ∞Z ∞
−∞
Z ∞
Z ∞
f (x, y) dx dy =
f1 (x) dx
f2 (y) dy
−∞
−∞
Z ∞
Z ∞
+α
(2f1 (x)F1 (x) − f1 (x)) dx
(2f2 (y)F2 (y) − f2 (y))
−∞
−∞
−∞
= 1
R∞
because 2 −∞ f1 (x) F1 (x) dx = 1. This also shows
Z ∞
f (x, y)dx = f2 (y);
−∞
Z ∞
f (x, y)dy = f1 (x)
−∞
−∞
PS Sastry, IISc, Bangalore, 2020 30/36
PS Sastry, IISc, Bangalore, 2020 31/36
Independent Random Variables
Two random variable X, Y are said to be independent if
for all Borel sets B1 , B2 , the events [X ∈ B1 ] and
[Y ∈ B2 ] are independent.
◮ If X, Y are independent then
◮
Thus infinitely many joint distributions can all have the
same marginals.
◮ So, in general, the marginals cannot determine the joint
distribution.
◮ An important special case where this is possible is that of
independent random variables
◮
P [X ∈ B1 , Y ∈ B2 ] = P [X ∈ B1 ] P [Y ∈ B2 ], ∀B1 , B2 ∈ B
◮
In particular
FXY (x, y) = P [X ≤ x, Y ≤ y] = P [X ≤ x]P [Y ≤ y] = FX (x) FY (y)
◮
PS Sastry, IISc, Bangalore, 2020 32/36
Theorem: X, Y are independent if and only if
FXY (x, y) = FX (x)FY (y).
PS Sastry, IISc, Bangalore, 2020 33/36
◮
◮
Suppose X, Y are independent discrete rv’s
fXY (x, y) = P [X = x, Y = y] = P [X = x]P [Y = y] = fX (x)fY (y)
The joint mass function is a product of marginals.
◮ Suppose fXY (x, y) = fX (x)fY (y). Then
X
X
FXY (x, y) =
fXY (xi , yj ) =
fX (xi )fY (yj )
xi ≤x,yj ≤y
=
X
xi ≤x
◮
fX (xi )
xi ≤x,yj ≤y
X
fY (yj ) = FX (x)FY (y)
yj ≤y
So, X, Y are independent if and only if
fXY (x, y) = fX (x)fY (y)
Let X, Y be independent continuous rv
Z y
Z x
′
′
fY (y ′ ) dy ′
fX (x ) dx
FXY (x, y) = FX (x)FY (y) =
−∞
−∞
Z y Z x
(fX (x′ )fY (y ′ )) dx′ dy ′
=
−∞
−∞
This implies joint density is product of marginals.
◮ Now, suppose fXY (x, y) = fX (x)fY (y)
Z y Z x
fXY (x′ , y ′ ) dx′ dy ′
FXY (x, y) =
−∞
Z−∞
y Z x
fX (x′ )fY (y ′ ) dx′ dy ′
=
−∞
Z−∞
Z y
x
′
′
=
fX (x ) dx
fY (y ′ ) dy ′ = FX (x)FY (y)
◮
−∞
◮
−∞
So, X, Y are independent if and only if
fXY (x, y) = fX (x)fY (y)
PS Sastry, IISc, Bangalore, 2020 34/36
PS Sastry, IISc, Bangalore, 2020 35/36
Recap: Joint Distribution Function
◮
Let X, Y be independent.
◮ Then P [X ∈ B1 |Y ∈ B2 ] = P [X ∈ B1 ].
◮ Hence, we get FX|Y (x|y) = FX (x).
◮ This also implies fX|Y (x|y) = fX (x).
◮ This is true for all the four possibilities of X, Y being
continuous/discrete.
Given X, Y rv’s on same probability space, joint
distribution function: FXY : ℜ2 → ℜ
FXY (x, y) = P [X ≤ x, Y ≤ y]
◮
◮
It satisfies
1. FXY (−∞, y) = FXY (x, −∞) = 0, ∀x, y;
FXY (∞, ∞) = 1
2. FXY is non-decreasing in each of its arguments
3. FXY is right continuous and has left-hand limits in each
of its arguments
4. For all x1 < x2 and y1 < y2
FXY (x2 , y2 )−FXY (x2 , y1 )−FXY (x1 , y2 )+FXY (x1 , y1 ) ≥ 0
◮
PS Sastry, IISc, Bangalore, 2020 36/36
Any F : ℜ2 → ℜ satisfying the above would be a joint
distribution function.
PS Sastry, IISc, Bangalore, 2020 1/41
Recap: Joint Probability mass function
X ∈ {x1 , x2 , · · · }, Y ∈ {y1 , y2 , · · · }
◮ The joint pmf: fXY (x, y) = P [X = x, Y = y].
◮ The joint pmf satisfies:
◮
◮
A1 P
fXYP
(x, y) ≥ 0, ∀x, y and non-zero only for xi , yj pairs
A2
i
j fXY (xi , yj ) = 1
Given the joint pmf, we can get the joint df as
X X
FXY (x, y) =
fXY (xi , yj )
i:
xi ≤x
j:
yj ≤y
Any fXY : ℜ2 → [0, 1] satisfying A1 and A2 above is a
joint pmf. (The FXY satisfies all properties of df).
◮ Given the joint pmf, we can (in principle) compute the
probability of any event involving the two discrete random
variables.
X
fXY (xi , yj )
P [(X, Y ) ∈ B] =
◮
Recap joint density
◮
−∞
◮
◮
y1
P [(X, Y ) ∈ B] =
Z
fXY (x, y) dx dy, ∀B ∈ B 2
B
PS Sastry, IISc, Bangalore, 2020 3/41
Recap Conditional distributions
Marginal distribution functions of X, Y are
FX (x) = FXY (x, ∞);
x
If X, Y have joint pdf fXY then the marginal pdf are
Z ∞
Z ∞
fX (x) =
fXY (x, y) dy; fY (y) =
fXY (x, y) dx
−∞
Let X, Y be continuous or discrete random variables
FY (y) = FXY (∞, y)
X, Y discrete with joint pmf fXY . The marginal pmfs are
X
X
fX (x) =
fXY (x, y); fY (y) =
fXY (x, y)
y
◮
1. fXY (x, y) ≥ 0, ∀x, y
R∞ R∞
2. −∞ −∞ fXY (x′ , y ′ ) dy ′ dx′ = 1
and, in general,
◮
◮
The joint density fXY satisfies the following
x1
PS Sastry, IISc, Bangalore, 2020 2/41
Recap Marginals
−∞
Any function fXY : ℜ2 → ℜ satisfying the above two is a
joint density function. (Then the above FXY can be
shown to be a joint df).
◮ We also have
Z x 2 Z y2
fXY dy dx
P [x1 ≤ X ≤ x2 , y1 ≤ Y ≤ y2 ] =
◮
i,j:
(xi ,yj )∈B
Two cont rv X, Y have a joint density fXY if
Z x Z y
fXY (x′ , y ′ ) dy ′ dx′ , ∀x, y
FXY (x, y) =
−∞
PS Sastry, IISc, Bangalore, 2020 4/41
FX|Y (x|y) = lim P [X ≤ x|Y ∈ [y, y + δ]]
δ→0
(= P [X ≤ x|Y = y] when Y is discrete)
◮ This is well defined for all values that Y can assume.
◮ For each y, FX|Y (x|y) is a df in x.
◮ If X, Y have a joint density or if X is continuous and Y
is discrete, FX|Y would be absolutely continuous and
would have a density.
PS Sastry, IISc, Bangalore, 2020 5/41
Recap Contional density (or mass) fn
◮
Recap
Let X be a discrete random variable. Then
◮
When X, Y are both discrete or they have a joint density
fX|Y (x|y) = lim P [X = x|Y ∈ [y, y + δ] ]
δ→0
fXY (x, y) = fX|Y (x|y)fY (y) = fY |X (y|x)fX (x)
(= P [X = x|Y = y] if Y is discrete)
◮ This will be the mass function corresponding to the df
FX|Y .
◮ Let X be a continuous rv. Then we define conditional
density fX|Y by
Z x
fX|Y (x′ |y) dx′
FX|Y (x|y) =
−∞
This exists if X, Y have a joint density or when Y is
discrete.
◮
When X, Y are discrete or continuous (all four
possibilities)
fX|Y (x|y)fY (y) = fY |X (y|x)fX (x)
Here fX|Y , fX are densities when X is continuous and
mass functions when X is discrete. Similarly for fY |X , fY
◮ The above relation gives rise to the total probability rules
and Bayes rule for rv’s
PS Sastry, IISc, Bangalore, 2020 6/41
Recap
◮
PS Sastry, IISc, Bangalore, 2020 7/41
Recap Bayes rule
If Y is discrete
◮
fX (x) =
X
fX|Y (x|y)fY (y)
When X, Y are continuous or discrete (all four
possibilities)
y
If X is continuous, the fX , fX|Y are densities; If X is also
discrete, they are mass functions
◮ If Y is continuous
Z ∞
fX (x) =
fX|Y (x|y)fY (y) dy
fY |X (y|x)fX (x) = fX|Y (x|y) fY (y)
◮
◮
fY |X (y|x) =
−∞
◮
◮
If X is continuous, the fX , fX|Y are densities; If X is also
discrete, they are mass functions (Where needed we
assume the conditional density exists)
PS Sastry, IISc, Bangalore, 2020 8/41
This gives rise to Bayes rule:
fY |X (y|x)fX (x)
fX|Y (x|y) fY (y)
fX|Y (x|y) =
fX (x)
fY (y)
We need to interpret fX or fX|Y as mass functions when
X is discrete and as densities when X is a continuous
and so on
PS Sastry, IISc, Bangalore, 2020 9/41
Recap Independent Random variables
More than two rv
Everything we have done so far is easily extended to
multiple random variables.
◮ Let X, Y, Z be rv on the same probability space.
◮ We define joint distribution function by
◮
X and Y are said to be independent if events [X ∈ B1 ],
[Y ∈ B2 ] are independent for all B1 , B2 ∈ B.
◮ X and Y are independent if and only if
◮
1. FXY (x, y) = FX (x) FY (y)
2. fXY (x, y) = fX (x) fY (y)
◮
FXY Z (x, y, z) = P [X ≤ x, Y ≤ y, Z ≤ z]
◮
This also implies FX|Y (x|y) = FX (x) and
fX|Y (x|y) = fX (x)
If all three are discrete then the joint mass function is
fXY Z (x, y, z) = P [X = x, Y = y, Z = z]
◮
If they are continuous , they have a joint density if
Z z Z y Z x
FXY Z (x, y, z) =
fXY Z (x′ , y ′ , z ′ ) dx′ dy ′ dz ′
−∞
−∞
−∞
PS Sastry, IISc, Bangalore, 2020 10/41
PS Sastry, IISc, Bangalore, 2020 11/41
◮
◮
◮
Easy to see that joint mass function satisfies
1. fXY Z (x, y, z) ≥ 0 and is non-zero only for countably
many tuples.
P
2.
x,y,z fXY Z (x, y, z) = 1
Similarly the joint density satisfies
FXY (x, y) = FXY Z (x, y, ∞); FZ (z) = FXY Z (∞, ∞, z) and so on
◮
1. fRXY ZR(x, y,
z) ≥ 0
∞ R∞
∞
2. −∞ −∞ −∞ fXY Z (x, y, z) dx dy dz = 1
These are straight-forward generalizations
◮ The properties of joint distribution function such as it
being non-decreasing in each argument etc are easily seen
to hold here too.
◮ Generalizing the special property of the df (relating to
probability of cylindrical sets) is a little more complicated.
(An exercise for you!)
◮
PS Sastry, IISc, Bangalore, 2020 12/41
Now we get many different marginals:
Similarly we get
fY Z (y, z) =
fX (x) =
Z ∞
fXY Z (x, y, z) dx;
−∞
Z ∞Z ∞
fXY Z (x, y, z) dy dz
−∞
−∞
Any marginal is a joint density of a subset of these rv’s
and we obtain it by integrating the (full) joint density
with respect to the remaining variables.
◮ We obtain the marginal mass functions for a subset of the
rv’s also similarly where we sum over the remaining
variables.
◮
PS Sastry, IISc, Bangalore, 2020 13/41
Like in case of marginals, there are different types of
conditional distributions now.
◮ We can always define conditional distribution functions
like
◮
We have to be a little careful in dealing with these when
some random variables are discrete and others are
continuous.
◮ Suppose X is continuous and Y, Z are discrete. We do
not have any joint density or mass function as such.
◮ However, the joint df is always well defined.
◮ Suppose we want marginal joint distribution of X, Y . We
know how to get FXY by marginalization.
◮ Then we can get fX (a density), fY (a mass fn), fX|Y
(conditinal density) and fY |X (conditional mass fn)
◮ With these we can generally calculate most quantities of
interest.
◮
FXY |Z (x, y|z) = P [X ≤ x, Y ≤ y|Z = z]
FX|Y Z (x|y, z) = P [X ≤ x|Y = y, Z = z]
In all such cases, if the conditioning random variables are
continuous, we define the above as a limit.
◮ For example when Z is continuous
◮
FXY |Z (x, y|z) = lim P [X ≤ x, Y ≤ y|Z ∈ [z, z + δ]]
δ→0
PS Sastry, IISc, Bangalore, 2020 14/41
◮
If X, Y, Z are all discrete then, all conditional mass
functions are defined by appropriate conditional
probabilities. For example,
fX|Y Z (x|y, z) = P [X = x|Y = y, Z = z]
◮
PS Sastry, IISc, Bangalore, 2020 15/41
◮
P [Z ≤ z, X ∈ [x, x + δ], Y ∈ [y, y + δ]]
δ→0
P [X ∈ [x, x + δ, Y ∈ [y, y + δ]]
R z R x+δ R y+δ
fXY Z (x′ , y ′ , z ′ ) dy ′ dx′ dz ′
y
−∞ x
= lim
R x+δ R y+δ
δ→0
fXY (x′ , y ′ ) dy ′ dx′
y
x
Z z
fXY Z (x, y, z ′ ) ′
=
dz
fXY (x, y)
−∞
FZ|XY (z|x, y) = lim
Thus the following are obvious
fXY Z (x, y, z)
fZ (z)
fXY Z (x, y, z)
fX|Y Z (x|y, z) =
fY Z (y, z)
fXY Z (x, y, z) = fZ|Y X (z|y, x)fY |X (y|x)fX (x)
fXY |Z (x, y|z) =
◮
For example, the first one above follows from
When X, Y, Z have joint density, all such relations hold
for the appropriate (conditional) densities. For example,
◮
Thus we get
fXY Z (x, y, z) = fZ|XY (z|x, y)fXY (x, y) = fZ|XY (z|x, y)fY |X (y|x)fX (x)
P [X = x, Y = y, Z = z]
P [X = x, Y = y|Z = z] =
P [Z = z]
PS Sastry, IISc, Bangalore, 2020 16/41
PS Sastry, IISc, Bangalore, 2020 17/41
Independence of multiple random variables
We can similarly talk about the joint distribution of any
finite number of rv’s
◮ Let X1 , X2 , · · · , Xn be rv’s on the same probability space.
◮ We denote it as a vector X or X. We can think of it as a
mapping, X : Ω → ℜn .
◮ We can write the joint distribution as
◮
Random variables X1 , X2 , · · · , Xn are said to be
independent if the the events [Xi ∈ Bi ], i = 1, · · · , n are
independent.
(Recall definition of independence of a set of events)
◮ Independence implies that the marginals would determine
the joint distribution.
◮
FX (x) = P [X ≤ x] = P [Xi ≤ xi , i = 1, · · · , n]
We represent by fX (x) the joint density or mass function.
Sometimes we also write it as fX1 ···Xn (x1 , · · · , xn )
◮ We use similar notation for marginal and conditional
distributions
◮
PS Sastry, IISc, Bangalore, 2020 18/41
Example
◮
Example
Let a joint density be given by
fXY Z (x, y, z) = K,
−∞
−∞
◮
Let a joint density be given by
0<z<y<x<1
First let us determine K.
Z ∞Z ∞Z ∞
fXY Z (x, y, z) dz dy dx =
−∞
PS Sastry, IISc, Bangalore, 2020 19/41
fXY Z (x, y, z) = K,
0<z<y<x<1
First let us determine K.
Z 1Z xZ y
0
= K
0
= K
0
Z 1Z x
0
Z 1
0
1
= K
6
K dz dy dx
y dy dx
0
2
x
dx
2
⇒K=6
PS Sastry, IISc, Bangalore, 2020 20/41
Z ∞Z ∞Z ∞
−∞
−∞
−∞
fXY Z (x, y, z) dz dy dx =
Z 1 Z x Z y
x=0
= K
= K
K dz dy dx
z=0
y=0
Z 1 Z x
y dy dx
x=0 y=0
Z 1 2
0
1
= K
6
x
dx
2
⇒K=6
PS Sastry, IISc, Bangalore, 2020 21/41
◮
fXY Z (x, y, z) = K,
fXZ (x, z) = 6(x − z),
0<z<y<x<1
◮
◮
We got the joint density as
Suppose we want to find the (marginal) joint distribution
of X and Z.
Z ∞
fXY Z (x, y, z) dy
fXZ (x, z) =
−∞
Z x
=
K dy, 0 < z < x < 1
z
= 6(x − z),
0<z<x<1
0<z<x<1
We can verify this is a joint density
Z 1Z x
Z ∞Z ∞
6(x − z) dz dx
fXZ (x, z) dz dx =
0
0
−∞ −∞
Z 1
x
z2
x
6x z|0 − 6
=
dx
2 0
0
Z 1
x2
2
=
6x − 6
dx
2
0
1
x3
=1
= 3
3 0
PS Sastry, IISc, Bangalore, 2020 22/41
PS Sastry, IISc, Bangalore, 2020 23/41
Functions of multiple random variables
◮
The joint density of X, Y, Z is
fXY Z (x, y, z) = 6,
◮
0<z<y<x<1
The joint density of X, Z is
fXZ (x, z) = 6(x − z),
Let X, Y be random variables on the same probability
space.
◮ Let g : ℜ2 → ℜ.
◮ Let Z = g(X, Y ). Then Z is a rv
◮ This is analogous to functions of a single rv
◮
0<z<x<1
Z = g(X,Y)
◮
Hence,
g
fY |XZ (y|x, z) =
1
fXY Z (x, y, z)
=
,
fXZ (x, z)
x−z
0<z<y<x<1
Sample Space
[ XY]
R2
R
B’
PS Sastry, IISc, Bangalore, 2020 24/41
B
PS Sastry, IISc, Bangalore, 2020 25/41
◮
let Z = g(X, Y )
◮ We can determine distribution of Z from the joint
distribution of X, Y
◮
FZ (z) = P [Z ≤ z] = P [g(X, Y ) ≤ z]
◮
fZ (z) = P [min(X, Y ) = z]
= P [X = z, Y > z] + P [Y = z, X > z] + P [X = Y = z]
X
X
=
P [X = z, Y = y] +
P [X = x, Y = z]
y>z
x>z
+P [X = z, Y = z]
For example, if X, Y are discrete, then
fZ (z) = P [Z = z] = P [g(X, Y ) = z] =
Let X, Y be discrete rv’s. Let Z = min(X, Y ).
=
X
xi ,yj :
fXY (z, y) +
y>z
fXY (xi , yj )
g(xi ,yj )=z
X
X
fXY (x, z) + fXY (z, z)
x>z
Now suppose X, Y are independent and both of them
have geometric distribution with the same parameter, p.
◮ Such random variables are called independent and
identically distributed or iid random variables.
◮
PS Sastry, IISc, Bangalore, 2020 26/41
◮
Now we can get pmf of Z as (note Z ∈ {1, 2, · · · })
fZ (z) = P [X = z, Y > z] + P [Y = z, X > z] + P [X = Y = z]
= P [X = z]P [Y > z] + P [Y = z]P [X > z] + P [X = z]P [Y = z]
2
= p(1 − p)z−1 (1 − p)z ∗ 2 + p(1 − p)z−1
2
= 2p(1 − p)z−1 (1 − p)z + p(1 − p)z−1
= 2p(1 − p)2z−1 + p2 (1 − p)2z−2
= p(1 − p)2z−2 (2(1 − p) + p)
= (2 − p)p(1 − p)2z−2
PS Sastry, IISc, Bangalore, 2020 28/41
PS Sastry, IISc, Bangalore, 2020 27/41
◮
We can show this is a pmf
∞
X
z=1
fZ (z) =
∞
X
(2 − p)p(1 − p)2z−2
z=1
= (2 − p)p
∞
X
(1 − p)2z−2
z=1
1
1 − (1 − p)2
1
=1
= (2 − p)p
2p − p2
= (2 − p)p
PS Sastry, IISc, Bangalore, 2020 29/41
Let us consider the max and min functions, in general.
◮ Let Z = max(X, Y ). Then we have
◮
FZ (z) =
=
=
=
=
P [Z ≤ z] = P [max(X, Y ) ≤ z]
P [X ≤ z, Y ≤ z]
FXY (z, z)
FX (z)FY (z), if X, Y are independent
(FX (z))2 , if they are iid
Suppose X, Y are iid uniform over (0, 1)
◮ Then we get df and pdf of Z = max(X, Y ) as
◮
FZ (z) = z 2 , 0 < z < 1;
and fZ (z) = 2z, 0 < z < 1
FZ (z) = 0 for z ≤ 0 and FZ (z) = 1 for z ≥ 1 and
fZ (z) = 0 outside (0, 1)
This is true of all random variables.
◮ Suppose X, Y are iid continuous rv. Then density of Z is
◮
fZ (z) = 2FX (z)fX (z)
PS Sastry, IISc, Bangalore, 2020 31/41
PS Sastry, IISc, Bangalore, 2020 30/41
◮
This is easily generalized to n radom variables.
◮ Let Z = max(X1 , · · · , Xn )
FZ (z) = P [Z ≤ z] = P [min(X, Y ) ≤ z]
◮
FZ (z) =
=
=
=
=
◮
P [Z ≤ z] = P [max(X1 , X2 , · · · , Xn ) ≤ z]
P [X1 ≤ z, X2 ≤ z, · · · , Xn ≤ z]
FX1 ···Xn (z, · · · , z)
FX1 (z) · · · FXn (z), if they are independent
(FX (z))n , if they are iid
where we take FX as the common df
It is difficult to write this in terms of joint df of X, Y .
◮ So, we consider the following
◮
P [Z > z] =
=
=
=
=
For example if all Xi are uniform over (0, 1) and ind, then
FZ (z) = z n , 0 < z < 1
P [min(X, Y ) > z]
P [X > z, Y > z]
P [X > z]P [Y > z], using independence
(1 − FX (z))(1 − FY (z))
(1 − FX (z))2 , if they are iid
Hence, FZ (z) = 1 − (1 − FX (z))(1 − FY (z))
◮
PS Sastry, IISc, Bangalore, 2020 32/41
Consider Z = min(X, Y ) and X, Y independent
We can once again find density of Z if X, Y are
continuous
PS Sastry, IISc, Bangalore, 2020 33/41
min fn is also easily generalized to n random variables
◮ Let Z = min(X1 , X2 , · · · , Xn )
◮
Suppose X, Y are iid uniform (0, 1).
◮ Z = min(X, Y )
◮
P [Z > z] =
=
=
=
=
FZ (z) = 1 − (1 − FX (z))2 = 1 − (1 − z)2 , 0 < z < 1
Notice that P [X > z] = (1 − z).
◮ We get the density of Z as
◮
fZ (z) = 2(1 − z), 0 < z < 1
◮
P [min(X1 , X2 , · · · , Xn ) > z]
P [X1 > z, · · · , Xn > z]
P [X1 > z] · · · P [Xn > z], using independence
(1 − FX1 (z)) · · · (1 − FXn (z))
(1 − FX (z))n , if they are iid
Hence, when Xi are iid, the df of Z is
FZ (z) = 1 − (1 − FX (z))n
where FX is the common df
PS Sastry, IISc, Bangalore, 2020 34/41
PS Sastry, IISc, Bangalore, 2020 35/41
Let X, Y ∈ {0, 1, · · · }
◮ Let Z = X + Y . Then we have
◮
Let X, Y be independent
◮ Let Z = max(X, Y ) and W = min(X, Y ).
◮ We want joint distribution function of Z and W .
◮
fZ (z) = P [X + Y = z] =
x+y=z
=
This is difficult to find. But we can easily find
=
◮
Remaining details are left as an exercise for you!!
z
X
k=0
z
X
P [X = k, Y = z − k]
fXY (k, z − k)
k=0
P [max(X, Y ) ≤ z, min(X, Y ) > w]
◮
P [X = x, Y = y]
x,y:
FZW (z, w) = P [Z ≤ z, W ≤ w]
◮
X
Now suppose X, Y are independent. Then
fZ (z) =
z
X
fX (k)fY (z − k)
k=0
PS Sastry, IISc, Bangalore, 2020 36/41
PS Sastry, IISc, Bangalore, 2020 37/41
◮
◮
FZ (z) = P [Z ≤ z] = P [X + Y ≤ z]
Z Z
=
fXY (x, y) dy dx
Now suppose X, Y are independent Poisson with
parameters λ1 , λ2 . And, Z = X + Y .
fZ (z) =
=
z
X
fX (k)fY (z − k)
=
k=0
z
X
{(x,y):x+y≤z}
Z z−x
fXY (x, y) dy dx
−(λ1 +λ2 )
= e−(λ1 +λ2 )
y=−∞
change of variable: t = x + y
dt = dy; when (y = z − x), t = z
Z ∞ Z z
fXY (x, t − x) dt dx
=
x=−∞ t=−∞
Z z Z ∞
=
fXY (x, t − x) dx dt
z
z!
1 X
λk1 λz−k
2
z! k=0 k!(z − k)!
1
(λ1 + λ2 )z
z!
−∞
◮
◮
Z ∞
x=−∞
λk1 −λ1 λz−k
2
e
e−λ2
k!
(z − k)!
k=0
= e
Let X, Y have a joint density fXY . Let Z = X + Y
Z is Poisson with parameter λ1 + λ2
−∞
This gives us
fZ (z) =
Z ∞
fXY (x, z − x) dx
−∞
PS Sastry, IISc, Bangalore, 2020 39/41
PS Sastry, IISc, Bangalore, 2020 38/41
◮
◮
X, Y have joint density fXY . Z = X + Y . Then
Z ∞
fZ (z) =
fXY (x, z − x) dx
fX (x) = λ e−λx , x > 0
◮
−∞
◮
Now suppose X and Y are independent. Then
Z ∞
fZ (z) =
fX (x) fY (z − x) dx
−∞
Density of sum of independent random variables is the
convolution of their densities.
(Convolution)
Let Z = X + Y . Then, density of Z is
Z ∞
fX (x) fY (z − x) dx
fZ (z) =
−∞
Z z
λ e−λx λ e−λ(z−x) dx
=
0
Z z
2 −λz
dx = λ2 z e−λz
= λ e
0
◮
fX+Y = fX ∗ fY
Suppose X, Y are iid exponential rv’s.
Thus, sum of independent exponential random variables
has gamma distribution:
fZ (z) = λz λe−λz , z > 0
PS Sastry, IISc, Bangalore, 2020 40/41
PS Sastry, IISc, Bangalore, 2020 41/41
Recap
◮
Recap
Given X1 , · · · , Xn , random variables on the same
probability space, Z = g(X1 , · · · , Xn ) is a rv
(if g : ℜn → ℜ is borel measurable).
Z = g(X)
X1 , · · · , Xn are said to be independent if events
[X1 ∈ B1 ], · · · , [Xn ∈ Bn ] are independent.
◮ If X1 , · · · , Xn are indepedent and all of them have the
same distribution function then they are said to be iid –
independent and identically distributed
◮
g
n
Sample Space
R
X
R
B’
◮
B
We can determine distribution of Z from the joint
distribution of all Xi
FZ (z) = P [Z ≤ z] = P [g(X1 , · · · , Xn ) ≤ z]
PS Sastry, IISc, Bangalore, 2020 1/43
Recap
◮
PS Sastry, IISc, Bangalore, 2020 2/43
Recap
Let X1 , · · · , Xn be independent and
Z = max(X1 , · · · , Xn )
FZ (z) =
n
Y
◮
FXi (z)
FZ (z) = 1 −
i=1
n
= (F (z)) ,
Let X1 , · · · , Xn be independent and
Z = min(X1 , · · · , Xn )
if they are iid
PS Sastry, IISc, Bangalore, 2020 3/43
n
Y
i=1
(1 − FXi (z))
= 1 − (1 − F (z))n ,
if they are iid
PS Sastry, IISc, Bangalore, 2020 4/43
Recap
Recall problem from last class
Let X, Y be random variables with joint density fXY
◮ Z = X +Y
Z ∞
fXY (t, z − t) dt
fZ (z) =
◮
−∞
◮
If X, Y are independent
Z ∞
fX (t) fY (z − t) dt
fZ (z) =
Let X, Y be independent
◮ Let Z = max(X, Y ) and W = min(X, Y ).
◮ We want joint distribution function of Z and W .
◮
FZW (z, w) = P [Z ≤ z, W ≤ w]
◮
This is difficult to find. But we can easily find
−∞
Density of sum of independent random variables is the
convolution of their densities.
◮ Sum of independent exponential random variables has
gamma density.
P [max(X, Y ) ≤ z, min(X, Y ) > w]
◮
Remaining details are left as an exercise for you!!
PS Sastry, IISc, Bangalore, 2020 5/43
X, Y iid with df F and density f
Z = max(X, Y ) and W = min(X, Y ).
◮ We want joint distribution function of Z and W .
◮ We can use the following
PS Sastry, IISc, Bangalore, 2020 6/43
◮
P [Z ≤ z] = P [Z ≤ z, W ≤ w] + P [Z ≤ z, W > w]
P [Z ≤ z, W > w] = P [w < X, Y ≤ z] = (F (z) − F (w))2
P [Z ≤ z] = P [X ≤ z, Y ≤ z] = (F (z))2
◮
So, we get FZW as
FZW (z, w) = P [Z ≤ z, W ≤ w]
= P [Z ≤ z] − P [Z ≤ z, W > w]
= (F (z))2 − (F (z) − F (w))2
◮
We have P [w < X, Y ≤ z] = (F (z) − F (w))2 only when
w ≤ z.
◮ Otherwise it is zero.
◮ Hence we get FZW as
(F (z))2
if w > z
FZW (z, w) =
2
2
(F (z)) − (F (z) − F (w))
if w ≤ z
◮
◮
We can get joint density of Z, W as
∂2
FZW (z, w)
∂z ∂w
= 2f (z)f (w), w ≤ z
fZW (z, w) =
Is this correct for all values of z, w?
PS Sastry, IISc, Bangalore, 2020 7/43
PS Sastry, IISc, Bangalore, 2020 8/43
Order Statistics
Let X1 , · · · , Xn be iid with density f .
◮ Let X(k) denote the k th smallest of these.
◮ That is, X(k) = gk (X1 , · · · , Xn ) where gk : ℜn → ℜ and
the value of gk (x1 , · · · , xn ) is the k th smallest of the
numbers x1 , · · · , xn .
◮ X(1) = min(X1 , · · · , Xn ),
X(n) = max(X1 , · · · , Xn )
◮ The joint distribution of X(1) , · · · X(n) is called the order
statistics.
◮ We calculated the order statistics for the case n = 2.
◮ It can be shown that
◮
fX(1) ···X(n) (x1 , · · · xn ) = n!
Let X1 , · · · , Xn be iid with df F and density f .
◮ P [Xi ≤ y] = F (y) for any i and y.
◮ Since they are independent, we have, e.g.,
◮
n
Y
i=1
P [X1 ≤ y, X2 > y, X3 ≤ y] = (F (y))2 (1 − F (y))
Hence, probability that exactly k of these n random
variables are less than or equal to y is
n
Ck (F (y))k (1 − F (y))n−k
◮ Now the event [X(k) ≤ y] is same as the event “at least k
of these are less than or equal to y”
◮ Hence we get
◮
FX(k) (y) =
f (xi ), x1 < x2 < · · · < xn
n
X
n
j=k
Cj (F (y))j (1 − F (y))n−j
We can get the density by differentiating this.
PS Sastry, IISc, Bangalore, 2020 10/43
PS Sastry, IISc, Bangalore, 2020 9/43
Distribution of sums of independent rv
Suppose X, Y are iid uniform over (−1, 1).
◮ let Z = X + Y . We want fZ .
◮ The density of X, Y is
◮
fX (x) = 0.5, −1 < x < 1. fY is also same
◮ Note that Z takes values in [−2, 2]
Z ∞
fX (t) fY (z − t) dt
fZ (z) =
◮
−∞
◮
For the integrand to be non-zero we need
−1 < t < 1 ⇒ t < 1, t > −1
◮ −1 < z − t < 1 ⇒
t < z + 1, t > z − 1
◮ Hence we need:
t < min(1, z + 1), t > max(−1, z − 1)
◮ Hence, for z < 0, we need −1 < t < z + 1
and, for z ≥ 0 we need z − 1 < t < 1
◮
◮
◮
fZ is convolution of this density with itself.
PS Sastry, IISc, Bangalore, 2020 11/43
Thus we get
R z+1
−1 14 dt = z+2
4
fZ (z) =
R
1 1 dt = 2−z
4
z−1 4
if − 2 ≤ z < 0
if 2 ≥ z ≥ 0
PS Sastry, IISc, Bangalore, 2020 12/43
◮
Thus, the density of sum of two ind rv’s that are uniform
over (−1, 1) is
z+2
if − 2 < z < 0
4
fZ (z) =
2−z
if 0 < z < 2
4
◮
This is a triangle with vertices (−2, 0), (0, 0.5), (2, 0)
Independence of functions of random variable
Suppose X and Y are independent.
◮ Then g(X) and h(Y ) are independent
◮ This is because [g(X) ∈ B1 ] = [X ∈ B̃1 ] for some Borel
set, B̃1 and similarly [h(Y ) ∈ B2 ] = [Y ∈ B̃2 ]
◮ Hence, [g(X) ∈ B1 ] and [h(Y ) ∈ B2 ] are independent.
◮
PS Sastry, IISc, Bangalore, 2020 13/43
PS Sastry, IISc, Bangalore, 2020 14/43
Independence of functions of random variable
This is easily generalized to functions of multiple random
variables.
◮ If X, Y are vector random variables (or random vectors),
independence implies [X ∈ B1 ] is independent of
[Y ∈ B2 ] for all borel sets B1 , B2 (in appropriate spaces).
◮ Then g(X) would be independent of h(Y).
◮ That is, suppose X1 , · · · , Xm , Y1 , · · · , Yn are
independent.
◮ Then, g(X1 , · · · , Xm ) is independent of h(Y1 , · · · , Yn ).
◮
PS Sastry, IISc, Bangalore, 2020 15/43
Let X1 , X2 , X3 be independent continuous rv
◮ Z = X 1 + X 2 + X3 .
◮ Can we find density of Z?
◮ Let W = X1 + X2 .
◮ Then Z = W + X3 and W and X3 are independent.
◮ Exercise for you: Find density of X1 + X2 + X3 where
X1 , X2 , X3 are iid uniform over (0, 1).
◮
PS Sastry, IISc, Bangalore, 2020 16/43
Sum of independent gamma rv
◮
Z ∞
Gamma density with parameters α > 0 and λ > 0 is given
by
1
λα xα−1 e−λx , x > 0
f (x) =
Γ(α)
We will call this Gamma(α, λ).
◮ The α is called the shape parameter and λ is called the
rate parameter.
◮ For α = 1 this is the exponential density.
◮ Let X ∼ Gamma(α1 , λ), Y ∼ Gamma(α2 , λ).
Suppose X, Y are independent.
◮ Let Z = X + Y . Then Z ∼ Gamma(α1 + α2 , λ).
fZ (z) =
fX (x) fY (z − x) dx
−∞
Z z
1
1
=
λα1 xα1 −1 e−λx
λα2 (z − x)α2 −1 e−λ(z−x) dx
Γ(α1 )
Γ(α2 )
0
α1 +α2 −λz Z z
x α2 −1
x α1 −1 α2 −1 λ
e
=
z
dx
1−
z α1 −1
Γ(α1 )Γ(α2 ) 0
z
z
x
change the variable: t =
(⇒ z −1 dx = dt)
z
Z
λα1 +α2 e−λz α+ α2 −1 1 α1 −1
=
t
(1 − t)α2 −1 dt
z
Γ(α1 )Γ(α2 )
0
1
λα1 +α2 z α1 +α2 −1 e−λz
=
Γ(α1 + α2 )
Because
Z 1
Γ(α1 )Γ(α2 )
tα1 −1 (1 − t)α2 −1 dt =
Γ(α1 + α2 )
0
PS Sastry, IISc, Bangalore, 2020 17/43
PS Sastry, IISc, Bangalore, 2020 18/43
A Calculation Trick
If X, Y are independent gamma random variables then
X + Y also has gamma distribution.
◮ If X ∼ Gamma(α1 , λ), and Y ∼ Gamma(α2 , λ), then
X + Y ∼ Gamma(α1 + α2 , λ).
◮ Exercise for you: Show that sum of independent Gaussian
random variables has gaussian density.
◮ The algebra is a little involved.
◮ First take the two gaussians to be zero-mean.
◮ There is a calculation trick that is often useful with
Gaussian density
◮
PS Sastry, IISc, Bangalore, 2020 19/43
I =
=
=
=
Z ∞
1
√
2πK
Z ∞
1 2
x − 2bx + c
dx
exp −
2K
−∞
Z ∞
1 2
2
exp −
dx
(x − b) + c − b
2K
−∞
Z ∞
(x − b)2
(c − b2 )
exp −
exp −
dx
2K
2K
−∞
(c − b2 ) √
exp −
2πK
2K
because
(x − b)2
exp −
2K
−∞
dx = 1
PS Sastry, IISc, Bangalore, 2020 20/43
◮
Let X1 , · · · , Xn be continuous random variables with
joint density fX1 ···Xn . We define Y1 , · · · Yn by
Y1 = g1 (X1 , · · · , Xn )
We next look at a general theorem that is quite useful in
dealing with functions of multiple random variables.
◮ This result is only for continuous random variables.
◮
···
Yn = gn (X1 , · · · , Xn )
We think of gi as components of g : ℜn → ℜn .
◮ We assume g is continuous with continuous first partials
and is invertible.
◮ Let h be the inverse of g. That is
X1 = h1 (Y1 , · · · , Yn )
◮
···
Xn = hn (Y1 , · · · , Yn )
Each of gi , hi are ℜn → ℜ functions and we can write
them as
yi = gi (x1 , · · · , xn );
···
xi = hi (y1 , · · · , yn )
We denote the partial derivatives of these functions by
∂xi
etc.
∂yj
PS Sastry, IISc, Bangalore, 2020 21/43
◮
Proof of Theorem
The jacobian of the inverse transformation is
J=
∂(x1 , · · · , xn )
=
∂(y1 , · · · , yn )
∂x1
∂y1
∂x1
∂y2
···
∂x1
∂yn
∂x2
∂y1
∂x2
∂y2
···
..
.
∂x2
∂yn
∂xn
∂y1
∂xn
∂y2
···
∂xn
∂yn
..
.
..
.
PS Sastry, IISc, Bangalore, 2020 22/43
◮
FY (y) = FY1 ···Yn (y1 , · · · yn ) = P [Yi ≤ yi , i = 1, · · · , n]
Z
=
fY1 ···Yn (y1′ , · · · , yn′ ) dy1′ · · · dyn′
..
.
We assume that J is non-zero in the range of the
transformation
◮ Theorem: Under the above conditions, we have
Let B = (−∞, y1 ] × · · · × (−∞, yn ] ⊂ ℜn . Then
B
◮
Define
◮
fY1 ···Yn (y1 , · · · , yn ) = |J|fX1 ···Xn (h1 (y1 , · · · , yn ), · · · , hn (y1 , · · · , yn ))
Or, more compactly, fY (y) = |J|fX (h(y))
PS Sastry, IISc, Bangalore, 2020 23/43
g −1 (B) = {(x1 , · · · , xn ) ∈ ℜn : g(x1 , · · · , xn ) ∈ B}
= {(x1 , · · · , xn ) ∈ ℜn : gi (x1 , · · · , xn ) ≤ yi , i = 1 · · · n}
◮
Then we have
FY1 ···Yn (y1 , · · · yn ) = P [gi (X1 , · · · , Xn ) ≤ yi , i = 1, · · · n]
Z
=
fX1 ···Xn (x′1 , · · · , x′n ) dx′1 · · · dx′n
g −1 (B)
PS Sastry, IISc, Bangalore, 2020 24/43
Proof of Theorem
◮
B = (−∞, y1 ] × · · · × (−∞, yn ].
◮ g −1 (B) = {(x1 , · · · , xn ) ∈ ℜn : g(x1 , · · · , xn ) ∈ B}
X1 , · · · Xn are continuous rv with joint density
◮
Y1 = g1 (X1 , · · · , Xn )
◮
FY (y1 , · · · , yn ) = P [gi (X1 , · · · , Xn ) ≤ yi , i = 1, · · · , n]
Z
=
fX1 ···Xn (x′1 , · · · , x′n ) dx′1 · · · dx′n
g −1 (B)
change variables: yi′ = gi (x′1 , · · · , x′n ), i = 1, · · · n
(x′1 , · · · x′n ) ∈ g −1 (B) ⇒ (y1′ , · · · , yn′ ) ∈ B
x′i = hi (y1′ , · · · , yn′ ), dx′1 · · · dx′n = |J|dy1′ · · · dyn′
FY (y1 , · · · , yn ) =
Z
B
fX1 ···Xn (h1 (y′ ), · · · , hn (y′ )) |J|dy1′ · · · dyn′
⇒ fY1 ···Yn (y1 , · · · , yn ) = fX1 ···Xn (h1 (y), · · · , hn (y)) |J|
X1 = h1 (Y1 , · · · , Yn )
J=
◮
1
2
− 12
fY1 ···Yn (y1 , · · · , yn ) = |J|fX1 ···Xn (h1 (y1 , · · · , yn ), · · · , hn (y1 , · · · , yn ))
◮
Called multidimensional change of variable formula
PS Sastry, IISc, Bangalore, 2020 26/43
◮
let Z = X + Y and W = X − Y . Then
Z ∞
1
z+w z−w
fZ (z) =
fXY
,
dw
2
2
−∞ 2
z+w
1
change the variable: t =
⇒ dt = dw
2
2
⇒
w
=
2t
−
z
⇒
z
−
w
=
2z
− 2t
Z ∞
fZ (z) =
fXY (t, z − t) dt
−∞
Z ∞
z−w
fXY (z − t, t) dt, by using t =
=
above
2
−∞
◮
We get same result as earlier. If, X, Y are independent
Z ∞
fX (t) fY (z − t) dt
fZ (z) =
1
2
z+w z−w
,
2
2
Now we get density of Z as
Z ∞
1
z+w z−w
fZ (z) =
dw
fXY
,
2
2
−∞ 2
PS Sastry, IISc, Bangalore, 2020 27/43
Xn = hn (Y1 , · · · , Yn )
We assume the Jacobian of the inverse transform, J, is
non-zero
◮ Then the density of Y is
Hence we get
1
fZW (z, w) = fXY
2
◮
=−
···
◮
◮
1
2
1
2
Yn = gn (X1 , · · · , Xn )
The transformation is continuous with continuous first
partials and is invertible and
PS Sastry, IISc, Bangalore, 2020 25/43
Let X, Y have joint density fXY . Let Z = X + Y .
◮ We want fZ . For the theorem we need two functions.
◮ To use the theorem, we need an invertible transformation
of ℜ2 onto ℜ2 of which one component is x + y.
◮ Take Z = X + Y and W = X − Y . This is an invertible.
◮ X = (Z + W )/2 and Y = (Z − W )/2. The Jacobian is
···
−∞
PS Sastry, IISc, Bangalore, 2020 28/43
◮
◮
let Z = X + Y and W = X − Y . We got
z+w z−w
1
fZW (z, w) = fXY
,
2
2
2
Now we can calculate fW also.
Z ∞
1
z+w z−w
fXY
,
dz
fW (w) =
2
2
−∞ 2
1
z+w
⇒ dt = dz
change the variable: t =
2
2
⇒
z
=
2t
−
w
⇒
z
−
w
=
2t
− 2w
Z ∞
fXY (t, t − w) dt
fW (w) =
−∞
Z ∞
z−w
fXY (t + w, t)dt, using t =
=
above
2
−∞
Example
◮
Let X, Y be iid U (0, 1). Let Z = X − Y .
Z ∞
fX (t) fY (t − z) dt
fZ (z) =
−∞
◮
For the integrand to be non-zero (note Z ∈ (−1, 1))
0 < t < 1 ⇒ t > 0, t < 1
◮ 0 < t − z < 1 ⇒
t > z, t < 1 + z
◮ ⇒
max(0, z) < t < min(1, 1 + z)
◮
◮
◮
Thus, we get density as
R
1+z 1 dt = 1 + z, if − 1 < z < 0
0
fZ (z) =
R
1 1 dt = 1 − z,
0<z<1
z
This we have when X, Y ∼ U (0, 1) iid
fX−Y (z) = 1 − |z|,
−1 < z < 1
PS Sastry, IISc, Bangalore, 2020 29/43
◮
We showed that
Z ∞
Z ∞
fX+Y (z) =
fXY (t, z − t) dt =
fXY (z − t, t) dt
−∞
−∞
Z ∞
Z ∞
fXY (t + w, t)dt
fXY (t, t − w) dt =
fX−Y (w) =
−∞
−∞
◮
Suppose X, Y are discrete. Then we have
X
fX+Y (z) = P [X + Y = z] =
P [X = k, Y = z − k]
PS Sastry, IISc, Bangalore, 2020 30/43
Distribution of product of random variables
We want density of Z = XY .
◮ We need one more function to make an invertible
transformation
◮ A possible choice: Z = XY
W =Y
◮ This is invertible: X = Z/W
Y =W
◮
J=
k
=
X
k
fX−Y (w) = P [X − Y = w] =
=
X
k
◮
fXY (k, z − k)
X
k
P [X = k, Y = k − w]
fXY (k, k − w)
PS Sastry, IISc, Bangalore, 2020 31/43
1
w
−z
w2
0
1
1
w
Hence we get
fZW (z, w) =
◮
=
z 1
fXY
,w
w
w
Thus we get the density of product as
Z ∞
z 1
fXY
fZ (z) =
, w dw
w
−∞ w
PS Sastry, IISc, Bangalore, 2020 32/43
example
◮
◮
◮
Let X, Y be iid U (0, 1). Let Z = XY .
Z ∞
z
1
fX
fY (w) dw
fZ (z) =
w
−∞ w
Suppose X, Y are discrete and Z = XY
X
X
fZ (0) = P [X = 0 or Y = 0] =
fXY (x, 0) +
fXY (0, y
We need: 0 < w < 1 and 0 < wz < 1. Hence
fZ (z) =
Z 1
z
1
dw =
w
Z 1
z
X, Y have joint density and Z = XY . Then
Z ∞
z 1
fXY
.w dw
fZ (z) =
w
−∞ w
x
X
k
fXY
fZ (k) =
P X = ,Y = y =
y
y6=0
y6=0
X
1
dw = − ln(z), 0 < z < 1
w
◮
We wanted density of Z = XY .
◮ We used: Z = XY and W = Y .
◮ We could have used: Z = XY and W = X.
◮ This is invertible: X = W and Y = Z/W .
J=
◮
0
1
1
w
−z
w2
=−
◮
Distributions of quotients
X, Y have joint density and Z = X/Y .
◮ We can take: Z = X/Y
W =Y
◮ This is invertible: X = ZW
Y =W
◮
J=
◮
z
1
fXY w,
fZW (z, w) =
w
w
Z ∞
z
1
dw
fXY w,
fZ (z) =
w
−∞ w
k
, y , k 6= 0
y
PS Sastry, IISc, Bangalore, 2020 34/43
1
w
This gives
We cannot always interchange density and mass
functions!!
PS Sastry, IISc, Bangalore, 2020 33/43
◮
y
w z
0 1
=w
Hence we get
fZW (z, w) = |w| fXY (zw, w)
◮
Thus we get the density of quotient as
Z ∞
fZ (z) =
|w| fXY (zw, w) dw
−∞
The fZ should be same in both cases.
PS Sastry, IISc, Bangalore, 2020 35/43
PS Sastry, IISc, Bangalore, 2020 36/43
example
◮
Let X, Y be iid U (0, 1). Let Z = X/Y .
Note Z ∈ (0, ∞)
Z ∞
fZ (z) =
|w| fX (zw) fY (w) dw
−∞
◮
X, Y have joint density and Z = X/Y
Z ∞
fZ (z) =
|w| fXY (zw, w) dw
−∞
◮
We need 0 < w < 1 and 0 < zw < 1 ⇒ w < 1/z.
◮ So, when z ≤ 1, w goes from 0 to 1; when z > 1, w goes
from 0 to 1/z.
◮ Hence we get density as
R
01 w dw = 21 ,
if 0 < z ≤ 1
fZ (z) =
R 1/z w dw = 1 , 1 < z < ∞
2z 2
0
◮
SupposeX, Y are discrete and Z = X/Y
fZ (z) = P [Z = z] = P [X/Y = z]
X
=
P [X = yz, Y = y]
y
=
X
fXY (yz, y)
y
PS Sastry, IISc, Bangalore, 2020 37/43
We chose: Z = X/Y and W = Y .
◮ We could have taken: Z = X/Y and W = X
◮ The inverse is: X = W and Y = W/Z
◮
J=
◮
0
1
− zw2
1
z
w
=− 2
z
Thus we get the density of quotient as
Z ∞
w
w
fZ (z) =
f
dw
XY w,
2
z
−∞ z
dw
w
put t =
⇒ dt =
, w = tz
z
z
Z
PS Sastry, IISc, Bangalore, 2020 38/43
Exchangeable Random Variables
X1 , X2 , · · · , Xn are said to be exchangeable if their joint
distribution is same as that of any permutation of them.
◮ let (i1 , · · · , in ) be a permutation of (1, 2, · · · , n). Then
joint df of (Xi1 , · · · , Xin ) should be same as that
(X1 , · · · , Xn )
◮ Take n = 3. Suppose FX X X (a, b, c) = g(a, b, c). If they
1 2 3
are exchangeable, then
◮
FX2 X3 X1 (a, b, c) = P [X2 ≤ a, X3 ≤ b, X1 ≤ c]
= P [X1 ≤ c, X2 ≤ a, X3 ≤ b]
= g(c, a, b) = g(a, b, c)
∞
=
−∞
|t|fXY (tz, t) dt
◮
◮
We can show that the density of quotient is same in both
these approches.
PS Sastry, IISc, Bangalore, 2020 39/43
The df or density should be “symmetric” in its variables if
the random variables are exchangeable.
PS Sastry, IISc, Bangalore, 2020 40/43
◮
Consider the density of three random variables
2
f (x, y, z) = (x + y + z),
3
0 < x, y, z < 1
They are exchangeable (because f (x, y, z) = f (y, x, z))
◮ If random variables are exchangeable then they are
identically distributed.
FXY Z (a, ∞, ∞) = FXY Z (∞, ∞, a) ⇒ FX (a) = FZ (a)
◮ The above example shows that exchangeable random
variables need not be independent. The joint density is
not factorizable.
Z 1Z 1
2
2(x + 1)
(x + y + z) dy dz =
3
0 3
0
Expectation of functions of multiple rv
◮
◮
◮
Theorem: Let Z = g(X1 , · · · Xn ) = g(X). Then
Z
g(x) dFX (x)
E[Z] =
ℜn
◮
That is, if they have a joint density, then
Z
g(x) fX (x) dx
E[Z] =
ℜn
◮
Similarly, if all Xi are discrete
X
E[Z] =
g(x) fX (x)
x
So, the joint density is not the product of marginals
PS Sastry, IISc, Bangalore, 2020 41/43
◮
Let Z = X + Y . Let X, Y have joint density fXY
Z ∞Z ∞
E[X + Y ] =
(x + y) fXY (x, y) dx dy
−∞ −∞
Z ∞ Z ∞
=
x
fXY (x, y) dy dx
−∞
−∞
Z ∞ Z ∞
fXY (x, y) dx dy
y
+
−∞
−∞
Z ∞
Z ∞
y fY (y) dy
x fX (x) dx +
=
−∞
−∞
= E[X] + E[Y ]
Expectation is a linear operator.
◮ This is true for all random variables.
PS Sastry, IISc, Bangalore, 2020 42/43
Recap
◮
X1 , · · · Xn are continuous rv with joint density
Y1 = g1 (X1 , · · · , Xn )
◮
···
Yn = gn (X1 , · · · , Xn )
The transformation is continuous with continuous first
partials and is invertible and
X1 = h1 (Y1 , · · · , Yn )
···
Xn = hn (Y1 , · · · , Yn )
We assume the Jacobian of the inverse transform, J, is
non-zero
◮ Then the density of Y is
◮
◮
fY1 ···Yn (y1 , · · · , yn ) = |J|fX1 ···Xn (h1 (y1 , · · · , yn ), · · · , hn (y1 , · · · , yn ))
◮
PS Sastry, IISc, Bangalore, 2020 43/43
Called multidimensional change of variable formula
PS Sastry, IISc, Bangalore, 2020 1/37
Recap
Recap
One can use the theorem to find densities of sum,
difference, product and quotient of random variables.
Z ∞
Z ∞
fX+Y (z) =
fXY (t, z − t) dt =
fXY (z − t, t) dt
−∞
−∞
Z ∞
Z ∞
fXY (t + z, t)dt
fXY (t, t − z) dt =
fX−Y (z) =
−∞
−∞
Z ∞
Z ∞
z z
1
1
, t dt =
fXY
fXY t,
dt
fX∗Y (z) =
t
t
−∞ t
−∞ t
Z ∞
Z ∞
t
t
|t| fXY (zt, t) dt =
fXY t,
f(X/Y ) (z) =
dt
2
z
−∞ z
−∞
◮
X1 , X2 , · · · , Xn are said to be exchangeable if their joint
distribution is same as that of any permutation of them.
◮ If the random variables are exchangeable then the joint
distribution function remains the same on permutation of
arguments.
◮ Exchangeable random variables are identically distributed
but they may not be independent.
◮
PS Sastry, IISc, Bangalore, 2020 3/37
PS Sastry, IISc, Bangalore, 2020 2/37
Recap
We saw E[X + Y ] = E[X] + E[Y ].
◮ Let us calculate Var(X + Y ).
Var(X + Y ) = E ((X + Y ) − E[X + Y ])2
= E ((X − EX) + (Y − EY ))2
= E (X − EX)2 + E (Y − EY )2
+2E [(X − EX)(Y − EY )]
= Var(X) + Var(Y ) + 2Cov(X, Y )
◮
◮
Let Z = g(X1 , · · · Xn ) = g(X). Then
Z
E[Z] =
g(x) dFX (x)
ℜn
◮
For example, if they have a joint density, then
Z
g(x) fX (x) dx
E[Z] =
ℜn
This gives us: E[X + Y ] = E[X] + E[Y ]
◮ In general, E [g1 (X) + g2 (X)] = E [g1 (X] + E [g2 (X)]
◮
PS Sastry, IISc, Bangalore, 2020 4/37
where we define covariance between X, Y as
Cov(X, Y ) = E [(X − EX)(Y − EY )]
PS Sastry, IISc, Bangalore, 2020 5/37
Example
◮
We define covariance between X and Y by
Cov(X, Y ) = E [(X − EX)(Y − EY )]
= E [XY − X(EY ) − Y (EX) + EX EY ]
= E[XY ] − EX EY
◮
Consider the joint density
fXY (x, y) = 2, 0 < x < y < 1
◮
Note that Cov(X, Y ) can be positive or negative
◮ X and Y are said to be uncorrelated if Cov(X, Y ) = 0
◮ If X and Y are uncorrelated then
◮
We want to calculate Cov(X, Y )
Z 1
Z 1Z 1
1
x (1 − x) dx =
x 2 dy dx = 2
EX =
3
0
x
0
EY =
Var(X + Y ) = Var(X) + Var(Y )
◮
0
Note that E[X + Y ] = E[X] + E[Y ] for all random
variables.
E[XY ] =
PS Sastry, IISc, Bangalore, 2020 6/37
◮
Suppose X, Y are independent. Then
Z Z
E[XY ] =
x y fXY (x, y) dx dy
Z Z
=
x y fX (x) fY (y) dx dy
Z
Z
=
xfX (x) dx yfY (y) dy = EX EY
Then, Cov(X, Y ) = E[XY ] − EX EY = 0.
◮ X, Y independent ⇒ X, Y uncorrelated
◮
0
y 2 dx dy = 2
Z 1
y 2 dy =
0
xy 2 dx dy = 2
Z 1
0
y
2
3
1
y2
dy =
2
4
1
Hence, Cov(X, Y ) = E[XY ] − EX EY = 14 − 92 = 36
PS Sastry, IISc, Bangalore, 2020 7/37
Uncorrelated random variables may not be
independent
Suppose X ∼ N (0, 1) Then, EX = EX 3 = 0
◮ Let Y = X 2 Then,
◮
E[XY ] = EX 3 = 0 = EX EY
Thus X, Y are uncorrelated.
◮ Are they independent? No
e.g.,
P [X > 2 |Y < 1] = 0 6= P [X > 2]
◮
◮
PS Sastry, IISc, Bangalore, 2020 8/37
0
Z 1Z y
0
◮
Independent random variables are uncorrelated
Z 1Z y
X, Y are uncorrealted does not imply they are
independent.
PS Sastry, IISc, Bangalore, 2020 9/37
◮
◮
α2 E[X 2 ] + β 2 E[Y 2 ] + 2αβE[XY ] ≥ 0, ∀α, β ∈ ℜ
E[XY ]
Take α = −
E[X 2 ]
(E[XY ])2
(E[XY ])2
2
2
+ β E[Y ] − 2β
≥ 0, ∀β ∈ ℜ
E[X 2 ]
E[X 2 ]
2
2
(E[XY ])2
2 (E[XY ])
⇒ 4
− 4E[Y ]
≤0
E[X 2 ]
E[X 2 ]
We define the correlation coefficient of X, Y by
Cov(X, Y )
ρXY = p
Var(X) Var(Y )
If X, Y are uncorrelated then ρXY = 0.
◮ We will show that |ρXY | ≤ 1
◮ Hence −1 ≤ ρXY ≤ 1, ∀X, Y
◮
We have E [(αX + βY )2 ] ≥ 0, ∀α, β ∈ ℜ
⇒ (E[XY ])2 ≤ E[X 2 ]E[Y 2 ]
PS Sastry, IISc, Bangalore, 2020 10/37
◮
We showed that
(E[XY ])2 ≤ E[X 2 ]E[Y 2 ]
Take X − EX in place of X and Y − EY in place of Y
in the above algebra.
◮ This gives us
PS Sastry, IISc, Bangalore, 2020 11/37
Linear Least Squares Estimation
◮
(E[(X − EX)(Y − EY )])2 ≤ E[(X−EX)2 ]E[(Y −EY )2 ]
⇒ (Cov(X, Y ))2 ≤ Var(X)Var(Y )
◮ Hence we get
!2
Cov(X, Y )
ρ2XY = p
≤1
Var(X)Var(Y )
◮
The equality holds here only if E [(αX + βY )2 ] = 0
Thus,
◮
Suppose we want to approximate Y as an affine function
of X.
◮ We want a, b to minimize E [(Y − (aX + b))2 ]
◮ For a fixed a, what is the b that minimizes
E [((Y − aX) − b)2 ] ?
◮ We know the best b here is:
b = E[Y − aX] = EY − aEX.
◮ So, we want to find the best a to minimize
J(a) = E [(Y − aX − (EY − aEX))2 ]
◮
|ρXY | = 1 only if αX + βY = 0
Correlation coefficient of X, Y is ±1 only when Y is a
linear function of X
PS Sastry, IISc, Bangalore, 2020 12/37
PS Sastry, IISc, Bangalore, 2020 13/37
We want to find a to minimize
J(a) = E (Y − aX − (EY − aEX))2
= E ((Y − EY ) − a(X − EX))2
= E (Y − EY )2 + a2 (X − EX)2 − 2a(Y − EY )(X − EX)
= Var(Y ) + a2 Var(X) − 2aCov(X, Y )
◮
◮
◮
J ∗ = Var(Y ) + a2 Var(X) − 2aCov(X, Y )
2
Cov(X, Y )
Cov(X, Y )
Var(X) − 2
Cov(X, Y )
= Var(Y ) +
Var(X)
Var(X)
(Cov(X, Y ))2
= Var(Y ) −
Var(X)
(Cov(X, Y ))2
= Var(Y ) 1 −
Var(Y ) Var(X)
2
= Var(Y ) 1 − ρXY
So, the optimal a satisfies
2aVar(X) − 2Cov(X, Y ) = 0 ⇒ a =
The final mean square error, say, J ∗ is
Cov(X, Y )
Var(X)
PS Sastry, IISc, Bangalore, 2020 14/37
◮
The best mean-square approximation of Y as a ‘linear’
function of X is
Cov(X, Y )
Cov(X, Y )
X + EY −
EX
Y =
Var(X)
Var(X)
Called the line of regression of Y on X.
◮ If cov(X, Y ) = 0 then this reduces to approximating Y by
a constant, EY .
◮ The final mean square error is
Var(Y ) 1 − ρ2XY
◮
If ρXY = ±1 then the error is zero
◮ If ρXY = 0 the final error is Var(Y )
◮
PS Sastry, IISc, Bangalore, 2020 16/37
PS Sastry, IISc, Bangalore, 2020 15/37
◮
The covariance of X, Y is
Cov(X, Y ) = E[(X−EX) (Y −EY )] = E[XY ]−EX EY
Note that Cov(X, X) = Var(X)
◮ X, Y are called uncorrelated if Cov(X, Y ) = 0.
◮ X, Y independent ⇒ X, Y uncorrelated.
◮ Uncorrelated random variables need not necessarily be
independent
◮ Covariance plays an important role in linear least squares
estimation.
◮ Informally, covariance captures the ‘linear dependence’
between the two random variables.
PS Sastry, IISc, Bangalore, 2020 17/37
Covariance Matrix
Covariance matrix
Let X1 , · · · , Xn be random variables (on the same
probability space)
◮ We represent them as a vector X.
◮ As a notation, all vectors are column vectors:
X = (X1 , · · · , Xn )T
◮ We denote E[X] = (EX1 , · · · , EXn )T
◮ The n × n matrix whose (i, j)th element is Cov(Xi , Xj ) is
called the covariance matrix (or variance-covariance
matrix) of X. Denoted as ΣX or ΣX
Cov(X1 , X1 ) Cov(X1 , X2 ) · · · Cov(X1 , Xn )
Cov(X2 , X1 ) Cov(X2 , X2 ) · · · Cov(X2 , Xn )
ΣX =
..
..
..
..
.
.
.
.
Cov(Xn , X1 ) Cov(Xn , X2 ) · · · Cov(Xn , Xn )
◮
If a = (a1 , · · · , an )T then
a aT is a n × n matrix whose (i, j)th element is ai aj .
◮ Hence we get
ΣX = E (X − EX) (X − EX)T
◮
◮
This is because
(X − EX) (X − EX)T ij = (Xi − EXi )(Xj − EXj )
and (ΣX )ij = E[(Xi − EXi )(Xj − EXj )]
PS Sastry, IISc, Bangalore, 2020 18/37
PS Sastry, IISc, Bangalore, 2020 19/37
ΣX is a real symmetric matrix
◮ It is positive semidefinite.
◮ Let a ∈ ℜn and let Y = aT X.
◮ Then, EY = aT EX. We get variance of Y as
h
2 i
Var(Y ) = E[(Y − EY )2 ] = E aT X − aT EX
h
2 i
T
= E a (X − EX)
= E aT (X − EX) (X − EX)T a
= aT E (X − EX) (X − EX)T a
◮
Recall the following about vectors and matrices
◮ let a, b ∈ ℜn be column vectors. Then
◮
2
T T aT b = aT b
a b = bT a aT b = bT a aT b
◮
Let A be an n × n matrix with elements aij . Then
bT Ab =
n
X
bi bj aij
i,j=1
T
where b = (b1 , · · · , bn )
◮ A is said to be positive semidefinite if bT Ab ≥ 0, ∀b
PS Sastry, IISc, Bangalore, 2020 20/37
= aT ΣX a
This gives aT ΣX a ≥ 0, ∀a
◮ This shows ΣX is positive semidefinite
◮
PS Sastry, IISc, Bangalore, 2020 21/37
P
Y = aT X = i ai Xi – linear combination of Xi ’s.
◮ We know how to find its mean and variance
X
EY = aT EX =
ai EXi ;
◮
◮
aT ΣX a = Var(aT X) ≥ 0
i
Var(Y ) = aT ΣX a =
X
ai aj Cov(Xi , Xj )
i,j
Specifically, by taking all components of a to be 1, we get
!
n
n
n
n X
X
X
X
X
Var
Cov(Xi , Xj ) =
Xi =
Var(Xi )+
Cov(Xi , Xj )
◮
i=1
◮
i,j=1
i=1
i=1 j6=i
Covariance matrix ΣX positive semidefinite because
ΣX would be positive definite if aT ΣX a > 0, ∀a 6= 0
◮ It would fail to be positive definite if Var(aT X) = 0 for
some nonzero a.
◮ Var(Z) = E[(Z − EZ)2 ] = 0 implies Z = EZ, a
constant.
◮ Hence, ΣX fails to be positive definite only if there is a
non-zero linear combination of Xi ’s that is a constant.
◮
If Xi are independent, variance of sum is sum of
variances.
PS Sastry, IISc, Bangalore, 2020 23/37
PS Sastry, IISc, Bangalore, 2020 22/37
Let Y = aT X and assume ||a|| = 1
◮ Y is projection of X along the direction a.
◮ Suppose we want to find a direction along which variance
is maximized
◮ We want to maximize aT ΣX a subject to aT a = 1
◮ The lagrangian is aT ΣX a + η(1 − aT a)
◮ Equating the gradient to zero, we get
◮
Covariance matrix is a real symmetric positive
semidefinite matrix
◮ It have real and non-negative eigen values.
◮ It would have n linearly independent eigen vectors.
◮ These also have some interesting roles.
◮ We consider one simple example.
◮
ΣX a = ηa
So, a should be an eigen vector (with eigen value η).
◮ Then the variance would be aT ΣX a = ηaT a = η
◮ Hence the direction is the eigen vector corresponding to
the highest eigen value.
◮
PS Sastry, IISc, Bangalore, 2020 24/37
PS Sastry, IISc, Bangalore, 2020 25/37
Joint moments
◮
Given two random variables, X, Y
◮ The joint moment of order (i, j) is defined by
◮
◮
mij = E[X i Y j ]
◮
m10 = EX, m01 = EY , m11 = E[XY ] and so on
◮ Similarly joint central moments of order (i, j) are defined
by
sij = E (X − EX)i (Y − EY )j
s10 = s01 = 0, s11 = Cov(X, Y ), s20 = Var(X) and so on
◮ We can similarly define joint moments of multiple random
variables
We can define moment generating function of X, Y by
MXY (s, t) = E esX+tY , s, t ∈ ℜ
This is easily generalized to n random variables
h T i
MX (s) = E es X , s ∈ ℜn
Once again, we can get all the moments by differentiating
the moment generating function
∂
= EXi
MX (s)
∂si
s=0
◮
More generally
∂ m+n
= EXin Xjm
MX (s)
n
m
∂si ∂sj
s=0
PS Sastry, IISc, Bangalore, 2020 27/37
PS Sastry, IISc, Bangalore, 2020 26/37
Conditional Expectation
Let X, Y be discrete random variables (on the same
probability space).
◮ The conditinal expectation of h(X) conditioned on Y is a
function of Y , and its value for any y is defined by
X
E[h(X)|Y = y] =
h(x) fX|Y (x|y)
◮
Suppose X, Y have a joint density fXY
◮ Consider the conditional density fX|Y (x|y). This is a
density in x for every value of y.
◮ Since it is a density, we can use it in an expectation
R
integral: g(x) fX|Y (x|y) dx
◮ This is like expectation of g(X) since fX|Y (x|y) is a
density in x.
◮ However, its value would be a function of y.
◮ That is, this is a kind of expectation that is a function of
Y (and hence is a random variable)
◮ It is called conditional expectation.
◮ We will now define it formally
◮
PS Sastry, IISc, Bangalore, 2020 28/37
x
=
X
h(x) P [X = x|Y = y]
x
◮
What this means is that we define E[h(X)|Y ] = g(Y )
where
X
h(x) fX|Y (x|y)
g(y) =
x
◮
Thus, E[h(X)|Y ] is a random variable
PS Sastry, IISc, Bangalore, 2020 29/37
A simple example
◮
Let X, Y have joint density fXY .
◮ The conditinal expectation of h(X) conditioned on Y is a
function of Y , and its value for any y is defined by
Z ∞
h(x) fX|Y (x|y) dx
E[h(X)|Y = y] =
Consider the joint density
◮
fXY (x, y) = 2, 0 < x < y < 1
◮
We calculated the conditional densities earlier
1
1
fX|Y (x|y) = , fY |X (y|x) =
, 0<x<y<1
y
1−x
◮
Now we can calculate the conditional expectation
Z ∞
x fX|Y (x|y) dx
E[X|Y = y] =
−∞
Z y
y
1 x2
y
1
=
=
x dx =
y
y 2 0 2
0
−∞
◮
Once again, what this means is that E[h(X)|Y ] = g(Y )
where
Z ∞
h(x) fX|Y (x|y) dx
g(y) =
−∞
This gives: E[X|Y ] = Y2
◮ We can show E[Y |X] = 1+X
2
◮
PS Sastry, IISc, Bangalore, 2020 31/37
PS Sastry, IISc, Bangalore, 2020 30/37
The conditional expectation is defined by
X
E[h(X)|Y = y] =
h(x) fX|Y (x|y), X, Y are discrete
◮
E[h(X)|Y = y] =
Zx ∞
h(x); fX|Y (x|y) dx,
◮
X, Y have joint density
E [E[h(X)|Y ]] = E[h(X)]
◮ E[h (X)h (Y )|Y ] = h (Y )E[h (X)|Y ]
1
2
2
1
◮ E[h(X, Y )|Y = y] = E[h(X, y)|Y = y]
−∞
◮
◮
We can actually define E[h(X, Y )|Y ] also as above.
That is,
Z ∞
E[h(X, Y )|Y = y] =
h(x, y) fX|Y (x|y) dx
−∞
◮
Conditional expectation also has some extra properties
which are very important
We will justify each of these.
◮ The last property above follows directly from the
definition.
◮
It has all the properties of expectation:
1. E[a|Y ] = a where a is a constant
2. E[ah1 (X) + bh2 (X)|Y ] = aE[h1 (X)|Y ] + bE[h2 (X)|Y ]
3. h1 (X) ≥ h2 (X) ⇒ E[h1 (X)|Y ] ≥ E[h2 (X)|Y ]
PS Sastry, IISc, Bangalore, 2020 32/37
PS Sastry, IISc, Bangalore, 2020 33/37
◮
Expectation of a conditional expectation is the
unconditional expectation
◮
E [ E[h(X)|Y ] ] = E[h(X)]
◮
Any factor that depends only on the conditioning variable
behaves like a constant inside a conditional expectation
In the above, LHS is expectation of a function of Y .
Let us denote g(Y ) = E[h(X)|Y ]. Then
E [ E[h(X)|Y ] ] = E[g(Y )]
Z ∞
=
g(y) fY (y) dy
−∞
Z ∞ Z ∞
=
h(x) fX|Y (x|y) dx fY (y) dy
−∞
−∞
Z ∞Z ∞
h(x) fXY (x, y) dy dx
=
−∞ −∞
Z ∞
h(x) fX (x) dx
=
E[h1 (X) h2 (Y )|Y ] = h2 (Y )E[h1 (X)|Y ]
◮
Let us denote g(Y ) = E[h1 (X) h2 (Y )|Y ]
g(y) = E[h1 (X) h2 (Y )|Y = y]
Z ∞
h1 (x)h2 (y) fX|Y (x|y) dx
=
−∞
Z ∞
h1 (x) fX|Y (x|y) dx
= h2 (y)
−∞
= h2 (y) E[h1 (X)|Y = y]
−∞
= E[h(X)]
PS Sastry, IISc, Bangalore, 2020 34/37
PS Sastry, IISc, Bangalore, 2020 35/37
A very useful property of conditional expectation is
E[ E[X|Y ] ] = E[X] (Assuming all expectations exist)
◮ We can see this in our earlier example.
◮
fXY (x, y) = 2, 0 < x < y < 1
◮
◮ We calculated: EX = 1 and EY
3
◮ We also showed E[X|Y ] = Y
2
= 32
E[ E[X|Y ] ] = E[X],
∀X, Y
This is a useful technique to find EX.
◮ We can choose a Y that is useful.
◮
1
Y
= = E[X]
E[ E[X|Y ] ] = E
2
3
◮
We have
Similarly
2
1+X
= = E[Y ]
E[ E[Y |X] ] = E
2
3
PS Sastry, IISc, Bangalore, 2020 36/37
PS Sastry, IISc, Bangalore, 2020 37/37
Density of XY
Let X, Y have joint density fXY .
◮ Let Z = XY . We want to find density of XY directly
◮ Let Az = {(x, y) ∈ ℜ2 : xy ≤ z} ⊂ ℜ2 .
◮
FZ (z) = P [XY ≤ z] = P [(X, Y ) ∈ Az ]
Z Z
=
fXY (x, y) dy dx
Az
We need to find limits for integrating over Az
◮ If x > 0, then xy ≤ z ⇒ y ≤ z/x
If x < 0, then xy ≤ z ⇒ y ≥ z/x
◮
FZ (z) =
Z 0 Z ∞
−∞
fXY (x, y) dy dx+
z/x
Z ∞ Z z/x
0
fXY (x, y) dy dx
−∞
PS Sastry, IISc, Bangalore, 2020 1/32
Recap: Covariance
◮
FZ (z) =
Z 0 Z ∞
−∞
z/x
fXY (x, y) dy dx +
Z ∞ Z z/x
0
fXY (x, y) dy dx
−∞
Change variable from y to t using t = xy
y = t/x; dy = x1 dt; y = z/x ⇒ t = z
Z 0 Z −∞
Z ∞Z z
1
t
t
1
FZ (z) =
fXY (x, ) dt dx +
fXY (x, ) dt d
x
x
x
−∞ z
0
−∞ x
Z 0 Z z
Z ∞Z z
1
1
t
t
fXY (x, ) dt dx +
fXY (x, ) d
=
x
x
0
−∞ x
−∞ x
Z−∞
∞ Z z
t
1
dt dx
fXY x,
=
x
−∞ −∞ x
Z z Z ∞
1
t
fXY x,
=
dx dt
x
−∞ −∞ x
R∞
This shows: fZ (z) = −∞ x1 fXY x, xz dx
◮
PS Sastry, IISc, Bangalore, 2020 2/32
Recap: Correlation coefficient
The covariance of X, Y is
Cov(X, Y ) = E[(X−EX) (Y −EY )] = E[XY ]−EX EY
Note that Cov(X, X) = Var(X)
◮ Var(X + Y ) = Var(X) + Var(Y ) + 2Cov(X, Y )
◮ X, Y are called uncorrelated if Cov(X, Y ) = 0.
◮ If X, Y are uncorrelated, Var(X + Y ) = Var(X) + Var(Y )
◮ X, Y independent ⇒ X, Y uncorrelated.
◮ Uncorrelated random variables need not necessarily be
independent
PS Sastry, IISc, Bangalore, 2020 3/32
◮
The correlation coefficient of X, Y is
Cov(X, Y )
ρXY = p
Var(X) Var(Y )
If X, Y are uncorrelated then ρXY = 0.
◮ −1 ≤ ρXY ≤ 1, ∀X, Y
◮ |ρXY | = 1 iff X = aY
◮
PS Sastry, IISc, Bangalore, 2020 4/32
Recap: mean square estimation
◮
Recap: Covariance matrix
The best mean-square approximation of Y as a ‘linear’
function of X is
Cov(X, Y )
Cov(X, Y )
X + EY −
EX
Y =
Var(X)
Var(X)
Called the line of regression of Y on X.
◮ If cov(X, Y ) = 0 then this reduces to approximating Y by
a constant, EY .
◮ The final mean square error is
Var(Y ) 1 − ρ2XY
◮
◮
For a random vector, X = (X1 , · · · , Xn )T , the covariance
matrix is
ΣX = E (X − EX) (X − EX)T
(ΣX )ij = E[(Xi − EXi )(Xj − EXj )]
Var(aT X) = aT ΣX a
◮ ΣX is a real symmetric and positive semidefinite matrix.
◮
If ρXY = ±1 then the error is zero
◮ If ρXY = 0 the final error is Var(Y )
◮
PS Sastry, IISc, Bangalore, 2020 5/32
Recap: Moment generating function
PS Sastry, IISc, Bangalore, 2020 6/32
Recap: Conditional Expectation
The conditional expectation of h(X) conditioned on Y is
defined by
X
h(x) fX|Y (x|y), X, Y are discrete
E[h(X)|Y = y] =
◮
For a pair of rv, the joint moment of order (i, j) is
mij = E[X i Y j ]
◮ The moment generating function of X, Y is
MXY (s, t) = E esX+tY , s, t ∈ ℜ
◮ For n rv, the joint moments are
mi1 i2 ···in = E X1i1 X2i2 · · · Xnin
◮
◮
The moment generating function of X is
h T i
MX (s) = E es X , s ∈ ℜn
E[h(X)|Y = y] =
Zx ∞
h(x) fX|Y (x|y) dx,
X, Y have joint density
−∞
The conditional expectation of h(X) conditioned on Y is
a function of Y : E[h(X)|Y ] = g(Y )
the above specify the value of g(y).
◮ We define E[h(X, Y )|Y ] also as above:
Z ∞
h(x, y) fX|Y (x|y) dx
E[h(X, Y )|Y = y] =
◮
−∞
◮
PS Sastry, IISc, Bangalore, 2020 7/32
If X, Y are independent, E[h(X)|Y ] = E[h(X)]
PS Sastry, IISc, Bangalore, 2020 8/32
Recap: Properties of Conditional Expectation
◮
Expectation of a conditional expectation is the
unconditional expectation
E [ E[h(X)|Y ] ] = E[h(X)]
◮
It has all the properties of expectation:
◮
E[a|Y ] = a where a is a constant
E[ah1 (X) + bh2 (X)|Y ] = aE[h1 (X)|Y ] + bE[h2 (X)|Y ]
◮ h (X) ≥ h (X)
⇒ E[h1 (X)|Y ] ≥ E[h2 (X)|Y ]
1
2
◮
◮
◮
Conditional expectation also has some extra properties
which are very important
E [E[h(X)|Y ]] = E[h(X)]
◮ E[h (X)h (Y )|Y ] = h (Y )E[h (X)|Y ]
1
2
2
1
◮ E[h(X, Y )|Y = y] = E[h(X, y)|Y = y]
◮
In the above, LHS is expectation of a function of Y .
Let us denote g(Y ) = E[h(X)|Y ]. Then
E [ E[h(X)|Y ] ] = E[g(Y )]
Z ∞
=
g(y) fY (y) dy
−∞
Z ∞ Z ∞
=
h(x) fX|Y (x|y) dx fY (y) dy
−∞
−∞
Z ∞Z ∞
h(x) fXY (x, y) dy dx
=
−∞ −∞
Z ∞
h(x) fX (x) dx
=
−∞
= E[h(X)]
PS Sastry, IISc, Bangalore, 2020 10/32
PS Sastry, IISc, Bangalore, 2020 9/32
◮
Any factor that depends only on the conditioning variable
behaves like a constant inside a conditional expectation
Example
◮
Let X, Y be random variables with joint density given by
fXY (x, y) = e−y , 0 < x < y < ∞
E[h1 (X) h2 (Y )|Y ] = h2 (Y )E[h1 (X)|Y ]
◮
◮
Let us denote g(Y ) = E[h1 (X) h2 (Y )|Y ]
g(y) = E[h1 (X) h2 (Y )|Y = y]
Z ∞
h1 (x)h2 (y) fX|Y (x|y) dx
=
−∞
Z ∞
h1 (x) fX|Y (x|y) dx
= h2 (y)
−∞
= h2 (y) E[h1 (X)|Y = y]
PS Sastry, IISc, Bangalore, 2020 11/32
The marginal densities are:
Z ∞
Z ∞
fX (x) =
fXY (x, y) dy =
e−y dy = e−x , x > 0
−∞
x
Z ∞
fXY (x, y) dx =
Z y
EX = 1;
Var(X) = 1;
fY (y) =
−∞
e−y dx = y e−y , y > 0
0
Thus, X is exponential and Y is gamma.
◮ Hence we have
EY = 2;
Var(Y ) = 2
PS Sastry, IISc, Bangalore, 2020 12/32
◮
fXY (x, y) = e−y , 0 < x < y < ∞
Recall the joint and marginal densities
fXY (x, y) = e−y , 0 < x < y < ∞
◮
Let us calculate covariance of X and Y
Z ∞Z ∞
E[XY ] =
xy fXY (x, y) dx dy
−∞ −∞
Z ∞Z y
Z ∞
1 3 −y
−y
y e dy = 3
=
xye dx dy =
2
0
0
0
fX (x) = e−x , x > 0;
◮
The conditional densities will be
fX|Y (x|y) =
Hence, Cov(X, Y ) = E[XY ] − EX EY = 3 − 2 = 1.
◮ ρXY = √1
2
◮
fY |X (y|x) =
e−y
1
fXY (x, y)
= −y = , 0 < x < y < ∞
fY (y)
ye
y
fXY (x, y)
e−y
= −x = e−(y−x) , 0 < x < y < ∞
fX (x)
e
PS Sastry, IISc, Bangalore, 2020 14/32
PS Sastry, IISc, Bangalore, 2020 13/32
◮
The conditional densities are
1
fX|Y (x|y) = ;
y
◮
fY (y) = ye−y , y > 0
fY |X (y|x) = e−(y−x) , 0 < x < y < ∞
We can now calculate the conditional expectation
Z
Z y
1
y
x dx =
E[X|Y = y] = x fX|Y (x|y) dx =
y
2
0
Thus E[X|Y ] = Y2
Z
Z ∞
ye−(y−x) dy
y fY |X (y|x) dy =
Z ∞ x
∞
−y
x
−y
= e −ye x +
e dy
x
= ex xe−x + e−x = 1 + x
E[Y |X = x] =
◮
We got
E[X|Y ] =
◮
Y
;
2
E[Y |X] = 1 + X
Using this we can verify:
EY
Y
2
= = 1 = EX
=
E[ E[X|Y ] ] = E
2
2
2
E[ E[Y |X] ] = E[1 + X] = 1 + 1 = 2 = EY
Thus, E[Y |X] = 1 + X
PS Sastry, IISc, Bangalore, 2020 15/32
PS Sastry, IISc, Bangalore, 2020 16/32
◮
A property of conditional expectation is
Let X be geometric and we want EX.
◮ X is number of tosses needed to get head
◮ Let Y ∈ {0, 1} be outcome of first toss. (1 for head)
◮
E[ E[X|Y ] ] = E[X]
We assume that all three expectations exist.
◮ Very useful in calculating expectations
Z
X
EX =
E[X|Y = y] fY (y) or
E[X|Y = y] fY (y) dy
◮
E[X] =
=
=
=
⇒
y
◮
Can be used to calculate probabilities of events too
⇒
P (A) = E[IA ] = E [ E [IA |Y ] ]
E[ E[X|Y ] ]
E[X|Y = 1] P [Y = 1] + E[X|Y = 0] P [Y = 0]
E[X|Y = 1] p + E[X|Y = 0] (1 − p)
1 p + (1 + EX)(1 − p)
EX (1 − (1 − p)) = p + (1 − p) = 1
1
EX =
p
PS Sastry, IISc, Bangalore, 2020 17/32
◮
P [X = k|Y = 1] = 1 if k = 1 (otherwise it is zero) and
hence E[X|Y = 1] = 1
(
0
if k = 1
P [X = k|Y = 0] =
(1−p)k−1 p
if k ≥ 2
(1−p)
Hence
E[X|Y = 0] =
∞
X
k (1 − p)k−2 p
k=2
=
∞
X
(k − 1) (1 − p)
k−2
k=2
k=2
=
∞
X
∞
X
(1 − p)k−2 p
p+
′
k ′ (1 − p)k −1 p +
k′ =1
= EX + 1
∞
X
′
(1 − p)k −1 p
PS Sastry, IISc, Bangalore, 2020 18/32
Another example
Example: multiple rounds of the party game
◮ Let Rn denote number of rounds when you start with n
people.
◮ We want R̄n = E [Rn ].
◮ We want to use E [Rn ] = E[ E [Rn |Xn ] ]
◮ We need to think of a useful Xn .
◮ Let Xn be the number of people who got their own hat in
the first round with n people.
◮
k′ =1
PS Sastry, IISc, Bangalore, 2020 19/32
PS Sastry, IISc, Bangalore, 2020 20/32
Rn – number of rounds when you start with n people.
◮ Xn – number of people who got their own hat in the first
round
◮
E [Rn ] = E[ E [Rn |Xn ] ]
n
X
E [Rn |Xn = i] P [Xn = i]
=
=
=
i=0
n
X
i=0
n
X
What would be E[Xn ]?
◮ Let Yi ∈ {0, 1} denote whether or not ith person got his
own hat.
◮ We know
◮
E[Yi ] = P [Yi = 1] =
(1 + E [Rn−i ]) P [Xn = i]
P [Xn = i] +
i=0
n
X
Now, Xn =
n
X
Yi and hence EXn =
i=1
E [Rn−i ] P [Xn = i]
i=0
If we can guess value of E[Rn ] then we can prove it using
mathematical induction
Assume: E [Rk ] = k, 1 ≤ k ≤ n − 1
E [Rn ] =
n
X
P [Xn = i] +
i=0
n
X
n
X
E[Yi ] = 1
i=1
Hence a good guess is E[Rn ] = n.
◮ We verify it using mathematical induction. We know
E[R1 ] = 1
◮
PS Sastry, IISc, Bangalore, 2020 22/32
PS Sastry, IISc, Bangalore, 2020 21/32
◮
1
(n − 1)!
=
n!
n
Analysis of Quicksort
E [Rn−i ] P [Xn = i]
i=0
= 1 + E [Rn ] P [Xn = 0] +
= 1 + E [Rn ] P [Xn = 0] +
n
X
i=1
n
X
Given n numbers we want to sort them. Many algorithms.
◮ Complexity – order of the number of comparisons needed
◮ Quicksort: Choose a pivot. Separte numbers into two
parts – less and greater than pivot, do recursively
◮ Separating into two parts takes n − 1 comparisons.
◮ Suppose the two parts contain m and n − m − 1.
Separating both of them into two parts each takes
m + n − m − 1 comparisons
◮ So, final number of comparisons depends on the ‘number
of rounds’
◮
E [Rn−i ] P [Xn = i]
(n − i) P [Xn = i]
i=1
E [Rn ] (1 − P [Xn = 0]) = 1 + n(1 − P [Xn = 0]) −
n
X
i P [Xn = i]
i=1
= 1 + n (1 − P [Xn = 0]) − E[Xn ]
= 1 + n (1 − P [Xn = 0]) − 1
⇒ E [Rn ] = n
PS Sastry, IISc, Bangalore, 2020 23/32
PS Sastry, IISc, Bangalore, 2020 24/32
quicksort details
Average case complexity of quicksort
Given {x1 , · · · , xn }.
◮ Choose first as pivot
{xj1 , xj2 , · · · , xjm }x1 {xk1 , xk2 , · · · , xkn−1−m }
◮
Assume pivot is equally likely to be the smallest or second
smallest or mth smallest.
◮ Mn – number of comparisons.
◮ Define: X = j if pivot is j th smallest
◮ Given X = j we know Mn = (n − 1) + Mj−1 + Mn−j .
◮
◮
Suppose rn is the number of comparisons. If we get
(roughly) equal parts, then
E[Mn ] = E[ E[Mn |X] ] =
rn ≈ n+2rn/2 = n+2(n/2+2rn/4 ) = n+n+4rn/4 = · · · = n log2 (n)
◮
=
n
X
E[(n − 1) + Mj−1 + Mn−j ]
j=1
n(n + 1)
2
If you are lucky, O(n log(n)) comparisons.
◮ If unlucky, in the worst case, O(n2 ) comparisons
◮ Question: ‘on the average’ how many comparisons?
E[Mn |X = j] P [X = j]
j=1
If all the rest go into one part, then
rn = n + rn−1 = n + (n − 1) + rn−2 = · · · =
n
X
n−1
2X
= (n − 1) +
E[Mk ],
n k=1
◮
◮
1
n
(taking M0 = 0)
This is a recurrence relation. (A little complicated to
solve)
PS Sastry, IISc, Bangalore, 2020 25/32
PS Sastry, IISc, Bangalore, 2020 26/32
Least squares estimation
◮
We want to estimate Y as a function of X.
◮ We want an estimate with minimum mean square error.
◮ We want to solve (the min is over all functions g)
◮
◮
We want to show that for all g
E (E[Y | X] − Y )2 ≤ E (g(X) − Y )2
We have
(g(X) − Y )2 =
min E (Y − g(X))2
g
=
Earlier we considered linear functions: g(X) = aX + b
◮ The solution now turns out to be
◮
2
(g(X) − E[Y | X]) + (E[Y | X] − Y )
2
2
g(X) − E[Y | X] + E[Y | X] − Y
+ 2 g(X) − E[Y | X] E[Y | X] − Y
Now we can take expectation on both sides.
◮ We first show that expectation of last term on RHS
above is zero.
◮
∗
g (X) = E[Y |X]
◮
Let us prove this.
PS Sastry, IISc, Bangalore, 2020 27/32
PS Sastry, IISc, Bangalore, 2020 28/32
◮
First consider the last term
E (g(X) − E[Y | X])(E[Y | X] − Y )
= E E (g(X) − E[Y | X])(E[Y | X] − Y ) | X
because E[Z] = E[ E[Z|X] ]
= E (g(X) − E[Y | X]) E (E[Y | X] − Y ) | X
because E[h1 (X)h2 (Z)|X] = h1 (X) E[h2 (Z)|X]
= E (g(X) − E[Y | X]) E (E[Y | X])|X − E{Y | X})
= E (g(X) − E[Y | X]) (E[Y | X] − E[Y | X))
= 0
We earlier got
2
2
g(X) − E[Y | X] + E[Y | X] − Y
+ 2 g(X) − E[Y | X] E[Y | X] − Y
(g(X) − Y )2 =
◮
◮
Hence we get
E (g(X) − Y )2
= E (g(X) − E[Y | X])2
+ E (E[Y | X] − Y )2
≥ E (E[Y | X] − Y )2
Since the above is true for all functions g, we get
g ∗ (X) = E [Y | X]
PS Sastry, IISc, Bangalore, 2020 29/32
Sum of random number of random variables
PS Sastry, IISc, Bangalore, 2020 30/32
◮
We have
E[S|N = n] = E
Let X1 , X2 , · · · be iid rv on the same probability space.
Suppose EXi = µ, ∀i.
◮ Let N be a positive integer valued rv that is independent
of all Xi .
PN
◮ Let S =
i=1 Xi .
◮ We want to calculate ES. We can use
◮
E[S] = E[ E[S|N ] ]
= E
" N
X
" i=1
n
X
Xi | N = n
#
Xi | N = n
#
i=1
=
n
X
i=1
◮
since E[h(X, Y )|Y = y] = E[h(X, y)|Y = y]
n
X
E[Xi ] = nµ
E[Xi | N = n] =
Hence we get
E[S|N ] = N µ
◮
PS Sastry, IISc, Bangalore, 2020 31/32
i=1
⇒ E[S] = E[N ]E[X1 ]
Actually, we did not use independence of Xi .
PS Sastry, IISc, Bangalore, 2020 32/32
Recap: Conditional Expectation
Recap: Properties of Conditional Expectation
The conditional expectation of h(X) conditioned on Y is
defined by
X
h(x) fX|Y (x|y), X, Y are discrete
E[h(X)|Y = y] =
◮
E[h(X)|Y = y] =
Zx ∞
h(x) fX|Y (x|y) dx,
◮
It has all the properties of expectation:
E[a|Y ] = a where a is a constant
E[ah1 (X) + bh2 (X)|Y ] = aE[h1 (X)|Y ] + bE[h2 (X)|Y ]
◮ h (X) ≥ h (X)
⇒ E[h1 (X)|Y ] ≥ E[h2 (X)|Y ]
1
2
◮
◮
X, Y have joint density
−∞
◮
The conditional expectation of h(X) conditioned on Y is
a function of Y : E[h(X)|Y ] = g(Y )
the above specify the value of g(y).
◮ We define E[h(X, Y )|Y ] also as above:
Z ∞
h(x, y) fX|Y (x|y) dx
E[h(X, Y )|Y = y] =
◮
Conditional expectation also has some extra properties
which are very important
E [E[h(X)|Y ]] = E[h(X)]
◮ E[h (X)h (Y )|Y ] = h (Y )E[h (X)|Y ]
1
2
2
1
◮ E[h(X, Y )|Y = y] = E[h(X, y)|Y = y]
◮
−∞
◮
If X, Y are independent, E[h(X)|Y ] = E[h(X)]
PS Sastry, IISc, Bangalore, 2020 1/36
PS Sastry, IISc, Bangalore, 2020 2/36
Sum of random number of random variables
◮
The property of conditional expectation
E[ E[X|Y ] ] = E[X]
Let X1 , X2 , · · · be iid rv on the same probability space.
Suppose EXi = µ, ∀i.
◮ Let N be a positive integer valued rv that is independent
of all Xi .
PN
◮ Let S =
i=1 Xi .
◮ We want to calculate ES. We can use
◮
is very useful in calculating expectations
Z
X
EX =
E[X|Y = y] fY (y) or
E[X|Y = y] fY (y) dy
y
We saw many examples.
◮ Can be used to calculate probabilities of events too
E[S] = E[ E[S|N ] ]
P (A) = E[IA ] = E [ E [IA |Y ] ]
PS Sastry, IISc, Bangalore, 2020 3/36
PS Sastry, IISc, Bangalore, 2020 4/36
◮
We have
Variance of random sum
E[S|N = n] = E
= E
" N
X
" i=1
n
X
i=1
=
n
X
i=1
◮
Xi | N = n
#
Xi | N = n
#
since E[h(X, Y )|Y = y] = E[h(X, y)|Y = y]
n
X
E[Xi ] = nµ
E[Xi | N = n] =
S=
PN
i=1 Xi , Xi iid, ind of N . Want Var(S)
E[S 2 ] = E
◮
i=1
Hence we get
N
X
i=1
Xi
!2
=EE
= E
Actually, we did not use independence of Xi .
n
X
| N
i=1
!2
Xi
PS Sastry, IISc, Bangalore, 2020 6/36
PS Sastry, IISc, Bangalore, 2020 5/36
P
Let Y = ni=1 Xi , Xi iid
◮ Then, Var(Y ) = n Var(X1 )
◮ Hence we have
i=1
Xi
!2
i=1
⇒ E[S] = E[N ]E[X1 ]
N
X
As earlier, we have
!2
!2
n
N
X
X
| N = n
Xi
Xi
| N = n = E
E
i=1
E[S|N ] = N µ
◮
◮
◮
◮
E
N
X
i=1
◮
◮
Using this
Xi
!2
Hence
E
!2
| N = n = E
N
X
i=1
Xi
n
X
i=1
!2
Xi = n Var(X1 )+(nEX1 )2
PN
i=1 Xi
(Xi iid). We got
E[S 2 ] = E[ E[S 2 |N ] ] = EN Var(X1 ) + E[N 2 ](EX1 )2
E[Y 2 ] = Var(Y ) + (EY )2 = n Var(X1 ) + (nEX1 )2
◮
S=
Now we can calculate variance of S as
Var(S) =
=
=
=
E[S 2 ] − (ES)2
EN Var(X1 ) + E[N 2 ](EX1 )2 − (EN EX1 )2
EN Var(X1 ) + (EX1 )2 E[N 2 ] − (EN )2
EN Var(X1 ) + Var(N ) (EX1 )2
| N = N Var(X1 ) + N 2 (EX1 )2
PS Sastry, IISc, Bangalore, 2020 7/36
PS Sastry, IISc, Bangalore, 2020 8/36
Wald’s formula
Another Example
PN
Considered S = i=1 Xi with N independent of all Xi .
With iid Xi , the formula ES = EN EX1 is valid even
under some dependence between N and Xi .
◮ Here is one version of Wald’s formula. We assume
◮
◮
1. E[|X
i |] < ∞, ∀i and EN < ∞.
2. E Xn I[N ≥n] = E[Xn ]P [N ≥ n], ∀n
P
PN
Let SN = N
i=1 Xi and let TN =
i=1 E[Xi ].
◮ Then, ESN = ETN .
If E[Xi ] is same for all i, ESN = EX1 EN .
◮ Assume Xi are iid. Suppose the event [N ≤ n − 1]
depends only on X1 , · · · , Xn−1 .
◮ Then the event [N ≤ n − 1] and hence its complement
[N ≥ n] is independent of Xn and the assumption above
is satisfied.
◮ Such an N is an example of what is called a stopping
time.
◮
We toss a (biased) coin till we get k consecutive heads.
Let Nk denote the number of tosses needed.
◮ N1 would be geometric.
◮ We want E[Nk ]. What rv should we condition on?
◮ Useful rv here is Nk−1
◮
E[Nk | Nk−1 = n] = (n + 1)p + (1 − p)(n + 1 + E[Nk ])
◮
Thus we get the recurrence relation
E[Nk ] = E[ E[Nk | Nk−1 ] ]
= E [ (Nk−1 + 1)p + (1 − p)(Nk−1 + 1 + E[Nk ]) ]
PS Sastry, IISc, Bangalore, 2020 9/36
◮
We have
PS Sastry, IISc, Bangalore, 2020 10/36
◮
E[Nk ] = E [ (Nk−1 + 1)p + (1 − p)(Nk−1 + 1 + E[Nk ]) ]
◮
As mentioned earlier, we can use the conditional
expectation to calculate probabilities of events also.
Denoting Mk = E[Nk ], we get
Mk = pMk−1 + p + (1 − p)Mk−1 + (1 − p) + (1 − p)Mk
pMk = Mk−1 + 1
1
1
Mk =
Mk−1 +
p
p
2
2
1
1
1
1
1
1 1
+ =
Mk−2 +
+
Mk−2 +
=
p p
p
p
p
p
p
k−1
k−1
k
X 1 j
X 1 j
1
1
=
M1 +
=
(M1 = )
p
p
p
p
j=1
j=1
k
1
1
1
−
p
p
1 − pk
=
=
(1 − p)pk
1 − p1
PS Sastry, IISc, Bangalore, 2020 11/36
P (A) = E[IA ] = E [ E [IA |Y ] ]
E[IA |Y = y] = P [IA = 1|Y = y] = P (A|Y = y)
◮
Thus, we get
P (A) = E[IA ] = E [ E [IA |Y ] ]
X
=
P (A|Y = y)P [Y = y],
when Y is discrete
y
=
Z
P (A|Y = y) fY (y) dy,
when Y is continuous
PS Sastry, IISc, Bangalore, 2020 12/36
Example
◮
Let X, Y be independent continuous rv
◮ We want to calculate P [X ≤ Y ]
◮ We can calculate it by integrating joint density over
A = {(x, y) : x ≤ y}
Z Z
P [X ≤ Y ] =
fX (x) fY (y) dx dy
A
Z y
Z ∞
=
fY (y)
fX (x) dx dy
−∞
−∞
Z ∞
FX (y) fY (y) dy
=
◮
We can also use the conditional expectation method here
Z ∞
P [X ≤ Y ] =
P [X ≤ Y | Y = y] fY (y) dy
−∞
Z ∞
P [X ≤ y | Y = y] fY (y) dy
=
−∞
Z ∞
P [X ≤ y] fY (y) dy
=
−∞
Z ∞
FX (y) fY (y) dy
=
−∞
−∞
◮
IF X, Y are iid then P [X < Y ] = 0.5
PS Sastry, IISc, Bangalore, 2020 13/36
PS Sastry, IISc, Bangalore, 2020 14/36
◮
Consider a sequence of bernoullli trials where p,
probability of success, is random.
◮ We first choose p uniformly over (0, 1) and then perform
n tosses.
◮ Let X be the number of heads.
◮ Conditioned on knowledge of p, we know distribution of
X
P [X = k | p] = n Ck pk (1 − p)n−k
◮
◮
0
k!(n − k)!
Ck
(n + 1)!
Z 1
Γ(k + 1)Γ(n − k + 1)
pk (1 − p)n−k dp =
because
Γ(n + 2)
0
1
=
n+1
=
Now we can calculate P [X = k] using the conditioning
argument.
◮
PS Sastry, IISc, Bangalore, 2020 15/36
Assuming p is chosen uniformly from (0, 1), we get
Z
P [X = k] =
[P [X = k | p] f (p) dp
Z 1
n
Ck pk (1 − p)n−k 1 dp
=
n
1
So, we get: P [X = k] = n+1
, k = 0, 1, · · · , n
PS Sastry, IISc, Bangalore, 2020 16/36
Gaussian or Normal distribution
The Gaussian or normal density is given by
(x−µ)2
1
f (x) = √ e− 2σ2 , −∞ < x < ∞
σ 2π
◮ If X has this density, we denote it as X ∼ N (µ, σ 2 ).
We showed EX = µ and Var(X) = σ 2
◮ The density is a ‘bell-shaped’ curve
◮
PS Sastry, IISc, Bangalore, 2020 17/36
Standard Normal rv — X ∼ N (0, 1)
◮ The distribution function of standard normal is
Z x
t2
1
√ e− 2 dt
Φ(x) =
2π
−∞
◮
◮
◮
Suppose X ∼ N (µ, σ 2 )
Z b
(x−µ)2
1
√ e− 2σ2 dx
P [a ≤ X ≤ b] =
a σ 2π
(x − µ)
1
take y =
⇒ dy = dx
σ
σ
Z (b−µ)
σ
y2
1
√ e− 2 dy
=
(a−µ)
2π
σ
a−µ
b−µ
−Φ
= Φ
σ
σ
We can express probability of events involving all Normal
rv using Φ.
PS Sastry, IISc, Bangalore, 2020 19/36
PS Sastry, IISc, Bangalore, 2020 18/36
◮
X ∼ N (0, 1). Then its mgf is
Z ∞
tX x2
1
MX (t) = E e
=
etx √ e− 2 dx
2π
Z ∞ −∞
1
1
2
e− 2 (x −2tx) dx
= √
2π −∞
Z ∞
1
1
2
2
= √
e− 2 ((x−t) −t ) dx
2π −∞
Z ∞
1 2
1
1
2
t
= e2 √
e− 2 (x−t) dx
2π −∞
1 2
= e2t
◮
Now let Y = σX + µ. Then Y ∼ N (µ, σ 2 ).
The mgf of Y is
MY (t) = E et(σX+µ) = etµ E e(tσ)X = etµ MX (tσ)
1 2 2
= e(µt+ 2 t σ )
PS Sastry, IISc, Bangalore, 2020 20/36
Multi-dimensional Gaussian Distribution
◮
◮
We begin by showing the following is a density (when M
is symmetric +ve definite)
The n-dimensional Gaussian density is given by
fX (x) =
1
1
1
2
|Σ| (2π)
n
2
T
e− 2 (x−µ) Σ
−1 (x−
1
T
fY (y) = C e− 2 y M y
µ ) , x ∈ ℜn
µ ∈ ℜn and Σ ∈ ℜn×n are parameters of the density and
Σ is symmetric and positive definite.
◮ If X1 , · · · , Xn have the above joint density, they are said
to be jointly Gaussian.
◮ We denote this by X ∼ N (µ, Σ)
◮ We will now show that this is a joint density function.
◮
R
1 T
Let I = ℜn C e− 2 y M y dy
◮ Since M is real symmetric, there exits an orthogonal
transform, L with L−1 = LT , |L| = 1 and LT M L is
diagonal
◮ Let LT M L = diag(m1 , · · · , mn ).
◮ Then for any z ∈ ℜn ,
X
zT LT M Lz =
mi zi2
◮
i
PS Sastry, IISc, Bangalore, 2020 22/36
PS Sastry, IISc, Bangalore, 2020 21/36
We will first relate m1 · · · mn to the matrix M .
By definition, LT M L = diag(m1 , · · · , mn ). Hence
−1
1
1
= LT M L
= L−1 M −1 (LT )−1 = LT M −1 L
diag
,··· ,
m1
mn
◮
◮
We now get
Z
1 T
I =
C e− 2 y M y dy
◮
ℜn
change variable: z = L−1 y = LT y ⇒ y = Lz
Z
1 T T
e− 2 z L M Lz dz (note that |L| = 1)
= C
n
Zℜ
1 P
2
e− 2 i mi zi dz
= C
= C
= C
ℜn
n
YZ
e
i=1
ℜ
n
Y
r
i=1
− 21 mi zi2
2π
dzi = C
n Z
Y
i=1
1
mi
e
− 21
zi2
1
mi
dzi
ℜ
◮
Since |L| = 1, we get
LT M −1 L = M −1 =
Putting all this together
Z
n r
Y
1
1 T
n
1
C e− 2 y M y dy = C
= C (2π) 2 M −1 2
2π
mi
ℜn
i=1
⇒
PS Sastry, IISc, Bangalore, 2020 23/36
1
m1 · · · mn
1
n
2
(2π) |M −1 |
1
2
Z
1
T
e− 2 y M y dy = 1
ℜn
PS Sastry, IISc, Bangalore, 2020 24/36
◮
◮
We showed the following is a density (taking M
fY (y) =
◮
1
e
fY (y) =
= Σ)
1
(2π) |Σ|
1
2
T
e− 2 (x−µ) Σ
−1 (x−
1
(2π) |Σ|
1
2
T
e− 2 y Σ
−1 y
, y ∈ ℜn
As earlier let M = Σ−1 . Let LT M L = diag(m1 , · · · , mn )
◮ Define Z = (Z1 , · · · , Zn )T = LT Y. Then Y = LZ.
◮ Recall |L| = 1, |M −1 | = (m1 · · · mn )−1
◮ Then density of Z is
, y∈ℜ
1
n
2
1
n
2
◮
n
Let X = Y + µ. Then
fX (x) = fY (x − µ) =
◮
1
n
(2π) 2 |Σ| 2
− 21 yT Σ−1 y
−1
Consider Y with joint density
µ)
1
fZ (z) =
n
2
1 T
1
T
− 2 z L M Lz
=
1 e
n
2
1
( m1 ···m
)2
n
(2π)
(2π) |M −1 | 2
r
r
z2
n
n
Y
Y
− 21 1i
1
1
1
1
1
2
q e − 2 mi zi =
q e mi
=
1
1
2π
2π
i=1
i=1
This is the multidimensional Gaussian distribution
mi
1 P
−2
1 e
2
i mi zi
mi
This shows that Zi ∼ N (0, m1i ) and Zi are independent.
PS Sastry, IISc, Bangalore, 2020 26/36
PS Sastry, IISc, Bangalore, 2020 25/36
◮
If Y has density fY and Z = LT Y then Zi ∼ N (0, m1i )
and Zi are independent. Hence,
1
1
= LT M −1 L
ΣZ = diag
,··· ,
m1
mn
◮
fY (y) =
◮
Also, since Zi = 0, ΣZ = E[ZZT ].
◮ Since Y = LZ, E[Y] = 0 and
Let Y have density
◮
ΣY = E[YYT ] = E[LZZT LT ] = LE[ZZT ]LT = L(LT M −1 L)LT = M −1
◮
T
e− 2 y Σ
−1 y
, y ∈ ℜn
1
n
2
(2π) |Σ|
1
1
2
T
e− 2 (x−µ) Σ
−1 (x−
µ)
We have
EX = E[Y + µ] = µ
Thus, if Y has density
fY (y) =
(2π) |Σ|
1
1
2
Let X = Y + µ. Then
fX (x) =
◮
1
n
2
1
n
(2π) 2 |Σ|
1
1
2
T
e− 2 y Σ
−1 y
, y ∈ ℜn
ΣX = E[(X − µ)(X − µ)T ] = E[YYT ] = Σ
then EY = 0 and ΣY = M −1 = Σ
PS Sastry, IISc, Bangalore, 2020 27/36
PS Sastry, IISc, Bangalore, 2020 28/36
Multi-dimensional Gaussian density
◮
X = (X1 , · · · , Xn )T are said to be jointly Gaussian if
fX (x) =
1
n
2
(2π) |Σ|
1
1
2
T
e− 2 (x−µ) Σ
−1 (x−
◮
fX (x) =
µ)
EX = µ and ΣX = Σ.
◮ Suppose Cov(Xi , Xj ) = 0, ∀i 6= j.
◮ Then Σij = 0, ∀i 6= j. Let Σ = diag(σ 2 , · · · , σ 2 ).
1
n
◮
2
n
P
Y
xi −µi 2
x −µ
1
1
− 12 iσ i
− 21 n
i=1
σi
i
√ e
fX (x) =
=
e
n
(2π) 2 σ1 · · · σn
σ 2π
i=1 i
This implies Xi are independent.
◮ If X1 , · · · , Xn are jointly Gaussian then uncorrelatedness
implies independence.
◮
Let X = (X1 , · · · , Xn )T be jointly Gaussian:
1
n
2
(2π) |Σ|
1
1
2
T
e− 2 (x−µ) Σ
−1 (x−
µ)
Let Y = X − µ.
◮ Let M = Σ−1 and L be such that
LT M L = diag(m1 , · · · , mn )
◮ Let Z = (Z1 , · · · , Zn )T = LT Y .
◮ Then we saw that Zi ∼ N (0, 1 ) and Zi are independent.
mi
◮ If X1 , · · · , Xn are jointly Gaussian then there is a ‘linear’
transform that transforms them into independent random
variables.
◮
PS Sastry, IISc, Bangalore, 2020 29/36
PS Sastry, IISc, Bangalore, 2020 30/36
Moment generating function
Since Zi are independent, easy to get MZ .
◮ We know Zi ∼ N (0, 1 ). Hence
mi
◮
Let X = (X1 , · · · , Xn )T be jointly Gaussian
◮ Let Y = X − µ and Z = (Z1 , · · · , Zn )T = LT Y as earlier
◮ The moment generating function of X is given by
h T i
MX (s) = E es X
h T
i
h T i
s (Y+µ)
sT µ
= E e
=e
E es Y
h T i
sT µ
= e
E es LZ
h T i
T
= es µ E eu Z
◮
T
where u = L s
sT µ
= e
MZ (u)
PS Sastry, IISc, Bangalore, 2020 31/36
MZi (ui ) = e
h
MZ (u) = E e
◮
uT Z
i
=
n
Y
i=1
1 1
u2
2 mi i
=e
u2
i
2mi
n
P u2i
u2
ui Z i Y
i
2mi
= e i 2mi
E e
=
e
i=1
We derived earlier
T
MX (s) = es µ MZ (u),
where u = LT s
PS Sastry, IISc, Bangalore, 2020 32/36
◮
We got
MX (s) = e
◮
Let X, Y be jointly Gaussian. For simplicity let
EX = EY = 0.
◮ Let Var(X) = σ 2 , Var(Y ) = σ 2 and ρXY = ρ.
x
y
⇒ Cov(X, Y ) = ρσx σy .
◮ Now, the covariance matrix and its inverse are given by
1
σx2
ρσx σy
σy2
−ρσx σy
−1
; Σ = 2 2
Σ=
ρσx σy
σy2
σx2
σx σy (1 − ρ2 ) −ρσx σy
◮
sT µ
T
MZ (u); u = L s; MZ (u) = e
P
u2
i
i 2mi
Earlier we have shown LT M −1 L = diag( m11 , · · · , m1n )
where M −1 = Σ. Now we get
1
1
1
1 X u2i
= uT (LT M −1 L)u = sT M −1 s = sT Σs
2 i mi
2
2
2
◮
◮
Hence we get
sT
MX (s) = e µ
◮
+ 21 sT Σs
The joint density of X, Y is given by
fXY (x, y) =
This is the moment generating function of
multi-dimensional Normal density
◮
PS Sastry, IISc, Bangalore, 2020 33/36
Suppose X, Y are jointly Gaussian (with the density
above)
◮ Then, all the marginals and conditionals would be
Gaussian.
◮ X ∼ N (0, σ 2 ), and Y ∼ N (0, σ 2 )
x
y
◮ fX|Y (x|y) would be a Gaussian density with mean yρ σx
σy
and variance σx2 (1 − ρ2 ).
◮ Exercise for you – show all this starting with the joint
density we have
◮ Note that X, Y are individually Gaussian does not mean
they are jointly Gaussian (unless they are independent)
◮
PS Sastry, IISc, Bangalore, 2020 35/36
2πσx σy
1
p
1 − ρ2
e
−
1
2(1−ρ2 )
y2
2ρxy
x2
2 + σ 2 − σx σy
σx
y
This is the bivariate Gaussian density
PS Sastry, IISc, Bangalore, 2020 34/36
The multi-dimensional Gaussian density has some
important properties.
◮ If X1 , · · · , Xn are jointly Gaussian then they are
independent if they are uncorrelated.
◮ Suppose X1 , · · · , Xn be jointly Gaussian and have zero
means. Then there is an orthogonal transform Y = AX
such that Y1 , · · · , Yn are jointly Gaussian and
independent.
◮ X1 , · · · , Xn are jointly Gaussian if and only if tT X is
Gaussian for for all non-zero t ∈ ℜn .
◮ We will prove this using moment generating functions
◮
PS Sastry, IISc, Bangalore, 2020 36/36
Recap: Multi-dimensional Gaussian density
◮
X = (X1 , · · · , Xn )T are said to be jointly Gaussian if
fX (x) =
1
n
2
(2π) |Σ|
1
T
e− 2 (x−µ) Σ
1
2
−1 (x−
µ)
EX = µ and ΣX = Σ.
◮ The moment generating function is given by
◮
1 T
T
MX (s) = es µ + 2 s Σ s
◮
When X, Y are jointly Gaussian, the joint densityis given
by
1
−
1
2
p
e 2(1−ρ )
fXY (x, y) =
2πσx σy 1 − ρ2
(y−µy )
(x−µx )2
+
2
2
σx
σy
2
−
2ρ(x−µx )(y−µy )
σx σy
The multi-dimensional Gaussian density has some
important properties.
◮ If X1 , · · · , Xn are jointly Gaussian then they are
independent if they are uncorrelated.
◮ Suppose X1 , · · · , Xn be jointly Gaussian and have zero
means. Then there is an orthogonal transform Y = AX
such that Y1 , · · · , Yn are jointly Gaussian and
independent.
◮ X1 , · · · , Xn are jointly Gaussian if and only if tT X is
Gaussian for for all non-zero t ∈ ℜn .
◮ We will prove this using moment generating functions
◮
PS Sastry, IISc, Bangalore, 2020 1/32
Suppose X = (X1 , · · · , Xn )T be jointly Gaussian and let
W = tT X.
◮ Let µX and ΣX denote the mean vector and covariance
matrix of X. Then
PS Sastry, IISc, Bangalore, 2020 2/32
◮
µw , EW = tT µX ;
◮
Now suppose W = tT X is Gaussian for all t.
1
2 2
T
1
2
T
MW (u) = euµw + 2 u σw = eu t µX + 2 u t ΣX t
σw2 , Var(W ) = tT ΣX t
This implies
h T i
1 2 T
T
E eu t X = eu t µX + 2 u t ΣX t , ∀u ∈ ℜ, ∀t ∈ ℜn , t 6= 0
h T i
1 T
T
E et X = et µX + 2 t ΣX t , ∀t
◮
◮
The mgf of W is given by
h T i
uW MW (u) = E e
= E eu t X
T
1
2 T
= MX (ut) = eut µx + 2 u t Σx t
1
2 2
= euµw + 2 u σw
◮
showing that W is Gaussian
Shows density of Xi is Gaussian for each i. For example,
if we take t = (1, 0, 0, · · · , 0)T then W above would be
X1 .
PS Sastry, IISc, Bangalore, 2020 3/32
This implies X is jointly Gaussian.
◮ This is a defining property of multidimensional Gaussian
density
PS Sastry, IISc, Bangalore, 2020 4/32
Let X = (X1 , · · · , Xn )T be jointly Gaussian.
◮ Let A be a k × n matrix with rank k.
◮ Then Y = AX is jointly Gaussian.
◮ We will once again show this using the moment
generating function.
◮ Let µx and Σx denote mean vector and covariance matrix
of X. Similarly µy and Σy for Y
◮ We have µy = Aµx and
Σy = E (Y − µy )(Y − µy )T
= E (A(X − µx ))(A(X − µx ))T
= E A(X − µx )(X − µx )T AT
= A E (X − µx )(X − µx )T AT = AΣx AT
◮
PS Sastry, IISc, Bangalore, 2020 5/32
◮
The mgf of Y is
h T i
MY (s) = E es Y
(s ∈ ℜk )
i
h T
= E es A X
= MX (AT s)
T
1 T
(Recall MX (t) = et µx + 2 t Σx t )
T
1 T
T
= es Aµx + 2 s A Σx A s
1 T
T
= e s µy + 2 s Σ y s
This shows Y is jointly Gaussian
PS Sastry, IISc, Bangalore, 2020 6/32
X is jointly Gaussian and A is a k × n matrix with rank k.
◮ Then Y = AX is jointly Gaussian.
◮ This shows all marginals of X are gaussian
◮ For example, if you take A to be
1 0 0 ··· 0
A=
0 1 0 ··· 0
◮
then Y = (X1 , X2 )T
PS Sastry, IISc, Bangalore, 2020 7/32
PS Sastry, IISc, Bangalore, 2020 8/32
Jensen’s Inequality
◮
Jensen’s Inequality: Proof
Let g : ℜ → ℜ be a convex function. Then
◮
We have
g(EX) ≤ E[g(X)]
g(x) ≥ g(x0 ) + λ(x0 )(x − x0 ), ∀x
For example, (EX)2 ≤ E [X 2 ]
◮ Function g is convex if
◮
◮
g(αx+(1−α)y) ≤ αg(x)+(1−α)g(y), ∀x, y, ∀0 ≤ α ≤ 1
◮
g(X(ω)) ≥ g(EX) + λ(EX)(X(ω) − EX), ∀ω
If g is convex, then, given any x0 , exists λ(x0 ) such that
g(x) ≥ g(x0 ) + λ(x0 )(x − x0 ), ∀x
Take x0 = EX and x = X(ω). Then
Y (ω) ≥ Z(ω), ∀ω ⇒ Y ≥ Z ⇒ EY ≥ EZ
◮ Hence we get
◮
g(X) ≥ g(EX) + λ(EX)(X − EX)
⇒ E[g(X)] ≥ g(EX) + λ(EX) E[X − EX] = g(EX)
◮
This completes the proof
PS Sastry, IISc, Bangalore, 2020 9/32
Consider the set of all mean-zero random variables.
◮ It is closed under addition and scalar (real number)
multiplication.
◮ Cov(X, Y ) = E[XY ] satisfies
◮
1. Cov(X, Y ) = Cov(Y, X)
2. Cov(X, X) = Var(X) ≥ 0 and is zero only if X = 0
3. Cov(aX, Y ) = aCov(X, Y )
4. Cov(X1 + X2 , Y ) = Cov(X1 , Y ) + Cov(X2 , Y )
Thus Cov(X, Y ) is an inner product here.
◮ The Cauchy-Schwartz inequality (|xT y| ≤ ||x|| ||y||)
gives
p
p
|Cov(X, Y )| ≤ Cov(X, X) Cov(Y, Y ) = Var(X) Var(Y )
◮
This is same as |ρXY | ≤ 1
◮ A generalization of Cauchy-Schwartz inequality is Holder
inequality
◮
PS Sastry, IISc, Bangalore, 2020 11/32
PS Sastry, IISc, Bangalore, 2020 10/32
Holder Inequality
◮
For all p, q with p, q > 1 and p1 + 1q = 1
1
1
E[|XY |] ≤ (E|X|p ) p (E|Y |q ) q
◮
◮
(We assume all the expectations are finite)
If we take p = q = 2
p
E[|XY |] ≤ E[X 2 ] E[Y 2 ]
This is same as Cauchy-Schwartz inequality. We once
again get
Cov(X, Y )
= E[(X − EX)(Y − EY )]
≤ E (X − EX)(Y − EY )
p
E[(X − EX)2 ] E[(Y − EY )2 ]
≤
p
Var(X) Var(Y )
=
PS Sastry, IISc, Bangalore, 2020 12/32
Proof
◮
First we will show, for p, q > 1 and p1 + 1q = 1
|xy| ≤
◮
|y|q
|x|p
+
, ∀x, y ∈ ℜ
p
q
We have for all x1 , x2 > 0 and 0 ≤ t ≤ 1,
(1−t)
tx1 + (1 − t)x2 ≥ xt1 x2
◮
For x > 0, g(x) = − log(x) is convex because
g ′′ (x) = 1/x2 ≥ 0, ∀x.
◮ Hence, for all x1 , x2 > 0 and 0 ≤ t ≤ 1,
◮
Take x1 = |x|p , x2 = |y|q , t = p1 (and hence 1 − t = 1q )
1
1 p 1 q
|x| + |y|
p
q
p
|y|q
|x|
+
, ∀x, y
|xy| ≤
p
q
1
(|x|p ) p (|y|q ) q ≤
⇒
− log(tx1 + (1 − t)x2 ) ≤ −t log(x1 ) − (1 − t) log(x2 )
t (1−t)
⇒ log(tx1 + (1 − t)x2 ) ≥ log x1 x2
(1−t)
⇒ tx1 + (1 − t)x2 ≥ xt1 x2
PS Sastry, IISc, Bangalore, 2020 14/32
PS Sastry, IISc, Bangalore, 2020 13/32
◮
Jensen’s Inequality: If g is convex and EX and
E[g(X)] exist
g(EX) ≤ E[g(X)]
◮
Holder Inequality: For p, q > 1 and p1 + 1q = 1
|x|p |y|q
+
, ∀x, y
|xy| ≤
p
q
◮
1
p −p
Take x = X(ω) (E|X| )
1
q −q
, y = Y (ω) (E|Y | )
1
1
p
|X(ω)Y (ω)|
1
p
⇒
⇒
(E|X|p ) (E|Y |q )
|XY |
1
q
1
p
1
q
(E|Y |q )
≤
|X(ω)| (E|X| )
p
p
1
p
(E|X|p ) (E|Y |q )
E|XY |
(E|X|p )
1
q
p −1
|X| (E|X| )
p
≤
1 1
+ =1
p q
⇒ E|XY | ≤ (E|X|p )
+
p −1
≤
1
p
q
|Y (ω)| (E|Y | )
q
q
+
q −1
q −1
|Y | (E|Y | )
q
E|XY | ≤ (E|X|p ) p (E|Y |q ) q
(assuming all expectations exist)
◮ For p = q = 2, the above is Cauchy-Schwartz inequality
◮ This implies |ρXY | ≤ 1
◮ Minkowski’s Inequality:
1
(E|Y |q )
1
1
(E|X + Y |r ) r ≤ (E|X|r ) r + (E|Y |r ) r
1
q
PS Sastry, IISc, Bangalore, 2020 15/32
PS Sastry, IISc, Bangalore, 2020 16/32
Chernoff Bounds
◮
Hoeffding Inequality
Recall Markov inequality. If h is positive, strictly
increasing
P [X > a] = P [h(X) > h(a)] ≤
◮
Take h(x) = esx , s > 0. Then
P [X > a] ≤
◮
E[h(X)]
h(a)
E[esX ]
MX (s)
=
, ∀s > 0
sa
e
esa
Often we need to deal with sums of iid random variables.
◮ Here is a simple version of an inequality very useful in
such situations.
◮ Let Xi be iid and let Xi ∈ [a, b], ∀i. Let EXi = µ
" n
#
X
2ǫ2
P
Xi − nµ ≥ ǫ ≤ 2e− n(b−a) , ǫ > 0
◮
i=1
◮
The RHS is a function of S. We can get a tight bound by
using a value of s which minimizes RHS.
Note we do not need knowledge of any moments of Xi to
calculate the bound
PS Sastry, IISc, Bangalore, 2020 17/32
PS Sastry, IISc, Bangalore, 2020 18/32
Let X1 , X2 , · · · be iid random variables
◮ Let EXi = µ and let Var(Xi ) = σ 2
Pn
◮ Define Sn =
i=1 Xi . Then
◮
ESn =
n
X
i=1
◮
PS Sastry, IISc, Bangalore, 2020 19/32
EXi = nµ;
and
Var(Sn ) =
n
X
Var(Xi ) = nσ 2
i=1
We are interested in Snn , average of X1 , · · · , Xn .
Sn
1
E
ESn = µ, ∀n
=
n
n
2
nσ 2
1
Sn
σ2
Var(Sn ) = 2 = , ∀n
=
Var
n
n
n
n
PS Sastry, IISc, Bangalore, 2020 20/32
Weak Law of large numbers
◮
P
Xi are iid, EXi = µ, Var(Xi ) = σ 2 , Sn = ni=1 Xi
Sn
Sn
σ2
E
= µ; and Var
=
n
n
n
As n becomes large, variance of Snn becomes close to zero
◮ Sn ‘converges’ to its expectation, µ, as n → ∞
n
◮ By Chebyshev Inequality
Var( Snn )
Sn
σ2
P
−µ ≥ǫ ≤
=
, ∀ǫ > 0
n
ǫ2
nǫ2
◮
◮
Thus, we get
lim P
n→∞
◮
Sn
− µ ≥ ǫ = 0, ∀ǫ > 0
n
Suppose we are tossing a (biased) coin repeatedly
◮ Xi = 1 if ith toss came up head and is zero otherwise.
◮ EXi = p where p is the probability of heads. Variance of
Xi is p(1 − p)
Pn
◮ Sn =
i=1 Xi is the number of heads in n tosses
S
n
◮
is the fraction of heads in n tosses.
n
◮ We are saying Sn ‘converges’ to p
n
◮ The probability of head is the limiting fraction of heads
when you toss the coin infinite times
Sn
− p ≥ ǫ = 0, ∀ǫ > 0
lim P
n→∞
n
◮
Known as weak law of large numbers
PS Sastry, IISc, Bangalore, 2020 22/32
PS Sastry, IISc, Bangalore, 2020 21/32
X is a random variable and we want to find EX.
◮ Make multiple independent observations of X. Call them
X1 , · · · , Xn .
Pn
◮ These are called samples of X. Sn =
i=1 Xi
◮ Sn is the sample mean – average of all samples.
n
◮ Sn has the same expectation as X but has much smaller
n
variance.
◮ Sample mean ‘converges’ to expectation (’population
mean’)
◮ This is the principle of sample surveys
◮ In general one can get an approximate value of
expectation of X through simulations/experiments
◮ Known as Monte Carlo simulations
◮
This is true of any event.
◮ Consider repeatedly performing a random experiment
◮ Xi be the indicator of event A on ith repetition
◮ Then EXi = P (A), ∀i
◮ Sn is the fraction of times the event A occurred.
n
◮ The fraction of times an event occurs ‘converges’ to its
probability as you repeat the experiment infinite times
◮
PS Sastry, IISc, Bangalore, 2020 23/32
PS Sastry, IISc, Bangalore, 2020 24/32
◮
◮
2
Pn
Xi are iid, EXi = µ, Var(Xi ) = σ , Sn = i=1 Xi
Sn
σ2
Sn
= µ; and Var
=
E
n
n
n
◮ As n becomes large, variance of Sn
n
◮ We would like to say Sn → µ.
n
becomes close to zero
We need to properly define convergence of a sequence of
random variables
◮ One way of looking at this convergence is
Sn
lim P
− µ ≥ ǫ = 0, ∀ǫ > 0
n→∞
n
◮
◮
There are other ways of defining convergence of random
variables
PS Sastry, IISc, Bangalore, 2020 25/32
◮
Recall convergence of real number sequences.
A sequence of real numbers xn is said to converge to x0 ,
xn → x0 , if
∀ǫ > 0, ∃N < ∞, s.t. |xn − x0 | ≤ ǫ, ∀n ≥ N
To show a sequence converges using this definition, we
need to know (or guess) the limit.
◮ Convergent sequences of real numbers satisfy the Cauchy
criterion
◮
∀ǫ > 0, ∃N < ∞, s.t.|xn − xm | ≤ ǫ, ∀n, m ≥ N
Now consider defining sequence of random variables Xn
converging to X0
◮ These are not numbers. They are, in fact functions.
◮ We know that |Xn − X0 | ≤ ǫ is an event. We can define
convergence in terms of probability of that event
becoming 1.
◮ Or we can look at different notions of convergence of a
sequence of functions to a function.
PS Sastry, IISc, Bangalore, 2020 26/32
◮
Convergence in Probability
◮
Consider a sequence of functions gn mapping ℜ to ℜ.
◮ We can say gn → g0 if gn (x) → g0 (x), ∀x.
◮ This is known as point-wise convergence
R
◮ Or we can ask for
|gn (x) − g0 (x)|2 dx → 0.
◮ There are multiple notions of convergence that are
reasonable for a sequence of functions.
◮ Thus there would be multiple ways to define convergence
of sequence of random variables.
◮
A sequence of random variables, Xn , is said to converge
in probability to a random variable X0 is
lim P [|Xn − X0 | > ǫ] = 0, ∀ǫ > 0
n→∞
P
This is denoted as Xn → X0
◮ We would mostly be considering convergence to a
constant.
◮ By the definition of limit, the above means
∀δ > 0, ∃N < ∞, s.t. P [|Xn − X0 | > ǫ] < δ, ∀n > N
◮
PS Sastry, IISc, Bangalore, 2020 27/32
We only need marginal distributions of individual Xn to
decide whether a sequence converges to a constant in
probability
PS Sastry, IISc, Bangalore, 2020 28/32
Example: Partial sums of iid random variables
Example
Let Ω = [0, 1] with the usual probability measure and let
Xn = I[0, 1/n] .
◮ P [Xn = 1] = 1 = 1 − P [Xn = 0]
n
◮ The probability of Xn taking value 1 is decreasing with n
◮ A good guess is that it converges to zero
◮
P
Xi are iid, EXi = µ, Var(Xi ) = σ 2 , Sn = ni=1 Xi
◮ Then we saw
σ2
Sn
− µ ≥ ǫ ≤ 2 , ∀ǫ > 0
P
n
nǫ
◮
P
Hence we have Snn → µ
◮ Weak law of large numbers says that sample mean
converges in probability to the expectation
◮
P [|Xn − 0| > ǫ] = P [Xn = 1] =
1
n
which goes to zero as n → ∞.
◮
P
Hence, Xn → 0
PS Sastry, IISc, Bangalore, 2020 29/32
Example
PS Sastry, IISc, Bangalore, 2020 30/32
Some properties of convergence in probability
Let X1 , X2 , · · · be a sequence of iid random variable
which are uniform over (0, 1).
◮ Let Mn = max(X1 , X2 , · · · , Xn )
◮ Does Mn converge in probability?
◮ A reasonable guess for the limit is 1
◮
P
P
◮
Xn → X and Xn → Y ⇒ P [X = Y ] = 1
◮
Xn → X ⇒ P [|Xn − Xm | > ǫ] → 0 as n, m → ∞
◮
Suppose Xn → X and Yn → Y Then the following hold
P
P
P
P
P [|Mn − 1| ≥ ǫ] = P [Mn ≤ 1 − ǫ] = (1 − ǫ)
P
◮
This implies Mn → 1
◮ Suppose Zn = min(X1 , X2 , · · · , Xn ).
P
Then Zn → 0
◮
1. aXn → aX
P
2. Xn + Yn → X + Y
P
3. Xn Yn → XY
n
PS Sastry, IISc, Bangalore, 2020 31/32
We omit the proofs
PS Sastry, IISc, Bangalore, 2020 32/32
Recap: Multi-dimensional Gaussian density
◮
Recap
X = (X1 , · · · , Xn )T are said to be jointly Gaussian if
fX (x) =
1
n
2
(2π) |Σ|
1
T
e− 2 (x−µ) Σ
1
2
−1 (x−
µ)
If X1 , · · · , Xn are jointly Gaussian then they are
independent if they are uncorrelated.
◮ When X1 , · · · , Xn be jointly Gaussian (with zero means),
there is an orthogonal transform Y = AX such that
Y1 , · · · , Yn are jointly Gaussian and independent.
◮ X1 , · · · , Xn are jointly Gaussian if and only if tT X is
Gaussian for for all non-zero t ∈ ℜn .
◮ If X1 , · · · , Xn are jointly Gaussian and A is a k × n
matrix of rank k, then, Y = AX is jointly gaussian
◮
EX = µ and ΣX = Σ.
◮ The moment generating function is given by
◮
1 T
T
MX (s) = es µ + 2 s Σ s
◮
When X, Y are jointly Gaussian, the joint density is given
by
1
−
1
2
p
e 2(1−ρ )
fXY (x, y) =
2πσx σy 1 − ρ2
(y−µy )
(x−µx )2
+
2
2
σx
σy
2
−
2ρ(x−µx )(y−µy )
σx σy
PS Sastry, IISc, Bangalore, 2020 1/34
Recap: Moment inequalities
◮
◮
PS Sastry, IISc, Bangalore, 2020 2/34
Recap
Jensen’s Inequality: If g is convex and EX and
E[g(X)] exist
g(EX) ≤ E[g(X)]
◮
Holder Inequality: For p, q > 1 and p1 + 1q = 1
MX (s)
E[esX ]
=
, ∀s > 0
P [X > a] ≤
esa
esa
1
1
E|XY | ≤ (E|X|p ) p (E|Y |q ) q
◮
(assuming all expectations exist)
◮ For p = q = 2, the above is Cauchy-Schwartz inequality
◮ This implies |ρXY | ≤ 1
◮ Minkowski’s Inequality:
1
1
Chernoff Bounds
Hoeffding Inequality Xi iid, Xi ∈ [a, b], ∀i and
EXi = µ
#
" n
X
2ǫ2
Xi − nµ ≥ ǫ ≤ 2e− n(b−a) , ǫ > 0
P
i=1
1
(E|X + Y |r ) r ≤ (E|X|r ) r + (E|Y |r ) r
PS Sastry, IISc, Bangalore, 2020 3/34
PS Sastry, IISc, Bangalore, 2020 4/34
Recap: Weak Law of large numbers
◮
◮
Recap: Convergence in Probability
P
Xi are iid, EXi = µ, Var(Xi ) = σ 2 , Sn = ni=1 Xi
Sn
Sn
σ2
E
= µ; and Var
=
n
n
n
By Chebyshev Inequality
Var( Snn )
Sn
σ2
−µ ≥ǫ ≤
= 2 , ∀ǫ > 0
P
n
ǫ2
nǫ
⇒
lim P
n→∞
Sn
− µ ≥ ǫ = 0, ∀ǫ > 0
n
◮
A sequence of random variables, Xn , is said to converge
in probability to a random variable X0 is
lim P [|Xn − X0 | > ǫ] = 0, ∀ǫ > 0
n→∞
P
This is denoted as Xn → X0
◮ By the definition of limit, the above means
∀δ > 0, ∃N < ∞, s.t. P [|Xn − X0 | > ǫ] < δ, ∀n > N
◮
We only need marginal distributions of individual Xn to
decide whether a sequence converges to a constant in
probability
PS Sastry, IISc, Bangalore, 2020 6/34
PS Sastry, IISc, Bangalore, 2020 5/34
◮
◮
We mentioned point-wise convergence of a sequence of
functions
gn → g0
if
P ({ω : Xn (ω) → X(ω)}) = 1
gn (x) → g0 (x), ∀x
Since random variables are also functions we can define
convergence like this.
◮ We can demand Xn (ω) → X0 (ω), ∀ω
◮ Such pointise convergence is too restrictive.
◮ But we can demand that it should be satisfied for almost
all ω
A sequence of random variables, Xn , is said to converge
almost surely or with probability one to X if
or equivalently
◮
PS Sastry, IISc, Bangalore, 2020 7/34
P ({ω : Xn (ω) 9 X(ω)}) = 0
a.s.
w.p.1
Denoted as Xn → X or Xn → X or Xn → X0 (w.p.1)
◮ We are saying that for ‘almost all’ ω, Xn (ω) converges to
X(ω)
◮ We will first try and write the event
{ω : Xn (ω) 9 X(ω)} in a proper form
◮
PS Sastry, IISc, Bangalore, 2020 8/34
Note that given any ω, Xn (ω) is real number sequence.
◮ Hence Xn (ω) → X(ω) is same as
◮
Recall convergence of real number sequences.
◮ A sequence of real numbers xn is said to converge to x0 ,
xn → x0 , if
◮
∀ǫ > 0 ∃N < ∞ ∀k ≥ 0 |XN +k (ω) − X(ω)| < ǫ
This is equivalent to
∀ǫ > 0, ∃N < ∞, s.t. |xn − x0 | < ǫ, ∀n ≥ N
∀r > 0, r integer ∃N < ∞ ∀k ≥ 0 |XN +k (ω) − X(ω)| <
This is equivalent to
∀ǫ > 0, ∃N < ∞, ∀k ≥ 0 |xN +k − x0 | < ǫ
◮
◮
Hence, Xn (ω) 9 X(ω) is same as
∃r ∀N ∃k |XN +k (ω) − X(ω)| ≥
So, xn 9 x0 means
∃ǫ ∀N ∃k |xN +k − x0 | ≥ ǫ
◮
◮
◮
◮
The event {ω : Xn (ω) 9 X(ω)} can be expressed as
1
∞
∞
∞
∪r=1 ∩N =1 ∪k=0 |XN +k − X| ≥
r
Hence Xn converges almost surely to X iff
1
∞
∞
∞
P ∪r=1 ∩N =1 ∪k=0 |XN +k − X| ≥
=0
r
This is same as
1
∞
P ∩∞
|XN +k − X| ≥
= 0, ∀r > 0, integer
N =1 ∪k=0
r
Same as
∞
P (∩∞
N =1 ∪k=0
[|XN +k − X| ≥ ǫ]) = 0, ∀ǫ > 0
PS Sastry, IISc, Bangalore, 2020 11/34
1
r
Hence we can write this event as
1
∞
∞
∞
∪r=1 ∩N =1 ∪k=0 ω : |XN +k (ω) − X(ω)| ≥
r
PS Sastry, IISc, Bangalore, 2020 9/34
◮
1
r
PS Sastry, IISc, Bangalore, 2020 10/34
◮
A sequence Xn is said to converge almost surely or
with probability one to X if
P ({ω : Xn (ω) → X(ω)}) = 1
◮
We can also write it as
P [Xn → X] = 1
◮
We showed that this is equivalent to
∞
P (∩∞
N =1 ∪k=0 [|XN +k − X| ≥ ǫ]) = 0, ∀ǫ > 0
◮
Same as
∞
P (∩∞
N =1 ∪k=N [|Xk − X| ≥ ǫ]) = 0, ∀ǫ > 0
PS Sastry, IISc, Bangalore, 2020 12/34
◮
let Ak = [|Xk − X| ≥ ǫ]
◮ Let BN = ∪∞ Ak .
k=N
◮ Then, BN +1 ⊂ BN and hence BN ↓.
◮ Hence, lim BN = ∩∞ BN .
N =1
a.s.
◮ We saw that Xn → X is same as
◮
Xn converges to X almost surely iff
lim P (∪∞
k=n [|Xk − X| ≥ ǫ]) = 0, ∀ǫ > 0
n→∞
◮
To show convergence with probability one using this one
needs to know the joint distribution of Xn , Xn+1 , · · ·
◮
Contrast this with Xn → X which is
P
∞
P (∩∞
N =1 ∪k=N [|Xk − X| ≥ ǫ]) = 0, ∀ǫ > 0
lim P [|Xn − X| > ǫ] = 0, ∀ǫ > 0
n→∞
⇔ P
[|X
−
X|
≥
ǫ]
= 0, ∀ǫ > 0
lim ∪∞
k
k=N
◮
N →∞
⇔ lim
N →∞
P (∪∞
k=N
This also shows that
a.s.
Xn → X
[|Xk − X| ≥ ǫ]) = 0, ∀ǫ > 0
◮
⇒
P
Xn → X
Almost sure convergence is a stronger mode of
convergence
PS Sastry, IISc, Bangalore, 2020 13/34
PS Sastry, IISc, Bangalore, 2020 14/34
simple example: almost sure convergence
◮
Let Ω = [0, 1] with the usual probability measure and let
Xn = I[0, 1/n] .
1 ω ≤ n1
Xn (ω) =
0 otherwise
Xn converges to X almost surely iff
∞
P (∩∞
N =1 ∪k=N [|Xk − X| ≥ ǫ]) = 0, ∀ǫ > 0
P
Since Xn → 0, zero is the only candidate for limit
◮ Xn (ω) = 1 only when n ≤ 1/ω.
◮ Given any ω, for all n > 1/ω, Xn (ω) = 0
◮ Hence, {ω : Xn (ω) → 0} = (0, 1]
◮
◮
⇔
lim P (∪∞
k=n [|Xk − X| ≥ ǫ]) = 0, ∀ǫ > 0
n→∞
We normally do not specify Xn as functions over Ω
◮ We are only given the distributions
◮ How do we establish convergence almost surely
◮
P [Xn → X0 ] = P ({ω : Xn (ω) → 0}) = P ((0, 1]) = 1
◮
a.s
Hence Xn → 0
PS Sastry, IISc, Bangalore, 2020 15/34
PS Sastry, IISc, Bangalore, 2020 16/34
Let A1 , A2 , · · · be a sequence of events.
How do we define limit of this sequence ?
◮ Define sequences
◮
◮
Bn = ∪∞
k=n Ak
◮
◮
Cn = ∩∞
k=n Ak
◮
These are monotone: Bn ↓, Cn ↑. They have limits.
Define
We can show lim inf An ⊂ lim sup An
ω ∈ lim inf An ⇒
⇒
⇒
⇒
⇒
∞
lim sup An , lim Bn = ∩∞
n=1 ∪k=n Ak
∞
lim inf An , lim Cn = ∪∞
n=1 ∩k=n Ak
If lim sup An = lim inf An then we define that as
lim An . Otherwise we say the sequence does not have a
limit
◮ Note that lim sup An and lim inf An are events
a.s.
◮ Note that Xn → X iff
◮
∞
ω ∈ ∪∞
n=1 ∩k=n Ak
∃m, ω ∈ Ak , ∀k ≥ m
ω ∈ ∪∞
j=n Aj , ∀n
∞
ω ∈ ∩∞
n=1 ∪j=n Aj
ω ∈ lim sup An
∞
P (∩∞
N =1 ∪k=N [|Xk − X| ≥ ǫ]) = 0, ∀ǫ > 0
⇔ P (lim sup [|Xn − X| ≥ ǫ]) = 0,
∀ǫ > 0
PS Sastry, IISc, Bangalore, 2020 17/34
PS Sastry, IISc, Bangalore, 2020 18/34
◮
◮
We can characterize lim inf An as follows
∞
ω ∈ lim inf An ⇒ ω ∈ ∪∞
n=1 ∩k=n Ak
⇒ ∃m, ω ∈ Ak , ∀k ≥ m
⇒ ω belongs to all but finitely many of An
Thus, lim inf An consists of all points that are there in
all but finitely many An .
PS Sastry, IISc, Bangalore, 2020 19/34
We can characterize lim sup An as follows
∞
ω ∈ lim sup An ⇒ ω ∈ ∩∞
n=1 ∪k=n Ak
⇒ ω ∈ ∪∞
k=n Ak , ∀n
⇒ ω belongs to infinitely many of An
Thus lim sup An consists of points that are in infinitely
many An
One refers to lim sup An also as ‘An infinitely often’ or
‘An i.o.’
◮ What is the difference between
Points that belong to all but finitely many An and
Points that belong to infinitely many An
◮ There can be ω that are there in infinitely many of An
and are also not there in infinitely many of the An
PS Sastry, IISc, Bangalore, 2020 20/34
Example
example
◮
Consider the following sequence of sets: A, B, A, B, · · ·
◮ Recall
◮
∞
lim sup An = ∩∞
n=1 ∪k=n Ak
∪∞
k=n Ak = A ∪ B, ∀n
∞
lim inf An = ∪∞
n=1 ∩k=n Ak
⇒ lim sup An = A ∪ B
n
)
Consider the sets An = [0, 1 + (−1)
n
The sequence is
1
1
1
, 0, 1 −
, 0, 1 +
···
[0, 0), 0, 1 +
2
3
4
Guess: lim sup An = [0, 1] and lim inf An = [0, 1)
1
1
◮ First note that
) ⊂ ∪∞
[0, 1 + n+1
k=n Ak ⊂ [0, 1 + n ).
Hence
◮
∞
∞
x ∈ [0, 1] ⇒ x ∈ ∪∞
k=n Ak , ∀n ⇒ x ∈ ∩n=1 ∪k=n Ak ⇒ x ∈ lim sup An
∩∞
k=n Ak = A ∩ B, ∀n ⇒ lim inf An = A ∩ B
Given any ǫ > 0, 1 + ǫ ∈
/ [0, 1 + n1 ) if ǫ > n1 or n > 1ǫ .
◮ Hence, given any ǫ > 0, ∃n such that 1 + ǫ ∈
/ ∪∞
k=n Ak .
◮ This proves lim sup An = [0, 1]
◮
PS Sastry, IISc, Bangalore, 2020 22/34
PS Sastry, IISc, Bangalore, 2020 21/34
◮
◮
◮
◮
◮
∞
Now let us consider: lim inf An = ∪∞
n=1 ∩k=n Ak .
n
)
Recall An = [0, 1 + (−1)
n
1
1
First note that [0, 1 − n ) ⊂ ∩∞
k=n Ak ⊂ [0, 1 − n+1 )
Given any ǫ > 0, 1 − ǫ < 1 − n1 if n > 1ǫ
Hence, given any ǫ > 0, ∃n such that 1 − ǫ ∈ ∩∞
k=n Ak
Hence 1 − ǫ ∈ lim inf An
◮ It is easy to see 1 ∈
/ ∩∞
k=n Ak for ay n.
◮ Hence 1 ∈
/ lim inf An
◮ This proves lim inf An = [0, 1)
◮ Since lim sup An 6= lim inf An , this sequence does not
have a limit
◮
a.s.
Xn → X iff
∞
P (∩∞
N =1 ∪k=N [|Xk − X| ≥ ǫ]) = 0, ∀ǫ > 0
Let Aǫn = [|Xn − X| ≥ ǫ]
a.s.
◮ Then Xn → X iff
◮
◮
PS Sastry, IISc, Bangalore, 2020 23/34
P (lim sup Aǫn ) = 0, ∀ǫ > 0
The question now is: can we get probability of
lim sup An
◮ We look at an important result that allows us to do this
◮
PS Sastry, IISc, Bangalore, 2020 24/34
Borel-Cantelli Lemma
◮
Borel-Cantelli lemma: Given sequence of events,
A1 , A2 ,P
···
◮
≤
limn→∞
P∞
k=n P (Ak ) = 0
lim P (∪∞
k=n Ak )
=
Proof:
P∞
◮ We will first show: P (∪∞ Ai ) ≤
i=n
i=n P (Ai ), ∀n
PN
N
◮ We have the result: P (∪
i=n Ai ) ≤
i=n P (Ai ), n ≤ N
N
◮ For any n, let BN = ∪
i=n Ai . Then BN ⊂ BN +1 .
∞
◮ limN →∞ BN = ∪
k=n Ak
N →∞
k=1 P (Ak ) < ∞, then,
n→∞
P (lim sup An ) = 1
N
P (∪∞
i=n Ai ) = P ( lim ∪i=n Ai ) =
P∞
0 ≤ P (lim sup An ) = P (∩∞
∪∞ A )
n=1 k=n k
= P lim ∪∞
k=n Ak
∞
i=1 P (Ai ) < ∞, then, P (lim sup An ) = 0
P∞
If i=1 P (Ai ) = ∞ and Ai are independent,
1. If
2.
If
n→∞
≤
lim
n→∞
∞
X
P (Ak )
k=n
= 0,
if
lim
N →∞
P (Ai ) =
i=n
∞
X
◮
This completes proof of first part of Borel-Cantelli lemma
P (Ai )
i=n
PS Sastry, IISc, Bangalore, 2020 25/34
PS Sastry, IISc, Bangalore, 2020 26/34
◮
P (Ak ) − C < ǫ ⇒
k=1
◮
n→∞
∞
X
=
P (Ak ) < ǫ
k=n
This implies
lim
n→∞
∞
X
For the second part of the lemma:
P (lim sup An ) = P (∩∞
∪∞ A )
n=1 k=n k
= P lim ∪∞
k=n Ak
P
Let ∞
k=1 P (Ak ) = C < ∞
◮ It means given any ǫ > 0, ∃n
◮
n
X
P (Ak ) < ∞
k=1
lim P (∪N
i=n Ai )
N →∞
N
X
∞
X
=
=
P (Ak ) = 0
lim P (∪∞
k=n Ak )
n→∞
c
lim (1 − P (∩∞
k=n Ak ) )
n→∞
lim
n→∞
1−
∞
Y
(1 − P (Ak ))
k=n
!
because Ak are independent
∞
Y
(1 − P (Ak ))
= 1 − lim
k=n
n→∞
PS Sastry, IISc, Bangalore, 2020 27/34
k=n
PS Sastry, IISc, Bangalore, 2020 28/34
◮
lim
n→∞
We can compute that limit as follows
∞
Y
(1 − P (Ak )) ≤
lim
n→∞
k=n
=
∞
Y
e−P (Ak ) ,
since 1 − x ≤ e−x
k=n
P
− ∞
k=n P (Ak )
◮
lim e
n→∞
Given a sequence Xn we want to know whether it
converges to X
◮ Let Aǫ = [|Xk − X| ≥ ǫ]
k
◮
= 0
P
Xn → X if
lim P [|Xk − X| ≥ ǫ] = 0
k→∞
because
P∞
⇒
k=1 P (Ak ) = ∞
◮ This finally gives us
limn→∞
P (lim sup An ) = 1 − lim
n→∞
P∞
∞
Y
k=n P (Ak ) = ∞
◮
a.s.
P (Ak ) < ∞ ⇒ P (lim sup Ak ) = 0 ⇒ Xk → X
k=1
k=n
PS Sastry, IISc, Bangalore, 2020 29/34
PS Sastry, IISc, Bangalore, 2020 30/34
◮
◮
P [Xn = cn ] = an
We want to investigate convergence to 0.
◮ Aǫ = [|Xn − 0| > ǫ] = [Xn = cn ], ∀ǫ > 0
n
◮ Hence P (Aǫ ) = an , ∀ǫ > 0.
n
◮
P
If an → 0 then Xn → 0. (e.g., an = n1 , n12 )
P
a.s.
◮ If
an < ∞, Xn → 0 (e.g., an = n12 )
◮
Consider a sequence Xn with
P [Xn = 0] = 1 −
Consider a sequence Xn with
P [Xn = 0] = 1 − an ;
PS Sastry, IISc, Bangalore, 2020 31/34
lim P (Ak ) = 0, ∀ǫ > 0
k→∞
By Borel-Cantelli lemma
∞
X
(1 − P (Ak )) = 1
same as
1
;
n
P [Xn = 1] =
1
n
P
We can easily conclude Xn → 0.
P 1
◮ But since,
n n = ∞, Borel-Cantelli lemma is not really
useful here
◮ We saw one example where such Xn converge almost
surely.
◮ But, if Xn are independent, then by Borel-Cantelli
lemma, they do not converge
◮ Convergence (to a constant) in probability depends only
on distribution of individual Xn .
◮ Convergence almost surely depends on the joint
distribution
◮
PS Sastry, IISc, Bangalore, 2020 32/34
Strong Law of Large Numbers
Let Aǫn = Snn − µ > ǫ
◮ As we saw, by Chebyshev inequality
Sn
σ2
P
−µ >ǫ ≤ 2
n
nǫ
◮
Let Xn be iid, EXn = µ, Var(Xn ) = σ 2 , Sn =
◮ We saw weak law of large numbers:
◮
Pn
i=1 Xi
Sn P
→µ
n
◮
This shows P (Aǫn ) → 0 and thus we get weak law
◮ To prove strong law using Borel-Cantelli lemma, we need
P
P (Aǫn ) < ∞
P σ2
◮ Since
n nǫ2 = ∞, the Chebyshev bound is not useful
◮ We need a bound: P [| Sn − µ|] ≤ cn such that
n
P
c
<
∞.
n n
◮
Strong law of large numbers says:
Sn a.s.
→µ
n
PS Sastry, IISc, Bangalore, 2020 33/34
Recap: Convergence in Probability
◮
Recap: Weak Law of large numbers
A sequence of random variables, Xn , is said to converge
in probability to a random variable X0 is
lim P [|Xn − X0 | > ǫ] = 0, ∀ǫ > 0
n→∞
P
This is denoted as Xn → X0
◮ By the definition of limit, the above means
∀δ > 0, ∃N < ∞, s.t. P [|Xn − X0 | > ǫ] < δ, ∀n > N
◮
PS Sastry, IISc, Bangalore, 2020 34/34
◮
P
Xi are iid, EXi = µ, Var(Xi ) = σ 2 , Sn = ni=1 Xi
Sn
σ2
Sn
= µ; and Var
=
E
n
n
n
Weak law of large numbers states
Sn P
→ µ
n
We only need marginal distributions of individual Xn to
decide whether a sequence converges to a constant in
probability
PS Sastry, IISc, Bangalore, 2020 1/33
PS Sastry, IISc, Bangalore, 2020 2/33
Recap: almost sure convergence
Recap
◮
◮
A sequence of random variables, Xn , is said to converge
almost surely or with probability one to X if
∞
P (∩∞
N =1 ∪k=0 [|XN +k − X| ≥ ǫ]) = 0, ∀ǫ > 0
Same as
P ({ω : Xn (ω) → X(ω)}) = 1
or equivalently
The sequence Xn converges to X almost surely iff
∞
P (∩∞
N =1 ∪k=N [|Xk − X| ≥ ǫ]) = 0, ∀ǫ > 0
◮
Equivalently
lim P (∪∞
k=n [|Xk − X| ≥ ǫ]) = 0, ∀ǫ > 0
P ({ω : Xn (ω) 9 X(ω)}) = 0
w.p.1
a.s.
Denoted as Xn → X or Xn → X or Xn → X0 (w.p.1)
◮ We can also write it as
◮
n→∞
◮
P
Xn → X iff
lim P [|Xn − X| > ǫ] = 0, ∀ǫ > 0
n→∞
P [Xn → X] = 1
a.s.
◮
Xn → X
PS Sastry, IISc, Bangalore, 2020 4/33
Recap
Let A1 , A2 , · · · be a sequence of events.
◮ We define
◮
lim sup An ,
lim inf An ,
P
Xn → X
Almost sure convergence is a stronger mode of
convergence
PS Sastry, IISc, Bangalore, 2020 3/33
Recap: lim sup and lim inf
⇒
◮
∞
∩∞
n=1 ∪k=n Ak
∞
∪∞
n=1 ∩k=n Ak
If lim sup An = lim inf An then that is lim An .
Otherwise the sequence does not have a limit
◮ lim sup An and lim inf An are events
◮ lim inf An ⊂ lim sup An
◮
PS Sastry, IISc, Bangalore, 2020 5/33
a.s.
Xn → X iff
∞
P (∩∞
N =1 ∪k=N [|Xk − X| ≥ ǫ]) = 0, ∀ǫ > 0
◮
◮
Let Aǫk = [|Xk − X| ≥ ǫ].
a.s.
Hence, Xn → X iff
P (lim sup Aǫn ) = 0, ∀ǫ > 0
PS Sastry, IISc, Bangalore, 2020 6/33
Given a sequence Xn we want to know whether it
converges to X
◮ Let Aǫ = [|Xk − X| ≥ ǫ]
k
Recall: Borel-Cantelli Lemma
◮
◮
◮
Borel-Cantelli lemma: Given sequence of events,
A1 , A2 , · · ·
2.
P (lim sup Aǫn ) = 0, ∀ǫ > 0
◮
P∞
i=1 P (Ai ) < ∞, then, P (lim sup An ) = 0
P∞
If i=1 P (Ai ) = ∞ and Ai are independent,
1. If
a.s.
Xn → X if
By Borel-Cantelli lemma
∞
X
P (lim sup An ) = 1
k=1
a.s.
P (Ak ) < ∞ ⇒ P (lim sup Ak ) = 0 ⇒ Xk → X
If Ak are ind
∞
X
k=1
a.s.
P (Ak ) = ∞ ⇒ P (lim sup Ak ) = 1 ⇒ Xk 9 X
PS Sastry, IISc, Bangalore, 2020 8/33
PS Sastry, IISc, Bangalore, 2020 7/33
Strong Law of Large Numbers
Let Aǫn = Snn − µ > ǫ
◮ As we saw, by Chebyshev inequality
Sn
σ2
P
−µ >ǫ ≤ 2
n
nǫ
◮
Let Xn be iid, EXn = µ, Var(Xn ) = σ 2 , Sn =
◮ We saw weak law of large numbers:
◮
Pn
i=1 Xi
Sn P
→µ
n
◮
This shows P (Aǫn ) → 0 and thus we get weak law
◮ To prove strong law using Borel-Cantelli lemma, we need
P
P (Aǫn ) < ∞
P σ2
◮ Since
n nǫ2 = ∞, the Chebyshev bound is not useful
◮ We need a bound: P [| Sn − µ|] ≤ cn such that
n
P
n cn < ∞.
◮
Strong law of large numbers says:
Sn a.s.
→µ
n
PS Sastry, IISc, Bangalore, 2020 9/33
PS Sastry, IISc, Bangalore, 2020 10/33
Let us assume Xi have finite fourth moment
!4
n
n
X
X X 4!
X
(Xi −µ)4 +
(Xi − µ) =
(Xi −µ)2 (Xj −µ)2 +T
2!2!
i=1
i j>i
i=1
◮
Where T represent a number of terms such that every
term in it contains a factor like (Xi − µ)
Note that E[(Xi − µ)(Xj − µ)3 ] = 0 etc. because Xi are
independent.
◮ Hence we get
!4
n
X
(Xi − µ) = nE[(Xi −µ)4 ]+3n(n−1)σ 4 ≤ C ′ n2
E
◮
Now we can get, using Markov inequality
Sn
− µ > ǫ = P [|Sn − nµ| > nǫ]
P
n
" n
#
X
= P
(Xi − µ) > nǫ
i=1
≤
≤
◮
i=1
Since
P
E(
Pn
i=1 (Xi − µ))
(nǫ)4
4
C
C ′ n2
= 2
4
4
nǫ
n
Sn a.s.
C
n n2 < ∞, we get n → µ
PS Sastry, IISc, Bangalore, 2020 12/33
PS Sastry, IISc, Bangalore, 2020 11/33
Convergence in rth mean
◮
◮
Strong law of large numbers says
Sn a.s.
→µ
n
where Sn =
n
X
E [|Xn − X|r ] → 0
Xi , Xi iid, EXi = µ
i=1
We say that a sequence Xn converges in rth mean to X if
E[|Xn |r ] < ∞, ∀n, E[|X|r ] < ∞ and
r
Denoted as Xn → X
◮ Consider our old example of binary random variables
◮
We proved it assuming finite fourth moment of Xi .
◮ This is only for illustration
◮ Strong law holds without any such assumptions on
moments
◮ Strong law of large numbers says that sample mean
converges to the expectation with probability one.
◮
as n → ∞
P [Xn = 1] =
◮
1
n
P [Xn = 0] = 1 −
1
n
All moments of Xn are finite and we have
2
1
E |Xn − 0|2 = → 0
n
Hence Xn → 0.
◮ In this example Xn converges in r th mean for all r
◮
PS Sastry, IISc, Bangalore, 2020 13/33
PS Sastry, IISc, Bangalore, 2020 14/33
◮
◮
P [Xn = 0] = 1 − an ;
r
Suppose Xn → X. Then, by Markov inequality
E [|Xn − X|r ]
P [|Xn − X| > ǫ] ≤
→0
ǫr
◮
Hence
r
Xn → X
⇒
P [Xn = cn ] = an
P
Assume an → 0 so that Xn → 0
◮ By Borel-Cantelli lemma
X
a.s.
an < ∞
Xn → 0 ⇔
◮
P
Xn → X
Consider sequence Xn where Xn are independent with
n
th
In general, neither of convergence almost surely and in r
mean imply the other.
◮ We can generate counter examples for this easily.
◮ However, if all Xn take values in a bounded interval, then
almost sure convergence implies rth mean convergence
◮
◮
For convergence in rth mean we need
E [|Xn − 0|r ] = (cn )r an → 0
r
Take an = n1 and cn = 1. Then Xn → 0 but the sequence
does not converge almost surely.
a.s.
◮ Take an = 12 and cn = en . Then Xn → 0 but the
n
sequence does not converge in rth mean for any r.
◮
PS Sastry, IISc, Bangalore, 2020 16/33
PS Sastry, IISc, Bangalore, 2020 15/33
Convergence in distribution
Let Fn be the df of Xn , n = 1, 2, · · · . Let X be a rv with
df F .
◮ Sequence Xn is said to converge to X in distribution if
◮
◮
◮
r
Fn (x) → F (x), ∀x where F is continuous
Let Xn → X. Then
1. E[|Xn |r ] → E[|X|r ]
s
2. Xn → X, ∀s < r
◮
We denote this as
d
Xn → X,
The proofs are straight-forward but we omit the proofs
L
or Xn → X,
w
or Fn → F
This is also known as convergence in law or weak
convergence
◮ Note that here we are essentially talking about
convergence of distribution functions.
◮ Convergence in probability implies convergence in
distribution
◮ The converse is not true. (e.g., sequence of iid random
variables)
◮
PS Sastry, IISc, Bangalore, 2020 17/33
PS Sastry, IISc, Bangalore, 2020 18/33
Examples
Examples
X1 , X2 , · · · be iid; uniform over (0, 1)
◮ Nn = min(X1 , · · · , Xn ), Yn = nNn . Does Yn converge in
distribution?
◮
P [Nn > a] = (P [Xi > a])n = (1 − a)n , 0 < a < 1
y n
P [Yn > y] = P [Nn > y/n] = 1 −
,
n
◮
P [|Nn − θ| > ǫ] = P [Nn > θ + ǫ] = (P [Xi > θ + ǫ])n
if n > y
P [Xi > θ + ǫ] =
Hence for any y
Z ∞
e−x+θ dx = e−ǫ
θ+ǫ
y n
= e−y
lim P [Yn > y] = lim 1 −
n→∞
n→∞
n
◮
Let {Xn } be iid with density f (x) = e−x+θ , x > θ > 0.
◮ Let Nn = min(X1 , · · · Xn ). Does Nn converge in
probability?
◮ Guess for limit: θ
◮
The sequence converges in distribution to an exponential
rv
P [Nn > θ + ǫ] = e−ǫ
P
n
→ 0, as n → ∞, ∀ǫ > 0
Hence Nn → θ
◮ Does it converge almost surely?
◮
PS Sastry, IISc, Bangalore, 2020 19/33
Examples
EXn = mn and Var(Xn ) = σn2 , n = 1, 2, · · ·
◮ Want a sufficient condition for Xn − mn to converge in
probability
◮ Note that E[Xn − mn ] = 0, and Var(Xn − mn ) = σ 2 , ∀n
n
PS Sastry, IISc, Bangalore, 2020 20/33
◮
We have seen different modes of convergence
◮
Xn → X iff
d
Fn (x) → F (x), ∀x where F is continuous
◮
P [|Xn − mn | > ǫ] ≤
σn2
ǫ2
◮
lim P [|Xn − X| > ǫ] = 0, ∀ǫ > 0
n→∞
◮
Hence, a sufficient condition is σn2 → 0.
◮ What is a sufficient condition for convergece almost
surely?
P
Xn → X iff
r
Xn → X iff
E [|Xn − X|r ] → 0
◮
◮
as n → ∞
a.s
Xn → X iff
P [Xn → X] = 1 or P [lim sup |Xn − X| > ǫ] = 0
PS Sastry, IISc, Bangalore, 2020 21/33
PS Sastry, IISc, Bangalore, 2020 22/33
◮
We have the following relations among different modes of
convergence
r
P
d
a.s.
P
d
Xn → X ⇒ Xn → X ⇒ X n → X
Xn → X ⇒ X n → X ⇒ X n → X
All the implications are one-way and we have seen
counter examples
◮ In general, almost sure convergence does not imply
convergence in rth mean and vice versa
◮
Strong and weak laws of large numbers are very useful
examples of convergence of sequences of random
variables.
Pn
◮ Given Xi are iid, EXi = µ, Var(Xi ) = σ 2 , Sn =
i=1 Xi
◮
P
Weak law of large numbers: Snn → µ
a.s.
◮ strong law of large numbers: Sn → µ
n
◮
Another useful result is the Central Limit Theorem (CLT)
◮ CLT is about (normalized) sums of of independent
random variables converging to the Gaussian distribution
◮
PS Sastry, IISc, Bangalore, 2020 23/33
PS Sastry, IISc, Bangalore, 2020 24/33
Central Limit Theorem
◮
Given Xi are iid, EXi = µ, Var(Xi ) = σ 2 , n = 1, 2, · · ·
Sn =
n
X
i=1
Xi ⇒ ESn = nµ, Var(Sn ) = nσ 2
Given any rv Y , let Z = √Y −EY
Var(Y )
◮ Then, EZ = 0 and Var(Z) = 1.
S −nµ
◮ Define S̃n = n √
E S̃n = 0, Var(S̃n ) = 1, ∀n
σ n
Take Xi iid, EXi = 0, Var(Xi ) = 1, n = 1, 2, · · ·
Pn
◮ Sn =
i=1 Xi
◮ Strong law of large numbers implies
◮
Sn a.s.
→ 0
n
◮
◮
d
Central Limit Theorem states: S̃n → N (0, 1)
Z a
x2
1
√ e− 2 dx
lim P [S̃n ≤ a] = Φ(a) ,
n→∞
2π
−∞
PS Sastry, IISc, Bangalore, 2020 25/33
◮
Central Limit Theorem implies
S a.s.
√n → N (0, 1)
n
PS Sastry, IISc, Bangalore, 2020 26/33
Central Limit Theorem
◮
Characteristic Function
Given Xi are iid, EXi = µ, Var(Xi ) = σ 2 , n = 1, 2, · · ·
Sn =
n
X
Xi
i=1
Sn − nµ
√
S̃n =
σ n
d
Central Limit Theorem states: S̃n → N (0, 1)
◮ We use characteristic functions for proving CLT
◮
◮
◮
Given rv X, its characteristic function, φX , is defined by
Z
√
iuX φX (u) = E e
= eiux dFX (x) (i = −1)
Since |eiux | ≤ 1, φX exists for all random variables
PS Sastry, IISc, Bangalore, 2020 27/33
PS Sastry, IISc, Bangalore, 2020 28/33
Properties of characteristic function
Let µr = E[X r ] and let νr = E[|X|r ]
◮ If νr is finite, then
◮
φX (u) = E eiuX =
Z
eiux dFX (x) (i =
√
−1)
s=0
φ is continuous; |φ(u)| ≤ φ(0) = 1; φ(−u) = φ∗ (u)
◮ If Y = aX + b, φY (u) = eiub φX (ua)
◮ If E|X|r < ∞, φ would be differentiable r times and
◮
(r)
φX (u) =
r−1
X
r iuX
φ (u) = E[(iX) e
]
µs
(iu)r
(iu)s
+ ρ(u) µr
s!
r!
where |ρ(u)| ≤ 1 and ρ(u) → 1 as u → 0
◮ If all moments exist, then
φX (u) =
∞
X
s=0
PS Sastry, IISc, Bangalore, 2020 29/33
µs
(iu)s
s!
PS Sastry, IISc, Bangalore, 2020 30/33
Characteristic function example
We denote by φF characteristic function of df F
◮ Let Fn be a sequence of distribution functions
◮ Continuity theorem
◮
◮
Let X be binomial rv
n
X
iuX n
φX (u) = E e
=
Ck pk (1 − p)n−k eiuk
k=0
If Fn → F then φFn → φF
◮ If φ
Fn → ψ and ψ is continuous at zero, then ψ would be
characteristic function of some df, say, F , and Fn → F
◮
=
n
X
n
k=0
peiu + (1 − p)
D
=
Ck (peiu )k (1 − p)n−k
PS Sastry, IISc, Bangalore, 2020 31/33
n
PS Sastry, IISc, Bangalore, 2020 32/33
Recap: Modes of convergence
◮
◮
Let X ∼ N (0, 1)
Z ∞
x2
1
√ eiux e− 2 dx
2π
Z−∞
∞
1
1
2
2 2
√ e− 2 ((x−iu) −i u ) dx
=
2π
−∞
Z ∞
2
1
u
1
2
√ e− 2 ((x−iu) dx
= e− 2
2π
−∞
φX (u) = E eiuX =
d
Xn → X iff
Fn (x) → F (x), ∀x where F is continuous
◮
P
Xn → X iff
lim P [|Xn − X| > ǫ] = 0, ∀ǫ > 0
n→∞
◮
u2
r
Xn → X iff
E [|Xn − X|r ] → 0
= e− 2
◮
as n → ∞
a.s
Xn → X iff
P [Xn → X] = 1 or P [lim sup |Xn − X| > ǫ] = 0
PS Sastry, IISc, Bangalore, 2020 33/33
PS Sastry, IISc, Bangalore, 2020 1/34
Recap
◮
Recap
We have the following relations among different modes of
convergence
r
P
d
Xn → X ⇒ Xn → X ⇒ X n → X
a.s.
P
d
Xn → X ⇒ X n → X ⇒ X n → X
◮
◮
◮
◮
All the implications are one-way and we have seen
counter examples
◮ In general, almost sure convergence does not imply
convergence in rth mean and vice versa
P
Weak law of large numbers: Snn → µ
d
−nµ
→ N (0, 1)
Central Limit Theorem: Sσn√
n
PS Sastry, IISc, Bangalore, 2020 3/34
Recap: Characteristic Function
Take Xi iid, EXi = 0, Var(Xi ) = 1, n = 1, 2, · · ·
Pn
◮ Sn =
i=1 Xi
◮ Strong law of large numbers implies
◮
Sn a.s.
→ 0
n
◮
i=1 Xi
a.s.
PS Sastry, IISc, Bangalore, 2020 2/34
Recap
Pn
strong law of large numbers: Snn → µ
D
◮
Given Xi are iid, EXi = µ, Var(Xi ) = σ 2 , Sn =
◮
◮
Given rv X, its characteristic function, φX , is defined by
Z
√
iuX φX (u) = E e
= eiux dFX (x) (i = −1)
Since |eiux | ≤ 1, φX exists for all random variables
φ is continuous; |φ(u)| ≤ φ(0) = 1; φ(−u) = φ∗ (u)
◮ If Y = aX + b, φ (u) = eiub φ (ua)
Y
X
◮ If E|X|r < ∞, φ would be differentiable r times and
◮
Central Limit Theorem implies
S a.s.
√n → N (0, 1)
n
φ(r) (u) = E[(iX)r eiuX ]
PS Sastry, IISc, Bangalore, 2020 4/34
PS Sastry, IISc, Bangalore, 2020 5/34
Recap
Recap
Let µr = E[X r ] and let νr = E[|X|r ]
◮ If νr is finite, then
◮
r−1
X
(iu)r
(iu)s
+ ρ(u) µr
µs
φX (u) =
s!
r!
s=0
We denote by φF characteristic function of df F
◮ Let Fn be a sequence of distribution functions
◮ Continuity theorem
◮
If Fn → F then φFn → φF
◮ If φ
Fn → ψ and ψ is continuous at zero, then ψ would be
characteristic function of some df, say, F , and Fn → F
◮
where |ρ(u)| ≤ 1 and ρ(u) → 1 as u → 0
◮ If all moments exist, then
s=0
µs
(iu)s
s!
D
φX (u) =
∞
X
PS Sastry, IISc, Bangalore, 2020 6/34
P
Given Xi iid, EXi = µ, Var(Xi ) = σ 2 , Sn = ni=1 Xi
−nµ
Sn −ESn
◮ Let S̃n = √
= Sσn√
n
var(Sn )
◮ (Lindberg-Levy) Central Limit Theorem
Z x
h
i
t2
S
−
nµ
1
n
√
lim P S˜n ≤ x = lim P
≤x = √
e− 2 dt, ∀x
n→∞
n→∞
σ n
2π −∞
◮
◮
Proof:
◮ Without loss of generality let us assume µ = 0.
◮ We use characteristic function of S̃n for the proof.
◮ Let φ be the characteristic function of Xi . Then
n
t
n
√
and φS̃n (t) = φ
φSn (t) = (φ(t))
σ n
PS Sastry, IISc, Bangalore, 2020 8/34
Recall that we can expand φ in a Taylor series
φ(u) =
r−1
X
µs
s=0
◮
PS Sastry, IISc, Bangalore, 2020 7/34
(iu)r
(iu)s
+ρ(u) µr
, ρ(u) → 1, as u → 0
s!
r!
Here we assume: EXi = 0 and EXi2 = σ 2
φ(t) = 1 + 0 −
φ
t
√
σ n
1
ρ(t) σ 2 t2
2
2
1
t
2 t
√
= 1− ρ
σ 2
2
σ n
σ n
2
2
1 t
t
1 t
√
+
= 1−
1−ρ
2 n
2 n
σ n
1 t2
1
= 1−
+ o
2 n
n
PS Sastry, IISc, Bangalore, 2020 9/34
Hence we get
n
t
√
lim φ (t) = lim φ
n→∞ S̃n
n→∞
σ n
n
1 t2
1
= lim 1 −
+ o
n→∞
2 n
n
t2
= e− 2
which is the characteristic function of standard normal
◮ By Continuity theorem, distribution function of S˜n
converges to that of standard Normal rv
Z x
i
h
t2
1
˜
e− 2 dt, ∀x
lim P Sn ≤ x = √
n→∞
2π −∞
What CLT says is that sums of iid random variables,
when appropriately normalized, would always approach
the Gaussian distribution.
◮ It allows one to approximate distribution of sums of
independent rv’s
Pn
◮ Let Xi be iid and Sn =
i=1 Xi
x − nµ
x − nµ
Sn − nµ
√
√
P [Sn ≤ x] = P
≤ √
≈Φ
σ n
σ n
σ n
◮
◮
Thus, Sn is well approximated by a normal rv with mean
nµ and variance nσ 2 , if n is large
D
◮
PS Sastry, IISc, Bangalore, 2020 10/34
PS Sastry, IISc, Bangalore, 2020 11/34
P
Z = 20
i=1 Xi , Xi ∼ U [−0.5, 0.5], Xi iid
◮ EXi = 0 and Var(Xi ) = 1 .
12
◮ Hence, EZ = 0 and Var(Z) = 20 = 5
12
3
Example
◮
P [|Z| ≤ 3] = P [−3 ≤ Z ≤ 3]
3
−3
Z − EZ
≤q
= P q ≤ p
5
5
Var(Z)
3
3
−3
3
≈ Φ q − Φ q
Twenty numbers are rounded off to the nearest integer
and added. What is the probability that the sum obtained
differs from true sum by more than 3.
◮ A reasonable assumption is round-off errors are
independent and uniform over [−0.5, 0.5]
P20
◮ Take Z =
i=1 Xi , Xi ∼ U [−0.5, 0.5], Xi iid.
◮ Then Z represents the error in the sum.
◮
5
3
≈ Φ(2.3) − Φ(−2.3)
= 0.9893 − 0.0107 ≈ 0.98
◮
PS Sastry, IISc, Bangalore, 2020 12/34
5
3
Hence probability that the sum differs from true sum by
more than 3 is 0.02
PS Sastry, IISc, Bangalore, 2020 13/34
We can approximate binomial rv with Gaussian for large n
◮ Binomial random variable with parameters n, p is a sum
of n independent
Bernoulli variables:
Pn
Sn = i=1 Xi ; Xi ∈ {0, 1}, P [Xi = 1] = p, Xi ind
◮ Hence we can approximate distribution of Sn by
#
"
Sn − np
x − np
P [Sn ≤ x] = P p
≤p
np(1 − p)
np(1 − p)
!
x − np
≈ Φ p
np(1 − p)
◮
Sn be binomial with parameters n, p
P [Sn ≤ x] ≈ Φ
CLT allows one to get rate of convergence of law of large
numbers
Pn
◮ Let Xi iid, EXi = µ, Var(Xi ) = σ 2 , Sn =
i=1 Xi
S
n
◮ By Law of large numbers,
→ µ.
n
◮ Now, by CLT
Sn
− µ > ǫ = P [|Sn − nµ| > nǫ]
P
n
nǫ
Sn − nµ
√
> √
= P
σ n
σ n
nǫ
nǫ
√
≈ 1− Φ
−Φ − √
σ n
σ n
nǫ
√
= 2 1−Φ
σ n
np(1 − p)
!
For example, with p = 0.95
100 − 110 ∗ 0.95
≈ Φ(−1.97) = 0.025
P [S110 ≤ 100] ≈ Φ √
110 ∗ 0.05 ∗ 0.95
◮
Since Sn is integer-valued, the LHS above is same for all
x between two consecutive integers; but RHS changes
◮ To get a good approximation, to calculate P [Sn ≤ m] one
uses P [Sn ≤ m + 0.5] in the above approximation formula
◮
PS Sastry, IISc, Bangalore, 2020 14/34
◮
p
x − np
D
For large n, binomial rv is like a Gaussian rv with mean
np and variance np(1 − p)
◮ The approximation is quite good in practice
◮
◮
PS Sastry, IISc, Bangalore, 2020 15/34
Example: Opinion Polls
let p denote the fraction of population that prefers
product A to product B
◮ We want to estimate p
◮ We conduct a sample survey by asking n people
◮ We want to make a statement such as
p = 0.34 ± 0.07 with a confidence of 95%
◮
◮
Here, the 0.34 would be the sample mean. The other two
numbers can be fixed using CLT
(because Φ(−x) = (1 − Φ(x)) )
PS Sastry, IISc, Bangalore, 2020 16/34
PS Sastry, IISc, Bangalore, 2020 17/34
P
Xi ∈ {0, 1} iid, EXi = p, Sn = ni=1 Xi
◮ Now, by CLT, we have
Sn
P
− p > ǫ = P [|Sn − np| > nǫ]
n
◮
= 2 1−Φ
◮
p
Fortunately, p(1 − p) does not change too much with p
◮ It attains its maximum value of 0.5 at p = 0.5
◮ It is 0.458 at p = 0.3 and is 0.4 at p = 0.2
◮ One normally fixes this variance as 0.5 or 0.45 to
calculate the sample size, n.
◮ There are other ways of handling it
◮
nǫ
p
np(1 − p)
!!
Suppose we want to satisfy
Sn
P
−p >ǫ =δ
n
We can calculate any one of ǫ, δ or n given the other two
using the earlier equation.
◮ But we need value of p for it!
D
◮
PS Sastry, IISc, Bangalore, 2020 18/34
◮
We have
Sn
−p >ǫ =2 1−Φ
P
n
Confidence intervals
√
ǫ n
p
p(1 − p)
!!
Suppose n = 900 and
p ǫ = 0.025.
Let us approximate p(1 − p) = 0.45. Then
0.025 ∗ 30
2 1−Φ
= 2(1 − Φ(1.66)) ≈ 0.1
0.45
p
◮ If we took
p(1 − p) = 0.5 we get the value as 0.14
◮ If we use Chebyshev inequality with variance as 0.5 we get
the bound as 0.8
◮ If we change ǫ to 0.05, then at variance equal to 0.5 the
probability becomes about 0.02 while the Chebyshev
bound would be about 0.2
◮
PS Sastry, IISc, Bangalore, 2020 19/34
PS Sastry, IISc, Bangalore, 2020 20/34
P
Let Xi iid, EXi = µ, Var(Xi ) = σ 2 , Sn = ni=1 Xi .
◮ Using CLT, we get
√ c n
Sn
−µ >c =2 1−Φ
P
n
σ
◮
If the RHS above is δ, then we can say that
Sn
∈ [µ − c, µ + c] with probability (1 − δ)
n
◮ This interval is called the 100(1 − δ)% confidence interval.
◮
PS Sastry, IISc, Bangalore, 2020 21/34
P
√ Sn
c n
−µ >c =2 1−Φ
n
σ
√
Suppose c = 1.96σ
n
◮ Then
1.96σ
Sn
−µ > √
P
= 2 (1 − Φ (1.96)) = 0.05
n
n
◮
◮
central limit theorem
Denoting
X̄ = Snn , thei95% confidence interval is
h
√ , X̄ + 1.96σ
√
X̄ − 1.96σ
n
n
CLT essentially states that sum of many independent
random variables behaves like a Gaussian random variable
◮ It is very useful in many statistics applications.
◮ We stated CLT for iid random variables.
◮ While independence is important, all rv need not have the
same distribution.
◮ Essentially, the variances should not die out.
◮
D
One generally uses an estimate for σ obtained from Xi
◮ In analyzing any experimental data the confidence
intervals or the variance term is important
◮
PS Sastry, IISc, Bangalore, 2020 22/34
PS Sastry, IISc, Bangalore, 2020 23/34
Markov Chains
We have been considering sequences: Xn , n = 1, 2, · · ·
◮ We have so far considered only the asymptotic properties
or limits of such sequences.
◮ Any such sequence is an example of what is called a
random process or stochastic process
◮ Given n rv, they are completely characterized by their
joint distribution.
◮ How doe we specify or characterize an infinite collection
of random variables?
◮ We need the joint distribution of every finite subcollection
of them.
◮
PS Sastry, IISc, Bangalore, 2020 24/34
Let Xn , n = 0, 1, · · · be a sequence of discrete random
variables taking values in S.
Note that S would be countable
◮ We say it is a Markov chain if
◮
P [Xn+1 = xn+1 |Xn = xn , Xn−1 = xn−1 · · · X0 = x0 ] = P [Xn+1 = xn+1 |Xn = xn ], ∀x
◮
We can write it as
P [Xn+1 = xn+1 |Xn = xn , Xn−1 · · · X0 ] = P [Xn+1 = xn+1 |Xn = xn ], ∀xi
Conditioned on Xn , Xn+1 is independent of
Xn−1 , Xn−2 , · · ·
◮ We think of Xn as state at n
◮ For a Markov chain, given the current state, the future
evolution is independent of the history of how you
reached the current state
◮
PS Sastry, IISc, Bangalore, 2020 25/34
Example
In this example, we can think of Xn as the number of
people or things arriving at a facility in the nth time
interval.
◮ Then Yn would be total arrivals till end of nth time
interval.
◮ Number of packets coming into a network switch, number
people joining the queue in a bank, number of infections
till date are all Markov chains.
◮ This is a useful model for many dynamic systems or
processes
P [Yn+1 = y|Yn = x, Yn−1 , · · · ] = P [Xn+1 = y − x]
◮
Thus, Yn+1 is conditionally independent of Yn−1 , · · ·
conditioned on Yn
D
◮
Let Xi be iid discrete rv taking integer values.
Pn
◮ Let Y0 = 0 and Yn =
i=1 Xi
◮ Yn , n = 0, 1, · · · is a Markov chain with state space as
integers
◮ Note that Yn+1 = Yn + Xn+1 and Xn+1 is independent of
Y0 , · · · , Yn .
◮
PS Sastry, IISc, Bangalore, 2020 26/34
PS Sastry, IISc, Bangalore, 2020 27/34
Transition Probabilities
◮
The Markov property is: given current state, the future
evolution is independent of the history of how we came to
current state.
◮ It essentially means the current state contains all needed
information about history
◮ We are considering the case where states as well as time
are discrete.
◮ It can be more general and we discuss some of them
◮
Let {Xn , n = 0, 1, · · · } be a Markov Chain with
(countable) state space S
P r[Xn+1 = xn+1 |Xn = xn , Xn−1 · · · X0 ] = P r[Xn+1 = xn+1 |Xn = xn ], ∀x
(Notice change of notation)
◮ Define function P : S × S → [0, 1] by
P (x, y) = P r[Xn+1 = y|Xn = x]
◮
P is called the state transition probability function. It
satisfies
◮
◮
◮
PS Sastry, IISc, Bangalore, 2020 28/34
P
P(x, y) ≥ 0, ∀x, y ∈ S
y∈S P (x, y) = 1, ∀x ∈ S
If S is finite then P can be represented as a matrix
PS Sastry, IISc, Bangalore, 2020 29/34
Initial State Probabilities
◮
The state transition probability function is given by
P (x, y) = P r[Xn+1 = y|Xn = x]
In general, this can depend on n though our notation
does not show it
◮ If the value of that probability does not depend on n then
the chain is called homogeneous
◮ For a homogeneous chain we have
◮
Let {Xn } be a Markov Chain with state space S
◮ Define function π0 : S → [0, 1] by
◮
π0 (x) = P r[X0 = x]
It is the pmf of the rv X0
◮ Hence it satisfies
◮
◮
P r[Xn+1 = y|Xn = x] = P r[X1 = y|X0 = x], ∀n
◮
In this course we will consider only homogeneous chains
PS Sastry, IISc, Bangalore, 2020 30/34
Let Xn be a (homogeneous) Markov chain
◮ Then we have
◮
P r[X0 = x0 , X1 = x1 ] = P r[X1 = x1 |X0 = x0 ] P r[X0 = x0 ], ∀x0 , x1
= P (x0 , x1 )π0 (x0 ) = π0 (x0 )P (x0 , x1 )
◮
Now we can extend this as
P r[X0 = x0 , X1 = x1 , X2 = x2 ] = P r[X2 = x2 |X1 = x1 , X0 = x0 ] ·
P r[X0 = x0 , X1 = x1 ]
= P r[X2 = x2 |X1 = x1 ] ·
P r[X0 = x0 , X1 = x1 ]
= P (x1 , x2 ) P (x0 , x1 )π0 (x0 )
= π0 (x0 )P (x0 , x1 )P (x1 , x2 )
PS Sastry, IISc, Bangalore, 2020 32/34
π
P0 (x) ≥ 0, ∀x ∈ S
x∈S π0 (x) = 1
From now on, without loss of generality, we take
S = {0, 1, · · · }
D
◮
◮
◮
PS Sastry, IISc, Bangalore, 2020 31/34
This calculation is easily generalized to any number of
time steps
P r[X0 = x0 , · · · Xn = xn ] = P r[Xn = xn |Xn−1 = xn−1 , · · · X0 = x0 ] ·
P r[Xn−1 = xn−1 , · · · X0 = x0 ]
= P r[Xn = xn |Xn−1 = xn−1 ] ·
P r[Xn−1 = xn−1 , · · · X0 = x0 ]
= P (xn−1 , xn )P r[Xn−1 = xn−1 , · · · X0 = x0 ]
= P (xn−1 , xn )P r[Xn−1 = xn−1 |Xn−2 = xn−2 ] ·
P r[Xn−2 = xn−2 , · · · X0 = x0 ]
..
.
= π0 (x0 )P (x0 , x1 ) · · · P (xn−1 , xn )
PS Sastry, IISc, Bangalore, 2020 33/34
◮
Recap: Central Limit Theorem
We showed
P
Given Xi iid, EXi = µ, Var(Xi ) = σ 2 , Sn = ni=1 Xi
−nµ
Sn −ESn
◮ Let S̃n = √
= Sσn√
n
var(Sn )
◮ (Lindberg-Levy) Central Limit Theorem
Z x
h
i
t2
S
−
nµ
1
n
√
lim P S˜n ≤ x = lim P
≤x = √
e− 2 dt, ∀x
n→∞
n→∞
σ n
2π −∞
◮
P r[X0 = x0 , · · · Xn = xn ] = π0 (x0 )P (x0 , x1 ) · · · P (xn−1 , xn )
This shows that the transition probabilities, P , and initial
state probabilities, π0 , completely specify the chain.
◮ They give us the joint distribution of any finite
subcollection of the rv’s
◮ Suppose you want joint distribution of Xi , · · · Xi
1
k
◮ Let m = max(i1 , · · · , ik )
◮ We know how to get joint distribution of X0 , · · · , Xm .
◮ The joint distribution of Xi , · · · Xi is now calculated as
1
k
a marginal distribution from the joint distribution of
X 0 , · · · , Xm
◮
◮
It allows us to approximate distributions of sums of
independent random variables
x − nµ
√
P [Sn ≤ x] ≈ Φ
σ n
For example, binomial rv is well approximated by normal
for large n
◮ CLT is also important to get information on rate of
convergence of law of large numbers.
◮
PS Sastry, IISc, Bangalore, 2020 1/27
PS Sastry, IISc, Bangalore, 2020 34/34
Recap: Markov Chain
Recap: Transition Probabilities
Let Xn , n = 0, 1, · · · be a sequence of discrete random
variables taking values in S.
◮ We say it is a Markov chain if
◮
Let {Xn , n = 0, 1, · · · } be a Markov Chain with
(countable) state space S
◮ Transition probability function is P : S × S → [0, 1]
◮
P r[Xn+1 = xn+1 |Xn = xn , Xn−1 = xn−1 · · · X0 = x0 ] = P r[Xn+1 = xn+1 |Xn = xn ],
◮
We can write it as
fXn+1 |Xn ,···X0 (xn+1 |xn , · · · , x0 ) = fXn+1 |Xn (xn+1 |xn ), ∀xi
◮
For a Markov chain, given the current state, the future
evolution is independent of the history of how you
reached the current state
PS Sastry, IISc, Bangalore, 2020 2/27
P (x, y) = P r[Xn+1 = y|Xn = x]
The chain is said to be homogeneous when this is not a
function of time.
◮ It satisfies
◮
◮
◮
P
P(x, y) ≥ 0, ∀x, y ∈ S
y∈S P (x, y) = 1, ∀x ∈ S
If S is finite then P can be represented as a matrix
PS Sastry, IISc, Bangalore, 2020 3/27
Recap: Initial State Probabilities
◮
Let {Xn } be a Markov Chain with state space S
◮ Initial state probabilities π0 : S → [0, 1]
◮
π0 (x) = P r[X0 = x]
It satisfies
◮
◮
π
P0 (x) ≥ 0, ∀x ∈ S
x∈S π0 (x) = 1
The P and π0 determine all joint distributions
P r[X0 = x0 , · · · Xn = xn ] = P r[Xn = xn |Xn−1 = xn−1 , · · · X0 = x0 ] ·
P r[Xn−1 = xn−1 , · · · X0 = x0 ]
= P r[Xn = xn |Xn−1 = xn−1 ] ·
P r[Xn−1 = xn−1 , · · · X0 = x0 ]
= P (xn−1 , xn )P r[Xn−1 = xn−1 , · · · X0 = x0 ]
= P (xn−1 , xn )P r[Xn−1 = xn−1 |Xn−2 = xn−2 ] ·
P r[Xn−2 = xn−2 , · · · X0 = x0 ]
..
.
= π0 (x0 )P (x0 , x1 ) · · · P (xn−1 , xn )
PS Sastry, IISc, Bangalore, 2020 4/27
◮
PS Sastry, IISc, Bangalore, 2020 5/27
Example: 2-state chain
We showed
◮
P r[X0 = x0 , · · · Xn = xn ] = π0 (x0 )P (x0 , x1 ) · · · P (xn−1 , xn )
This shows P , and π0 , determine joint distribution of
X0 , · · · , Xm for any m
◮ Suppose you want joint distribution of Xi , · · · Xi
1
k
◮ Let m = max(i1 , · · · , ik )
◮ We know how to get joint distribution of X0 , · · · , Xm .
◮ The joint distribution of Xi , · · · Xi is now calculated as
1
k
a marginal distribution from the joint distribution of
X 0 , · · · , Xm
◮ This shows that the transition probabilities, P , and initial
state probabilities, π0 , completely specify the chain.
◮
◮
PS Sastry, IISc, Bangalore, 2020 6/27
◮
Let S = {0, 1}.
We can write the transition probabilities as a matrix
P (0, 0) P (0, 1)
1−p
p
P =
=
P (1, 0) P (1, 1)
q
1−q
Now we can calculate the joint distribution, e.g., of
X1 , X2 as
P r[X1 = 0, X2 = 1] =
=
1
X
x=0
1
X
P r[X0 = x, X1 = 0, X2 = 1]
π0 (x)P (x, 0)P (0, 1)
x=0
= π0 (0)(1 − p)p + π0 (1)qp
PS Sastry, IISc, Bangalore, 2020 7/27
◮
◮
Consider the 2-state chain with S = {0, 1} and
1−p
p
P =
q
1−q
◮
We can represent the chain through a graph as shown
below
We can similarly calculate probabilities of any events
involving these random variables
P r[X2 6= X0 ] = P r[X2 = 0, X0 = 1] + P r[X2 = 1, X0 = 0]
1
X
(π0 (1)P (1, x)P (x, 0) + π0 (0)P (0, x)P (x, 1))
=
p
x=0
◮
0
1
1-q
We have the formula
1-p
P r[X0 = x0 , · · · Xn = xn ] = π0 (x0 )P (x0 , x1 ) · · · P (xn−1 , xn )
◮
◮
This can easily be seen through a graphical notation.
q
The nodes represent states. The edges show possible
transitions and the probabilities
P r[X0 = 0, X1 = 1, X2 = 1, X3 = 0] = π0 (0)p(1 − q)q
PS Sastry, IISc, Bangalore, 2020 8/27
An example
PS Sastry, IISc, Bangalore, 2020 9/27
Birth-Death chain
A man has 4 umbrellas. carries them from home to office
and back when needed. Probability of rain in the morning
and evening is same, namely, p.
◮ What should be the state?
◮ S = {0, 1, · · · , 5}. The transition probabilities are
0
1
2
3
4
0
0
0
0
0
1
1
0
0
0
1
−
p
p
P =
2
0
0
1−p
p
0
3
0
1−p
p
0
0
p
0
0
0
4 1−p
◮
PS Sastry, IISc, Bangalore, 2020 10/27
◮
The following Markov chain is known as a birth-death
chain
q
p
q
q
q
p
p
p
...
i-1
i
...
i+1
In general, birth-death chains may have self-loops on
states
Pn
◮ Random walk: Xi ∈ {−1, +1}, iid, Sn =
i=1 Xi
◮ We can have ‘reflecting boundary’ at 0
◮ Queuing chains can also be birth-death chains
◮
PS Sastry, IISc, Bangalore, 2020 11/27
Gambler’s Ruin chain
◮
We can have birth-death chains with finite state space
also
q
q
q
◮
q
q
1-p
p
p
...
0
◮
i
i+1
p
1-q
...
i-1
q
q
1
p
p
The following chain is called Gambler’s ruin chain
p
p
...
N
This chain keeps visiting all the states again and again
0
1
...
i-1
i
i+1
N
Here, the chain is ultimately absorbed either in 0 or in N
◮ Here state can be the current funds that the gambler has
◮
PS Sastry, IISc, Bangalore, 2020 13/27
PS Sastry, IISc, Bangalore, 2020 12/27
We consider a simple case
P r[X3 = y, X1 = x, X0 = z]
P r[X3 = y|X1 = x, X0 = z] =
P r[X1 = x, X0 = z]
P
w π0 (z)P (z, x)P (x, w)P (w, y)
=
π0 (z)P (z, x)
X
=
P (x, w)P (w, y)
◮
◮
The transition probabilities we defined earlier are also
called one step transition probabilities
P (x, y) = P r[Xn+1 = y|Xn = x] = P r[X1 = y|X0 = x]
We can define transition probabilities for multiple steps,
that is, P r[Xn = y|X0 = x]
◮ We first look at one consequence of markov property
◮ The Markov property implies that it is the most recent
past that matters. For example
◮
w
◮
P r[Xn+m = y|Xn = x, X0 ] = P r[Xn+m = y|Xn = x]
We also have
P r[X3 = y|X1 = x] = P r[X2 = y|X0 = x]
P
w π0 (x)P (x, w)P (w, y)
=
π0 (x)
X
=
P (x, w)P (w, y)
w
◮
Thus we get
P r[X3 = y|X1 = x, X0 = z] = P r[X3 = y|X1 = x]
PS Sastry, IISc, Bangalore, 2020 14/27
PS Sastry, IISc, Bangalore, 2020 15/27
◮
Using similar algebra, we can show that
P r[Xm+n = y|Xm = x, X0 = z] = P r[Xm+n = y|Xm = x]
= P r[Xn = y|X0 = x]
◮
◮
P r[Xm+n = y|X0 = x] =
Or, in general,
X
P r[Xm+n = y, Xm = z|X0 = x]
z
fXm+n |Xm ,··· ,X0 (y|x, · · · ) = fXm+n |Xm (y|x)
◮
Now we get
=
Using the same algebra, we can show
X
P r[Xm+n = y|Xm = z, X0 = x] P r[Xm = z|X0 = x]
z
=
Pr[Xm+n = y|Xm = x, Xm−k ∈ Ak , k = 1, · · · , m] =
P r[Xm+n = y|Xm = x]
X
P r[Xm+n = y|Xm = z] P r[Xm = z|X0 = x]
z
=
X
P r[Xn = y|X0 = z] P r[Xm = z|X0 = x]
z
P r[Xm+n+r ∈ Br , r = 0, · · · , s | Xm = x, Xm−k ∈ Ak , k = 1, · · · , m]
= P r[Xm+n+r ∈ Br , r = 0, · · · , s | Xm = x]
PS Sastry, IISc, Bangalore, 2020 17/27
PS Sastry, IISc, Bangalore, 2020 16/27
Chapman-Kolmogorov Equations
Define: P n (x, y) = P r[Xn = y|x0 = x]
◮ These are called n-step transition probabilities.
◮ From what we showed, n-step transition probabilities
satisfy
X
P m (x, z)P n (z, y)
P m+n (x, y) =
◮
◮
z
These are known as Chapman-Kolmogorov equations
◮ This relationship is intuitively clear
◮
PS Sastry, IISc, Bangalore, 2020 18/27
Specifically, using Chapman-Kolmogorov equations,
X
P (x, z)P (z, y)
P 2 (x, y) =
z
For a finite chain, P is a matrix
◮ Thus P 2 (x, y) is the (x, y)th element of the matrix,
P ×P
◮ That is why we use P n for n-step transition probabilities
◮
PS Sastry, IISc, Bangalore, 2020 19/27
Define: πn (x) = P r[Xn = x].
◮ Then we get
X
πn (y) =
P r[Xn = y|X0 = x] P r[X0 = x]
◮
Hitting times
Let y be a state.
◮ We define hitting time for y as the random variable
◮
x
X
π0 (x)P n (x, y)
X
P r[Xn+1 = y|Xn = x] P r[Xn = x]
=
x
◮
x
X
=
Ty is the first time that the chain is in state y (after t = 0
when the chain is initiated).
◮ It is easy to see that P r[Ty = 1|X0 = x] = P (x, y).
◮ We often need conditional probability conditioned on the
initial state.
◮ Notation: Pz (A) = P r[A|X0 = z]
◮ We write the above as Px (Ty = 1) = P (x, y)
◮
In particular
πn+1 (y) =
Ty = min{n > 0 : Xn = y}
πn (x)P (x, y)
x
PS Sastry, IISc, Bangalore, 2020 20/27
PS Sastry, IISc, Bangalore, 2020 21/27
◮
Similarly we can get:
Ty = min{n > 0 : Xn = y}
n
P (x, y) =
n
X
Px (Ty = m)P n−m (y, y)
m=1
◮
We can now get
Px (Ty = 2) =
◮
X
z6=y
P (x, z) P (z, y) =
X
P (x, z) Pz (Ty = 1)
z6=y
Px (Ty = m) = P r[Ty = m|X0 = x]
X
=
P r[Ty = m|X1 = z, X0 = x] P r[X1 = z|X0 = x]
z6=y
=
X
P (x, z)P r[Ty = m|X1 = z]
=
z6=y
P n (x, y) = P r[Xn = y|X0 = x]
n
X
P r[Ty = m, Xn = y|X0 = x]
=
m=1
=
n
X
P r[Xn = y|Ty = m, X0 = x] P r[Ty = m|X0 = x]
m=1
=
z6=y
X
We can derive this as
P (x, z)Pz (Ty = m − 1)
=
n
X
m=1
n
X
P r[Xn = y|Xm = y] P r[Ty = m|X0 = x]
P n−m (y, y) Px (Ty = m)
m=1
PS Sastry, IISc, Bangalore, 2020 22/27
PS Sastry, IISc, Bangalore, 2020 23/27
◮
transient and recurrent states
Define ρxy = Px (Ty < ∞).
◮ It is the probability that starting in x you will visit y
◮ Note that
∞
X
Px (Ty = n)
ρxy = lim Px (Ty < n) =
◮
n→∞
n=1
Definition: A state y is called transient if ρyy < 1; it is
called recurrent if ρyy = 1.
◮ Intuitively, all transient states would be visited only
finitely many times while recurrent states are visited
infinitely often.
◮ For any state y define
1 if Xn = y
Iy (Xn ) =
0 otherwise
Now, the total number of visits to y is given by
Ny =
∞
X
Iy (Xn )
n=1
◮
We can get distribution of Ny as
Px (Ny ≥ 1) = Px (Ty < ∞) = ρxy
X
Px (Ty = m)Py (Ty < ∞)
Px (Ny ≥ 2) =
m
= ρyy
X
Px (Ty = m) = ρyy ρxy
m
m−1
ρyy ρxy
Px (Ny ≥ m) =
Px (Ny = m) = Px (Ny ≥ m) − Px (Ny ≥ m + 1)
m−1
= ρm−1
ρxy − ρm
yy
yy ρxy = ρxy ρyy (1 − ρyy )
Px (Ny = 0) = 1 − Px (Ny ≥ 1) = 1 − ρxy
PS Sastry, IISc, Bangalore, 2020 25/27
PS Sastry, IISc, Bangalore, 2020 24/27
Notation: Ex [Z] = E[Z|X0 = x]
◮ Define
◮
Theorem:
(i). Let y be transient. Then
G(x, y) , Ex [Ny ]
#
"∞
X
Iy (Xn )
= Ex
n=1
=
=
∞
X
n=1
∞
X
Ex [Iy (Xn )]
P n (x, y)
G(x, y) is the expected number of visits to y for a chain
that is started in x.
PS Sastry, IISc, Bangalore, 2020 26/27
ρxy
< ∞, ∀x
1 − ρyy
(ii) Let y be recurrent. Then
Py [Ny = ∞] = 1, and G(y, y) = Ey [Ny ] = ∞
Px [Ny = ∞] = ρxy , and G(x, y) =
n=1
◮
Px (Ny < ∞) = 1, ∀x and G(x, y) =
0 if ρxy = 0
∞ if ρxy > 0
PS Sastry, IISc, Bangalore, 2020 27/27
Recap: Markov Chain
Recap: Transition Probabilities
◮
Let Xn , n = 0, 1, · · · be a sequence of discrete random
variables taking values in S.
◮ We say it is a Markov chain if
Transition probability function is P : S × S → [0, 1]
◮
P r[Xn+1 = xn+1 |Xn = xn , Xn−1 = xn−1 · · · X0 = x0 ] = P r[Xn+1 = xn+1 |Xn = xn ],
◮
We can write it as
P (x, y) = P r[Xn+1 = y|Xn = x]
The chain is said to be homogeneous when this is not a
function of time.
◮ For a homogeneous chain
P r[Xn+1 = y|Xn = x] = P r[X1 = y|X0 = x], ∀n
fXn+1 |Xn ,···X0 (xn+1 |xn , · · · , x0 ) = fXn+1 |Xn (xn+1 |xn ), ∀xi
◮
For a Markov chain, given the current state, the future
evolution is independent of the history of how you
reached the current state
◮
P satisfies
◮
◮
◮
P
P(x, y) ≥ 0, ∀x, y ∈ S
y∈S P (x, y) = 1, ∀x ∈ S
If S is finite then P can be represented as a matrix
PS Sastry, IISc, Bangalore, 2020 2/40
PS Sastry, IISc, Bangalore, 2020 1/40
Recap: Initial State Probabilities
Recap
◮
◮
P r[Xm+n = y|Xm = x, X0 = z] = P r[Xm+n = y|Xm = x]
= P r[Xn = y|X0 = x]
Initial state probabilities π0 : S → [0, 1]
◮
π0 (x) = P r[X0 = x]
◮
◮
Or, in general,
fXm+n |Xm ,··· ,X0 (y|x, · · · ) = fXm+n |Xm (y|x)
It satisfies
◮
The Markov property implies
◮
π
P0 (x) ≥ 0, ∀x ∈ S
x∈S π0 (x) = 1
The P and π0 together determine all joint distributions
Further, we can show
Pr[Xm+n = y|Xm = x, Xm−k ∈ Ak , k = 1, · · · , m] =
P r[Xm+n = y|Xm = x]
P r[Xm+n+r ∈ Br , r = 0, · · · , s | Xm = x, Xm−k ∈ Ak , k = 1, · · · , m]
= P r[Xm+n+r ∈ Br , r = 0, · · · , s | Xm = x]
PS Sastry, IISc, Bangalore, 2020 3/40
PS Sastry, IISc, Bangalore, 2020 4/40
Recap: Chapman-Kolmogorov Equations
◮
Recap: Hitting times
The n-step transition probabilities are defined by
◮
n
We define hitting time for y as the random variable
P (x, y) = P r[Xn = y|X0 = x]
◮
These n-step transition probabilities satisfy
X
P m+n (x, y) =
P m (x, z)P n (z, y)
Ty = min{n > 0 : Xn = y}
◮
z
Using this defintion, we can derive
X
Px (Ty = m) =
P (x, z)Pz (Ty = m − 1)
z6=y
These are known as Chapman-Kolmogorov equations
◮ For a finite chain, the n-step transition probability matrix
is n-fold product of the transition probability matrix
◮ We also have
X
πn (x) , P r[Xn = x] =
π0 (x)P n (x, y)
◮
(Notation: Pz (A) = P r[A|X0 = z])
n
P (x, y) =
n
X
Px (Ty = m)P n−m (y, y)
m=1
x
PS Sastry, IISc, Bangalore, 2020 5/40
Recap: transient and recurrent states
PS Sastry, IISc, Bangalore, 2020 6/40
Recap
◮
Define ρxy = Px (Ty < ∞).
◮ It is the probability that starting in x you will visit y
◮ Note that
◮
ρxy = lim Px (Ty < n) =
n→∞
∞
X
For any state y define
Iy (Xn ) =
◮
The total number of visits to y is given by
Px (Ty = n)
n=1
N (y) =
Definition: A state y is called transient if ρyy < 1; it is
called recurrent if ρyy = 1.
◮ Intuitively, all transient states would be visited only
finitely many times while recurrent states are visited
infinitely often.
1 if Xn = y
0 otherwise
∞
X
Iy (Xn )
n=1
◮
We can get distribution of N (y) as
m−1
(1 − ρyy ), m ≥ 1
Px (N (y) = m) = ρxy ρyy
and Px (N (y) = 0) = 1 − ρxy
PS Sastry, IISc, Bangalore, 2020 7/40
PS Sastry, IISc, Bangalore, 2020 8/40
Recap
Theorem:
(i). Let y be transient. Then
Notation: Ex [Z] = E[Z|X0 = x]
◮ Define
◮
Px (N (y) < ∞) = 1, ∀x and G(x, y) =
G(x, y) , Ex [N (y)]
∞
X
Ex [Iy (Xn )]
=
=
n=1
∞
X
◮
(ii) Let y be recurrent. Then
Py [N (y) = ∞] = 1, and G(y, y) = Ey [N (y)] = ∞
P n (x, y)
n=1
Px [N (y) = ∞] = ρxy , and G(x, y) =
G(x, y) is the expected number of visits to y for a chain
that is started in x.
0 if ρxy = 0
∞ if ρxy > 0
Proof of (ii):
y recurrent ⇒ ρyy = 1. Hence
Proof of (i): y is transient; ρyy < 1
m
Py [N (y) ≥ m] = ρm
yy = 1, ∀m
⇒ Py [N (y) = ∞] = lim Py [N (y) ≥ m] = 1
m ρxy ρm−1
yy (1 − ρyy )
⇒ G(y, y) = Ey [N (y)] = ∞
G(x, y) = Ex [N (y)] =
=
PS Sastry, IISc, Bangalore, 2020 10/40
PS Sastry, IISc, Bangalore, 2020 9/40
X
ρxy
< ∞, ∀x
1 − ρyy
X
mPx [N (y) = m]
m→∞
m
= ρxy
∞
X
m ρm−1
yy (1 − ρyy )
m−1
= ρxy , ∀m
Px [N (y) ≥ m] = ρxy ρyy
m=1
= ρxy
1
< ∞, because ρyy < 1
1 − ρyy
Hence Px [N (y) = ∞] = ρxy
ρxy = 0 ⇒ Px [N (y) ≥ m] = 0, ∀m > 0 ⇒ G(x, y) = 0
⇒ Px [N (y) < ∞] = 1
ρxy > 0 ⇒ Px [N (y) = ∞] > 0 ⇒ G(x, y) = ∞
PS Sastry, IISc, Bangalore, 2020 11/40
PS Sastry, IISc, Bangalore, 2020 12/40
Transient states are visited only finitely many times while
recurrent states are visited infinitely often
◮ If S is finite, it should have at least one recurrent state
◮ If y is transient, then, for all x
◮
G(x, y) =
∞
X
◮
Theorem: If x is recurrent and x leads to y then y is
recurrent and ρxy = ρyx = 1.
Proof:
Take x 6= y, wlog. Since ρxy > 0, ∃n s.t. P n (x, y) > 0
◮ Take least such n. Then we have states y1 , · · · , yn−1 ,
none of which is x (or y) such that
◮
P n (x, y) < ∞ ⇒
n=1
lim P n (x, y) = 0
n→∞
P
However, y P n (x, y) = 1, ∀n, ∀x
◮ If all y ∈ S are transient, then we get a contradiction
X
X
1 = lim
P n (x, y) =
lim P n (x, y) = 0
P (x, y1 ) P (y1 , y2 ) · · · P (yn−1 , y) > 0
◮
n→∞
y∈S
y∈S
◮
Now suppose, ρyx < 1. Then
P (x, y1 ) P (y1 , y2 ) · · · P (yn−1 , y)(1 − ρyx ) > 0
n→∞
A finite chain has to have at least one recurrent state
◮ An infinite chain can have only transient states
◮
is the probability of starting in x but not returning to x.
◮ But this cannot be because x is recurrent and hence
ρxx = 1
◮ Hence, if x is recurrent and x leads to y then ρyx = 1
PS Sastry, IISc, Bangalore, 2020 13/40
◮
We say, x leads to y if ρxy > 0
PS Sastry, IISc, Bangalore, 2020 14/40
Now, ∃n0 , n1 s.t. P n0 (x, y) > 0, P n1 (y, x) > 0.
P n1 +n+n0 (y, y) = Py [Xn1 +n+n0 = y]
≥ Py [Xn1 = x, Xn1 +n = x, Xn1 +n+n0 = y]
= P n1 (y, x)P n (x, x)P n0 (x, y), ∀n
P∞
m
◮ We know G(x, x) =
m=1 P (x, x) = ∞
∞
X
m
P (y, y) ≥
m=1
≥
∞
X
m=n0 +n1 +1
∞
X
n1
m
P (y, y) =
∞
X
P n1 +n+n0 (y, y)
What we showed so far is: if x leads to y and x is
recurrent, then ρyx = 1 and y is recurrent.
◮ Now, y is recurrent and y leads to x and hence ρxy = 1.
◮ This completes proof of the theorem
◮
n=1
P (y, x)P n (x, x)P n0 (x, y)
n=1
= ∞, because x is recurrent
⇒ y is recurrent
PS Sastry, IISc, Bangalore, 2020 15/40
PS Sastry, IISc, Bangalore, 2020 16/40
equivalence relation
example
| m, n are integers}
Let A = { m
n
◮ Define relation R by
m p
,
∈ R if mq = np
n q
◮
let R be a relation on set A. Note R ⊂ A × A
◮ R is called an equivalence relation if it is
◮
1. reflexive, i.e., (x, x) ∈ R, ∀x ∈ A
2. symmetric, i.e., (x, y) ∈ R ⇒ (y, x) ∈ R
3. transitive, i.e., (x, y), (y, z) ∈ R ⇒ (x, z) ∈ R
This is the usual equality of fractions
◮ Easy to check it is an equivalence relation.
◮
PS Sastry, IISc, Bangalore, 2020 17/40
PS Sastry, IISc, Bangalore, 2020 18/40
Equivalence classes
◮
Let R be an equivalence relation on A.
◮ Then, A can be partitioned as
◮
ST = {y ∈ S : ρyy < 1}
A = C1 + C2 + · · ·
◮
SR = {y ∈ S : ρyy = 1}
On SR , consider the relation: ‘x leads to y’ (i.e., x is
related to y if ρxy > 0)
◮ This is an equivalence relation
◮
Where Ci satisfy
◮
The state space of any Markov chain can be partitioned
into the transient and recurrent states: S = ST + SR :
x, y ∈ Ci ⇒ (x, y) ∈ R, ∀i
x ∈ Ci , y ∈ Cj , i 6= j ⇒ (x, y) ∈
/R
ρxx > 0, ∀x ∈ SR
◮ ρ
xy > 0 ⇒ ρyx > 0, ∀x, y ∈ SR
◮ ρ
xy > 0, ρyz > 0 ⇒ ρxz > 0
◮
In our example, each equivalence class corresponds to a
rational number.
◮ Here, Ci contains all fractions that are equal to that
rational number
◮
PS Sastry, IISc, Bangalore, 2020 19/40
◮
Hence we get a partition: SR = C1 + C2 + · · · where Ci
are equivalence classes.
PS Sastry, IISc, Bangalore, 2020 20/40
A set of states, C ⊂ S is said to be irreducible if x leads
to y for all x, y ∈ C
◮ An irreducible set is also called a communicating class
◮ A set of states, C ⊂ S, is said to be closed if
x ∈ C, y ∈
/ C implies ρxy = 0.
◮ Once the chain visits a state in a closed set, it cannot
leave that set.
◮ We get a partition of recurrent states
◮
On SR , “x leads to y” is an equivalence relation.
◮ This gives rise to the partition SR = C1 + C2 + · · ·
◮ Since Ci are equivalence classes, they satisfy:
◮
◮
◮
x, y ∈ Ci ⇒ x leads to y
x ∈ Ci , y ∈ Cj , i 6= j ⇒ ρxy = 0
All states in any Ci lead to each other or communicate
with each other
◮ If i 6= j and x ∈ Ci and y ∈ Cj , then, ρxy = ρyx = 0. x
and y do not communicate with each other.
◮
SR = C 1 + C 2 + · · ·
where each Ci is a closed and irreducible set of states.
◮ If S is irreducible then the chain is said to be irreducible.
(Note that S is trivially closed)
PS Sastry, IISc, Bangalore, 2020 21/40
In an irreducible set of states, if one state is recurrent,
then, all states are recurrent.
◮ We saw that a finite chain has to have at least one
recurrent state.
◮ Thus, a finite irreducible chain is recurrent.
◮ For example, in the umbrellas problem, the chain is
irreducible and hence all states are recurrent.
◮ An infinite irreducible chain may be wholly transient
◮ Here is a trivial example of non-irreducible transient chain:
PS Sastry, IISc, Bangalore, 2020 22/40
◮
0
1
2
3
The state space of any Markov chain can be partitioned
into transient and recurrent states.
◮ We need not calculate ρxx to do this partition.
◮ By looking at the structure of transition probability
matrix we can get this partition
◮
...
PS Sastry, IISc, Bangalore, 2020 23/40
PS Sastry, IISc, Bangalore, 2020 24/40
Example
0
1
0
1
2
3
4
5
2
0
+
+
−
−
−
−
1
−
+
+
−
−
−
4
3
2
−
+
+
−
−
−
3
−
−
+
+
−
+
5
If you start the chain in a recurrent state it will stay in
the corresponding closed irreducible set
◮ If you start in one of the transient states, it would
eventually get ‘absorbed’ in one of the closed irreducible
sets of recurrent states.
◮ We want to know the probabilities of ending up in
different sets.
◮ We want to know how long you stay in transient states
◮ We want to know what is the ‘steady state’ ?
◮
4
−
−
−
+
+
−
5
−
−
+
−
+
+
State 0 is called an absorbing state. {0} is a closed
irreducible set.
◮ 1, 2 are transient states.
◮ We get: ST = {1, 2} and SR = {0} + {3, 4, 5}
◮
PS Sastry, IISc, Bangalore, 2020 25/40
let C be a closed irreducible set of recurrent states
◮ TC – hitting time for C.
TC = min{n > 0 : Xn ∈ C}
It is the first time instant when the chain is in C
◮ Define ρC (x) = Px [TC < ∞]
1 if x ∈ C
If x is recurrent, ρC (x) =
0 if x ∈
/C
◮
PS Sastry, IISc, Bangalore, 2020 26/40
Example: Absorption probabilities
0.2
1.0
◮
PS Sastry, IISc, Bangalore, 2020 27/40
1
0.25
2
0.2
4
3
5
0.4
◮
0.2
ST = {1, 2} and C1 = {0}, C2 = {3, 4, 5}
X
X
P (x, y) ρC (y)
ρC (x) =
P (x, y) +
y∈C
y∈ST
ρC1 (1) = P (1, 0) + P (1, 1)ρC1 (1) + P (1, 2)ρC1 (2)
= 0.25 + 0.5ρC1 (1) + 0.25ρC1 (2)
ρC1 (2) = 0 + 0.2ρC1 (1) + 0.4ρC1 (2)
y∈ST
By solving this set of linear equations we can get
ρc (x), x ∈ ST
0.25
0.5
Because each x is in a closed irreducible set
◮ Suppose x is transient. Then
X
X
ρC (x) =
P (x, y) +
P (x, y) ρC (y)
y∈C
0
Solving these, we get ρC1 (1) = 0.6, ρC1 (2) = 0.2
◮ What would be ρC (1)?
2
◮
PS Sastry, IISc, Bangalore, 2020 28/40
Expected time in transient states
stationary distributions
We consider a simple method to get the time spent in
transient states for finite chains
◮ Let states 1, 2, · · · , t be the transient states
◮ bij – the expected number of time instants spent in state
j when started in i.
◮ Then we get
◮
bij = δij +
t
X
P (i, k)bkj
π : S → [0, 1] is a probability distribution
P (mass
function) over S if π(x) ≥ 0, ∀x and x∈S π(x) = 1
◮ A probability distribution over S, π, is said to be a
stationary distribution for the Markov chain with
transition probabilities P if
X
π(y) =
π(x)P (x, y), ∀y ∈ S
◮
x∈S
k=1
where δij = 1 if i = j and is zero otherwise
◮ let B be the t × t matrix of bij , I be the t × t identity
matrix and PT be the submatrix (corresponding to the
transient states) of P .
◮ Then the above in Matrix notation is
Suppose S is finite. Then π can be represented by a
vector.
◮ The π is stationary if
◮
πT = πT P
or P T π = π
B = I + PT B or B = (I − PT )−1
PS Sastry, IISc, Bangalore, 2020 30/40
PS Sastry, IISc, Bangalore, 2020 29/40
◮
π is a stationary distribution if
X
π(y) =
π(x)P (x, y), ∀y ∈ S
x∈S
Recall πn (x) , P r[Xn = x] satisfies
X
X
πn+1 (y) =
P r[Xn+1 = y|Xn = x]P r[Xn = x] =
πn (x)P (x, y)
◮
x∈S
x∈S
Hence, if π0 = π then π1 = π
and hence πn = π, ∀n
◮ Hence the name, stationary distribution.
◮ It is also called the invariant distribution or the invariant
measure
◮
PS Sastry, IISc, Bangalore, 2020 31/40
If the chain is started in stationary distribution then the
distribution of Xn is not a function of time, as we saw.
◮ Suppose for a chain, distribution of Xn is not dependent
on n. Then the chain must be in a stationary distribution.
◮ Suppose π = π0 = π1 = · · · = πn = · · · . Then
X
X
π(y) = π1 (y) =
π0 (x)P (x, y) =
π(x)P (x, y)
◮
x∈S
x∈S
which shows π is a stationary distribution
PS Sastry, IISc, Bangalore, 2020 32/40
Example
0.75
0
Suppose S is finite.
◮ Then π is a stationary distribution if
◮
P T π = π or
0.5
1
0.25
PT − I π = 0
Note that each column of P T sums to 1.
◮ Hence, P T − I would be singular
(1 is always an eigen value for a column stochastic matrix)
◮ A stationary distribution always exists for a finite chain.
◮ But it may or may not be unique.
◮ What about infinite chains?
◮
0.5
2
0.25
0.75
The stationary distribution has to satisfy
X
π(y) =
π(x)P (x, y), ∀y ∈ S
x∈S
◮
◮
Thus we get the following linear equations
0.75π(0) + 0.5π(1) = π(0)
0.25π(0) + 0.75π(2) = π(1)
0.5π(1) + 0.25π(2) = π(2)
in addition, π(0) + π(1) + π(2) = 1
PS Sastry, IISc, Bangalore, 2020 33/40
0.75
0
0.5
1
0.5
2
PS Sastry, IISc, Bangalore, 2020 34/40
0.25
0.75
0
0.25
0.5
1
0.5
2
0.25
0.75
0.25
We can also write the equations for π as
0.75
0.25
0
π(0) π(1) π(2) 0.5
0
0.5 = π(0) π(1) π(2)
0 0.75 0.25
0.75
◮
0.75π(0) + 0.5π(1) = π(0)
0.25π(0) + 0.75π(2) = π(1)
0.5π(1) + 0.25π(2) = π(2)
◮
We have to solve these along with π(0) + π(1) + π(2) = 1
PS Sastry, IISc, Bangalore, 2020 35/40
1
π(0)
2
1
0.25π(0) + 0.75π(2) = π(1) ⇒ π(2) = π(0)
3
0.5π(1) + 0.25π(2) = π(2)
1 1
=1
π(0) + π(1) + π(2) = 1 ⇒ π(0) 1 + +
2 3
0.75π(0) + 0.5π(1) = π(0) ⇒ π(1) =
6
Now, π(0) 1 + 21 + 31 = 1 gives π(0) = 11
6 3 2
◮ We get a unique solution:
11 11 11
◮
PS Sastry, IISc, Bangalore, 2020 36/40
Example2
Example2
1.0
0.5
0
1.0
0
0.5
1
0.5
2
π(y) =
1.0
X
1
0.5
2
1.0
π(x)P (x, y), ∀y ∈ S
x∈S
The stationary distribution has to satisfy
1.0
0
0
π(0) π(1) π(2) 0.5 0 0.5 = π(0) π(1) π(2)
0 0 1.0
◮
We also have to add the equation π(0) + π(1) + π(2) = 1
◮ We now do not have a unique stationary distribution
◮
We get the following linear equations
π(0) + 0.5π(1) = π(0) ⇒ π(1) = 0
0.5π(1) + π(2) = π(2) ⇒ π(1) = 0
π(0) + π(1) + π(2) = 1 ⇒ π(0) = 1 − π(2)
◮
Now there are infinitely many solutions.
◮ Any distribution [a 0 1 − a] with 0 ≤ a ≤ 1 is a
stationary distribution
◮ This chain is not irreducible; the previous one is
irreducible
◮
PS Sastry, IISc, Bangalore, 2020 38/40
PS Sastry, IISc, Bangalore, 2020 37/40
Let Iy (Xn ) be indicator of [Xn = y]
Pn
◮ Number of visits to y till n: Nn (y) =
m=1 Iy (Xn )
◮
We now explore conditions for existence and uniqueness
of stationary distributions
◮ For finite chains stationary distribution always exists.
◮ For finite irreducible chains it is unique.
◮ But for infinite chains, it is possible that stationary
distribution does not exist.
◮ When the stationary distribution is unique, we also want
to know if the chain converges to that distribution
◮ The stationary distribution, when it exists, is related to
expected fraction of time spent in different states.
◮
Gn (x, y) , Ex [Nn (y)] =
Ex [Iy (Xn )] =
◮
n
X
P m (x, y)
m=1
m=1
Expected fraction of time spent in y till n is
n
1 X m
Gn (x, y)
P (x, y)
=
n
n m=1
◮
PS Sastry, IISc, Bangalore, 2020 39/40
n
X
We will first establish a limit for the above as n → ∞
PS Sastry, IISc, Bangalore, 2020 40/40
Recap: Markov Chain
Recap: Transition Probabilities
◮ Let Xn , n = 0, 1, · · · be a sequence of discrete random
variables taking values in S.
◮ We say it is a Markov chain if
P r[Xn+1 = xn+1 |Xn = xn , Xn−1 = xn−1 · · · X0 = x0 ] = P r[Xn+1 = xn+1 |Xn = xn ],
◮ We can write it as
fXn+1 |Xn ,···X0 (xn+1 |xn , · · · , x0 ) = fXn+1 |Xn (xn+1 |xn ), ∀xi
◮ Transition probabilities: P (x, y) = P r[Xn+1 = y|Xn = x]
Chain is homogeneous:
P r[Xn+1 = y|Xn = x] = P r[X1 = y|X0 = x], ∀n
◮ Initial probabilities π0 (x) = P r[X0 = x]
◮ Similarly, πn (x) = P r[Xn = x]
◮ For a Markov chain, given the current state, the future
evolution is independent of the history of how you
reached the current state
PS Sastry, IISc, Bangalore, 2020 1/39
Recap: Chapman-Kolmogorov Equations
◮ n-step transition probabilities:
P n (x, y) = P r[Xn = y|X0 = x]
◮ These satisfy Chapman-Kolmogorov equations:
X
P m (x, z)P n (z, y)
P m+n (x, y) =
z
◮ For a finite chain, the n-step transition probability matrix
is n-fold product of the transition probability matrix
PS Sastry, IISc, Bangalore, 2020 3/39
PS Sastry, IISc, Bangalore, 2020 2/39
Recap: transient and recurrent states
◮ Hitting time for y: Ty = min{n > 0 : Xn = y}
◮ ρxy = Px (Ty < ∞).
◮ A state y is called transient if ρyy < 1; it is called
recurrent if ρyy = 1.
◮ N (y) – total number of visits to y
◮ G(x, y) = Ex [N (y)]
PS Sastry, IISc, Bangalore, 2020 4/39
Recap
Recap
Theorem:
(i). Let y be transient. Then
Px (N (y) < ∞) = 1, ∀x and G(x, y) =
ρxy
< ∞, ∀x
1 − ρyy
(ii) Let y be recurrent. Then
Py [N (y) = ∞] = 1, and G(y, y) = Ey [N (y)] = ∞
Px [N (y) = ∞] = ρxy , and G(x, y) =
◮ Transient states are visited only finitely many times while
recurrent states are visited infinitely often
◮ A finite chain should have at least one recurrent state
◮ We say, x leads to y if ρxy > 0
Theorem: If x is recurrent and x leads to y then y is
recurrent and ρxy = ρyx = 1.
0 if ρxy = 0
∞ if ρxy > 0
PS Sastry, IISc, Bangalore, 2020 6/39
PS Sastry, IISc, Bangalore, 2020 5/39
Recap: closed and irreducible sets
Recap: Partition of state space
◮ A set of states, C ⊂ S is said to be irreducible if x leads
to y for all x, y ∈ C
◮ An irreducible set is also called a communicating class
◮ A set of states, C ⊂ S, is said to be closed if
x ∈ C, y ∈
/ C implies ρxy = 0.
◮ Once the chain visits a state in a closed set, it cannot
leave that set.
PS Sastry, IISc, Bangalore, 2020 7/39
◮ S = ST + SR , transient and recurrent states and
SR = C 1 + C 2 + · · ·
where Ci are closed and irreducible
◮ We can calculate absorption probabilities for Ci using
X
X
P (x, y) ρC (y)
ρC (x) =
P (x, y) +
y∈C
y∈ST
PS Sastry, IISc, Bangalore, 2020 8/39
Recap: Stationary distribution
◮ π is said to be a stationary distribution for the Markov
chain with transition probabilities P if
X
π(y) =
π(x)P (x, y), ∀y ∈ S
x∈S
◮ For finite chains, P T π = π
◮ When π is stationary distribution,
π0 = π ⇒ πn = π, ∀n
◮ If πn = π, ∀n then π is a stationary distribution
◮ For a finite chain, a stationary distribution always exists.
◮ The stationary distribution, when it exists, is related to
expected fraction of time spent in different states.
◮ Let Iy (Xn ) be indicator of [Xn = y]
P
◮ Number of visits to y till n: Nn (y) = nm=1 Iy (Xm )
Gn (x, y) , Ex [Nn (y)] =
n
X
lim Nn (y) = N (y)
n→∞
and
P r[N (y) < ∞] = 1
⇒
Nn (y)
= 0 (w.p.1) and
n→∞
n
lim
lim Gn (x, y) = G(x, y) < ∞
n→∞
Gn (x, y)
=0
n→∞
n
lim
◮ The expected fraction of time spent in a transient state is
zero.
◮ This is intuitively obvious
PS Sastry, IISc, Bangalore, 2020 11/39
P m (x, y)
m=1
m=1
◮ Expected fraction of time spent in y till n is
n
1 X m
Gn (x, y)
P (x, y)
=
n
n m=1
◮ We will first establish a limit for the above as n → ∞
PS Sastry, IISc, Bangalore, 2020 9/39
◮ Suppose y is transient. Then we have
Ex [Iy (Xm )] =
n
X
PS Sastry, IISc, Bangalore, 2020 10/39
◮ Now, let y be recurrent
◮ Then, Py [Ty < ∞] = 1
◮ Define my = Ey [Ty ]
◮ my is mean return time to y
◮ We will show that Nnn(y) converges to m1 if the chain
y
starts in y.
◮ Convergence would be with probability one.
PS Sastry, IISc, Bangalore, 2020 12/39
◮ We have
◮ Consider a chain started in y
◮ let Tyr be time of rth visit to y, r ≥ 1
Tyr = min{n ≥ 1 : Nn (y) = r}
◮ Define Wy1 = Ty1 = Ty and Wyr = Tyr − Tyr−1 , r > 1
◮ Note that Ey [Wy1 ] = Ey [Ty ] = my
◮ Also, Tyr = Wy1 + · · · + Wyr
◮ Wyr are the “waiting times”
◮ By Markovian property we should expect them to be iid
◮ We will prove this.
◮ Then Tyr /r converges to my by law of large umbers
P r[Wy3 = k3 |Wy2 = k2 , Wy1 = k1 ] =
P r[Xk1 +k2 +j 6= y, 1 ≤ j ≤ k3 − 1, Xk1 +k2 +k3 = y | B]
where B = [Xk1 +k2 = y, Xk1 = y, Xj 6= y, j < k1 + k2 , j 6= k1 ]
◮ Using the Markovian property, we get
P r[Wy3 = k3 |Wy2 = k2 , Wy1 = k1 ] =
P r[Xk1 +k2 +j 6= y, 1 ≤ j ≤ k3 − 1, Xk1 +k2 +k3 = y | Xk1 +k2 = y]
= P r[Xj 6= y, 1 ≤ j ≤ k3 − 1, Xk3 = y | X0 = y]
= Py [Wy1 = k3 ]
◮ In general, we get
P r[Wyr = kr | Wyr−1 = kr−1 , · · · , Wy1 = k1 ] = Py [Wy1 = kr ]
PS Sastry, IISc, Bangalore, 2020 13/39
◮ This shows the waiting time are iid
X
Py [Wy2 = k2 | Wy1 = k1 ] Py [Wy1 = k1 ]
Py [Wy2 = k2 ] =
k1
=
X
Py [Wy1 = k2 ] Py [Wy1 = k1 ]
k1
⇒
= Py [Wy1 = k2 ]
identically distributed
PS Sastry, IISc, Bangalore, 2020 14/39
◮ We have shown Wyr , r = 1, 2, · · · are iid
◮ Since E[Wy1 ] = my , by strong law of large numbers,
k
Tyk
1X r
lim
Wy = my , (w.p.1)
= lim
k→∞ k
k→∞ k
r=1
Py [Wy2 = k2 , Wy1 = k1 ] = Py [Wy2 = k2 | Wy1 = k1 ]Py [Wy1 = k1 ]
◮ Note that this is true even if my = ∞
= Py [Wy1 = k2 ] Py [Wy1 = k1 ]
⇒
= Py [Wy2 = k2 ] Py [Wy1 = k1 ]
independent
PS Sastry, IISc, Bangalore, 2020 15/39
PS Sastry, IISc, Bangalore, 2020 16/39
TyNn (y) ≤ n < TyNn (y)+1
◮ For all n such that Nn (y) ≥ 1, we have
◮ Now we have
N (y)+1
N (y)
n
Ty n
Ty n
≤
<
Nn (y)
Nn (y)
Nn (y)
TyNn (y) ≤ n < TyNn (y)+1
◮ Nn (y) is the number of visits to y till time step n
◮ Suppose N50 (y) = 8 – Visited y 8 times till time 50.
◮ So, the 8th visit occurred at or before time 50.
◮ The 9th visit has not occurred till 50.
◮ So, time of 9th visit is beyond 50.
◮ We know that
◮ As n → ∞, Nn (y) → ∞, w.p.1
n
◮ As n → ∞, Tny → my , w.p.1
◮ Hence we get
n
= my ,
n→∞ Nn (y)
w.p.1
1
Nn (y)
=
,
n
my
w.p.1
lim
or
lim
n→∞
PS Sastry, IISc, Bangalore, 2020 17/39
◮ All this is true if the chain started in y.
◮ That means it is true if the chain visits y once.
◮ So, we get
I[T <∞]
Nn (y)
= y
,
n→∞
n
my
lim
◮
w.p.1
PS Sastry, IISc, Bangalore, 2020 18/39
◮ Thus we have proved the following theorem
◮ Theorem:
Let y be recurrent. Then
1
convergence in mean
Px [Ty < ∞]
ρxy
Nn (y)
Gn (x, y)
= lim
= lim Ex
=
lim
n→∞
n→∞
n→∞
n
n
my
my
I[T <∞]
Nn (y)
= y
,
n→∞
n
my
lim
Since 0 ≤ Nnn(y) ≤ 1, almost sure convergence implies
2
lim
n→∞
w.p.1
ρxy
Gn (x, y)
=
n
my
◮ The fraction of time spent in each recurrent state is
inversely proportional to the mean recurrence time
PS Sastry, IISc, Bangalore, 2020 19/39
PS Sastry, IISc, Bangalore, 2020 20/39
◮ The limiting fraction of time spent in a state is inversely
proportional to my , the mean return time.
◮ Intuitively, the stationary probability of a state could be
the limiting fraction of time spent in that state.
◮ Thus π(y) = m1 is a good candidate for stationary
y
distribution.
◮ We first note that we can have my = ∞.
Though Py [Ty < ∞] = 1, we can have Ey [Ty ] = ∞.
◮ What if my = ∞, ∀y?
◮ Does not seem reasonable for a finite chain.
◮ But for infinite chains??
◮ Let us characterize y for which my = ∞
◮ A recurrent state y is called null recurrent if my = ∞.
◮ y is called positive recurrent if my < ∞
◮ We earlier saw that the fraction of time spent in a
transient state is zero.
◮ Suppose y is null recurrent. Then
Nn (y)
1
=
=0
n→∞
n
my
lim
◮ Thus the limiting fraction of time spent by the chain in
transient and null recurrent states is zero.
PS Sastry, IISc, Bangalore, 2020 21/39
◮ Theorem: Let x be positive recurrent and let x lead to
y. Then y is positive recurrent.
Proof
◮ Since x is recurrent and x leads to y we know ∃n0 , n1 s.t.
P n0 (x, y) > 0, P n1 (y, x) > 0 and
P n1 +m+n0 (y, y) ≥ P n1 (y, x)P m (x, x)P n0 (x, y), ∀m
Summing the above for m = 1, 2, · · · n and dividing by n
n
X
n
X
1
1
P n1 +m+n0 (y, y) ≥ P n1 (y, x)
P m (x, x) P n0 (x, y), ∀n
n m=1
n m=1
If we now let n → ∞, the RHS goes to
P n1 (y, x) m1x P n0 (x, y) > 0.
PS Sastry, IISc, Bangalore, 2020 22/39
n
n
1 X n1 +m+n0
1X m
P
P (x, x) P n0 (x, y), ∀n
(y, y) ≥ P n1 (y, x)
n m=1
n m=1
◮ We can write the LHS of above as
n +n+n
n1 +n0
1 1X 0 m
1 X
1
n1 +m+n0
P
(y, y) =
P (y, y) −
P m (y, y)
n m=1
n m=1
n m=1
n
X
n1 + n + n 0
1
=
n
n1 + n + n0
n1 +n+n
X 0
m=1
n +n
1
0
1 X
P (y, y) −
P m (y, y)
n m=1
m
n
1
1 X n1 +m+n0
P
(y, y) =
⇒ lim
n→∞ n
my
m=1
1
1
≥ P n1 (y, x)
P n0 (x, y) > 0
my
mx
which implies y is positive recurrent
⇒
PS Sastry, IISc, Bangalore, 2020 23/39
PS Sastry, IISc, Bangalore, 2020 24/39
◮ Let C be a finite closed set of recurrent states.
◮ Suppose all states in C are null recurrent. Then
n
◮ Thus, in a closed irreducible set of recurrent states, if one
state is positive recurrent then all are positive recurrent.
◮ Hence, in the partition: SR = C1 + C2 + · · · , each Ci is
either wholly positive recurrent or wholly null recurrent.
◮ We next show that a finite chain cannot have any null
recurrent states.
1X m
P (x, y) = 0, ∀x, y ∈ C
n→∞ n
m=1
lim
◮ Since C is closed,
◮ Thus we get
1=
P
y∈C P
m
(x, y) = 1, ∀m, ∀x ∈ C.
n
n
X1X
1 XX m
P (x, y) =
P m (x, y), ∀n
n m=1 y∈C
n m=1
y∈C
n
X1X
n
1X m
P (x, y) =
lim
P (x, y) = 0
⇒ 1 = lim
n→∞ n
n→∞
n m=1
m=1
y∈C
y∈C
X
m
where we could take the limit inside the sum because C is
finite.
PS Sastry, IISc, Bangalore, 2020 26/39
PS Sastry, IISc, Bangalore, 2020 25/39
Example of null recurrent chain
◮ Consider the chain with state space {0, 1, · · · } given by
q(4)
◮ If C is a finite closed set of recurrent states then all
states in it cannot be null recurrent.
◮ Actually what we showed is that any closed finite set
must have at least one positive recurrent state.
◮ Hence, in a finite chain, every closed irreducible set of
recurrent states contains only positive recurrent states.
◮ Hence, a finite chain cannot have a null recurrent state.
q(2)
0
1
2
3
...
q(1)
q(3)
◮ Here, q(k) ≥ 0, ∀k and
P∞
P0 [T0 = j+1] = q(j) ⇒ m0 =
k=1 q(k) = 1. We have
∞
∞
X
X
j Po [T0 = j] =
j=2
PS Sastry, IISc, Bangalore, 2020 27/39
4
j q(j−1)
j=2
(Note that P0 [T0 = 1] = 0)
◮ So, m0 = ∞ if the q(·) distribution has infinite
expectation. For example, if q(k) = kc2
◮ Then state 0 is null recurrent. Implies chain is null
recurrent
PS Sastry, IISc, Bangalore, 2020 28/39
◮ Suppose π is a stationary distribution.
◮ Then π(y) = 0 if y is transient or null recurrent
◮ We prove this as follows
X
π(y) =
π(x)P m (x, y) ∀m
x
n
n
X
1X m
1 XX
m
π(x)P (x, y) =
π(x)
P (x, y)
⇒ π(y) =
n m=1 x
n
x
m=1
n
1X m
⇒ π(y) = lim
π(x)
P (x, y)
n→∞
n
x
m=1
X
◮ Bounded Convergence Theorem: Suppose
P
a(x) ≥ 0, ∀x ∈ S and x a(x) < ∞. Let bn (x), x ∈ S
be such that |bn (x)| ≤ K, ∀x, n and suppose
limn→∞ bn (x) = b(x), ∀x ∈ S. Then
X
X
X
a(x) bn (x) =
a(x) lim bn (x) =
a(x) b(x)
lim
n→∞
x∈S
n→∞
x∈S
x∈S
◮ We had
n
1X m
π(y) = lim
π(x)
P (x, y)
n→∞
n
x
m=1
X
◮ We have
n
π(x) ≥ 0;
◮ The proof is complete if we can take the limit inside the
sum
1X m
π(x) = 1; 0 ≤
P (x, y) ≤ 1, ∀x
n m=1
x
X
◮ Hence, if y is transient or null recurrent, then
n
X
1X m
π(y) =
π(x) lim
P (x, y) = 0
n→∞ n
x
m=1
PS Sastry, IISc, Bangalore, 2020 29/39
◮ In any stationary distribution π, we would have π(y) = 0
is y is transient or null recurrent.
◮ Hence an irreducible transient or null recurrent chain
would not have a stationary distribution.
PS Sastry, IISc, Bangalore, 2020 30/39
◮ Theorem An irreducible positive recurrent chain has a
unique stationary distribution given by
1
π(y) =
, ∀y ∈ S
my
P
◮ Suppose ∃ π such that π(y) = x π(x)P (x, y). Then
X
π(y) =
π(x) P m (x, y), ∀m
x
n
⇒ π(y) =
1X m
π(x)
P (x, y), ∀n
n
x
m=1
X
n
1X m
P (x, y)
⇒ π(y) = lim
π(x)
n→∞
n
m=1
x
X
n
1X m
P (x, y)
⇒ π(y) =
π(x) lim
n→∞ n
m=1
x
X
1
1
=
=
π(x)
m
my
y
x
X
PS Sastry, IISc, Bangalore, 2020 31/39
PS Sastry, IISc, Bangalore, 2020 32/39
◮ To complete the proof, we need to show
P
◮ We also need to show m1 = x m1 P (x, y)
y
x
◮ We skip these steps in the proof.
◮ The theorem shows that an irreducible positive recurrent
chain has a unique stationary distribution
◮ Corollary: An irreducible chain has a stationary
distribution if and only if it is positive recurrent
◮ An irreducible finite chain has a unique stationary
distribution
P
1
y my = 1.
PS Sastry, IISc, Bangalore, 2020 33/39
◮ Consider an irreducible positive recurrent chain.
◮ It has a unique stationary distribution and
Pn
1
m
m=1 P (x, y) converges to π(y).
n
◮ The next question is convergence of πn
X
π0 (x) P n (x, y) =?
lim πn (y) = lim
n→∞
n→∞
x
◮ If P n (x, y) converges to g(y) then that would be the
stationary distribution and πn converges to it
P
◮ But, n1 nm=1 am may have a limit though limn→∞ an
may not exist.
For example, an = (−1)n
PS Sastry, IISc, Bangalore, 2020 35/39
◮ If π 1 and π 2 are stationary distributions, then so is
απ 1 + (1 − α)π 2 (easily verified)
◮ Let C be a closed irreducible set of positive recurrent
states.
Then there is a unique stationary distribution π that
satisfies π(y) = 0, ∀y ∈
/ C.
◮ Any other stationary distribution of the chain is a convex
combination of the stationary distributions concentrated
on each of the closed irreducible sets of positive recurrent
states.
◮ This answers all questions about existence and uniqueness
of stationary distributions
PS Sastry, IISc, Bangalore, 2020 34/39
◮ Consider a chain with transition probabilities
0
1
0
0
1/3 0 2/3 0
P =
0 2/3 0 1/3
0
0
1
0
◮ One can show π T = 18 38 38 18
◮ However, P n goes to different limits based on whether n
is even or odd
PS Sastry, IISc, Bangalore, 2020 36/39
◮ The chain is the folowing
1/3
1
0
dx = gcd{n ≥ 1 : P n (x, x) > 0}
2
1
2/3
◮ We define period of a state x as
1
2/3
3
1/3
0
1
0
0
1/3 0 2/3 0
P =
0 2/3 0 1/3
0
0
1
0
◮ We can return to a state only after even number of time
steps
◮ That is why P n does not go to a limit
◮ Such a chain is called a periodic chain
◮ If P (x, x) > 0 then dx = 1
◮ If x leads to y and y leads to x, then dx = dy
◮ Let P n1 (x, y) > 0, P n2 (y, x) > 0. Then
P n1 +n2 (x, x) > 0 ⇒ dx divides n1 + n2 .
◮ For any n s.t. P n (y, y) > 0, we get pn1 +n+n2 (x, x) > 0
◮ Hence, dx divides n for all n s.t. P n (y, y) > 0 ⇒ dx ≤ dy
◮ Similarly, dy ≤ dx and hence dy = dx
◮ All states in an irreducible chain have the same period.
◮ If the period is 1 then chain is called aperiodic
PS Sastry, IISc, Bangalore, 2020 37/39
PS Sastry, IISc, Bangalore, 2020 38/39
Recap: Stationary Distribution
◮ The extra condition we need for convergence of πn is
aperiodicity
◮ For an aperiodic, irreducible, positive recurrent chain,
there is a unique stationary distribution and πn converges
to it irrespective of what π0 is.
◮ An aperiodic, irreducible, positive recurrent chain is called
an ergodic chain
PS Sastry, IISc, Bangalore, 2020 39/39
◮
π is said to be a stationary distribution for the Markov
chain with transition probabilities P if
X
π(y) =
π(x)P (x, y), ∀y ∈ S
x∈S
When π is stationary distribution,
π0 = π ⇒ πn = π, ∀n
◮ If πn = π, ∀n then π is a stationary distribution
◮ For a finite chain: P T π = π
◮ A stationary distribution always exists for a finite chain
◮
PS Sastry, IISc, Bangalore, 2020 1/36
Recap
Recap: positive and null recurrent states
Nn (y) – number of visits to y till n
Pn
m
◮ Gn (x, y) = Ex [Nn (y)] =
m=1 P (x, y)
– expected number of visits to y till n
◮ my = Ey [Ty ] – mean return time to y
◮
I[T <∞]
Nn (y)
= y
,
n→∞
n
my
lim
y is positive recurrent if my < ∞
◮ y is null recurrent if my = ∞
◮ If x is positive recurrent and x leads to y, then y is
positive recurrent
◮ In a closed irreducible set of recurrent states either all
states are positive recurrent or all states are null recurrent
◮ A finite closed set has to have at least one positive
recurrent state
◮ A finite chain cannot have null recurrent states
◮
w.p.1
n
Gn (x, y)
1 X m
ρxy
lim
= lim
P (x, y) =
n→∞
n→∞ n
n
my
m=1
PS Sastry, IISc, Bangalore, 2020 2/36
Recap: Existence of stationary distribution
In any stationary distribution π, π(y) = 0 if y is transient
or null recurrent
◮ An irreducible transient or null recurrent chain does not
have a stationary distribution
◮ An irreducible positive recurrent chain has a unique
stationary distribution: π(y) = m1y
PS Sastry, IISc, Bangalore, 2020 3/36
Recap: Periodic chains
◮
An irreducible chain has a stationary distribution iff it is
positive recurrent
◮ For a non-irreducible chain, for each closed irreducible set
of positive recurrent states, there is a unique stationary
distribution concentrated on that set.
◮ All stationary distributions of the chain are convex
combinations of these
◮
PS Sastry, IISc, Bangalore, 2020 4/36
The period of a state x is
dx = gcd{n ≥ 1 : P n (x, x) > 0}
◮ If x and y lead to each other, dx = dy
◮ In an irreducible chain, all states have the same period
◮ An irreducible chain is called aperiodic if the period is 1
◮ For an irreducible aperiodic positive recurrent chain, πn
converges to π, the unique stationary distribution,
irrespective of what π0 is.
◮ Also, for an irreducible, aperiodic, positive recurrent
chain, P n (x, y) converges to m1y
◮
PS Sastry, IISc, Bangalore, 2020 5/36
Example
◮
Consider the umbrella problem
0
1
2
3
0
0
0
0
0
1
0
0
0
1−p
P =
2
0
0
1−p
p
3
0
1−p
p
0
4 1−p
p
0
0
0
◮
1
2
3
4
1
p
0
0
0
We want calculate the probability of getting caught in a
rain without an umbrella.
◮ This would be the steady state probability of state 0
multiplied by p
◮ We are using the fact that this chain converges to the
stationary distribution starting with any initial
probabilities.
◮
4
This is an irreducible, aperiodic positive recurrent chain
PS Sastry, IISc, Bangalore, 2020 6/36
0
1
P =
2
3
4
0
1
2
3
0
0
0
0
0
0
0
1−p
0
0
1−p
p
0
1−p
p
0
1−p
p
0
0
The stationary distribution satisfies π T P = π T
π(0)
π(1)
π(2)
π(3)
π(4)
=
=
=
=
=
PS Sastry, IISc, Bangalore, 2020 7/36
4
1
p
0
0
0
(1 − p)π(4)
(1 − p)π(3) + pπ(4) ⇒ π(3) = π(1)
(1 − p)π(2) + pπ(3)
(1 − p)π(1) + pπ(2) ⇒ π(2) = π(1)
π(0) + pπ(1) ⇒ π(4) = π(1)
This gives 4π(1) + (1 − p)π(1) = 1 and hence
1−p
1
i = 1, 2, 3, 4 and π(0) =
π(i) =
5−p
5−p
PS Sastry, IISc, Bangalore, 2020 8/36
PS Sastry, IISc, Bangalore, 2020 9/36
Birth-Death chains
birth-death chains – stationary distribution
q
i
p
1-p
0
0
◮
1-q
0
i-1
...
i
p
The following is a finite birth-death chain
q
0
0
i
1-q
i-1
i
p
i
i+1
...
q
π(y) =
N
N
N
N
X
π(x)P (x, y)
x
ri
π(0) = π(0)(1 − p0 ) + π(1)q1
⇒ π(1)q1 − π(0)p0 = 0
π(1) = π(0)p0 + π(1)(1 − p1 − q1 ) + π(2)q2
⇒ π(1)q1 − π(0)p0 = π(2)q2 − π(1)p1
⇒ π(2)q2 − π(1)p1 = 0
π(2) = π(1)p1 + π(2)(1 − p2 − q2 ) + π(3)q3
⇒ π(2)q2 − π(1)p1 = π(3)q3 − π(2)p2 = 0
We assume pi , qi > 0, ∀i.
◮ Then the chain is irreducible, positive recurrent
◮ If we assume ri > 0 at least for one i, it is also aperiodic
◮ We can derive a general form for its stationary
probabilities
◮
PS Sastry, IISc, Bangalore, 2020 10/36
◮
PS Sastry, IISc, Bangalore, 2020 11/36
Thus we get
π(1)q1 − π(0)p0
π(2)q2 − π(1)p1
p0
π(0)
= 0 ⇒ π(1) =
q1
p0 p1
p1
π(1) =
π(0)
= 0 ⇒ π(2) =
q2
q1 q2
◮
Consider a birth-death chain
q
q
q
x
Iterating like this, we get
x-1
rx-1
π(n) = ηn π(0), where ηn =
◮
With η0 = 1, we get π(0)
1
π(0) = PN
j=0 ηj
◮
p0 p1 · · · pn−1
, n = 1, 2, · · · , N
q1 q2 · · · qn
PN
j=0 ηj = 1 and hence
x+1
x-1
...
x
p
x-1
◮
N
N
i
0
...
q
ri
p
1-p
i+1
...
x+1
p
rx
p
...
x+1
x
rx+1
The chain may be infinite or finite
◮ Let a, b ∈ S with a < b. Assume px , qx > 0, a < x < b.
◮ Define
◮
U (x) = Px [Ta < Tb ], a < x < b,
and π(n) = ηn π(0), n = 1, · · · , N
U (a) = 1, U (b) = 0
We want to derive a formula for U (x)
◮ This can be useful, e.g., in the gambler’s ruin chain
◮
Note that this process is applicable even for infinite chains
with state space {0, 1, 2, · · · } (but there may not be a
solution)
PS Sastry, IISc, Bangalore, 2020 12/36
PS Sastry, IISc, Bangalore, 2020 13/36
q
q
q
x
x+1
x-1
...
x-1
x
p
x-1
rx-1
p
x+1
rx
p
...
x+1
x
qx
[U (x) − U (x − 1)]
px
qx qx−1
[U (x − 1) − U (x − 2)]
=
px px−1
qx qx−1 · · · qa+1
[U (a + 1) − U (a)]
=
px px−1 · · · pa+1
U (x + 1) − U (x) =
rx+1
U (x) = Px [Ta < Tb ] = P r[Ta < Tb |X0 = x]
x+1
X
P r[Ta < Tb |X1 = y] P r[X1 = y|X0 = x]
=
y=x−1
= U (x − 1)qx + U (x)rx + U (x + 1)px
= U (x − 1)qx + U (x)(1 − px − qx ) + U (x + 1)px
⇒
⇒
Let γy =
qy qy−1 · · · qa+1
, a < y < b, γa = 1
py py−1 · · · pa+1
Now we get
U (x + 1) − U (x) =
qx [U (x) − U (x − 1)] = px [U (x + 1) − U (x)]
qx
[U (x) − U (x − 1)]
U (x + 1) − U (x) =
px
PS Sastry, IISc, Bangalore, 2020 14/36
γx
[U (a + 1) − U (a)]
U (x + 1) − U (x) =
γa
By taking x = b − 1, b − 2, · · · , a + 1, a,
γb−1
[U (a + 1) − U (a)]
U (b) − U (b − 1) =
γa
γb−2
U (b − 1) − U (b − 2) =
[U (a + 1) − U (a)]
γa
..
.
γa
U (a + 1) − U (a) =
[U (a + 1) − U (a)]
γa
◮ Adding all these we get
PS Sastry, IISc, Bangalore, 2020 15/36
◮
γa
⇒ U (a) − U (a + 1) = Pb−1
x=a γx
PS Sastry, IISc, Bangalore, 2020 16/36
Using these, we get
γx
[U (a) − U (a + 1)]
γa
γa
γx
γx
= Pb−1
=
Pb−1
γa
x=a γx
x=a γx
U (x) − U (x + 1) =
◮
b−1
X
1
γx = U (b) − U (a) = 0 − 1
[U (a + 1) − U (a)]
γa
x=a
γx
[U (a + 1) − U (a)]
γa
Putting x = b − 1, b − 2, · · · , y in the above
γb−1
U (b − 1) − U (b) = Pb−1
x=a γx
γb−2
U (b − 2) − U (b − 1) = Pb−1
x=a γx
..
.
γy
U (y) − U (y + 1) = Pb−1
x=a γx
◮ Adding these we get
Pb−1
x=y γx
U (y) − U (b) = U (y) = Pb−1 , a < y < b
x=a γx
◮
PS Sastry, IISc, Bangalore, 2020 17/36
◮
We are considering birth-death chains
q
q
q
x
◮
x+1
Suppose this is a Gambler’s ruin chain:
px = p, qx = q, ∀x
q
x-1
...
x-1
x
p
p
x-1
x+1
p
p
x+1
x
q
q
1
...
p
p
...
rx-1
rx+1
rx
i-1
0
◮
◮
We have derived, for a < y < b,
Pb−1
qx qx−1 · · · qa+1
x=y γx
U (y) = Py [Ta < Tb ] = Pb−1 , γx =
px px−1 · · · pa+1
x=a γx
Py−1
x=a
Py [Tb < Ta ] = Pb−1
i+1
x
q
p
◮
Hence, for a Gambler’s ruin chain we get, e.g.,
i
q
Pi−1
−1
p
x=0 γx
Pi [TN < T0 ] = PN −1
= N
q
x=0 γx
−1
p
◮
This is the probability of gambler being successful
PS Sastry, IISc, Bangalore, 2020 18/36
◮
N
Then, γx =
γx
x=a γx
i
◮
Hence we also get
1
...
PS Sastry, IISc, Bangalore, 2020 19/36
Consider the following chain over {0, 1, · · · }
q
i
p
1-p
0
0
0
...
i-1
◮
i
p
i+1
...
Consider this chain started in state 1.
i
ri
This is an infinite irreducible birth-death chain
◮ We want to know whether the chain is transient or
recurrent etc.
◮ We can use the earlier analysis for this too.
Pn−1
γx
P1 [T0 < Tn ] = Px=1
, ∀n > 1
n−1
x=0 γx
Pn−1
1
x=0 γx − γ0
=
= 1 − Pn−1
Pn−1
x=0 γx
x=0 γx
◮
PS Sastry, IISc, Bangalore, 2020 20/36
[T0 < Tn ] ⊂ [T0 < Tn+1 ], n = 2, 3, · · ·
since the chain cannot hit n + 1 without hitting n.
◮ Also, 1 ≤ T2 < T3 < · · · < Tn and Tn ≥ n.
◮ Hence [T0 < ∞] is same as [T0 < Tn , for some n]
PS Sastry, IISc, Bangalore, 2020 21/36
◮
Consider this chain started in state 1.
P
Theorem: The chain is recurrent iff ∞
x=0 γx = ∞
Proof
◮ Supoose chain is recurrent. Since it is irreducible,
◮
[T0 < Tn ] ⊂ [T0 < Tn+1 ], n = 2, 3, · · ·
since the chain cannot hit n + 1 without hitting n.
◮ Also, 1 ≤ T2 < T3 < · · · < Tn and Tn ≥ n.
◮ Hence [T0 < ∞] is same as [T0 < Tn , for some n]
P1 [T0 < Tn , for some n] = P1 (∪n>1 [T0 < Tn ])
= P1 lim [T0 < Tn ]
P1 [T0 < ∞] = 1 ⇒
=
◮
n→∞
x=0 γx
n→∞
1
⇒ P1 [T0 < ∞] = 1 − P∞
x=0 γx
Suppose
P∞
x=0 γx = ∞ ⇒
P1 [T0 < ∞] = 1
P0 [T0 < ∞] = P (0, 0) + P (0, 1) P1 [T0 < ∞]
= P (0, 0) + P (0, 1) = 1
lim P1 ([T0 < Tn ])
1
lim 1 − Pn−1
γx = ∞
x=0
n→∞
=
∞
X
Implies state 0 is recurrent and hence the chain is
recurrent because it is irreducible.
◮ Note that we have used the fact that the chain is infinite
only to the right.
◮
PS Sastry, IISc, Bangalore, 2020 23/36
PS Sastry, IISc, Bangalore, 2020 22/36
◮
The chain is transient if
◮
Let px = p, qx = q ⇒
Transient if
P∞
x=0 γx < ∞
x
γx = pq
∞ x
X
q
<∞ ⇔ q<p
∞ x
X
q
=∞ ⇔ q≥p
x=0
Recurrent if
◮
x=0
p
p
P∞ q x
x=0
p
=∞
When will this chain be positive recurrent?
◮ We know that an irreducible chain is positive recurrent if
and only if it has a stationary distribution.
◮ We can check if it has a stationary distribution
◮ The earlier equations that we derived earlier hold for this
infinite case also.
◮
Intuitively clear
◮ This chain with q < p is an example of an irreducible
chain that is wholly transient
We know the chain is recurrent if
◮
PS Sastry, IISc, Bangalore, 2020 24/36
PS Sastry, IISc, Bangalore, 2020 25/36
◮
We derived earlier the equations that a stationary
distribution of this chain (if it exists) has to satisfy
π(n) = ηn π(0), where ηn =
p0 p1 · · · pn−1
, n = 1, 2, · · · ,
q1 q2 · · · qn
This analysis can handle chains which are infinite in one
direction
◮ Consider the following random walk chain
◮
Setting η0 = 1, we get π(0) j=0 ηj = 1
P∞
◮ Hence stationary distribution exists iff
j=0 ηj < ∞
◮ Let px = p, qx = q
◮
1-p
1-p
P∞
1-p
...
-1
p
0
p
+1
p
...
The state space here is {· · · , −1, 0, +1, · · · }
◮ The chain is irreducible and periodic with period 2
◮ P 2n (0, 0) = 2n Cn pn (1 − p)n .
P 2n
◮ We can look at the limit of 1
n P (0, 0)
n
◮ We can show that the chain is transient if p 6= 0.5 and is
recurrent if p = 0.5.
◮
∞
X
j=0
◮
ηj =
∞ j
X
p
j=0
q
<∞ ⇔ p<q
Thus in this special case, the chain is
transient if p > q; recurrent if p ≤ q
positive recurrent if p < q
◮ null recurrent if p = q
◮
◮
PS Sastry, IISc, Bangalore, 2020 26/36
In general, determining when an infinite chain is positive
recurrent is difficult.
◮ The method we had works only for birth-death chains
over non-negative integers.
◮ There is a useful general theorem.
◮
Foster’s Theorem
Let P be the transition probabilities of a homogeneous
irreducible Markov chain with state space S. Let
h : S → ℜ with h(x) ≥ 0 and
PS Sastry, IISc, Bangalore, 2020 27/36
Let {Xn , n ≥ 0} be an irreducible markov chain on a
finite state space S with stationary distribution π.
◮ Let r : S → ℜ be a bounded function.
◮ Suppose we want E[r(X)] with respect to the stationary
P
distribution π (E[r(X)] = j∈S r(j)π(j))
◮ Let Nn (j) be as earlier. Then
◮
n
1X
1X
Nn (j)r(j)
r(Xm ) =
n m=1
n j∈S
P
Pk∈S P (i, k)h(k) < ∞ ∀i ∈ F and
◮
/F
k∈S P (i, k)h(k) ≤ h(i) − ǫ ∀i ∈
◮
for some finite set F and some ǫ > 0. Then the Markov
chain is positive recurrent
◮ The h here is called a Lyapunov function.
◮ We will not prove this theorem
PS Sastry, IISc, Bangalore, 2020 28/36
n
X
Nn (j) X
1X
r(Xm ) =
r(j) lim
=
r(j)π(j)
⇒ lim
n→∞ n
n→∞
n
m=1
j∈S
j∈S
◮
For this to be true for infinite S, we need some extra
conditions
PS Sastry, IISc, Bangalore, 2020 29/36
MCMC Sampling
Consider a distribution over (finite) S: π(x) = b(x)
Z
P
◮ Since this is a distribution, Z =
x∈S b(x)
◮ We assume, we can efficiently calculate b(x) for any x
but computation of Z is intractable or computationally
expensive
E.g., the Boltzmann distribution: b(x) = e−E(x)/KT
◮ We want E[g(X)] w.r.t. distribution π (for any g)
◮
Suppose {Xn } is a an irreducible, aperiodic positive
recurrent Markov chain with stationary dist π(x) = b(x)
Z
◮ Then we have
◮
n
X
1X
g(Xm ) =
g(x)π(x)
lim
n→∞ n
m=1
x
hence, if we can design a Markov chain with a given
stationary distribution, we can use that to calculate the
expectation.
◮ We can also use the chain to generate samples from
distribution π
◮
E[g(X)] =
X
g(x) π(x) ≈
x
◮
n
X
1
g(Xi ),
n i=1
X 1 , · · · Xn ∼ π
One way to generate samples is to design an ergodic
markov chain with stationary distribution π
– MCMC sampling
PS Sastry, IISc, Bangalore, 2020 30/36
◮
{Xn }: Markov chain with stationary dist π(x) = b(x)
Z
We can approximate the expectation as
n
1X
g(XM +i )
g(x)π(x) ≈
n
x
i=1
X
Where M is large enough to assume chain is in steady
state
Pn
◮ When we take sample mean, 1
i=1 Zi , we want Zi to
n
be uncorrelated
◮ We can, for example, use
n
1X
g(XM +Ki )
g(x)π(x) ≈
n
x
i=1
X
◮
For all these, we need to design a Markov chain with π as
stationary distribution
PS Sastry, IISc, Bangalore, 2020 32/36
PS Sastry, IISc, Bangalore, 2020 31/36
Let Q = [q(i, j)] be the transition probability matrix of an
irreducible Markov chain over S.
◮ Q is called the proposal distribution
◮ We start with arbitray X0 and generate
Xn+1 , n = 0, 1, 2, · · · , iteratively as follows
◮
◮
◮
If Xn = i, we generate Y with P r[Y = k] = q(i, k)
Let the generated value for Y be j. Set
j
with probability α(i, j)
Xn+1 =
Xn with probability 1 − α(i, j)
α(i, j) is called the acceptance probability
◮ We want to choose α(i, j) to make Xn an ergodic
markov chain with stationary probabilities π
◮
PS Sastry, IISc, Bangalore, 2020 33/36
◮
The stationary distribution π satisfies (with transition
probabilities P )
X
π(x) P (x, y), ∀y ∈ S
π(y) =
◮
x
◮
Suppose there is a distribution g(·) that satisfies
Any stationary distribution has to satisfy
X
π(y) =
π(x) P (x, y), ∀y ∈ S
x
g(y) P (y, x) = g(x) P (x, y), ∀x, y ∈ S
◮
◮
This is called detailed balance
Summing both sides above over x give
X
X
g(x)P (x, y), ∀y
g(y) P (y, x) =
g(y) =
x
x
If I can find a π that satisfies
π(x)P (x, y) = π(y)P (y, x), ∀x, y ∈ S, x 6= y
that would be the stationary distribution
◮ This is called detailed balance
Thus if g(·) satisfies detailed balance, then it must be the
stationary distribution
◮ Note that it is not necessary for a stationary distribution
to satisfy detailed balance
◮
PS Sastry, IISc, Bangalore, 2020 35/36
PS Sastry, IISc, Bangalore, 2020 34/36
Recall our algorithm for generating Xn , n = 0, 1, · · ·
◮ Start with arbitrary X0 and generate Xn+1 from Xn
◮
If Xn = i, we generate Y with P r[Y = k] = q(i, k)
◮ Let the generated value for Y be j. Set
j
with probability α(i, j)
Xn+1 =
Xn with probability 1 − α(i, j)
◮
◮
Hence the transition probabilities for Xn are
P (i, j) = q(i, j) α(i, j), i 6= j
X
q(i, j) (1 − α(i, j))
P (i, i) = q(i, i) +
j6=i
π(i) = b(i)/Z is the desired stationary distribution
◮ So, we can try to satisfy
◮
π(i) P (i, j) = π(j) P (j, i), ∀i, j, i 6= j
that is, b(i)q(i, j) α(i, j) = b(j)q(j, i) α(j, i)
PS Sastry, IISc, Bangalore, 2020 36/36
MCMC Sampling
◮ Consider a distribution over (finite) S: π(x) = b(x)
Z
P
◮ Since this is a distribution, Z = x∈S b(x)
◮ We assume, we can efficiently calculate b(x) for any x
but computation of Z is intractable or computationally
expensive
E.g., the Boltzmann distribution: b(x) = e−E(x)/KT
◮ We want E[g(X)] w.r.t. distribution π (for any g)
n
1X
g(Xi ),
E[g(X)] =
g(x) π(x) ≈
n i=1
x
X
X 1 , · · · Xn ∼ π
◮ One way to generate samples is to design an ergodic
markov chain with stationary distribution π
– MCMC sampling
PS Sastry, IISc, Bangalore, 2020 1/35
◮ {Xn }: Markov chain with stationary dist π(x) = b(x)
Z
We can approximate the expectation as
◮ Suppose {Xn } is a an irreducible, aperiodic positive
recurrent Markov chain with stationary dist π(x) = b(x)
Z
◮ Then we have
n
X
1X
g(Xm ) =
g(x)π(x)
lim
n→∞ n
m=1
x
◮ hence, if we can design a Markov chain with a given
stationary distribution, we can use that to calculate the
expectation.
◮ We can also use the chain to generate samples from
distribution π
n
1X
g(XM +i )
g(x)π(x) ≈
n i=1
x
X
Where M is large enough to assume chain is in steady
state
P
◮ When we take sample mean, n1 ni=1 Zi , we want Zi to
be uncorrelated
◮ We can, for example, use
n
1X
g(XM +Ki )
g(x)π(x) ≈
n i=1
x
X
◮ For all these, we need to design a Markov chain with π as
stationary distribution
PS Sastry, IISc, Bangalore, 2020 2/35
◮ Let Q = [q(i, j)] be the transition probability matrix of an
irreducible Markov chain over S.
◮ Q is called the proposal distribution
◮ We start with arbitrary X0 and generate
Xn+1 , n = 0, 1, 2, · · · , iteratively as follows
◮ If Xn = i, we generate Y with P r[Y = k] = q(i, k)
◮ Let the generated value for Y be j. Set
Xn+1 =
j
with probability α(i, j)
Xn with probability 1 − α(i, j)
◮ α(i, j) is called the acceptance probability
◮ We want to choose α(i, j) to make Xn an ergodic
Markov chain with stationary probabilities π
PS Sastry, IISc, Bangalore, 2020 4/35
PS Sastry, IISc, Bangalore, 2020 3/35
◮ The stationary distribution π satisfies (with transition
probabilities P )
X
π(x) P (x, y), ∀y ∈ S
π(y) =
x
◮ Suppose there is a distribution g(·) that satisfies
g(y) P (y, x) = g(x) P (x, y), ∀x, y ∈ S
This is called detailed balance
◮ Summing both sides above over x give
X
X
g(x)P (x, y), ∀y
g(y) P (y, x) =
g(y) =
x
x
◮ Thus if g(·) satisfies detailed balance, then it must be the
stationary distribution
◮ Note that it is not necessary for a stationary distribution
to satisfy detailed balance
PS Sastry, IISc, Bangalore, 2020 5/35
◮ Recall our algorithm for generating Xn , n = 0, 1, · · ·
◮ Start with arbitrary X0 and generate Xn+1 from Xn
◮ If Xn = i, we generate Y with P r[Y = k] = q(i, k)
◮ Let the generated value for Y be j. Set
j
with probability α(i, j)
Xn+1 =
Xn with probability 1 − α(i, j)
◮ Any stationary distribution has to satisfy
X
π(y) =
π(x) P (x, y), ∀y ∈ S
x
◮ Hence the transition probabilities for Xn are
◮ If I can find a π that satisfies
P (i, j) = q(i, j) α(i, j), i 6= j
X
q(i, j) (1 − α(i, j))
P (i, i) = q(i, i) +
π(x)P (x, y) = π(y)P (y, x), ∀x, y ∈ S, x 6= y
j6=i
that would be the stationary distribution
◮ This is called detailed balance
◮ π(i) = b(i)/Z is the desired stationary distribution
◮ So, we can try to satisfy
π(i) P (i, j) = π(j) P (j, i), ∀i, j, i 6= j
that is, b(i)q(i, j) α(i, j) = b(j)q(j, i) α(j, i)
PS Sastry, IISc, Bangalore, 2020 6/35
Metropolis-Hastings Algorithm
◮ We want to satisfy
◮ Start with arbitrary X0 and generate Xn+1 from Xn
b(i)q(i, j) α(i, j) = b(j)q(j, i) α(j, i)
◮ Choose
α(i, j) = min
π(j)q(j, i)
,1
π(i)q(i, j)
PS Sastry, IISc, Bangalore, 2020 7/35
= min
b(j)q(j, i)
,1
b(i)q(i, j)
◮ Note that one of α(i, j), α(j, i) is 1
π(j)q(j, i)
< 1
π(i)q(i, j)
⇒ π(i) q(i, j) α(i, j) = π(j) q(j, i)
= π(j) q(j, i) α(j, i)
suppose α(i, j) =
◮ Note that π(i) above can be replaced by b(i)
PS Sastry, IISc, Bangalore, 2020 8/35
◮ If Xn = i, we generate Y with P r[Y = k] = q(i, k)
◮ Let the generated value for Y be j. Set
j
with probability α(i, j)
Xn+1 =
Xn with probability 1 − α(i, j)
Where Q = [q(i, j)] is the transition probabilities of an
irreducible chain and
π(j)q(j, i)
α(i, j) = min
,1
π(i)q(i, j)
◮ Then {Xn } would be an irreducible, aperiodic chain with
stationary distribution π.
◮ Q is called the proposal chain and α(i, j) is called
acceptance probabilities
PS Sastry, IISc, Bangalore, 2020 9/35
◮ Consider Boltzmann distribution: b(x) = e−E(x)/KT
◮ Take proposal to be uniform: from any state, we go to all
other states with equal probabilities
◮ Then,
b(y)
, 1 = min e−(E(y)−E(x))/KT , 1
α(x, y) = min
b(x)
◮ In state x you generate a random new state y.
If E(y) ≤ E(x) you always go there;
if E(y) > E(x), accept with probability e−(E(y)−E(x))/KT
◮ An interesting way to simulate Boltzmann distribution
◮ We could have chosen Q to be ‘uniform over neighbours’
PS Sastry, IISc, Bangalore, 2020 10/35
◮ Let b(x) = e−E(x)/T where T is a parameter called
‘temparature’
◮ {Xn } be Markov chain with stationary dist π(x) = b(x)
Z
◮ We can find relative occupation of different states by the
chain by collecting statistics during steady state
◮ We know
b(x1 )
π(x1 )
=
= e−(E(x1 )−E(x2 ))/T
π(x2 )
b(x2 )
◮ We spend more time in global minimum
We can increase the relative fraction of time spent in
global minimum by decreasing T (There is a price to pay!)
◮ Gives rise to interesting optimization technique called
simulated annealing
PS Sastry, IISc, Bangalore, 2020 12/35
◮ Suppose E : S → ℜ is some function.
◮ We want to find x ∈ S where E is globally minimized.
◮ A gradient descent type method tries to find a locally
minimizing direction and hence gives only a ‘local’
minimum.
◮ The Metropolis-Hastings algorithm gives another view
point on how such optimization problems can be handled.
◮ We can think of E as the energy function in a Boltzmann
distribution
PS Sastry, IISc, Bangalore, 2020 11/35
◮ In most applications of MCMC, x ∈ S is a vector.
◮ One normally changes one component at a time. That is
how neighbours can be defined
◮ A special case of proposal distribution is the conditional
distribution.
◮ Suppose X = (X1 , · · · , XN ). To propose a value for Xi ,
we use fXi |X−i
◮ Here the conditional distribution is calculated using the
target π as the joint distribution.
◮ With such a proposal distribution, one can show that
α(i, j) is always 1
◮ This is known as Gibbs sampling
PS Sastry, IISc, Bangalore, 2020 13/35
Random process
◮ A random process or a stochastic process is a collection
of random variables: {Xt , t ∈ T }
◮ Markov chain is an example. Here T = {0, 1, · · · }
◮ We call T the index set.
◮ Normally, T is either (a subset of) set of integers or an
interval on real line.
◮ We think of the index t as time
◮ Thus a random process can represent the time-evolution
of the state of a system
◮ We assume T is infinite
◮ The index need not necessarily represent time. It can
represent, for example, space coordinates.
PS Sastry, IISc, Bangalore, 2020 14/35
◮ A random process: {Xt , t ∈ T }
◮ We can think of this as a mapping: X : Ω × T → ℜ
◮ Thus, X(ω, ·) is a real-valued function over T .
◮ So, we can think of the process also as a collection of
time functions.
◮ X can be thought of as a map that associates with each
ω ∈ Ω a real-valued function on T .
◮ These functions are called sample paths or paths of the
process
◮ We can view the random process as a collection of
random variables, or as a collection of functions
◮ We will denote the random variables as Xt or X(t)
PS Sastry, IISc, Bangalore, 2020 16/35
◮ A random process: {Xt , t ∈ T }
◮ The set T can be countable e.g., T = {0, 1, 2, · · · }
◮ Or, T can be continuous e.g., T = [0, ∞)
◮ These are termed discrete-time or continuous-time
processes
◮ The random variables, Xt , may be discrete or continuous
◮ These are termed discrete-state or continuous-state
processes
◮ The Markov chain we considered is a discrete-time
discrete-state process
PS Sastry, IISc, Bangalore, 2020 15/35
◮ A finite collection of random variables is completely
specified by its joint distribution
◮ How do we characterize a random process?
◮ We need to specify joint distribution of Xt1 , Xt2 , · · · Xtn
for all n and all t1 , t2 , · · · tn ∈ T ..
◮ One can show this completely specifies the process.
◮ As we saw, for a Markov chain, π0 and P together specify
all such joint distributions
PS Sastry, IISc, Bangalore, 2020 17/35
Distributions of a random process
◮ A random process: {Xt , t ∈ T } or X : Ω × T → ℜ
◮ The first order distribution function of X is
FX (x; t) = P r[Xt ≤ x] = FXt (x)
◮ The second order distribution function of X is
FX (x1 , x2 ; t1 , t2 ) = P r[Xt1 ≤ x1 , Xt2 ≤ x2 ]
◮ The nth order distribution function of X is
FX (x1 , · · · , xn ; t1 , · · · tn ) = P r[Xti ≤ xi , i = 1, · · · , n]
PS Sastry, IISc, Bangalore, 2020 18/35
◮ Specifying the nth order distributions for all n separately
is not feasible.
◮ Hence one needs some assumptions on the model so that
these are specified implicitly.
◮ One example is the Markovian assumption.
◮ As we saw, in a Markov chain, the transition probabilities
and initial state probabilities would determine all the
distributions
◮ Another such useful assumption is what is called a
process with independent increments
◮ When it is a discrete-state process, all Xt would be
discrete random variables
◮ We can specify distributions through mass functions:
fX (x; t) = P r[Xt = x] = fXt (x)
fX (x1 , x2 ; t1 , t2 ) = P r[Xt1 = x1 , Xt2 = x2 ]
fX (x1 , · · · , xn ; t1 , · · · tn ) = P r[Xti = xi , i = 1, · · · , n]
◮ If all Xt are continuous random variables and if all
distributions have density functions, then we denote joint
density of Xt1 , · · · , Xtn by fX (x1 , · · · , xn ; t1 , · · · tn )
PS Sastry, IISc, Bangalore, 2020 19/35
◮ A random process {X(t), t ∈ T } is said to be a process
with independent increments if
for all t1 < t2 ≤ t3 < t4 , the random variables X(t2 )−
X(t1 ) and X(t4 ) − X(t3 ) are independent
◮ Note that this also implies, e.g., X(t1 ) is independent of
X(t2 ) − X(t1 ) for all t1 < t2 .
◮ Now suppose this is a discrete-state process.
◮ Then we can write nth order pmf’s as
P r[X(t1 ) = x1 , X(t2 ) = x2 , · · · X(tn ) = xn ]
= P r[X(t1 ) = x1 , X(t2 ) − X(t1 ) = x2 − x1 , · · · ]
= P r[X(t1 ) = x1 ] P r[X(t2 ) − X(t1 ) = x2 − x1 ] · · ·
· · · P r[X(tn ) − X(tn−1 ) = xn − xn−1 ]
◮ We only need up to second order distributions
PS Sastry, IISc, Bangalore, 2020 20/35
PS Sastry, IISc, Bangalore, 2020 21/35
◮ Let {X(t), t ∈ T } be a discrete-state process with
independent increments
◮ Then we specify fX (x; t) and another function
g(x1 , x2 ; t1 , t2 ) = P r[X(t2 ) − X(t1 ) = x2 − x1 ]
fX (x1 , · · · , xn ; t1 , · · · tn )
= P r[X(ti ) = xi , i = 1, · · · , n]
n−1
Y
P r[X(ti+1 ) − X(ti ) = xi+1 − xi ]
= fX (x1 ; t1 )
= fX (x1 ; t1 )
ηX (t) = E[X(t)], t ∈ T
◮ We define the autocorrelation of the process by
◮ Now we can get all distributions as
i=1
n−1
Y
◮ Given a random process {X(t), t ∈ T }
◮ Its mean or mean function is defined by
RX (t1 , t2 ) = E[X(t1 )X(t2 )]
◮ We define the autocovariance of the process by
CX (t1 , t2 ) = E [(X(t1 ) − E[X(t1 )])(X(t2 ) − E[X(t2 )])]
= RX (t1 , t2 ) − ηX (t1 )ηX (t2 )
g(xi , xi+1 ; ti , ti+1 )
i=1
PS Sastry, IISc, Bangalore, 2020 22/35
PS Sastry, IISc, Bangalore, 2020 23/35
Stationary Processes
◮ A random process {X(t), t ∈ T } is said to be stationary
if
for all n, for all t1 , · · · , tn , for all x1 , · · · xn and for all
τ we have
FX (x1 , · · · , xn ; t1 , · · · , tn ) = FX (x1 , · · · , xn ; t1 +τ, · · · , tn +τ )
◮ For a stationary process, the distributions are unaffected
by translation of the time axis.
◮ This is a rather stringent condition and is often referred
to as strict-sense stationarity
PS Sastry, IISc, Bangalore, 2020 24/35
◮ A homogeneous Markov chain started in its stationary
distribution is a stationary process
◮ As we know, if π0 is the stationary distribution then πn is
same for all n.
◮ This, along with the Markov condition would imply that
shift of time origin does not affect the distributions
P r[Xn = x0 , Xn+1 = x1 , · · · Xn+m = xm ]
= πn (x0 )P (x0 , x1 ) · · · P (xm−1 , xm )
= π0 (x0 )P (x0 , x1 ) · · · P (xm−1 , xm )
= P r[X0 = x0 , X1 = x1 , · · · Xm = xm ]
PS Sastry, IISc, Bangalore, 2020 25/35
◮ Suppose {X(t), t ∈ T } is (strict-sense) stationary
◮ Then the first order distribution is independent of time
FX (x; t) = FX (x; t + τ ), ∀x, t, τ
⇒ e.g., FX (x; t) = FX (x; 0)
◮ The process {X(t), t ∈ T } is said to be wide-sense
stationary if
◮ This implies ηX (t) = ηX , a constant
◮ The second order distribution has to satisfy
FX (x1 , x2 ; t, t + τ ) = FX (x1 , x2 ; 0, τ ), ∀x1 , x2 , t, τ
Hence FX (x1 , x2 ; t1 , t2 ) can depend only on t1 − t2
◮ This implies
FX (x; t) = FX (x; t + τ ), ∀x, t, τ
FX (x1 , x2 ; t1 , t2 ) = FX (x1 , x2 ; t1 + τ, t2 + τ )
◮ The process is wide-sense stationary if the first and
second order distributions are invariant to translation of
time origin
RX (t, t + τ ) = E[X(t)X(t + τ )] = RX (τ )
Autocorrelation depends only on the time difference
PS Sastry, IISc, Bangalore, 2020 27/35
PS Sastry, IISc, Bangalore, 2020 26/35
Ergodicity
◮ Let {X(t), t ∈ T } be wide-sense stationary. Then
1. ηX (t) = ηX , a constant
2. RX (t1 , t2 ) depends only on t1 − t2
◮ In many engineering applications, we call a process
wide-sense stationary if the above two hold.
◮ In this course we take the above as the definition of
wide-sense stationary process
◮ When the process is wide-sense stationary, we write
autocorrelation as
RX (τ ) = E[X(t)X(t + τ )]
PS Sastry, IISc, Bangalore, 2020 28/35
◮ Suppose X(n) is a discrete-time discrete-state process
(like a Markov chain)
◮ Suppose it is wide-sense stationary.
Then E[X(n)] does not depend on n
◮ Ergodicity is the question of
n
1X
?
lim
X(i) = E[X(n)] = ηX
n→∞ n
i=1
◮ We proved that this is true for an irreducible, aperiodic,
positive recurrent Markov chain (with a finite state space)
◮ The question is : do ‘time-averages’ converge to
‘ensemble-averages’
◮ The process is wide-sense stationary and hence all X(n)
have the same distribution; but they need not be
independent or uncorrelated (e.g., Markov chain)
PS Sastry, IISc, Bangalore, 2020 29/35
◮ Ergodicity is a question of whether time-averages
converge to ensemble-averages?
n
X
1
?
X(i) = E[X(n)] = ηX
n→∞ n
i=1
lim
◮ Define
1
ητ =
2τ
lim
n→∞ n
X(t) dt (τ > 0)
−τ
◮ For each τ , ητ is a rv. We write η for ηX .
◮ We say the process is mean-ergodic if
Or, more generally
n
1X
Z τ
P
ητ → η,
?
g(X(i)) = E[g(X(n))]
i=1
For a continuous time process we can write this as
Z τ
1
?
lim
X(t) dt = E[X(t)] = ηX
τ →∞ 2τ −τ
◮ Essentially if there is no long-term correlation in the
process this may hold.
◮ One sufficient condition could be that covariance between
X(t) and X(t + τ ) decreases fast with increasing τ .
as τ → ∞
◮ That is, if
lim P r [|ητ − η| > ǫ] = 0, ∀ǫ > 0
τ →∞
◮ Note that E[ητ ] = η, ∀τ .
◮ Hence it is enough if we show
στ2 , E (ητ − η)2 → 0,
PS Sastry, IISc, Bangalore, 2020 30/35
PS Sastry, IISc, Bangalore, 2020 31/35
◮ Let CX (t1 , t2 ) be the autocovariance of the process
Let I =
PS Sastry, IISc, Bangalore, 2020 32/35
Z τZ τ
−τ
CX (t1 , t2 ) = E[(X(t1 ) − η)(X(t2 ) − η)]
◮ Assuming wide-sense stationarity,
CX (t1 , t2 ) = CX (t1 − t2 )
◮ We can get στ2 as
στ2 = E (ητ − η)2
Z τ
Z τ
1
1
′
′
(X(t) − η) dt
(X(t ) − η) dt
= E
2τ −τ
2τ −τ
Z τZ τ
1
=
E[(X(t) − η)(X(t′ ) − η)] dt dt′
2
4τ −τ −τ
Z τZ τ
1
=
CX (t − t′ ) dt dt′
2
4τ −τ −τ
as τ → ∞
CX (t1 − t2 ) dt2 dt1
−τ
◮ Let z = t1 − t2 . We want to change the integration to be
over t2 and z
t1
T
T
-T
t2
-T
◮ Easy to see z goes from −2τ to 2τ
When z ≥ 0, for a given z, t2 goes from −τ to τ − z
When z < 0, for a given z, t2 goes from −τ − z to τ
PS Sastry, IISc, Bangalore, 2020 33/35
◮ Now we get
Z τZ τ
CX (t1 − t2 ) dt2 dt1
I =
−τ −τ
Z 2τ Z τ −z
Z 0 Z τ
CX (z) dt2 dz
CX (z) dt2 dz +
=
−τ
0
−2τ −τ −z
Z 2τ
Z 0
CX (z) (τ − z − (−τ )) dz
CX (z) (τ − (−τ − z)) dz +
=
0
−2τ
Z 2τ
Z 0
CX (z) (2τ − z) dz
CX (z) (2τ + z) dz +
=
0
−2τ
Z 2τ
CX (z) (2τ − |z|) dz
=
−2τ
◮ Now we get στ2 as
στ2
Z τZ τ
1
=
CX (t − t′ ) dt dt′
2
4τ −τ −τ
Z 2τ
1
CX (z) (2τ − |z|) dz
=
4τ 2 −2τ
Z 2τ
1
|z|
dz
=
CX (z) 1 −
2τ −2τ
2τ
◮ Hence, a sufficient condition for στ2 → 0 is
Z ∞
|CX (z)| dz < ∞
−∞
◮ This is a sufficient condition for the process being
mean-ergodic
PS Sastry, IISc, Bangalore, 2020 34/35
PS Sastry, IISc, Bangalore, 2020 35/35
Poisson Process
◮
A random process {N (t), t ≥ 0} is called a counting
process if
1. N (t) ≥ 0 and is integer-valued
2. If s < t then, N (s) ≤ N (t)
This is the next process we study
◮ This is a discrete-state continuous-time process
◮ The index set is the interval [0, ∞) and all random
variables are discrete and take non-negative integer
values.
◮
PS Sastry, IISc, Bangalore, 2020 1/32
N (t) represents number of ‘events’ till t
◮ The counting process has independent increments if for
all t1 < t2 ≤ t3 < t4 , N (t2 ) − N (t1 ) is independent of
N (t4 ) − N (t3 )
◮ In particular, for all s > t, N (s) − N (t) is independent of
N (t) − N (0)
◮ The process is said to have stationary increments if
N (t2 ) − N (t1 ) has the same distribution as
N (t2 + τ ) − N (t1 + τ ), ∀τ, ∀t2 > t1
PS Sastry, IISc, Bangalore, 2020 2/32
◮
We start with two definitions of Poisson process
◮ Definition 1 A counting process {N (t), t ≥ 0} is said to
be a Poisson process with rate λ > 0 if
◮
1. N (0) = 0
2. The process has stationaryn and independent increments
3. P r[N (t) = n] = e−λt (λt)
n! , n = 0, 1, · · ·
N (t) is Poisson with parameter λt
◮ E[N (t)] = λt and hence λ is called rate
◮ Since the process has stationary increments and
N (0) = 0, (N (t + s) − N (s)) would be Poisson with
parameter λt for all s, t > 0.
Definition 2 A counting process {N (t), t ≥ 0} is said to
be a Poisson process with rate λ > 0 if
1. N (0) = 0
2. The process has stationary and independent increments
3. P r[N (h) = 1] = λh + o(h) and
P r[N (h) ≥ 2] = o(h)
◮
We say g(h) is o(h) if
◮
g(h)
=0
h→0 h
lim
This definition tells us when Poisson process may be a
good model
◮ We will show that both definitions are equivalent
◮
PS Sastry, IISc, Bangalore, 2020 4/32
PS Sastry, IISc, Bangalore, 2020 3/32
We first show Definition 2 ⇒ Definition 1
◮ For this we need to calculate distribution of N (t)
◮ Let Pn (t) = P r[N (t) = n]
◮
P0 (t + h) = P r[N (t + h) = 0]
= P r[N (t) = 0, N (t + h) − N (t) = 0]
= P r[N (t) = 0] P r[N (t + h) − N (t) = 0]
(because of independent increments)
= P r[N (t) = 0] P r[N (h) = 0] (stationary increments)
= P0 (t)(1 − λh + o(h))
⇒
o(h)
P0 (t + h) − P0 (t)
= −λP0 (t) +
h
h
d
⇒
P0 (t) = −λP0 (t)
dt
PS Sastry, IISc, Bangalore, 2020 5/32
◮
Now we can solve this differential equation to get P0 (t)
d
P0 (t)
dt
1 d
⇒
P0 (t)
P0 (t) dt
⇒ ln(P0 (t))
⇒ P0 (t)
= −λP0 (t)
= −λ
= −λt + c
= Ke−λt
◮
Since P0 (0) = P r[N (0) = 0] = 1, we get K = 1 and
hence
P0 (t) = P r[N (t) = 0] = e−λt
◮
Next we consider Pn (t) for n > 0
PS Sastry, IISc, Bangalore, 2020 6/32
Pn (t + h) = P r[N (t + h) = n]
= P r[N (t) = n, N (t + h) − N (t) = 0] +
P r[N (t) = n − 1, N (t + h) − N (t) = 1] +
n
X
P r[N (t) = n − k, N (t + h) − N (t) = k]
d
Pn (t) + λPn (t) = λPn−1 (t)
dt
We need to solve this linear ODE to obtain Pn
◮ The integrating factor is eλt . Let P ′ (t) = d Pn (t)
n
dt
◮
k=2
= Pn (t)P0 (h) + Pn−1 (t)P1 (h) + o(h)
= Pn (t)(1 − λh + o(h)) + Pn−1 (t)(λh + o(h)) + o(h)
◮
⇒
d
Pn (t) = −λPn (t) + λPn−1 (t)
dt
◮
We showed: P0 (t) = e−λt and P1 (t) = λte−λt
◮
We need to show: Pk (t) = e−λt (λt)
k!
◮
Assume it is true till k = n − 1
◮
k
n−1
n−1
d
n t
λt
λt
λt −λt (λt)
=λ
Pn (t) e = λ e Pn−1 (t) = λe e
dt
(n − 1)!
(n − 1
n
(λt)n
1
t
+ c ⇒ Pn (t) = e−λt
⇒ eλt Pn (t) = λn
n (n − 1)!
n!
where c = 0 because Pn (0) = 0.
◮ This completes the proof that Definition 2 implies
Definition 1
PS Sastry, IISc, Bangalore, 2020 9/32
Since P1 (0) = P r[N (0) = 1] = 0, c = 0
Hence P1 (t) = λt e−λt
PS Sastry, IISc, Bangalore, 2020 8/32
PS Sastry, IISc, Bangalore, 2020 7/32
◮
We need Pn−1 to solve for Pn . Take n = 1
d
P1 (t) eλt = λ eλt P0 (t) = λeλt e−λt = λ
dt
⇒ eλt P1 (t) = λt + c ⇒ P1 (t) = e−λt (λt + c)
o(h)
Pn (t + h) − Pn (t)
= −λPn (t) + λPn−1 (t) +
h
h
⇒
eλt (Pn′ (t) + λPn (t)) = eλt λPn−1 (t)
d
Pn (t) eλt = λ eλt Pn−1 (t)
⇒
dt
Definition 1 A counting process {N (t), t ≥ 0} is said to
be a Poisson process with rate λ > 0 if
1. N (0) = 0
2. The process has stationaryn and independent increments
3. P r[N (t) = n] = e−λt (λt)
n! , n = 0, 1, · · ·
◮
Definition 2 A counting process {N (t), t ≥ 0} is said to
be a Poisson process with rate λ > 0 if
1. N (0) = 0
2. The process has stationary and independent increments
3. P r[N (h) = 1] = λh + o(h) and
P r[N (h) ≥ 2] = o(h)
PS Sastry, IISc, Bangalore, 2020 10/32
Now we prove Definition 1 implies Definition 2
◮ We need to only show point(3) of Definition 2 using point
(3) of Definition 1
◮
Let P r[N (t) = k] = e−λt
(λt)
k!
◮
Now we need to show P r[N (h) ≥ 2] = o(h)
P r[N (h) ≥ 2] = 1 − P r[N (h) = 0] − P r[N (h) = 1]
= 1 − e−λh − λhe−λh
k
This goes to zero as h → 0
◮ We can use L’Hospital rule
◮
P r[N (h) = 1] = λ h e−λh = λ h + λ h e−λh − 1 = λ h + o(h)
because
λ h e−λh − 1
= lim λ e−λh − 1 = 0
lim
h→0
h→0
h
◮
1 − e−λh − λhe−λh
λe−λh − λe−λh + λ2 he−λh
= lim
=0
h→0
h→0
h
1
lim
◮
This completes the proof that Definition 2 implies
Definition 1
We showed P r[N (h) = 1] = λh + o(h)
PS Sastry, IISc, Bangalore, 2020 11/32
These two definitions are equivalent
◮
◮
Definition 2 A counting process {N (t), t ≥ 0} is said to
be a Poisson process with rate λ > 0 if
1. N (0) = 0
2. The process has stationary and independent increments
3. P r[N (h) = 1] = λh + o(h) and
P r[N (h) ≥ 2] = o(h)
Since the process has stationary increments, for t2 > t1 ,
P r[N (t2 ) − N (t1 ) = k]] = P r[N (t2 − t1 ) − N (0) = k]
(λ(t2 − t1 ))k
= e−λ(t2 −t1 )
k!
Definition 1 A counting process {N (t), t ≥ 0} is said to
be a Poisson process with rate λ > 0 if
1. N (0) = 0
2. The process has stationaryn and independent increments
3. P r[N (t) = n] = e−λt (λt)
n! , n = 0, 1, · · ·
◮
PS Sastry, IISc, Bangalore, 2020 12/32
The first order distribution of the process is:
N (t) ∼ Poisson(λt)
◮ This, along with stationary and independent increments
property determines all distributions
◮
P r[N (t1 ) = n1 , N (t2 ) = n2 , N (t3 ) = n3 ]
= P r[N (t1 ) = n1 ] P r[N (t2 ) − N (t1 ) = n2 − n1 ]
P r[N (t3 ) − N (t2 ) = n3 − n2 ]
= P r[N (t1 ) = n1 ] P r[N (t2 − t1 ) = n2 − n1 ] P r[N (t3 − t2 ) = n3 − n2
where we assumed t1 < t2 < t3
PS Sastry, IISc, Bangalore, 2020 13/32
PS Sastry, IISc, Bangalore, 2020 14/32
◮
We can easily calculate mean and autocorrelation of the
process
ηN (t) = E[N (t)] = λ t
⇒
not stationary
With t2 > t1 , we have
RN (t1 , t2 ) =
=
=
=
=
=
=
E[N (t2 )N (t1 )]
E[N (t1 )(N (t2 ) − N (t1 ) + N (t1 ))]
E[N (t1 )(N (t2 ) − N (t1 ))] + E[N (t1 )2 ]
E[N (t1 )] E[N (t2 ) − N (t1 )] + E[N (t1 )2 ]
E[N (t1 )] E[N (t2 − t1 )] + E[N (t1 )2 ]
λt1 (λ(t2 − t1 )) + (λt1 + λ2 t21 )
λt1 + λ2 t1 t2
⇒ RN (t1 , t2 ) = λ2 t1 t2 + λ min(t1 , t2 )
Inter-arrival or waiting times
Let T1 denote the time of first event and let Tn denote
the time between nth and (n − 1)st events.
Pn
th
◮ Let Sn =
event
i=1 Ti – time of n
◮
P r[T1 > t] = P r[N (t) = 0] = e−λt
⇒
P r[T2 > t|T1 = s] = P r[0 events in (s, s + t] | T1 = s]
= P r[0 events in (s, s + t] ] = e−λt
Z
⇒ P r[T2 > t] =
P r[T2 > t|T1 = s] fT1 (s) ds = e−λt
◮
PS Sastry, IISc, Bangalore, 2020 15/32
◮
Tn are iid exponential with parameter λ
PS Sastry, IISc, Bangalore, 2020 16/32
The time of nth event is
Sn =
n
X
Ti
i=1
This can be used, e.g., in simulating Poisson process
◮ We can cut time axis into small intervals of length h.
◮ In each interval we can decide whether or not there is an
event, with prob λh.
◮ If there is an event, we choose its time uniformly in the
interval.
◮ Called Bernoulli approximation of Poisson process
◮ We could also generate Poisson process by generating
independent exponential random variables
◮
Since Ti are iid, exponential, Sn is Gamma with
parameters n, λ
◮ Let s < t.
P r[T1 < s, N (t) = 1]
P r[N (t) = 1]
P r[1 event in (0, s), 0 in [s, t]]
=
P r[N (t) = 1]
−λs −λ(t−s)
λse
e
=
λte−λt
s
=
t
P r[T1 < s|N (t) = 1] =
◮
T1 ∼ exponential(λ)
Conditioned on N (t) = 1, T1 is uniform over [0, t]
PS Sastry, IISc, Bangalore, 2020 17/32
PS Sastry, IISc, Bangalore, 2020 18/32
Examples
◮
◮
We look at a few simple example problems using Poisson
process.
We can explicitly derive this (taking t > 1)
P r[S3 > t, N (1) = 2]
P r[N (1) = 2]
P r[2 event in (0, 1], 0 in (1, t)]
=
P r[N (1) = 2]
P r[2 event in (0, 1]] P r[0 in (1, t)]
=
P r[2 event in (0, 1]]
= e−λ(t−1)
P r[S3 > t|N (1) = 2] =
E[N (4) − N (2)|N (1) = 3] = E[N (4) − N (2)]
= E[N (2) − 0] = 2λ
◮
Another example;
E[S4 ] = E
" 4
X
i=1
◮
#
Ti =
4
λ
◮
The memoryless property of exponential rv can be useful
1
if t < 1
P r[S3 > t|N (1) = 2] =
−λ(t−1)
e
if t ≥ 1
Here is another example
E[S4 |N (1) = 2] = 1 + E[S2 ] = 1 +
2
λ
Exercise for you: calculate P r[S4 > t|N (1) = 2] and use
it to find the above expectation
PS Sastry, IISc, Bangalore, 2020 19/32
PS Sastry, IISc, Bangalore, 2020 20/32
Example
Given a specific T0 we want to guess which is the last
event before T0 .
◮ Consider a strategy: we will wait till T0 − τ and pick the
next event as the last one before T0 .
◮ The probability of winning for this is
◮
P r[exactly 1 event in (T0 − τ, T0 )] = λτ e−λτ
◮
We pick τ to maximize this
λe−λτ − λ2 τ e−λτ = 0 ⇒ τ =
◮
1
λ
Let {N (t), t ≥ 0} be a Poisson process with rate λ
◮ Suppose each event can be one of two types –
Typ-I or Typ-II
◮
N1 (t) = number of Typ-I events till t
N2 (t) = number of Typ-II events till t
◮ Note that N (t) = N (t) + N (t), ∀t
1
2
◮
◮
◮
Suppose that, independently of everything else, an event
is of Typ-I with probability p and Typ-II with probability
(1 − p)
Theorem: {N1 (t), t ≥ 0} and {N2 (t), t ≥ 0} are Poisson
processes with rate λp and λ(1 − p) respectively, and
they are independent
Intuitively reasonable because expected inter-arrival time
is λ1
PS Sastry, IISc, Bangalore, 2020 21/32
PS Sastry, IISc, Bangalore, 2020 22/32
P r[N1 (t) = n, N2 (t) = m]
X
=
P r[N1 (t) = n, N2 (t) = m | N (t) = k] P r[N (t) = k]
k
= P r[N1 (t) = n, N2 (t) = m | N (t) = m + n] P r[N (t) = m + n]
(λt)m+n
= m+n Cn pn (1 − p)m e−λt
(m + n)!
(λt)m (λt)n
(m + n)! n
p (1 − p)m e−λ(p+1−p)t
=
m! n!
(m + n)!
n
m
(λpt) −λpt (λ(1 − p)t)
=
e
e−λ(1−p)t
n!
m!
◮
The interesting issue here is that N1 (t) and N2 (t) are
independent.
◮ Suppose customers arrive at a bank as a Poisson process
with rate 12 per hour.
◮ Independently of everything, an arriving customer is male
or female with equal probability.
◮ Q: Given that on some day 6 male customers came in the
first half hour, what is the expected number of female
customers in that half hour?
◮ The answer is 3 because the two processes are
independent
◮
This shows that N1 (t) and N2 (t) are independent Poisson
PS Sastry, IISc, Bangalore, 2020 23/32
The theorem is easily generalized to multiple types for
events
◮ Consider Poisson process with rate λ
◮ Suppose, independently of everything, an event is Typ-i
with probability pi , i = 1, · · · K.
PK
◮ Note we have
i=1 pi = 1
◮ Let Ni (t) be the number of Typ-i customers till t
◮ Then, these are independent Poisson processes with rates
λpi , i = 1, · · · , K
PS Sastry, IISc, Bangalore, 2020 24/32
◮
PS Sastry, IISc, Bangalore, 2020 25/32
Superposition of independent Poisson processes also gives
Poisson process.
◮ If N1 and N2 are independent Poisson processes with
rates λ1 and λ2 then N (t) = N1 (t) + N2 (t) is a Poisson
process with rate λ1 + λ2
◮ We know that sum of independent Possion rv’s is Poisson
◮
PS Sastry, IISc, Bangalore, 2020 26/32
There is an interesting generalization of this.
◮ Events are of different types
◮ The type of an event can depend on the time of
occurrence but it is independent of everything else.
◮ Suppose an event occurring at time t is Typ-i with
probability pi (t).
PK
◮ pi (t) ≥ 0, ∀i, t and
i=1 pi (t) = 1, ∀t
◮ Ni (t) is the number of Typ-i events till t
◮
Suppose number of radioactive particles emitted is
Poisson with rate λ.
◮ We are counting particles using a sensor
◮ Suppose (independent of everything) an emitted particle
is detected by our sensor with probability p
◮ Given that we detected K particles till t what is the
expected number of particles emitted?
◮ Let these processes be N (t), N1 (t), N2 (t)
◮
Theorem; Then, at any t, Ni (t), i = 1, · · · K are
independent Poisson random variables with
Z t
pi (s) ds
E[Ni (t)] = λ
E[N (t)|N1 (t) = K] = E[N1 (t) + N2 (t)|N1 (t) = K]
= K + E[N2 (t)] = K + λ(1 − p)t
where we have used independence of N1 and N2
0
PS Sastry, IISc, Bangalore, 2020 27/32
PS Sastry, IISc, Bangalore, 2020 28/32
Example: Tracking infections
◮
We use a simple model
◮ Individuals get infected as a Poisson process with rate λ
◮ Time between getting infected and showing symptoms is
a random variable with known distribution function G
An individual infected at s would show symptoms by t
with probability G(t − s)
◮ The incubation times of different infected individuals are
iid
◮ Define
◮
N (t) – total number infected till t
◮ N (t) – number showing symptoms by t
1
◮ N (t) – infected by t but not showing symptoms
2
◮
PS Sastry, IISc, Bangalore, 2020 29/32
Define two types of events. We take t as current time
and treat it as fixed
An event occurring at s is Typ-1 with probability
G(t − s)
◮ It is Typ-2 with probability 1 − G(t − s)
◮
Then, Typ-1 individuals are those showing symptoms by t
◮ From our theorem,
Z t
Z t
G(y) dy
G(t − s) ds = λ
E[N1 (t)] = λ
◮
0
E[N2 (t)] = λ
Z t
0
(1 − G(t − s)) ds = λ
0
Z t
(1 − G(y)) dy
0
PS Sastry, IISc, Bangalore, 2020 30/32
The Poisson process we considered is called homogeneous
because the rate is constant.
◮ For a non-homogeneous Poisson process the rate can be
changing with time.
◮ But we can still use a definition similar to definition 2
◮
Suppose we have n1 people showing symptoms at t
◮ We can approximate
Z t
G(y) dy
n1 ≈ E[N1 (t)] = λ
◮
0
◮
Hence we can estimate
P r[N (t + h) − N (t) = 1] = λ(t)h + o(h)
We still stipulate independent increments though we
cannot have stationary increments now
◮ One can show that N (t + s) − N (t) is Poisson with
Rτ
parameter m(t + s) − m(t) where m(τ ) = 0 λ(s) ds
◮ Suppose Yi are iid and ind of N (t). Then
◮
λ̂ = R t
0
◮
n1
G(y) dy
Using this we can approximate
Z t
E[N2 (t)] ≈ λ̂ (1 − G(y)) dy
X(t) =
0
N (t)
X
Yi
i=1
is called a compound Poisson process
PS Sastry, IISc, Bangalore, 2020 31/32
PS Sastry, IISc, Bangalore, 2020 32/32
Random Walk
Let Zi be iid with P r[Zi = +s] = P r[Zi = −s] = 0.5
◮ Define a continuous-time process X(t) by
◮
X(nT ) = Z1 + Z2 + · · · + Zn
X(t) = X(nT ), for nT ≤ t < (n + 1)T
Viewed as a discrete-time process, X(nT ), is a Markov
chain.
◮ Called a (one dimensional) random walk
◮ It is the position after n random steps
◮ We defined X(t) by piece-wise constant interpolation of
X(nT )
◮ We could have also use piece-wise linear interpolation
◮
PS Sastry, IISc, Bangalore, 2020 1/31
PS Sastry, IISc, Bangalore, 2020 2/31
We have EZi = 0 and E[Zi2 ] = s2
◮ Hence, E[X(nT )] = 0 and E[X 2 (nT )] = ns2
◮
◮
Consider t = nT
E[X 2 (t)] = ns2 = s2
)
√
would be Gaussian
For large n, X(nT
s n
where Φ is distribution function of standard Normal
◮ For any t, X(t) is X(nT ) for n = [t/T ].
Large n would mean large t. Hence
X(t)
m
ms
P r[X(t) ≤ ms] = P r √ ≤ √ ≈ Φ √
, for large t
n
s n
s n
If we let T → 0 then the variance goes to infinity (the
process goes to infinity) unless we let s also to go to zero.
◮ We actuall need s2 to go to zero at the same rate as T .
◮ So, we keep s2 = αT and let T go to zero.
◮ Define
W (t) =
lim
X(t)
2
We are interested in limit of this process as T → 0
T →0,s =αT
This is called the Wiener Process or Brownian motion.
This result is known as Donsker’s theorem
◮ Let us intuitively see some properties of W (t)
PS Sastry, IISc, Bangalore, 2020 3/31
◮
PS Sastry, IISc, Bangalore, 2020 4/31
We have seen that for n = [t/T ],
P r[X(t) ≤ ms] ≈ Φ
◮
t
T
◮
X(nT )
√ ≤ y ≈ Φ(y)
Pr
s n
◮
◮
m
√
n
◮
We had Zi iid and defined
X(nT ) = Z1 + Z2 + · · · + Zn
Let w = ms and t = nT . Then
m
w/s
w
√ =p
=√
n
t
t/T
r
w
T
=√
2
s
αt
W (t) is limit of X(t) as T goes to zero
◮ As T goes to zero, any t is ‘large n’.
◮ Hence we can expect
w
P r[W (t) ≤ w] = Φ √
αt
◮
⇒
◮
Hence we get
X((m + n)T ) − X(nT ) = Zn+1 + · · · + Zn+m
Thus, X(nT ) is independent of X((m + n)T ) − X(nT ).
◮ Hence the X(nT ) process has independent increments
◮ Hence, we can expect W (t) to be a process with
independent increments
W (t) ∼ N (0, αt)
PS Sastry, IISc, Bangalore, 2020 5/31
PS Sastry, IISc, Bangalore, 2020 6/31
X((m + n + k)T ) − X((n + k)T ) and
X((m + n)T ) − X(nT )
both are sums of m of the Zi ’s
◮ Hence both would have the same distribution
◮ Thus X(nT ) would also have stationary increments.
◮ Hence we also expect W (t) to have stationary increments
◮ Thus, W (t) should be a process with stationary and
independent increments and for each t, W (t) is Gaussian
with zero mean and variance proportional to t
◮ We will now formally define Brownian motion using these
properties.
◮
◮
Let {X(t), t ≥ 0} be a continuous-state continuous-time
process
This process is called a Brownian motion if
1. X(0) = 0
2. The process has stationary and independent increments
3. For every t > 0, X(t) is Gaussian with mean 0 and
variance σ 2 t
. Then, variance of B(t) is t
Let B(t) = X(t)
σ
◮ {B(t), t ≥ 0} is called standard Brownian Motion
◮ Let Y (t) = X(t) + µ. Then Y (t) has non-zero mean
◮ The mean can be a function of time
◮ {Y (t), t ≥ 0} is called Brownian motion with a drift
◮
PS Sastry, IISc, Bangalore, 2020 7/31
PS Sastry, IISc, Bangalore, 2020 8/31
◮
Let {X(t), t ≥ 0} be a Brownian motion
◮ The process has stationary increments.
◮ Hence for t2 > t1 , X(t2 ) − X(t1 ) has the same
distribution as X(t2 − t1 )
◮ Thus, X(t2 ) − X(t1 ) is Gaussian with zero mean and
variance σ 2 (t2 − t1 )
◮ Since increments are also independent, we can show that
all nth order distributions are Gaussian
We can calculate the autocorrelation function
RX (t1 , t2 ) = E[X(t1 )X(t2 )]
= E[X(t1 ) (X(t2 ) − X(t1 ) + X(t1 ))], (take t1 < t2 )
= E[X(t1 )(X(t2 ) − X(t1 ))] + E[X 2 (t1 )]
= E[X(t1 )] E[X(t2 ) − X(t1 )] + E[X 2 (t1 )]
= E[X 2 (t1 )]
= σ 2 t1
◮
◮
Since E[X(t)] = 0, ∀t, we have
Cov(X(t1 ), X(t2 )) = E[X(t1 )X(t2 )] = σ 2 min(t1 , t2 )
PS Sastry, IISc, Bangalore, 2020 9/31
PS Sastry, IISc, Bangalore, 2020 10/31
Suppose we want the joint distribution of
X(t1 ), X(t2 ), · · · , X(tn )
◮ Let t1 < t2 < · · · < tn
◮ Define random variables Y1 , · · · , Yn by
Y1 = X(t1 ), Yi = X(ti ) − X(ti−1 ), i = 2, · · · , n
◮
◮
X(t1 ) = Y1
X(t2 ) = Y1 + Y2
X(t3 ) = Y1 + Y2 + Y3
..
.
Y1 = X(t1 ), Y2 = X(t2 )−X(t1 ), Y3 = X(t3 )−X(t2 ), · · ·
We know Yi are independent because the process has
independent increments
◮ This transformation is invertible
◮ Hence we can get joint density of X(t1 ), · · · X(tn ) in
terms of joint density of Y1 , · · · , Yn
◮ This is how we can get nth order density for any
continuous-state process with independent increments
The transformation is invertible
◮
X(tn ) = Y1 + Y2 + · · · + Yn
Y1 , · · · Yn are independent and Gaussian and hence are
Jointly Gaussian
◮ Hence X(t1 ), · · · , X(tn ) are jointly Gaussian
◮ Thus all nth order distributions are Gaussian
◮
PS Sastry, IISc, Bangalore, 2020 11/31
PS Sastry, IISc, Bangalore, 2020 12/31
◮
X(t1 ), X(t2 ), · · · , X(tn ) are jointly Gaussian.
◮ We can write their joint density because we know the
means, variances and covariances
◮ We can also write the density using the transformation
considered earlier
Let t1 < t2 < · · · < tn
fX(s)X(t) (x, b)
(s < t)
fX(t) (b)
fX(s) (x) fX(t)−X(s) (b − x)
=
fX(t) (b)
◮
fX(s)|X(t) (x|b) =
x2
Note that Yi = X(ti ) − X(ti−1 ) is Gaussian with mean
zero and variance σ 2 (ti − ti−1 ), i = 1, · · · , n
(Take t0 = 0)
◮
PS Sastry, IISc, Bangalore, 2020 13/31
(b−x)2
∝ e− 2s e− 2(t−s) (taking σ 2 = 1)
1
bx
1
+
+
∝ exp −x2
2s 2(t − s)
t−s
t
sb
∝ exp −
x2 − 2 x
2s(t − s)
t
2
(x − bs/t)
∝ exp −
2s(t − s)/t
fX (x1 , · · · , xn ; t1 , · · · , tn ) = fY1 (x1 )fY2 (x2 − x1 ) · · · fYn (xn − xn−1 )
◮
Since all joint densities are Gaussian and are easy to
write, we can also calculate conditional densities
Hence the conditional density is Gaussian with mean bs/t
and variance s(t − s)/t
PS Sastry, IISc, Bangalore, 2020 14/31
Hitting Times
◮
An important result is that Brownian motion paths are
continuous
◮ Brownian motion is the limit of random walk where both
s and T tend to zero
◮ Intuitively the paths should be continuous.
◮ The paths are continuous but non-differentiable
everywhere
◮ This is a deep result
◮
Let Ta denote the first time Brownian motion hits a. We
take a > 0.
P r[X(t) ≥ a] = P r[X(t) ≥ a | Ta ≤ t] P r[Ta ≤ t] +
P r[X(t) ≥ a | Ta > t] P r[Ta > t]
Since Brownian motion paths are continuous,
P r[X(t) ≥ a | Ta > t] = 0
◮ Brownian motion is a limit of symmetric random walk.
Hence if we had already hit a sometime back, then now
we are as likely to be above a as below it.
1
⇒ P r[X(t) ≥ a | Ta ≤ t] =
2
Thus
P [X(t) ≥ a] = 0.5P r[Ta ≤ t]
◮
PS Sastry, IISc, Bangalore, 2020 15/31
◮
Hence we get
PS Sastry, IISc, Bangalore, 2020 16/31
Geometric Brownian Motion
P r[Ta ≤ t] = 2 P r[X(t) ≥ a]
Z ∞
x2
2
e− 2t dx
= √
2πtZ a
∞
2
2
− y2
= √
e
dy
2π a/√t
Here we have assumed a > 0. For a < 0 the situation is
similar. Hence the above is true √
even for a < 0 except
that the lower limit becimes |a|/ t
◮ Another interesting consequence is the following
◮
P r[ max X(s) ≥ a] = P r[Ta ≤ t], by continuity of paths
0≤s≤t
= 2P r[X(t) ≥ a]
PS Sastry, IISc, Bangalore, 2020 17/31
◮
Let {Y (t), t ≥ 0} is a Brownian motion with drift. Define
X(t) = eY (t)
Then, {X(t), t ≥ 0} is called geometric Brownian
motion. It is useful in mathematial finance
◮ Let X0 , X1 , · · · be time series of prices of a stock.
◮ Let Yn = Xn /Xn−1 and assume Yi are iid
◮
Xn = Yn Xn−1 = Yn Yn−1 Xn−2 = · · · = Yn Yn−1 · · · Y1 X0
⇒ ln(Xn ) =
◮
n
X
ln(Yi ) + ln(X0 )
i=1
Since ln(Yi ) are iid, with suitable normalization, the
interpolated process ln(X(t)) would be Brownian motion
and X(t) would be geometric Brownian motion
PS Sastry, IISc, Bangalore, 2020 18/31
Gaussian Processes
A continuous-time continuous-state process
{X(t), t ≥ 0} is said to be a Gaussian process if for all n
and all t1 , t2 , · · · , tn , we have that X(t1 ), · · · , X(tn ) are
jointly Gaussian.
◮ The Brownian motion is an example of a Gaussian Process
◮ The Brwonian motion is a Gaussian process with
◮
E[X(t)] = 0,
Var(X(t)) = σ 2 t,
Consider the statistics of the Brownian motion process for
0 < t < 1 under the condition that X(1) = 0
◮ Consider standard Brownian motion. (σ 2 = 1)
◮
E[X(t)|X(1) = 0] =
Cov(X(s), X(t)) = σ 2 min(s, t)
t
0=0
1
Recall that, for s < t, conditional density of X(s)
conditioned on X(t) = b is gaussian with mean bs/t and
variance s(t − s)/t
Recall that the multivariate Gaussian density is specified
by the marginal means, variances and the covariances of
the random variables
◮ Hence, a general Gaussian process is specified by the
mean function and the variance and covariance functions
◮
PS Sastry, IISc, Bangalore, 2020 20/31
PS Sastry, IISc, Bangalore, 2020 19/31
Consider a process {Z(t), 0 ≤ t ≤ 1}.
◮ It is called Brownian Bridge process if it is a Gaussian
process with mean zero and covariance function
Cov(Z(s), Z(t)) = s(1 − t) when s ≤ t.
◮ Let X(t) be a standard Brownian motion process.
◮ Then, Z(t) = X(t) − tX(1), 0 ≤ t ≤ 1 is a Brownian
Bridge
◮ Easy to see it is a Gaussian process with mean zero.
For s < t
◮
Now, for s < t < 1, since E[X(s)|X(1) = 0] = 0, s < 1,
Cov(X(s), X(t)|X(1) = 0) , E[X(s)X(t) | X(1) = 0]
= E[ E[X(s)X(t) | X(t), X(1) = 0] | X(1) = 0]
= E[ X(t)E[X(s) | X(t)] | X(1) = 0]
s
= E[ X(t) X(t) | X(1) = 0]
t
s
2
=
E[X (t) | X(1) = 0]
t
s
t(1 − t)
=
t
= s(1 − t)
Thus, for 0 < t < 1, conditioned on X(1) = 0, this process
has mean 0 and covariance function s(1 − t), s < t
PS Sastry, IISc, Bangalore, 2020 21/31
Cov(Z(s), Z(t)) = Cov(X(s) − sX(1), X(t) − tX(1))
= Cov(X(s), X(t)) − tCov(X(s), X(1)) −
sCov(X(1), X(t)) + stCov(X(1), X(1))
= s − st − st + st = s(1 − t)
PS Sastry, IISc, Bangalore, 2020 22/31
White Noise
◮
Assume V (t) is Gaussian. Let
Z t
V (τ ) dτ
X(t) =
0
◮
◮
Consider a process {V (t), t ≥ 0} with
E[V (t)] = 0;
Var(V (t)) = σ 2 Cov(V (t), V (s)) = 0, s 6= t
Then we get E[X(t)] = 0 and
Z t
Z tZ t
2
σ 2 dt1 = σ 2 t
E[V (t1 )V (t2 )] dt1 dt2 =
E[X (t)] =
0
This is a kind of generalization of sequence of iid random
variables to continuous time
◮ It is an example of what is called White Noise.
0
0
◮
E[X(t1 )(X(t2 )−X(t1 )] =
Z t1 Z t2
0
E[V (t)V (t′ )] dt dt′ = 0
t1
We see that X(t) is a process with mean zero, variance
proportional to t and having uncorrelated increments.
◮ One can show that it would be a Brownian motion
◮ The actual concept involved is rather deep
◮
PS Sastry, IISc, Bangalore, 2020 23/31
PS Sastry, IISc, Bangalore, 2020 24/31
Let {Xn , n = 0, 1, · · · } be a discrete-time
continuous-state process.
◮ It is called a martingale if E|Xn | < ∞, ∀n and
◮
We have considered three random processes
◮ Markov Chain
– Example of Discrete-time discrete-state process
◮ Poisson Process
– Example of continuous-time discrete-state process
◮ Brownian Motion
– Example of continuous-time continuous-state process
◮ We need an example of discrete-time continuous-state
process!
◮ Any sequence of continuous random variables would be a
discrete-time continuous-state process
◮
E[Xn+1 | Xn , · · · , X0 ] = Xn , ∀n
◮
Suppose Zi are iid with
P r[Zi = +1] = P r[Zi = −1] = 0.5. Let
n
X
Zi ⇒ Xn+1 = Xn + Zn+1
Xn =
i=1
◮
Since EZi = 0, ∀i,
E[Xn+1 | Xn , · · · , X0 ] = E[Xn +Zn+1 |Xn ] = Xn +E[Zn+1 |Xn ] = Xn
◮
◮
Hence, Xn is a martingale.
When Xn is a martingale, we have
E[Xn+1 ] = E[Xn ], ∀n
PS Sastry, IISc, Bangalore, 2020 25/31
PS Sastry, IISc, Bangalore, 2020 26/31
{Xn , n = 0, 1, · · · } and E|Xn | < ∞, ∀n
◮ It is called a martingale if
◮
E[Xn+1 | Xn , · · · , X0 ] = Xn , ∀n
◮
◮
It is called a supermartingale if
martingale convergence theorem: If Xn is a
martingale with supn E|Xn | < ∞ then Xn converges
almost surely to a rv X which will have finite expectation.
A positive supermartingale also converges almost surely
E[Xn+1 | Xn , · · · , X0 ] ≤ Xn , ∀n
◮
Martingales are useful because of the martingale
convergence theorem.
It is called a submartingale if
E[Xn+1 | Xn , · · · , X0 ] ≥ Xn , ∀n
Please note that these are ‘simplified’ definitions In the
above, the conditioning random variables can be another
sequence Yi if Y1 , · · · , Yn determine X1 , · · · , Xn
PS Sastry, IISc, Bangalore, 2020 27/31
Consider the 2-armed bandit problem in problem sheet 3.7
◮ The algorithm is
PS Sastry, IISc, Bangalore, 2020 28/31
◮
◮
E[p(k + 1) − p(k)|p(k)] = λ(1 − p(k)) d1 p(k)
−λp(k) d2 (1 − p(k)
= λ p(k)(1 − p(k)) (d1 − d2 )
≥ 0, if d1 > d2
p(k + 1) = p(k) + λ(1 − p(k)) if arm 1 chosen, b(k) = 1
= p(k) − λp(k) if arm 2 is chosen and b(k) = 1
= p(k) if b(k) = 0
◮
We get
E[p(k + 1) − p(k)|p(k)]
= λ(1 − p(k)) P r[b(k) = 1, arm 1 | p(k)]
−λp(k) P r[b(k) = 1, arm 2 | p(k)]
= λ(1 − p(k)) P r[b(k) = 1 | arm 1, p(k)] P r[arm 1 | p(k)]
−λp(k) P r[b(k) = 1 | arm 2, p(k)] P r[arm 2 | p(k)]
PS Sastry, IISc, Bangalore, 2020 29/31
This gives us
⇒ E[p(k+1) | p(k)] ≥ p(k) ⇒ E[p(k+1)] ≥ E[p(k)], ∀k
This also shows p(k) is a submartingale.
◮ Here, p(k) is bounded and 1 − p(k) is a supermartingale.
◮ So, we can conclude, the algorithm converges almost
surely
◮
PS Sastry, IISc, Bangalore, 2020 30/31
Continuous-Time Markov Chains
Let {X(t), t ≥ 0} be a continuous-time discrete-state
process
◮ Let X(t) take non-negative integer values
◮ It is called a continuous-time markov chain if
◮
We have mentioned martingales as an example of
discrete-time continuous processes
◮ A stochastic iterative algorithm essentially generates a
discrete-time continuous-state processes.
◮ Martingales are very useful in analyzing convergence of
many stochastic algorithms
◮ While we mentioned only discrete-time martingales, one
can similarly have continuous-time martingales
◮
P r[X(t + s) = j | X(s) = i, X(u) ∈ Au , 0 ≤ u < s]
= P r[X(t + s) = j | X(s) = i]
Only most recent past matters
◮ It is called homogeneous chain if
◮
P r[X(t+s) = j | X(s) = i] = P r[X(t) = j | X(0) = i], ∀s
PS Sastry, IISc, Bangalore, 2020 31/31
PS Sastry, IISc, Bangalore, 2020 1/31
◮
◮
Define
P r [X(s) = i, s ∈ [t, t + τ ] | X(s′ ) = i, 0 ≤ s′ ≤ t]
= P r[X(s) = i, s ∈ [t, t + τ ] | X(t) = i]
= P r[X(s) = i, s ∈ [0, τ ] | X(0) = i]
Pij (t) = P r[X(t) = j | X(0) = i] = P r[X(t+s) = j | X(s) = i]
It is the probability of going from i to j in time t
◮ Analogous to transition probabilities in the discrete case
◮ Like in the discrete case, we can show that the Markov
condition implies
′
′
P r[X(s) ∈ Bs , s ∈ (t, t + τ ] | X(t) = i, X(s ), 0 ≤ s < t]
= P r[X(s) ∈ Bs , s ∈ (t, t + τ ] | X(t) = i]
◮
Next we consider distribution of time spent in a state
before leaving it
By the Markov property and homogeneity we have
◮
Let X(0) = i and let Ti be time spent in i before leaving
it for the first time
P r[X(s) = i, s ∈ [t, t + τ ] | X(s′ ) = i, 0 ≤ s′ ≤ t]
= P r[Ti > t + τ | Ti > t]
P r[X(s) = i, s ∈ [0, τ ] | X(0) = i] = P r[Ti > τ ]
⇒ P r[Ti > t + τ | Ti > t] = P r[Ti > τ ]
⇒ Ti is memoryless and hence exponential
PS Sastry, IISc, Bangalore, 2020 2/31
PS Sastry, IISc, Bangalore, 2020 3/31
Example: Birth-Death process
Once you transit into a state, the time spent in it is
exponentially distributed.
◮ So, the chain can be viewed as follows
◮ Once you transit to a state, it spends time, say,
Ti ∼ exponential(νi ) in it.
◮ Then, when it leaves i, it transits to state j with
probability, say, zij
P
◮ We would have zij ≥ 0,
j zij = 1. Also, zii = 0
◮ Note that Pij (t) is different from these zij
◮
This is generalization of birth-death chains we saw earlier
to continuous time
◮ From i the process can only go to i + 1 or i − 1
◮ A birth event takes it to i + 1 and a death event takes it
to i − 1
◮ An example would be: X(t) is number of people in a
queuing system.
◮ A birth event would be a new person joining the queue.
◮ A death event would be a person leaving after finishing
service
◮
PS Sastry, IISc, Bangalore, 2020 5/31
PS Sastry, IISc, Bangalore, 2020 4/31
Suppose, in state n, time till next arrival or birth event is
exponential(λn ).
◮ Let time till next departure or death event be
exponential(µn )
We assume that these two are independent
◮ Now, these λn and µn completely determine νn and zij
and hence completely specify the chain
◮ zi,i+1 is the probability that when the system changes
state it goes to i + 1
◮ Hence it is the probability that a birth event occurs before
a death event.
◮ Let W1 ∼ exponential(λi ) and W2 ∼ exponential(µi ) be
independent. Then
◮
zi,i+1 = P r[W1 < W2 ] =
λi
;
λi + µi
⇒ zi,i−1 =
The time spent in state i, Ti , is exponential(νi )
◮ The chain would be in state i till either a birth event or a
death event occurs
◮ Hence, Ti = min(W1 , W2 )
◮ Hence, Ti ∼ exponential(λi + µi ).
◮ Thus, νi = λi + µi
◮ We have taken state space to be non-negative integers.
◮ Hence, µ0 = 0 and ν0 = λ0 and z01 = 1
◮
µi
λi + µi
PS Sastry, IISc, Bangalore, 2020 6/31
PS Sastry, IISc, Bangalore, 2020 7/31
Consider a queuing system
◮ Suppose people joining the queue is a Poisson process
with rate λ
◮ Suppose the time to service each customer is independent
and exponential with parmeter µ.
◮ We assume that the arrival and service processes are
independent.
◮ Then this is a birth death process with
◮
Suppose λn = λ, ∀n and µn = 0, ∀n
◮ It is called pure birth process
◮ The process spend time Ti ∼ exponential(λ) in state i
and then moves to state i + 1
◮ This is the Poisson process
◮
λn = λ, n ≥ 0
and
µn = µ, n ≥ 1
This is known as an M/M/1 queue
◮ A variation: M/M/K queue
nµ 1 ≤ n ≤ K
λn = λ, n ≥ 0 and µn =
Kµ n > K
◮
PS Sastry, IISc, Bangalore, 2020 9/31
PS Sastry, IISc, Bangalore, 2020 8/31
Consider an example of some calculations with continuous
Markov chains
◮ Consider a Birth-Death process. Let Yi be the time that a
chain currently in i takes to reach state i + 1 for the first
time.
◮ We want to calculate E[Yi ]. (Note that E[Y0 ] = 1/λ0 )
◮ The chain may directly go to i + 1 or it may go to i − 1
and then to i and then to i + 1 or ...
◮ Define
1 if first transition out of i is to i + 1
Ii =
0 if first transition out of i is to i − 1
◮
◮
We can find E[Yi ] by conditioning on Ii .
PS Sastry, IISc, Bangalore, 2020 10/31
Time spent in i is exponential with rate λi + µi .
◮ Hence, expected time till transition out of i is 1/(λi + µi )
◮ If this transition is to i + 1 then that is the expected time
to reach i + 1
◮
E [Yi | Ii = 1] =
1
λi + µ i
Suppose this transition is to i − 1.
◮ Then the expected time to reach i + 1 is this time plus
expected time to reach i from i − 1 plus expected time to
reach i + 1 from i
◮
E [Yi | Ii = 0] =
1
+ E [Yi−1 ] + E[Yi ]
λi + µi
PS Sastry, IISc, Bangalore, 2020 11/31
◮
We also have
λi
P r[Ii = 1] = zi,i+1 =
;
λi + µ i
◮
µi
P r[Ii = 0] =
λi + µi
Now we can calculate E[Yi ] as
◮
Thus we get
E [Yi ] =
µi
1
+ E[Yi−1 ], i ≥ 1
λi λi
Since E[Y0 ] = 1/λ0 , we have a formula for E[Yi ]
◮ For example,
1
µ1
1
µ2 1
µ1
E[Y1 ] =
+
; E[Y2 ] =
+
+
λ1 λ1 λ0
λ2 λ2 λ1 λ1 λ0
◮
E[Yi ] = P r[Ii = 1] E [Yi | Ii = 1] + P r[Ii = 0] E [Yi | Ii = 0]
1
λi
1
µi
=
+
+ E [Yi−1 ] + E[Yi ]
λi + µi λi + µi λi + µ i λi + µ i
1
µi
=
+
(E [Yi−1 ] + E[Yi ])
λi + µi
λi + µi
1
µi
+
(E[Yi−1 ])
λi + µi
λi + µi
µi
1
+ E[Yi−1 ]
E[Yi ] =
λi λi
µi
E[Yi ] 1 −
λi + µ i
◮
Expected time to go from i to j, i < j can now be
computed as
=
E[Yi ] + E[Yi+1 ] + · · · + E[Yj−1 ]
◮
Note that these are only for birth-death processes
PS Sastry, IISc, Bangalore, 2020 13/31
PS Sastry, IISc, Bangalore, 2020 12/31
◮
Consider the transition probabilities, Pij (t)
◮ These satisfy Chapmann-Kolmogorov equation
◮
Pij (t + s) = P r[X(t + s) = j | X(0) = i]
X
=
P r[X(t + s) = j | X(s) = k, X(0) = i]P r[X(s) = k | X(0) = i]
Chapmann-Kolmogorov equation gives
X
Pij (t + s) =
Pik (s) Pkj (t)
k
◮
Hence we get
Pij (t + h) − Pij (t) =
k
=
X
P r[X(t + s) = j | X(s) = k]P r[X(s) = k | X(0) = i]
=
P r[X(t) = j | X(0) = k]P r[X(s) = k | X(0) = i]
X
Pik (h) Pkj (t) − (1 − Pii (h))Pij (t)
◮
Define
Pik (h)
1 − Pii (h)
, i 6= k, and qii = lim
h→0
h→0
h
h
◮ Then, assuming limit and sum can be interchanged,
Pij (t + h) − Pij (t) X
lim
=
qik Pkj (t) − qii Pij (t)
h→0
h
k6=i
qik = lim
Pkj (t) Pik (s)
k
◮
X
k6=i
X
k
=
Pik (h) Pkj (t) − Pij (t)
k
k
=
X
For finite chain, P is a matrix and
P (t + s) = P (t) P (s)
PS Sastry, IISc, Bangalore, 2020 14/31
PS Sastry, IISc, Bangalore, 2020 15/31
By definition, 1 − Pii (h) is the probability that the chain
that started in i is not in i at h.
◮ This is equivalent to there being a transition in the time
h and transitions out of i occur at the rate of νi .
Also, two or more transitions in h is o(h)
◮ Hence
1 − Pii (h) = νi h + o(h)
◮
Thus qii = νi . It is rate of transition out of i
◮ We also have
P
X
1 − Pii (h)
j6=i Pij (h)
qij
= lim
=
νi = qii = lim
h→0
h→0
h
h
j6=i
◮
By definition, Pij (h) = qij h + o(h), i 6= j
◮ Hence qij is the rate at which transitions out of i into j
are occurring.
◮ Transitions out of i occur with rate νi and zij fraction of
these are into j
◮ Hence, qij = νi zij , i 6= j
◮ Thus, we got
X
X
qij
qij
, qii =
qij , zij = P
νi =
q
ij
j6
=
i
j6=i
j6=i
◮
The {qij } are called the infinitesimal generator of the
process.
◮ A continuous time Markov Chain is specified by these qij
◮
PS Sastry, IISc, Bangalore, 2020 16/31
PS Sastry, IISc, Bangalore, 2020 17/31
◮
Consider a Birth-Death process.
◮ We got earlier
◮
ν i = λi + µi ,
◮
zi,i+1 =
λi
,
λi + µ i
zi,i−1 =
µi
λi + µi
Now we can calculate qij
qi,i+1 = (λi +µi )
λi
= λi ,
λi + µi
qi,i−1 = (λi +µi )
µi
= µi
λi + µi
This is intuitively obvious
◮ We specify a birth-death chain by
birth rate (rate of transition from i to i + 1), λi and
death rate (rate of transition from i to i − 1), µi .
◮
PS Sastry, IISc, Bangalore, 2020 18/31
The Chapmann-Kolmogorov equations give us
X
Pij (t + h) − Pij (t) =
Pik (h) Pkj (t) − (1 − Pii (h))Pij (t)
k6=i
◮
Using this we derived
X
Pij′ (t) =
qik Pkj (t) − qii Pij (t)
k6=i
Called Kolmogorov Backward equation
◮ We can solve these ODEs to get Pij (t)
◮ For a birth-death chain the equation becomes
Pij′ (t) = λi Pi+1,j (t) + µi Pi−1,j (t) − (λi + µi )Pij (t)
PS Sastry, IISc, Bangalore, 2020 19/31
Poisson process as a special case
Consider a two-state Birth-Death chain.
◮ We would have µ0 = λ1 = 0. Let λ0 = λ and µ1 = µ
◮ The two states can be a machine working or failed.
◮ λ is rate of failure. Time till next failure is exponential(λ)
◮ µ is rate of repair. Time for repair is exponential(µ)
◮ We may want to calculate P00 (T ), the probability that
the machine would be working at a time T units later
given it is in working condition now
◮ We can calculate it by solving the ODE’s
◮
Consider the case: λi = λ and µi = 0. ∀i.
◮ This would be a Poisson process with rate λ.
◮ Taking i = 0, the differential equation becomes
◮
′
(t) = λP1j (t) − λP0j (t)
P0j
P0j (t) is the probability of j events in an interval of
length t which is same as what we had called Pj (t).
◮ Similarly, P1j (t) is same as what we called Pj−1 (t) there
◮ Now one can see that the above ODE is what we got for
Poisson process.
◮
PS Sastry, IISc, Bangalore, 2020 20/31
PS Sastry, IISc, Bangalore, 2020 21/31
Consider a finite chain
◮ Then the transition probabilities can be represented as a
matrix
◮ The Chapmann-Kolmogorov equation gives
◮
Pij′ (t) = λi Pi+1,j (t) + µi Pi−1,j (t) − (λi + µi )Pij (t)
◮
For the two state chain, these equations are
′
(t)
P00
′
P01 (t)
′
P10
(t)
′
P11 (t)
=
=
=
=
λ0 P10 (t) − λ0 P00 (t)
λ0 P11 (t) − λ0 P01 (t)
µ1 P00 (t) − µ1 P10 (t)
µ1 P01 (t) − µ1 P11 (t)
P (t + s) = P (t) P (s)
◮
Differentiating the above with respect to t
P ′ (t + s) = P ′ (t)P (s)
◮
Putting t = 0 in the above we get
P ′ (s) = P ′ (0) P (s) = Q̄ P (s), where Q̄ = P ′ (0)
As is easy to see, we get a system of equations like this
for any finite chain.
◮ Solving these we can show
◮
µ
λ −(λ+µ)t
e
+
P00 (t) =
λ+µ
λ+µ
PS Sastry, IISc, Bangalore, 2020 22/31
◮
The solution for this is
P (t) = etQ̄ ,
◮
because P (0) = I
This is the expression for calculating Pij (t) for any t and
i, j
PS Sastry, IISc, Bangalore, 2020 23/31
◮
Let us examine the matrix Q̄ = [q̄ij ]
P (h) − I
P (h) − P (0)
= lim
h↓0
h↓0
h
h
◮
Q̄ = P ′ (0) = lim
The Kolmogorov backward equation is
X
qik Pkj (t) − qii Pij (t)
Pij′ (t) =
k6=i
◮
This gives us
◮
for k 6= j, q̄kj
q̄jj
Pkj (h) − 0
= qkj
= lim
h↓0
h
Pjj (h) − 1
= −qjj = −νj
= lim
h↓0
h
Thus this Q̄ matrix has qik as off-diagonal entries and
−qjj as diagonal entries
◮ So, each row here sums to zero
◮ We normally write it as Q and call it the infinitesimal
generator of the process
◮
The above can be written in a matrix form
P ′ (t) = QP (t)
The off-diagonal entries of Q are qik and diagonal entries
are −qii
◮ From the above equation, P ′ (0) = Q
◮ So, what we did is to write the backward equation in
matrix form
◮
PS Sastry, IISc, Bangalore, 2020 25/31
PS Sastry, IISc, Bangalore, 2020 24/31
◮
For the backward equation, we started with
X
Pij (t + h) =
Pik (h) Pkj (t)
k
◮
The Chapmann-Kolmogorov equation also gives us
X
Pik (t) Pkj (h)
Pij (t + h) =
k
◮
Similar algebra as earlier gives us
X
Pij′ (t) =
Pik (t) qkj − qjj Pij (t)
We can define transient and recurrent states as in the
discrete case.
◮ However, we need to be careful about defining hitting
times or first passage times
◮ We define
◮
Ti = min{t > 0 : X(t) 6= i}
fi = min{t : t > Ti , X(t) = i}
k6=j
(under some assumptions about interchanging limit and
summation)
◮ This is known as Kolmogorov forward equation
◮ For finite chains, both forward and backward equations
are same
◮ For infinite chains there are some differences
PS Sastry, IISc, Bangalore, 2020 26/31
For a chain started in i we take fi as first return time to i
◮ A state i is said to be
◮
Transient if P r[fi < ∞ | X(0) = i] < 1
◮ Recurrent if P r[f < ∞ | X(0) = i] = 1
i
◮
PS Sastry, IISc, Bangalore, 2020 27/31
Most of the other definitions are also similar to the case
of discrete chains
◮ The chain is said to be irreducible if for all i, j there is a
positive probability of going from i to j in some finite
time: Pij (t) > 0 for some t
◮ A recurrent state is positive recurrent if mean time to
return is finite: E[fi | X(0) = i] < ∞
Otherwise it is null recurrent
◮ An irreducible positive recurrent chain would have a
unique stationary distribution
◮ There is no concept of periodicity in the continuous time
case
◮ An irreducible positive recurrent chain would be called an
ergodic chain
◮
◮
Define
πj (t) = P r[X(t) = j] =
X
i
This also analogous to the discrete case
◮ The above equation is true for general infinite chains.
◮ In the finite case, we can get a more compact expression
◮ For a finite chain, taking π as a row vector,
π(t) = π(0) P (t) = π(0) eQt
PS Sastry, IISc, Bangalore, 2020 28/31
◮
PS Sastry, IISc, Bangalore, 2020 29/31
We say π is a stationary distribution if
π(0) = π
⇒
π(t) = π, ∀t
◮
Hence, if we start the chain in the stationary distribution,
π ′ (t) = 0
◮ We get from the earlier equation
X
X
πi (0)Pij′ (t)
πj (t) =
πi (0)Pij (t) and hence πj′ (t) =
◮
i
i
◮
πi (0)Pij (t)
Using the forward equation for Pij′ (t)
X
i
πi (0)
X
qkj Pik (t) − qjj Pij (t)
⇒
qkj πk − πj
k6=j
X
k6=j
X
!
= 0
qjk = 0
What we showed is that any stationary distribution π has
to satisfy
X
X
qkj πk = πj
qjk
k6=j
k6=j
We can interpret this (as we did in discrete case)
◮ qkj is the rate of transition from k to j and πk is the
fraction present in k.
P
◮ Hence
k6=j qkj πk is the net flow into j
P
◮ πj
k6=j qjk is the net flow out of j
◮ At steady state the flows have to be balanced
◮ The above equation is known as a balance equation
◮
k6=j
when π is a stationary distribution and π(0) = π
PS Sastry, IISc, Bangalore, 2020 30/31
PS Sastry, IISc, Bangalore, 2020 31/31
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )