Discrete Distributions and Moments

Week 4

Lecture Notes

We will be covering discrete random variables this week.

A discrete random variable is one whose image 𝑋(Ξ©) is a finite/countable subset of ℝ.

First thing we introduce is the probability mass function (pmf).

It is basically the probability measure assigned to a single value: 𝑃𝑋({π‘₯})=𝑃(𝑋=π‘₯)

Because of the law of total probability, the probability of all outcomes must sum to 1:

βˆ‘π‘₯βˆˆπ‘‹(Ξ©)𝑃(𝑋=π‘₯)=1.

Next thing is the cumulative distribution function (cdf).

Usually use the capital F to denote this: 𝐹(𝑑)=𝑃(𝑋≀𝑑)=βˆ‘π‘₯βˆˆπ‘‹(Ξ©)∩π‘₯≀𝑑𝑃(𝑋=π‘₯)

A simple example for a discrete random variable is that if you roll a die, the outcome of the die will give you a discrete random variable. If I’m interested in 𝐹(3)=𝑃(𝑋≀3)=𝑃(𝑋=1)+𝑃(𝑋=2)+𝑃(𝑋=3)

Another example:

We denote 𝑋 as the number of times we roll the die until we get the outcome 6. If we’re lucky and roll the die once to get a 6, what’s the probability? For a fair die it’s 16. For the second roll, 𝑃(𝑋=2)=56Γ—16=536: the first roll is not 6 and the second roll is 6.

The outcome of the first roll does not affect the second roll.

More difficult one, 𝑃(𝑋=3)

𝑃(𝑋=3)=56Γ—56Γ—16

You can prove by induction that the formula is

𝑃(𝑋=𝑛)=(56)π‘›βˆ’1Γ—16,1≀𝑛

This is a simple example.

I want to say a property of the cdf:

If you have 𝑋:Ω→ℝ is a discrete r.v., the cdf 𝐹(𝑑) is piecewise constant and has finite/countable jumps.

If you think about cdf, it’s a probability that lies from 0 to 1.

The graph of discrete cdf is exclusive coming from the right side, so the hole is on the bottom of the jump, not the top. We accumulate in a discrete ways, which makes it like a staircase. Each piece corresponds to a constant value, and there are finite jumps.

For simplicity, we will denote the following notations:

𝑋(Ξ©)={π‘Ž1,π‘Ž2,π‘Ž3,…}

𝑝𝑖=𝑃(𝑋=π‘Žπ‘–),𝑖=1

Moments

Moments are expectations, expectations are kind of like intervals in calculus. Here we are talking about discrete random variables, so our integration is basically a summation. In the next class we are going to talk about continuous, where the integral is an integral. Integrals is approximated by the Riemann sum, and there are many techniques for evaluating them. But right now we are sticking to summations.

Let’s define the expectation, by definition 4.7.

If you have a discrete r.v. 𝑋, we say 𝑋 is integrable if

βˆ‘π‘₯βˆˆπ‘‹(Ξ©)|π‘₯|⋅𝑃(𝑋=π‘₯)<∞

If you map this to what you learned in calculus, this is absolute integrability. You know that if you are absolutely integrable, you are regular integrable. Why absolute value? This π‘₯ can take positive or negative values. If this holds, we can define expectation as

𝔼[𝑋]=βˆ‘π‘₯βˆˆπ‘‹(Ξ©)π‘₯𝑃(𝑋=π‘₯)

In order to help you understand this from a discrete random variable notation, you can put this in a table format.

