You are on page 1of 40

## Lecture Notes 2 Random Variables

### • Deﬁnition • Discrete Random Variables: Probability mass function (pmf ) • Continuous Random Variables: Probability density function (pdf) • Mean and Variance • Cumulative Distribution Function (cdf) • Functions of Random Variables

Corresponding pages from B&T textbook: 72–83, 86, 88, 90, 140–144, 146–150, 152–157, 179–186.

EE 178: Random Variables

## Random Variable

Page 2 – 1

ω

### X = x means that the random variable X takes on the value x

EE 178: Random Variables

Page 2 – 3

### (a) Deﬁne the random variable X as the maximum of the two rolls ( X ∈ {1, 2, 3, 4} )

4
3
2
1
234 ✄
1
1st roll
❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈ ❈❲
❇ ❇ ❇ ❇ ❇ ❇ ❇ ❇ ❇ ❇ ❇ ❇ ❇ ❇◆
✄✎ ✄
❡❡❡❡

• ### (a) Deﬁne the random variable N to be the number of packets arriving in the interval (0, 1]

EE 178: Random Variables

Page 2 – 5

N 1

k =1

T 1
T 2
T r −1
✲ ✛
✲ ✛
···
×
×
×
×
×
0
t 1
t 2
t 3
···
t r −1
t r

### • Very often we work directly with random variables without knowing (or caring to know) the underlying probability space

EE 178: Random Variables

Page 2 – 7

## Specifying a Random Variable

set A

### • Example: Roll fair 4-sided die twice independently: Deﬁne the r.v. X to be the maximum of the two rolls. What is the P{0.5 < X ≤ 2} ?

4
3
2nd roll
2
1
234
1
1st roll

EE 178: Random Variables

❢❢❢❢

Page 2 – 9

## Discrete Random Variables

x

### R

1 x 2 x 3

EE 178: Random Variables

Page 2 – 11

4
3
2nd roll
2
1
234
1
1st roll

❢❢❢❢

### 1234

EE

178: Random Variables

Page 2 – 13

xAX

## Famous Probability Mass Functions

### p X(k ) = p(1 − p) k−1for k = 1, 2, ...

EE 178: Random Variables

p X (k )
p
...
...

Page 2 – 15

### ﬁrst heads shows up (assuming independent coin ﬂips)

 k H −→ 1 p TH −→ 2 (1 − p)p TTH −→ 3 (1 − p) 2 p TTTH −→ 4 (1 − p) 3 p . . .

k =0

p X (k )
...
...
n
0 1 2 3
k ∗

### otherwise

EE 178: Random Variables

Page 2 – 17

k

p X (k )
.
.
.
.
.
.
0 1 2 3
k ∗

### otherwise

EE 178: Random Variables

Page 2 – 19

k e λt

1

λ

### nonnegative integer k ,

EE 178: Random Variables
Page 2 – 21
(n−k
)
λ
λ
p X n (k ) = n
n k 1 −
k
n
n−k
k
n(n − 1)
(n − k + 1)
λ
k n − λ
=
k !
n
n
n
n(n − 1)
(n
− k
+ 1) λ k
n − λ
=
(n − λ) k
k !
n
n
n(n − 1)
...
(n − k + 1)
λ k
λ
=
1 −
(n − λ)(n − λ)
...
(n − λ) k !
n

k

e λ

## Continuous Random Variables

### (integrate mass density to get the mass)

EE 178: Random Variables

Page 2 – 23

## Probability Density Function

b

a

x

x+x

### • Notation: X ∼ f X(x) means that X has pdf f X(x)

EE 178: Random Variables

Page 2 – 25

## Famous Probability Density Functions

### • Uniform : X ∼ U[a, b] for b>a has the pdf

1
b−a for a ≤ x ≤ b
f (x) =
0
otherwise
f X (x)
1
b−a
a
b

x

λe −λx for x ≥ 0
f (x) =
0
otherwise
f X (x)
λ

### between busses, etc.

EE 178: Random Variables

Page 2 – 27

10

5

1

### > x 1} = P{X > x − x 1}

EE 178: Random Variables

Page 2 – 29

x

x

1

e λx

e λx 1

= e λ(xx 1 )

• 1

(xµ) 2

N (µ, σ 2 )
µ

### phenomena

EE 178: Random Variables

## Mean and Variance

Page 2 – 31

xX

### E(X 2) = x 2p X(x) ≥ 0 rms = E(X 2)

xX

EE 178: Random Variables

Page 2 – 33

xX

2

x

x

x

x

E(X )

x

1

### So, for our example, Var(T ) = 22/225 − (4/15) 2= 0.02667 .

EE 178: Random Variables

Page 2 – 35

## Mean and Variance of Famous Discrete RVs

### transforms.

EE 178: Random Variables

Page 2 – 37

k =0

k =0

k =0

ka k 1

k =0

k =0

### ka k

or
d
1
a
ka k = a
=
da 1 − a
(1 − a) 2
k =0
Thus
E [X ] =
pk (1 − p) k −1
k =1
p
=
k (1 − p) k
1
− p
k =1
p
=
k (1 − p) k
1
− p
k =0
p 1 − p
1
=
=
1
− p p 2
p
EE 178: Random Variables
Page 2 – 39

k

=0

k

k =1

k =1

k

k =1

λ (k 1)

k

k =0

e λ

### Can show that the variance is also equal to λ

EE 178: Random Variables

Page 2 – 41

## Mean and Variance for Continuous RVs

−∞

### = E(X 2) − (E(X )) 2

EE 178: Random Variables

Page 2 – 42

a

b

a

b

a

b

3

b

a

### Thus, for X ∼ U[0, 1] , E(X ) = 1/2 and Var = 1/12

EE 178: Random Variables

Page 2 – 43

−∞

0

λx

u

v

dv

0

0

R udv =uv R vdu

0

### λ 2

EE 178: Random Variables

Page 2 – 44

### calculus, but it is messy)

EE
178: Random Variables
Page 2 – 45
Mean and Variance for Famous r.v.s
Random Variable
Mean
Variance
Bern(p)
p
p(1 − p)
Geom(p)
1/p
(1 − p)/p 2
B(n, p)
np
np(1 − p)
Poisson(λ)
λ
λ
U[a, b]
(a + b)/2
(b − a) 2 /12
Exp(λ)
1/λ
1/λ 2
N (µ, σ 2 )
µ
σ 2
EE
178: Random Variables
Page 2 – 46

## Cumulative Distribution Function (cdf)

### discrete nor continuous

EE 178: Random Variables

Page 2 – 47

### F X(∞) = 1, and F X(−∞) = 0

EE 178: Random Variables

Page 2 – 48

### where F X(a −) = lim x↑aF X(a)

EE 178: Random Variables

Page 2 – 49

### ◦

If a r.v. is discrete, its cdf consists of a set of steps
p X
(x)
F X (x)
1
x
1 2 3 4
1 2 3 4

x

−∞

### So, the cdf of a continuous r.v. X is continuous

EE 178: Random Variables

Page 2 – 50

F X (x)
1

x0

x0

### ∆x

EE 178: Random Variables

### ◦ The cdf of a mixed r.v. has the general form

F X (x)
1

EE 178: Random Variables

Page 2 – 51

Page 2 – 52

## Examples

x

a

1

xa

ba

1

ba

F X (x)
1
x
a
b

### x

EE
178:
Random Variables
Page 2 – 53
• cdf of an exponential r.v.:
F X (x) = 0, X < 0, and F X (x) = 1 − e −λx , x ≥ 0
f X (x)
F X (x)
λ
1
x
x
EE 178: Random Variables
Page 2 – 54

### x > 0

EE 178: Random Variables

Page 2 – 55

x

−∞

ξ 2

N (0, 1)
Q(x)
x

### compute P{X > a} for any Gaussian r.v. X

EE 178: Random Variables

Page 2 – 56

## Functions of a Random Variable

### for every y . Assuming Ω is discrete:

EE 178: Random Variables

Page 2 – 57

1

2

### P{ω }

{ω : g (X (ω ))=y }

### P{ω } =

{x: g (x)=y } {ω : X (ω )=x}

{x: g (x)=y }

### Thus

p Y (y ) = {x: g (x)=y } p X (x)

### the original random experiment

EE 178: Random Variables

Page 2 – 58

{x: g (x)=y }

{x: x3}

### 4

EE 178: Random Variables

## Derived Densities

Page 2 – 59

{x: g (x)=y }

### But basic idea does extend to cdfs

EE 178: Random Variables

Page 2 – 60

g (X )