Skip to content
Related Articles

Related Articles

Discrete Random Variables – Probability | Class 12 Maths
  • Last Updated : 16 Nov, 2020
GeeksforGeeks - Summer Carnival Banner

In probability, a random variable is a variable whose value is the outcome of a random experiment. Random variables are categorized as discrete and continuous random variables. As the name probably suggests, discrete random variables take discrete values or in other terms, the number of values that a discrete random variable takes is countable whereas the continuous random variable, the variable takes all the values present in a particular interval and hence it is not countable. 

Examples of a Discrete Random Variable

A very basic and fundamental example that comes to mind when talking about discrete random variables is the rolling of an unbiased standard die. An unbiased standard die is a die that has six faces and equal chances of any face coming on top. Considering we perform this experiment, it is pretty clear that there are only six outcomes for our experiment. Thus, our random variable can take any of the following discrete values from 1 to 6. Mathematically the collection of values that a random variable takes is denoted as a set. In this case, let the random variable be X. 

Thus, X = {1, 2, 3, 4, 5, 6}

Another popular example of a discrete random variable is the tossing of a coin. In this case, the random variable X can take only one of the two choices of Heads or Tails. 

Thus, X = {H, T}



Example of a Continuous Random Variable 

Consider a generalized experiment rather than taking some particular experiment. Suppose that in your experiment, the outcome of this experiment can take values in some interval (a, b). That means that each and every single point in the interval can be taken up as the outcome values when you do the experiment. Hence, you do not have discrete values in this set of possible values but rather an interval 

Thus, X= {x: x belongs to (a, b)}

Constructing a probability distribution for a discrete random variable 

A probability distribution is a way of distributing the probabilities of all the possible values that the random variable can take. Before constructing any probability distribution table for a random variable, the following conditions should hold valid simultaneously when constructing any distribution table 

  • All the probabilities associated with each possible value of the random variable should be positive and between 0 and 1
  • The sum of all the probabilities associated with every random variable should add up to 1

Example:
Consider the following problem where a standard die is being rolled and it’s been given that probability of any
face is proportional to the square of the number obtained on its face. Obtain the probability distribution table
associated with this experiment

Solution: 

Since P(x) ∝ x  => P(x) = kx2 where k is the proportionality constant and x are the numbers from 1 to 6 
Also from the two conditions listed above we know that the sum of all probabilities is 1 
Thus ∑ kx2 = 1 when summation is varied over x 
=> k + 4k + 9k + 16k + 25k + 36k = 1 
=> 91k =1 
=> k = 1/91

Thus substituting this value of k into each probability we can obtain the probability of each random variable and then forming a table we get         
 

x123456
P(x)1/914/919/9116/9125/9136/91

Checking the Validity of a probability distribution 

Any valid probability distribution table should satisfy both the above-mentioned conditions namely 



  • All the probabilities associated with each possible value of the random variable should be positive and between 0 and 1
  • The sum of all the probabilities associated with every random variable should add up-to 1

Example:
Check if the following probability distribution tables are valid or not

a) 

x1257
P(x)0.20.10.10.6

This is a valid distribution table because  

  • All the individual probabilities are between 0 and 1
  • The sum of all individual probabilities add up to 1

b) 

x012345
P(x)0.320.280.1-0.40.20.1

This is not a valid distribution table because 

  • There is one instance of a probability being negative

c) 

x1234
P(x)0.40.20.250.1

This is not a valid distribution table because 

  • The sum of all the individual probabilities do not add up to 1 although they are positive and between 0 and 1. For a table to be a valid distribution table both the conditions should satisfy simultaneously

Probability Model Example: The frozen yoghurt model 

The frozen yoghurt model is basically a situation where a person stands in a queue outside a shop to purchase frozen yoghurt. The person goes to the shop at a specific time daily and noted down the number of people waiting in the queue. Now, there is an assumption made that the shop owner is a very efficient person and serves the orders swiftly thus there cannot be more than 2 people waiting in the queue awaiting their orders. 

Say you note down the following observations after going to the shop for 50 days 

Number of people in queueFrequency 
014
125
211

Now suppose the person visits the shop on the 51st day. How likely is he going to see that there are 
a) 0 people in the queue
b) 1 person in queue 
c) 2 people in the queue 

Solution: 

First off, we need to construct our probability distribution table that would give the probability of our queue length being either 0 or 1 or 2 people long.
Using the basic probability formula that 
                                                                 P(x) = Favorable Outcomes / Total Outcomes 

Applying this to each row we get the probability table as 

xP(x)
014/50 = 0.28
125/50 = 0.5
211/50 = 0.22