𝑋={outcomeprobabilityπ‘Ž1𝑝1π‘Ž2𝑝2

This will be a handy tool when doing calculations.

This summation is purely rigorous.

We need the non-absolute value sum to be less, because the probability cannot be negative. I’m not just saying that the expectation is finite. I’m saying that the expectation is bounded by something finite. 𝑋<∞ is very different from 𝑋<π‘Œ<∞. The second one means that the value is bounded away from infinity, where π‘Œ is the ceiling. The first one means you can approach infinity. This is important for mathematical analysis.

Proposition 4.8 says a property of the expectation is that expectation is linear. If you learn functional analysis (calculus on functions), you understand that expectation is a linear operator. The statement is this: 𝕖[π‘Žπ‘‹+π‘π‘Œ]=π‘ŽπΈ[𝑋]+𝑏𝐸[π‘Œ] where π‘Ž and 𝑏 are constants in ℝ.

How do we prove this?

We want to first establish that 𝔼[π‘Žπ‘‹]=π‘Žπ”Ό[𝑋]

There are two cases. When π‘Ž=0, this is trivial because 𝑋 becomes 0. How do you prove for π‘Žβ‰ 0?

We will define 𝑍=π‘Žπ‘‹. From the definition of a discrete random variable, its image set must be a countable subset of ℝ. Therefore, 𝑍 is a discrete random variable. This implies that 𝑍(Ξ©) is countable. This is important because anything countable can be represented as a sum. πœ‹ is uncountable and cannot be represented by a summation.

𝔼[|𝑍|]=βˆ‘π‘₯βˆˆπ‘‹(Ξ©)|π‘Žπ‘₯|𝑃(𝑍=π‘Žπ‘₯)

by the simple definition of expectation.

=βˆ‘π‘₯βˆˆπ‘‹(Ξ©)|π‘Žπ‘₯|𝑃(π‘Žπ‘‹=π‘Žπ‘₯)

I’m going to factor out the π‘Ž, which we can do because we know π‘Žβ‰ 0

=|π‘Ž|βˆ‘π‘₯βˆˆπ‘‹(Ξ©)|π‘₯|⋅𝑃(𝑋=π‘₯)

Based on our definition 4.7, we can say that this is less than infinity.

Then we can formally write down 𝑍 without absolute value, since it’s bounded finitely.

𝔼[𝑍]=βˆ‘π‘₯βˆˆπ‘‹(Ξ©)π‘Žπ‘₯𝑃(𝑍=π‘Žπ‘₯)=π‘Žβˆ‘π‘₯βˆˆπ‘‹(Ξ©)π‘₯𝑃(𝑋=π‘₯)=π‘Žβ‹…π”Ό[𝑋]

This might seem silly, but we need to be rigorous in math when proving things.

Now we want to prove 𝔼[π‘Žπ‘‹+π‘π‘Œ]=𝔼[π‘Žπ‘‹]+𝔼[π‘Žπ‘Œ]

The proof is too long, has too much rigor, uses some techniques of interchanging the summation signs.

Second part of proposition is that if 𝑋β‰₯0, then 𝔼[𝑋]β‰₯0. If the random variable is greater than 0, then the expectation is greater than 0. The simple proof is that

𝔼[𝑋]=βˆ‘π‘₯βˆˆπ‘‹(Ξ©)π‘₯𝑃(𝑋=π‘₯)β‰₯0

If 𝑋>π‘Œ, then 𝔼[𝑋]β‰₯𝔼[π‘Œ], where we can show that the difference is positive

Theorem 4.9 the transfer formula says that for 𝑋 discrete r.v., where πœ‘:ℝ→ℝ is a measurable function, then πœ‘(𝑋) is a r.v. and is integrable iff

βˆ‘π‘₯βˆˆπ‘‹(Ξ©)|πœ‘(π‘₯)|𝑃(𝑋=π‘₯)<∞

In this case I can formally write down the expectation to be the sum

𝔼[πœ‘(𝑋)]=βˆ‘π‘₯βˆˆπ‘‹(Ξ©)πœ‘(π‘₯)𝑃(𝑋=π‘₯)

Examples

Here are some examples:

If we have a discrete r.v.

𝑋={10.220.330.5,𝔼[𝑋]=?

You multiply horizontally and add them all up.

Represented in the cases format,

𝔼[𝑋]=βˆ‘π‘–=1βˆžπ‘Žπ‘–π‘π‘–

For a measurable function πœ‘,

𝔼[πœ‘(𝑋)]=βˆ‘π‘–=1βˆžπœ‘(π‘Žπ‘–)𝑝𝑖

You only change the outcome, not the probability.

In this example,

𝔼[𝑋]=1Γ—0.2+2Γ—0.3+3Γ—0.5=2.3.

What if we take 𝔼[𝑋2]?

The square is a measurable function, so we can consider πœ‘(𝑋)=𝑋2

𝔼[πœ‘(𝑋)]=12Γ—0.2+22Γ—0.3+32Γ—0.5=5.9

We can go a little crazier and talk about πœ‘=sin𝑋

In all our examples, all of our functions are measurable. In terms of mathematical analysis, you might be interested in functions that are not measurable. But we don’t have to worry about that in our class.

Variance

The variance of a r.v. is defined to be

𝕍(𝑋)=𝔼[(π‘‹βˆ’π”Ό[𝑋])2]

There is an intuitive explanation for this definition. How do you measure the variability if numbers in a set? What you do is take the expected value of the numbers in the set.

Let’s say we have a sequence (π‘₯1,π‘₯2,…,π‘₯𝑛)

𝔼[𝑋]=π‘₯1β‹…1𝑛+π‘₯21𝑛+…+π‘₯𝑛1𝑛

We want to measure the distance from each data point to the middle point. The distance of each variable to that middle point is what we are counting. We square them because the difference might be positive or negative, so it makes them all 0.

What happens if we don’t square it?

𝔼[π‘‹βˆ’π”Ό[𝑋]]=𝔼[𝑋]βˆ’π”Ό[𝑋]=0

If you do some simple arithmetics, you can see the simple binomial expansion as

(π‘Ž+𝑏)2=π‘Ž2+2π‘Žπ‘+𝑏2

and if we apply this to our variance, we get

𝕍[𝑋]=𝔼[𝑋2βˆ’2𝑋𝔼[𝑋]+(𝔼[𝑋])2]

expected value of an expected value is the same thing because it’s just a constant

=𝔼[𝑋2]βˆ’2𝔼[𝑋]𝔼[𝑋]+(𝔼[𝑋])2

=𝔼[𝑋2]βˆ’(𝔼[𝑋])2β‰₯0

This is Jensen’s inequality, which shows the convexity of variance.

There are two operations, we take square, then expectation, and for the other, we take expectation first, then square. And this difference must be greater than or equal to 0.

Eventually, everything becomes calculus.

Definition 4.12 is of standard deviation, or std dev.

𝜎(𝑋)=𝕍(𝑋)=𝔼[𝑋2]βˆ’(𝔼[𝑋])2

This identity is very important:

𝔼[𝑋2]=𝕍(𝑋)+(𝔼[𝑋])2

This is very convenient for our calculations. Let’s think about calculating the variance for the cases format. Assuming this format, we can represent

𝕍[𝑋]=𝔼[𝑋2]βˆ’(𝔼[𝑋])2

=βˆ‘π‘–=1βˆžπ‘Žπ‘–2π‘π‘–βˆ’(βˆ‘π‘–=1βˆžπ‘Žπ‘–π‘π‘–)2

That’s it. This is the formula to use on homework. USEFUL

This has all been theoretical, abstract concepts. From now on we are going to talk about examples of discrete random variables.

We are going to go through several classes of random variables.

Discrete Uniform Distribution

The discrete uniform distribution has all the values being the same.

𝑋(Ξ©)={π‘₯1,π‘₯2,…,π‘₯𝑛} and pmf is given by

𝑝𝑖=𝑃(𝑋=π‘₯𝑖)=1𝑛,βˆ€π‘–βˆˆ{1,2,…,𝑛}

we denote this as

π‘‹βˆΌπ·π‘ˆ(𝑛) If you roll a fair die, the outcome of a die is a discrete uniform distribution. What is our cdf?

𝐹(𝑑)={0if 𝑑<1𝑖6if 𝑖≀𝑑≀𝑖+1,𝑖=1,2,3,4,51if 𝑑β‰₯6 Let’s look at expected value (in general, not just for fair die)

𝔼[𝑋]=βˆ‘π‘–=1𝑛𝑖⋅1𝑛

Let’s make this clear that the image set is 𝑋(Ξ©)={1,2,3,…,𝑛}

Then we can determine the high school mathematics by taking the variable outside.

=1𝑛(1+2+3+…+𝑛)

=1𝑛𝑛(𝑛+1)2

=𝑛+12

Now let’s look at the variance.

𝔼[𝑋2]=βˆ‘π‘–=1𝑛𝑖2β‹…1𝑛=1π‘›βˆ‘π‘–=1𝑛𝑖2

By the same summation property

=1𝑛(12+22+…+𝑛2)=1𝑛𝑛(𝑛+1)(2𝑛+1)6=(𝑛+1)(2𝑛+1)6

To get the full variance we have

𝕍[𝑋]=𝔼[𝑋2]βˆ’(𝔼[𝑋])2=(𝑛+1)(2𝑛+1)6βˆ’(𝑛+1)24

=2(𝑛+1)(2𝑛+1)βˆ’3(𝑛+1)212

=112(4𝑛2+6𝑛+2βˆ’3𝑛2βˆ’6π‘›βˆ’3)

=112(𝑛2βˆ’1)

Bernoulli Distribution

𝑋={1𝑝01βˆ’π‘ We will denote 𝑋 Bernoulli(𝑝).

The most obvious example is flipping a coin. Our expectation is very simple.

𝕑=12

𝔼[𝑋]=1×𝑝+0Γ—(1βˆ’π‘)=𝑝

For variance, it is

𝔼[𝑋2]=12×𝑝+02Γ—(1βˆ’π‘)=𝑝

𝕍[𝑋]=𝔼[𝑋2]βˆ’(𝔼[𝑋])2=π‘βˆ’π‘2=𝑝(1βˆ’π‘)

Binomial Distribution

This can be thought of as the sum of independent Bernoulli random variables. We will consider our pmf as

𝑃(𝑋=π‘˜)={(π‘›π‘˜)π‘π‘˜(1βˆ’π‘)π‘›βˆ’π‘˜if π‘˜βˆˆ{0,1,2,…,𝑛}0otherwise

Denote π‘‹βˆΌ Binom(𝑛,𝑝)

(π‘›π‘˜) is the combinatorial number, selecting π‘˜ items out of 𝑛 without caring about order

The formula is

(π‘›π‘˜)=𝑛!π‘˜!(π‘›βˆ’π‘˜)!

The factorial is

𝑛!=𝑛(π‘›βˆ’1)(π‘›βˆ’2)…2Γ—1

There is a property of the factorial that

𝑛!(π‘›βˆ’1)!=𝑛

which comes from the definition of the factorial.

We will consider more generally that

𝑛!(π‘›βˆ’π‘˜)!=𝑛(π‘›βˆ’1)(π‘›βˆ’2)…(π‘›βˆ’π‘˜+1)

This fact will become more important.

The binomial expansion formula is that

(π‘Ž+𝑏)𝑛=βˆ‘π‘˜=0𝑛(π‘›π‘˜)π‘Žπ‘˜π‘π‘›βˆ’π‘˜

We will use this in many places.

The expectation of the binomial distribution

𝔼[𝑋]=𝑛𝑝

Let’s prove this.

𝔼[𝑋]=βˆ‘π‘˜=0π‘›π‘˜π‘ƒ(𝑋=π‘˜)=βˆ‘π‘˜=0π‘›π‘˜β‹…(π‘›π‘˜)π‘π‘˜(1βˆ’π‘)π‘›βˆ’π‘˜

We will use the technique of factoring out what we want to prove, and then showing that the rest is equal to 1. This is a common and powerful technique. By definition of choose,

=βˆ‘π‘˜=1π‘›π‘˜β‹…π‘›!π‘˜!(π‘›βˆ’π‘˜)!π‘π‘˜(1βˆ’π‘)π‘›βˆ’π‘˜

Now we can factor out 𝑛𝑝

=π‘›π‘βˆ‘π‘˜=1π‘›π‘˜β‹…(π‘›βˆ’1)!π‘˜!(π‘›βˆ’π‘˜)!β‹…π‘π‘˜βˆ’1(1βˆ’π‘)π‘›βˆ’π‘˜

We can simplify out that π‘˜ and rewrite our π‘›βˆ’π‘˜ for future rearranging and rewrite our for future rearranging

=π‘›π‘βˆ‘π‘˜=1𝑛(π‘›βˆ’1)!(π‘˜βˆ’1)!((π‘›βˆ’1)βˆ’(π‘˜βˆ’1))!β‹…π‘π‘˜βˆ’1(1βˆ’π‘)(π‘›βˆ’1)βˆ’(π‘˜βˆ’1)

Next technique will be the change of variables in summations. Wherever I see π‘˜βˆ’1, I will change it to a dummy variable.

=π‘›π‘βˆ‘π‘˜β€²=0π‘›βˆ’1(π‘›βˆ’1)!(π‘˜β€²)!(π‘›βˆ’1βˆ’π‘˜β€²)!π‘π‘˜β€²(1βˆ’π‘)(π‘›βˆ’1)βˆ’π‘˜β€²

We’re almost there, now we can rewrite as a choose

=π‘›π‘βˆ‘π‘˜β€²=0π‘›βˆ’1(π‘›βˆ’1π‘˜β€²)π‘π‘˜β€²(1βˆ’π‘)(π‘›βˆ’1)βˆ’π‘˜β€²

We can now use the binomial expansion formula here.

=𝑛𝑝(𝑝+1βˆ’π‘)π‘›βˆ’1

=𝑛𝑝

For variance we will use a slightly different formulation.

We will consider 𝔼[𝑋(π‘‹βˆ’1)], which is equivalent to 𝔼[𝑋2]βˆ’π”Ό[𝑋], because I want to cancel the factorial in a certain way., which is equivalent to , because I want to cancel the factorial in a certain way.

𝔼[𝑋(π‘‹βˆ’1)]=βˆ‘π‘˜=0π‘›π‘˜(π‘˜βˆ’1)(π‘›π‘˜)π‘π‘˜(1βˆ’π‘)π‘›βˆ’π‘˜

I can safely start from 2 because of this minus 1 I’m using. Now let’s do some cancellations/substitutions.

βˆ‘π‘˜=2π‘›π‘˜(π‘˜βˆ’1)𝑛!π‘˜!(π‘›βˆ’π‘˜)!π‘π‘˜(1βˆ’π‘)π‘›βˆ’π‘˜

Now we can divide π‘˜ into its factorial.

βˆ‘π‘˜=2𝑛𝑛!(π‘˜βˆ’2)!(π‘›βˆ’π‘˜)!π‘π‘˜(1βˆ’π‘)π‘›βˆ’π‘˜

Let me take out the thing I want to prove, and use the π‘›βˆ’π‘˜ technique. technique.

=𝑛(π‘›βˆ’1)𝑝2βˆ‘π‘˜=2𝑛(π‘›βˆ’2)!(π‘˜βˆ’2)!((π‘›βˆ’2)βˆ’(π‘˜βˆ’2))!π‘π‘˜βˆ’2(1βˆ’π‘)(π‘›βˆ’2)βˆ’(π‘˜βˆ’2)

Using the π‘˜β€² technique for π‘˜βˆ’2.

=𝑛(π‘›βˆ’1)𝑝2βˆ‘π‘˜β€²=0π‘›βˆ’2(π‘›βˆ’2)!π‘˜β€²!(π‘›βˆ’2βˆ’π‘˜β€²)!π‘π‘˜β€²(1βˆ’π‘)(π‘›βˆ’2)βˆ’π‘˜β€²

By the binomial expansion formula this is

=𝑛(π‘›βˆ’1)𝑝2(𝑝+1βˆ’π‘)π‘›βˆ’2

=𝑛(π‘›βˆ’1)𝑝2

Plugging this back into variance, we can show that

𝕍(𝑋)=𝔼[𝑋(π‘‹βˆ’1)]+𝔼[𝑋]βˆ’(𝔼[𝑋])2

=𝑛(π‘›βˆ’1)𝑝2+π‘›π‘βˆ’π‘›2𝑝2

=𝑛2𝑝2βˆ’π‘›π‘2+π‘›π‘βˆ’π‘›2𝑝2

=𝑛𝑝(1βˆ’π‘)

You have to cancel a few things, use a change of variable, and group the sum into the binomial expansion formula. Those are the main techniques.

Stochastic calculus is less tedious but more conceptually difficult.

We have proposition 4.22: if π‘‹βˆˆBin(𝑛,𝑝), π‘ŒβˆΌBin(π‘š,𝑝), and 𝑋 and π‘Œ are independent, then their sum is binomial:

𝑋+π‘ŒβˆΌBin(𝑛+π‘š,𝑝)

Geometric Distribution

The distribution has no cap, can go to infinity.

𝑃(𝑋=π‘˜)=(1βˆ’π‘)π‘˜βˆ’1⋅𝑝,π‘˜=1,2,3,…

We can verify that this is in fact a probability distribution. We want to prove that

βˆ‘π‘˜=1βˆžπ‘ƒ(𝑋=π‘˜)βˆ‘π‘˜=1∞(1βˆ’π‘)π‘˜βˆ’1𝑝=π‘βˆ‘π‘˜=1∞(1βˆ’π‘)π‘˜βˆ’1

We can expand this summation to

=𝑝(1+(1βˆ’π‘)+(1βˆ’π‘)2+…)

Based on the geometric formula, we can show that

=𝑝11βˆ’(1βˆ’π‘)

=1

We will show some lemmas here, some results.

The power series is

βˆ‘π‘›=0∞π‘₯𝑛=11βˆ’π‘₯,βˆ€0<π‘₯<1

This is calculus:

βˆ‘π‘›=1βˆžπ‘›π‘₯π‘›βˆ’1=𝑑𝑑π‘₯(11βˆ’π‘₯)=1(1βˆ’π‘₯)2

We can also show

βˆ‘π‘›=2βˆžπ‘›(π‘›βˆ’1)π‘₯π‘›βˆ’2=0βˆ’1Γ—2(1βˆ’π‘₯)(βˆ’1)(1βˆ’π‘₯)4=2(1βˆ’π‘₯)3

We can start calculating the expected value now, this is from proposition 4.26

𝔼[𝑋]=βˆ‘π‘›=0βˆžπ‘ƒ(𝑋>𝑛)

𝑃(𝑋>𝑛)=βˆ‘π‘˜=𝑛+1βˆžπ‘ƒ(𝑋=π‘˜)=βˆ‘π‘˜=𝑛+1βˆžπ‘(1βˆ’π‘)π‘˜βˆ’1=𝑝(1βˆ’π‘)π‘›Γ—βˆ‘π‘˜=𝑛+1∞(1βˆ’π‘)π‘˜βˆ’π‘›βˆ’1

I want to make this formula into my power series. Let π‘˜β€²=π‘˜βˆ’π‘›βˆ’1. Then 𝑃(𝑋>𝑛)=𝑝(1βˆ’π‘)π‘›Γ—βˆ‘π‘˜β€²=0∞(1βˆ’π‘)π‘˜β€²=𝑝(1βˆ’π‘)𝑛×11βˆ’(1βˆ’π‘)=(1βˆ’π‘)𝑛.

𝑃(𝑋>𝑛)=𝑝(1βˆ’π‘)π‘›Γ—βˆ‘π‘˜β€²=0∞(1βˆ’π‘)π‘˜β€²=𝑝(1βˆ’π‘)𝑛×11βˆ’(1βˆ’π‘)=(1βˆ’π‘)𝑛.

𝑝(1βˆ’π‘)𝑛×11βˆ’(1βˆ’π‘)

=(1βˆ’π‘)𝑛

Then we have expected value as the infinite sum of this

𝔼[𝑋]=βˆ‘π‘›=0∞(1βˆ’π‘)𝑛=11βˆ’(1βˆ’π‘)=1𝑝

For variance, we will use the same intermediate value of 𝔼[𝑋(π‘‹βˆ’1)]

𝔼[𝑋(π‘‹βˆ’1)]=βˆ‘π‘˜=2βˆžπ‘˜(π‘˜βˆ’1)⋅𝑝(1βˆ’π‘)π‘˜βˆ’1

Take out what we want

=𝑝(1βˆ’π‘)βˆ‘π‘˜=2βˆžπ‘˜(π‘˜βˆ’1)(1βˆ’π‘)π‘˜βˆ’2

This follows from our third power series lemma

=𝑝(1βˆ’π‘)2𝑝3

=2(1βˆ’π‘)𝑝2

So for our variance, we get

𝕍[𝑋]=2(1βˆ’π‘)𝑝2+1π‘βˆ’1𝑝2

=2βˆ’2𝑝+π‘βˆ’1𝑝2

=1βˆ’π‘π‘2

Poisson will be beginning of next class