S1: Chapter 8Discrete Random Variables
www.drfrostmaths.com Dr J Frost ([email protected])
Last modified: 12th January 2016
Variables and Random VariablesIn Chapter 2, we saw that just like in algebra, we can use a variable to represent some quantity, such as height.
1 2 3 4 5 6
0.3 0.2 0.1 0.25 0.05 0.1
! A random variable represents a single experiment/trial. It consists of outcomes with a probability for each.
i.e. It is just like a variable in statistics, except each outcome has now been assigned a probability.
𝑃 (𝑋=𝑥 )
“The probability that… …the outcome of the random variable …
…was the specific outcome ”
A shorthand for is ! (note the lowercase ).It’s like saying “the probability that the outcome of my coin throw was heads” () vs “the probability of heads” (). In the latter the coin throw was implicit.
i.e. is a random variable (capital letter), but is a particular outcome.
Is it a discrete random variable?
The height of a person randomly chosen.
The number of cars that pass in the next hour.
The number of countries in the world.
No Yes
No Yes
No Yes
This is a continuous random variable.
It does not vary, so is not a variable!
Probability Distributions vs Probability Functions
There are two ways to write the mapping from outcomes to probabilities.
𝑝 (𝑥 )={0.1𝑥 , 𝑥=1,2,3,4¿0 , h𝑜𝑡 𝑒𝑟𝑤𝑖𝑠𝑒
Probability Functions
The “{“ means we have a ‘piecewise function’. This just simply means we choose the function from a list depending on the input.
e.g. if , then the probability is
1 2 3 4
0.1 0.2 0.3 0.4?
Probability Distribution
The table form that you know and love.
Advantages of probability function: Can have a rule/expression based on the outcome. Particularly for continuous random variables (in S2), it would be impossible to list the probability for every outcome. More compact.
Advantages of distribution: Probability for each outcome more explicit.
?
?
Example
The random variable represents the number of heads when three coins are tossed.
Underlying Sample Space
{ HHH, HHT, HTT, HTH, THH, THT, TTH, TTT }
Probability Distribution
Num heads 0 1 2 3
?
?
Probability Function
?
Exam Question
(Hint: Use your knowledge that )
Edexcel S1 May 2012
p(-1) = 4k, p(0) = k, p(1) = 0, p(2) = kAnd since , 4k + k + 0 + k = 6k = 1Therefore ?
Exercise 8A
The random variable X has a probability function.Show that
The random variable X has a probability function:
where k is a constant.
a) Find the value of k.b) Construct a table giving the probability distribution of .
7a) k = 0.1257b)
5
7
x 1 2 3 4
P(X = x) 0.125 0.125 0.375 0.375?
Probabilities of ranges of values
1 2 3 4 5 60.1 0.2 0.3 0.25 0.1 0.05
???
?
Cumulative Distribution Function (CDF)
How could we express “the probability that the age of someone is at most 40”?
F is known as the cumulative distribution function, where
(note the capital F)
??
0 1 20.25 0.5 0.25
0 1 20.25 0.75 1
If X is the number of heads thrown in 2 throws...
? ? ?
? ? ?
The discrete random variable X has a cumulative distribution function defined by:
; x = 1, 2 and 3
Find the value of k.F(3) = 1. Thus k = 5.
Draw the distribution table for the cumulative distribution function.
Write down F(2.6)F(2.6) = F(2) = 7/8
Find the probability distribution of X.
Example
x 1 2 3F(x) 3/4 7/8 1? ? ?
a
x 1 2 3P(X=x) 3/4 1/8 1/8
b
c
d
? ? ?
?
?
CDF
Shoe Size (x)
p(x)
Shoe Size (x)
F(x)
1
It’s just like how we’d turn a frequency graph into a cumulative frequency graph.
?
Exam Questions
Edexcel S1 May 2013 (R)
x 1 2 3
P(X = x) 0.4 0.25 0.35= 0.4?
?
Edexcel S1 Jan 2013
F(3) = 1, so (27 + k)/40 = 1, ...x 1 2 3
P(X = x) 0.35 0.175 0.475?
?
Exercise 8B
Q5-8
Expected Value, E[X]Suppose that we throw a single fair die 60 times, and see the following outcomes:
1 2 3 4 5 6
Frequency 9 11 10 8 12 10
What is the mean outcome based on our sample?
But using the actual probabilities of each outcome (i.e. 1/6 for each), what would we expect the average outcome to be?
3.5
! If is the random variable, is known as the expected value of .
It represents the mean outcome we would expect if we were to do our experiment lots of times.
?
?
Throw a lot of times.
For our fair die: ?
Quickfire E[X]Find the expected value of the following distributions (in your head!).
1 2 3
0.1 0.6 0.3
𝐸 ( 𝑋 )=2.2
4 6 8
0.5 0.25 0.25
𝐸 ( 𝑋 )=5.5
10 20 30
𝐸 ( 𝑋 )=20
? ?
?
Bro Tip: Suppose you treated the probabilities as frequencies then found the mean of the ‘frequency table’. What do you notice?
Bro Tip: If the distribution is ‘symmetrical’, i.e. both the outcomes and probabilities are symmetrical about the centre, then the expected value is this central value.
Harder Example
1 2 3 4 5
Given that , find the values of and .
Probabilities add to 1:Expected value:
Solving simultaneous equations:
?Hint: Can you think of TWO ways we could get an equation relating and ?
To and beyond
Remember with the mean for a sample, we could find the “mean of the squares” when finding variance, e.g. ? We just replaced each value with its square.
Unsurprisingly the same applies for the expected value of a random variable.Just replace with whatever is in the square brackets. Sorted!
1 2 3
0.1 0.5 0.4
𝐸 (𝑋 2 )=(12×0.1 )+(22×0.5 )+ (32×0.4 )=5.7??
Variance
We know how to find it for experimental data. How about for a random variable?
Mean of the Squares Minus Square of the Mean
𝐸 (𝑋 2 ) – 𝐸 ( 𝑋 )2? ? ?
1 2 3
0.1 0.5 0.4(We already worked out that )
𝑉𝑎𝑟 ( 𝑋 )=𝟓 .𝟕−𝟐 .𝟑𝟐=𝟎 .𝟒𝟏
𝑉𝑎𝑟 ( 𝑋 )=¿
?
Exam Questions
Edexcel S1 May 2010
Edexcel S1 Jan 2009
a = 1/4
= 1
E[X2] = 3.1 So Var[X] = 3.1 – 12 = 2.1
= 1
= P(X <= 1.5) = P(X <= 1) = 0.7
E[X2] = 2. So Var[X] = 2 – 12 = 1
???
???
Exercise 8D
Coding!Oh dear god, not again...
Suppose that we have a list of peoples heights x. The mean height is 1.5m and the variance 0.2m. We use the coding :
Recap
It’s no different with expected values. What do we expect these to be in terms of the original expected value E[X] and the original variance Var[X]?
E[X + 10] = E[X] + 10E[3X] = 3E[X]
Var[3X] = 9Var[X]
???
Adding 10 to all values adds 10 to the expected value.
??
Quickfire CodingExpress these in terms of the original and .
𝐸 (4 𝑋+1 )=4𝐸 ( 𝑋 )+1?
??
??
?
?
Exercise 8E
E[X] = 2, Var[X] = 6Finda) E[3X] = 3E[X] = 6 d) E[4 – 2X] = 4 – 2E[X] = 0f) Var[3X + 1] = 9Var[X] = 54
The random variable Y has mean 2 and variance 9.Find:a) E[3Y+1] = 3E[Y] + 1 = 7c) Var[3Y+1] = 9Var[Y] = 81e) E[Y2] = Var[Y] + E[Y]2 = 13f) E[(Y-1)(Y+1)] = E[Y2 – 1] = E[Y2] – 1 = 12
2
5
???
??
??
Bro Exam Tip: This has come up in exams multiple times.
S2 Preview
If X is the throw of a fair die, this obviously is its distribution...
We call this a discrete uniform distribution.?
If had say an -sided fair die, then:
𝐸 (𝑋 )=𝑛+12
𝑉𝑎𝑟 (𝑋 )=𝑛2−112
You won’t have exam questions on these, but you’ll revisit them in S2.
?
?
ExampleDigits are selected at random from a table of random numbers.a) Find the mean and standard deviation of a single digit.b) Find the probability that a particular digit lies within one standard deviation of the
mean.
a) Our digits are 0 to 9. We have useful formulae when the numbers start from 1 rather than 0. If the digit is R, let X = R + 1Then E[R] = E[X – 1] = E[X] – 1 = 11/2 – 1 = 4.5
Var[R] = Var[X – 1]= Var[X]= = 8.25So = 2.87 (to 2sf)
b) We want
?
?