Now the person when going to purchase his frozen yoghurt on the 51st day would see that the 
a) The probability of 0 people in the queue is 0.28
b) The probability of 1 person in the queue is 0.5
c) The probability of 2 people in the queue is 0.22

Note: During any practical experiment like the frozen yoghurt model, the probabilities get more and more accurate when your number of sample observations increase.

Expectation or the Expected value of a random variable 

An “expectation” or the “expected value” of a random variable is the value that you would expect the outcome of some experiment to be on average.
The expectation is denoted by E(X) 

The expectation of a random variable can be computed depending upon the type of random variable you have. 

For a Discrete Random Variable, E(X) = ∑x * P(X = x)

For a Continuous Random Variable, E(X) = ∫x * f(x)          

where,

The limits of integration are -∞ to + ∞ and

f(x) is the probability density function  

Expectation of a Discrete Random Variable 

For a discrete random variable, as mentioned above the expectation is E(X) = ∑ x * P(X = x). The following example would illustrate the definition and computation of expectation a bit more clearly 

Example: What is the expectation when a standard unbiased die is rolled?

Solution: 

Rolling a fair die has 6 possible outcomes : 1, 2, 3, 4, 5, 6 each with an equal probability of 1/6

Let X indicate the outcome of the experiment

Thus P(X=1) = 1/6

         P(X=2) = 1/6

         P(X=3) = 1/6

         P(X=4) = 1/6

         P(X=5) = 1/6

         P(X=6) = 1/6

Thus,  E(X) = ∑ x * P(X=x)

          E(X) = 1*(1/6) + 2*(1/6) + 3*(1/6) + 4*(1/6) + 5*(1/6) + 6*(1/6)

          E(X) = 7/2 = 3.5     

This expected value kind of intuitively makes sense as well because 3.5 is in halfway in between the possible values the die can

take and thus this is the value that you could expect.           

Properties of Expectation

  • In general, for any function f(x) , the expectation is  E[f(x)] = ∑ f(x) * P(X = x) 
  • If k is a constant then E(k) = k
  • If k is a constant and f(x) is a function of x then E[k f(x)] = k E[f(x)]
  • Let c1 and c2 be constants and u1 and u2 are functions of x then E = c1E[u1(x)] + c2E[u2(x)]

Example: Given E(X) = 4 and E(X2) = 6 find out the value of E(3X2 – 4X + 2)

Solution:

Using the various properties of expectation listed above , we get

E(3X2 – 4X + 2) = 3 * E(X2) – 4 * E(X) + E(2)

= 3 * 6 – 4 * 4 + 2

= 4    

Thus, E(3X2 – 4X + 2) = 4                                                                                

Variance and standard deviation of a discrete random variable

Variance and Standard deviation are the most prominent and commonly used measures of spread of a random variable. In simple terms, the term spread indicates how far or close the value of a variable is from a point of reference.
Variance of X is denoted by Var(X) and the Standard Deviation is basically just the square root of the variance. 

Mathematically, for a discrete random variable X, Var(X) = E(X2) – [E(X)]2 

Properties of Variance 

  • Var(k) = 0 when k is a constant
  • Var[aX + b] = a2Var(X)

Example 1: Find the variance and standard deviation when a fair die is rolled 

Solution:

From one of the examples mentioned earlier , we figured out that the when a fair die is rolled, E(X) = 3.5

Also, to find out Variance, we would need to find E(X2)

Using properties of Expectation, E(X2) = ∑ x2 * P(X=x)

Thus, E(X2) = 1*(1/6) + 4*(1/6) + 9*(1/6) + 16*(1/6) + 25*(1/6) + 36*(1/6)

                  = 91/6 = 15.16

And Thus Var(X) = 15.16 – (3.5)2

                          = 2.916 = 35/12

 Standard deviation is the square root of Variance

 Thus, Standard deviation = 1.7076 

Example 2: Find the variance and standard deviation of the following probability distribution table

X0123
P(X)0.10.20.40.3

Solution:

First off, we need to check if this distribution table is valid or not.

We see that both the conditions that are necessary for a distribution table being valid are satisfied simultaneously here. Thus, this is a valid distribution table.

Now to find variance, we need E(X) and E(X2)

E(X) = 0 * 0.1 + 1 * 0.2 + 2 * 0.4 + 3 * 0.3

Thus, E(X) = 1.9

E(X2) = 0 * 0.1 + 1 * 0.2 + 4 * 0.4 + 9 * 0.3

Thus, E(X2) = 4.5

Thus Var(X) = 4.5 – (1.9)2

                   = 0.89

Standard deviation = (0.89)0.5 = 0.9433

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :