Lecture 4

Robin Sandquist Robin Sandquist

Expected Values, Variance, and Discrete Distributions

Robin Sandquist

September 2026

Reminder

For a discrete random variable X, the probability mass function is

pX(k)=ℙ(X=k).

For a continuous random variable X with density fX, we have

ℙ(X∈A)=∫AfX(x)dx.

The expected value is given by

𝔼[X]={∑kkpX(k),if X is discrete,∫−∞∞xfX(x)dx,if X is continuous.

For a function g(X), we have

𝔼[g(X)]={∑kg(k)pX(k),if X is discrete,∫−∞∞g(x)fX(x)dx,if X is continuous.

If μ=𝔼[X], then

V(X)=𝔼[X2]−μ2,D(X)=V(X).

Properties of expected values and variance

Theorem

Let X be a random variable, and let α,β∈ℝ be constants. Then:

  1. 𝔼[αX+β]=α𝔼[X]+β.
  2. V(αX+β)=α2V(X).
  3. D(αX+β)=|α|D(X).

Proof of rule 2 in the discrete case.

Let μ=𝔼[X]. By rule 1,

𝔼[αX+β]=αμ+β.

Using the definition of variance, we get

V(αX+β)=𝔼[(αX+β−(αμ+β))2]=∑k(αk+β−αμ−β)2pX(k)=∑kα2(k−μ)2pX(k)=α2∑k(k−μ)2pX(k)=α2V(X).

□

The Binomial Distribution

Example (Seeds that germinate)

Suppose that we plant ten seeds. Each seed has probability 0.8 of germinating, independently of the other seeds.

Let X be the number of seeds that germinate. Then X counts the number of successes in ten independent trials, each with the same probability of success.

For exactly eight seeds to germinate, we need eight successes and two failures. A particular arrangement has probability

0.880.22.

There are (108) ways to choose which eight seeds germinate, so

ℙ(X=8)=(108)0.880.22.
Definition (Binomial distribution)

Suppose that we perform n independent tries, where each try succeeds with probability p.

If X is the number of successful tries, then X has a binomial distribution with parameters n and p. We write

X∼Bin⁡(n,p).

Its probability mass function is

pX(k)=ℙ(X=k)=(nk)pk(1−p)n−k,k=0,1,…,n.

The Hypergeometric Distribution

Example (Inspecting batteries)

A box contains twenty batteries, five of which are defective. We randomly choose four batteries without replacement, with every group of four equally likely to be chosen.

Let X be the number of defective batteries in the sample.

To get exactly one defective battery, we choose one of the five defective batteries and three of the fifteen working batteries. This can be done in

(51)(153)

ways.

There are (204) possible samples, so

ℙ(X=1)=(51)(153)(204).
Definition (Hypergeometric distribution)

Suppose that a population contains N objects, of which K have a certain property.

We choose n objects at random without replacement, with every sample of size n equally likely. Let X be the number of selected objects that have the property.

Then X has a hypergeometric distribution. Using the notation

X∼Hypergeom⁡(N,K,n),

its probability mass function is

pX(k)=ℙ(X=k)=(Kk)(N−Kn−k)(Nn),

for integers k satisfying

max⁡{0,n−(N−K)}≤k≤min⁡{n,K}.
Remark

In the binomial model, the tries are independent and the success probability stays the same.

When choosing without replacement, the probability of succes on the next draw depends on what has already been selected. This is the situation described by the hypergeometric distribution.

The Discrete Uniform Distribution

Definition (Discrete uniform distribution)

We say that X is discrete uniform on {1,…,k} if

ℙ(X=i)=1k,i=1,…,k.

Every value in the set has the same probability.

The Poisson Distribution

Definition (Poisson distribution)

We say that X has a Poisson distribution with parameter λ>0 if

pX(k)=ℙ(X=k)=e−λλkk!,k=0,1,2,….

We write

X∼Poisson⁡(λ).

Checking the probability mass function

Recall that a probability mass function is valid if all its values are non-negative and their sum is one.

Here,

e−λλkk!≥0

for every k≥0. Also,

∑k=0∞e−λλkk!=e−λ∑k=0∞λkk!=e−λeλ=1.

This confirms that the Poisson formula gives a valid probability mass function.

When is the Poisson distribution useful?

Suppose that an event occurs randomly at an average rate of c times per unit of time.

Under the usual Poisson model, the rate is constant, counts in separate time intervals are independent, and multiple events in a very short interval are unlikely.

If N(t) is the number of events in the interval [0,t], then

N(t)∼Poisson⁡(ct).
Example (Cars crossing a bridge)

Cars cross a bridge at an average rate of two cars per minute. Assume that the crossings follow a Poisson model.

What is the probability that less than three cars cross the bridge in two minutes?

Let X be the number of cars in this interval. Then

λ=2⋅2=4,X∼Poisson⁡(4).

less than three cars means zero, one, or two cars:

ℙ(X<3)=ℙ(X=0)+ℙ(X=1)+ℙ(X=2)=∑k=02e−44kk!

This calculates to about a 23.8% chance.

The geometric distribution and the first success

Suppose that we study repeated independent tries of the same type. Each try succeeds with probability p, where 0<p<1.

Let

X=the number of tries needed for the first success,

and

Y=X−1=the number of failures before the first success.

Their possible values are

X∈{1,2,3,…},Y∈{0,1,2,…}.

For X=k, the first k−1 tries must fail, and try k must succeed.

By independence,

pX(k)=ℙ(X=k)=(1−p)⋯(1−p)⏟k−1 failuresp=(1−p)k−1p,k=1,2,….

Since Y=X−1, we have

pY(k)=ℙ(Y=k)=ℙ(X=k+1)=(1−p)kp,k=0,1,2,….
Definition (First success distribution)

We say that X has a first-success distribution with parameter p if

ℙ(X=k)=(1−p)k−1p,k=1,2,….

In this course (in Swedish) we write

X∼ffg(p).
Definition (Geometric distribution)

We say that Y has a geometric distribution with parameter p if

ℙ(Y=k)=(1−p)kp,k=0,1,2,….

We write

Y∼Geo⁡(p)orY∼Geom⁡(p).