Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Expected Value

  • Last Updated : 24 Jun, 2021

Random variables are the functions that assign a probability to some outcomes in the sample space. They are very useful in the analysis of real-life random experiments which become complex. These variables take some outcomes from a sample space as input and assign some real numbers to it. The expectation is an important part of random variable analysis. It gives the average output of the random variable. Intuitively, it means that it gives the value that the random variable is going to throw most frequently when the experiment is repeated an infinite number of times. 

Random Variables and Expectations 

Random experiments are those experiments where it is not possible to be certain about the outcomes. In such cases, it is only possible to assign probabilities to the outcomes. Random variables connect the outcomes with a certain real number. For example, consider the experiment of tossing a coin three times. The thing to keep in mind is, a random variable can be defined according to our needs, but the only condition is, every outcome of the sample space must be given a value by a random variable. 

Attention reader! All those who say programming isn't for kids, just haven't met the right mentors yet. Join the  Demo Class for First Step to Coding Coursespecifically designed for students of class 8 to 12. 

The students will get to learn more about the world of programming in these free classes which will definitely help them in making a wise career choice in the future.

So, in this case, let R be the random variable, and in this case, it is defined as, 



R = Number of heads 

Sample Space = {HHH, HHT, HTH, HTT, THH, THT, TTH, TTT}

The value given by R for each outcome is shown below in the table. 

Input Output
R(HHH)3
R(HHT)2
R(HTH)2
R(HTT)1
R(THH) 2
R(THT)1
R(TTH)1
R(TTT)0

Notice that more than one outcome can be mapped to a single value by the random variable. 

Expectation

For a random variable X, the expectation gives an idea of the average value attained by X when the experiment is repeated many times. Since this value is mapped with an outcome in the sample space. Expected value can be used to determine which of the outcomes is most likely to happen when the experiment is repeated many times. 

For the random variable X which assumes values x1, x2, x3,…xn with probability P(x1), P(x2), P(x3), … P(xn)

The expectation of X is defined as, 



E(x) = \sum P(x_{i})x_{i}

Expected Value

Expectations have a lot of use cases and applications in real life. These concepts are used by insurance companies to compute the probability of death for a person. Expectations are also used in games of chances. For example, while playing poker, or maybe analyzing a lottery system. Analysts use it to compute the probability of winning. This concept is also used in the field of Artificial Intelligence(AI) a lot to understand real-life scenarios and actions. 

Term Life Insurance and Death Probability

Consider an example, let’s say Akhil has two kids and a wife, and he wants to take insurance policy for himself so that, in the case of any misshapen, his family won’t have to suffer economically. He buys an insurance policy of 50 lakh rupees. The policy is valid for the next 20 years, which means if something happens to Akhil in the next 10 years, the company will be paying his family 50 lakhs of rupees. These types of policies are called long-term life insurance policies. The condition in this policy is that Akhil will have to pay a premium of Rs 50,000 per year. 

How do companies make a profit and calculate the death probability in these cases? 

Total amount paid by Akhil in 10 years = Rs 50,000 × 10 

                                                              = Rs 5,00,000 

Insurance Policy = 50,00,000

The ratio becomes \frac{5,00,000}{50,00,000} = \frac{1}{10}. This means for Rs 10 of insurance they are getting Rs 1 premium. Since they are trying to make profits, they need to get at least 10 Akhils to break even. In that case, out of 10, if only one Akhil dies, the company can break even. 

So, if there is a probability of \frac{1}{10} a candidate dying and the company has 10 policyholders, there will be no loss and no profit. Thus, to make a profit 



P(Akhil Dying) ≤ 0.1

Getting Data from Expected Value 

The expected value gives the central value of the random variable. This is where most of the outputs of the random variables lie when the experiments are repeated many times. These values come in handy while inferring the other variables which are missing most of the time while performing such random experiments. Data can be retrieved using basic algebraic manipulations and expressions for calculating the expected value. The example given below will further clarify this method. 

Example: Aman’s dad gave him a die. To check if it was a fair die, he rolled the die 500 times and noted down the frequencies of the values obtained in the table on a piece of paper. Due to rain, some values on the table were washed away. So, instead of doing all the experiments again, he rolled the die 20 times and concluded that the expected value in 20 rolls was 3.37. The washed-away table is given below. Find the values of the missing frequencies. 

Die Value Absolute Frequency
1A
2110
395
470
575
6B
Total 500

Solution:

Assuming that the expected value remains the same in both 20 and 500 trials. 

Let’s say the random variable “X” is defined as the value obtained on the die. 

X can take values like 1, 2, 3, 4, 5 and 6 

The expected value of a random variable is given by, 

E(x) = \sum P(x_{i})x_{i}



 E(X) = \sum P(x_{i})x_{i} \\ E(X) = P(X = 1)(1) + P(X = 2)2 + P(X = 3)3 + P(X = 4)4 + P(X = 5)5 + P(X = 6)6 \\ E(X) = \frac{A}{500} + \frac{110}{500}.2 + \frac{95}{500}.3 + \frac{70}{500}.4 + \frac{75}{500}.5 + \frac{B}{500}.6 \\

Substituting the expected value, 

3.67 = \frac{A}{500} + \frac{110}{500}.2 + \frac{95}{500}.3 + \frac{70}{500}.4 + \frac{75}{500}.5 + \frac{B}{500}.6 \\ 1685 = A + 220 + 285 + 280 + 375 + 6B \\ 525 = A + 6B

Now this equation has two variables, one more equation is required to solve this.

A + 110 + 95 + 70 + 75 + B = 500 

⇒ A+ B = 150 

So, the two equations are, 

A + B = 150 

A + 6B = 525 

Solving these equations, the values of variables come out to be. 



A =75 and B = 75. 

Expected profit from Lottery Ticket 

Expectations can be used to analyze the profits that can be obtained from a lottery ticket. In such games, the chances of winning are little and players usually end up losing money. Through the theory of probability and expectations, the chances and the expected profits can be calculated using which wiser decisions can be made while playing such games. 

Example: Asif is playing the lottery in which he has to pick two numbers. If the ticket matches both numbers, he will win the grand prize, which is Rs10005. If only one number matches, he will win a small prize of Rs 1005 and the cost of a lottery ticket is Rs 5. Find the expected profit from the lottery ticket.

Solution : 

Suppose Asif draws a lottery ticket “04”. Let X be the random variable which represents profit when the “04” ticket was drawn. 

E(X) = P(winning grand prize)(10005 – 5) + P(winning small prize)(1005 – 5) + P(winning nothing)(-5)

Now, the values of these probabilities is required. 

P(winning grand prize) = Both the numbers match 

                                     = \frac{1}{10}.\frac{1}{10} = \frac{1}{100}

P(winning a small prize) = Only one of the numbers matches 

                                       = 2.\frac{1}{10}.\frac{9}{10} = \frac{18}{100}

P(winning neither of these prizes) = No one of the numbers matches 

                                       = \frac{9}{10}.\frac{9}{10} = \frac{81}{100}

Substituting these values, 

E(X) = P(winning grand prize)(10005 – 5) + P(winning small prize)(1005 – 5) + P(winning nothing)(-5)

⇒ E(X) = \frac{1}{100}.10000 + \frac{18}{100}.1000 + \frac{81}{100}.(-5)

⇒ E(X) = 100 + 180 – 4.05

⇒E(X) = 275.95

Expected Value while Fishing



This is yet another example of the use-case of expected value. In this case, there is a bet between two friends who are going fishing. Even before actually fishing, the chances or margins of profit can be analyzed using the expectations of random variables. The below example shows one such incident of bets between two friends who went fishing and placed bets on fish. 

Example: Two friends are fishing in a pond that contains 10 trout and 10 sunfish. Each time they catch a fish, they release it back immediately. They made a bet. If the next three fishes friend A catches are all sunfish, then friend B will pay him Rs 100, otherwise, friend A will have to pay Rs 20 to B. Find the expected profit from the bet. 

Solution: 

Let X be a random variable denoting the profit from the bet. 

E(X) = P(A catches all three sunfish)(100) + P(A cannot catch all three sunfish)(-20)

Computing the probabilities, 

P(A catches all three sunfish) = \frac{10}{20}.\frac{10}{20}.\frac{10}{20} = \frac{1}{8}

P(A doesn’t catch all three sunfish) = 1  – P(A catches all three sunfish)

                                                                = 1 – \frac{1}{8}

                                                                = \frac{7}{8}



Substituting the values computed above into the expectation equation, 

E(X) = P(A catches all three sunfish)(100) + P(A cannot catch all three sunfish)(-20)

⇒ E(X) = P(A catches all three sunfish)(100) + P(A cannot catch all three sunfish)(-20)

⇒ E(X) = \frac{1}{8}.100 + \frac{7}{8}.(-20)

⇒ E(X) = \frac{-40}{8} = -5

Comparing Insurance with Expected Value

Insurance companies show a lot of plans and try to lure customers to buy them. Not all the plans are beneficial to customers. One such case is medical insurance. A lot of insurance companies, in order to make more profit, make attractive schemes that are actually not beneficial in the long term. In such cases, it becomes essential to use the expectations and calculate the expected medical costs. Such methods usually help in differentiating between plans and making a wise decision about medical insurance. To get a better idea about this case, let’s consider the example given below. 

Example: Vasu wants to buy a medical insurance plan, but he is confused between plan A and plan B. 

Plan A: This is a low deductible plan, he will have to pay the first 10,000 rupees of any medical costs. Additionally, to cover the plan, he will have to pay Rs80,000 per year. 

Plan B: This is a high deductible plan, he will have to pay the first 25,000 rupees of any medical costs. Additionally, to cover the plan, he will have to pay Rs 60,000 per year. 

Find the expected cost for both plans and help Vasu decide. A table is given which gives the stats about the probability of these medical expenses. 

Medical CostProbability
Rs 0 30 %
Rs 1000025 %
Rs 40,00020 %
Rs 70,00020 %
Rs 1,50,0005 %

Solution: 

Let the random variable X define the expected cost, 

Expected Value for Plan A: 

E(X) = 80,000 + 0 (0.3) + 10000(0.25) + 10000(0.2) + 10000(0.2) + 10000(0.05) 

⇒ E(X) = 80,000 + 2500 + 2000 + 2000 + 500 

⇒ E(X) = 87000 

Expected value for plan B: 

E(X) = 60,000 + 0 (0.3) + 10000(0.25) + 25000(0.2) + 25000(0.2) + 25000(0.05) 

⇒ E(X) = 80,000 + 2500 + 5000 + 5000 + 12500 



⇒ E(X) = 1,05,000

Expected expenses are most in plan B. Thus, Vasu should take plan A. 

Let’s see some problems on these concepts. 

Sample Problems

Question 1: Find the expected value of the outcome when a die is rolled. 

Solution: 

Consider X is a random variable that represents the value that comes when a die is rolled. 

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

Now, since the die is a fair die, the probability of getting each outcome is equal. That is \frac{1}{6}

E(X) = \sum x_{i}P(X = x_i)

⇒ E(X) = P(X = 1)(1) + P(X = 2)(2) + P(X = 3)(3) + P(X = 4)(4) + P(X = 5)(5) + P(X = 6)(6)

⇒ E(X) = \frac{1}{6}(1 + 2 + 3 + 4 + 5 + 6)

⇒ E(X) = 3

Question 2: A company makes phones. Out of 100 phones, one is faulty. For each phone, the company makes a profit of Rs2,000 and a loss of Rs 10,000 for the faulty phone. Find the expected profit. 

Solution: 

Let X be expected profit

E() = \sum x_{i}P(X = x_i)

⇒ E(X) = P(X = Phone is working)(2000) + P(X = faulty phone)(10,000) 

⇒ E(X) = \frac{49}{50}.2000 + \frac{1}{50}(-10,000) \\ = 1960 -200 \\ = 1760

⇒ E(X) = 1760

Question 3: In a three-time coin toss experiment. Find the expected number of heads. 

Solution: 

Let X be the number of heads obtained 

Sample Space = {HHH, HHT, HTH, HTT, THH, THT, TTH, TTT}

E() = \sum x_{i}P(X = x_i)

⇒ E(X) =P(X = 0)(0) + P(X = 1)(1) + P(X =2)(2) + P(X = 3)(3)

Finding out the probabilities, 

P(X = 0) = \frac{1}{8}

P(X = 1) = \frac{3}{8}

P(X = 2) = \frac{3}{8}

P(X = 3) = \frac{1}{8}



⇒ E(X) = P(X = 0)(0) + P(X = 1)(1) + P(X =2)(2) + P(X = 3)(3)

⇒ E(X) = \frac{1}{8}. 0 + \frac{3}{8}.1 + \frac{3}{8}.2 + \frac{1}{8}.3

⇒ E(X) =\frac{12}{8}

⇒ E(X) = 1.5

Question 4: Two friends are fishing in a pond that contains 5 trout and 5 sunfish. Each time they catch a fish, they release it back immediately. They made a bet. If the next three fishes friend A catches are all sunfish, then friend B will pay him Rs 10, otherwise, friend A will have to pay Rs 2 to B. Find the expected profit from the bet. 

Solution: 

Let X be a random variable denoting the profit from the bet. 

E(X) = P(A catches all three sunfish)(10) + P(A cannot catch all three sunfish)(-2)

Computing the probabilities, 

P(A catches all three sunfish) = \frac{5}{10}.\frac{5}{10}.\frac{5}{10} = \frac{1}{8}

P(A doesn’t catch all three sunfish) = 1 – P(A catches all three sunfish)

                                                                = 1 – \frac{1}{8}

                                                                = \frac{7}{8}

Substituting the values computed above into the expectation equation, 

E(X) = P(A catches all three sunfish)(10) + P(A cannot catch all three sunfish)(-2)

⇒ E(X) = P(A catches all three sunfish)(10) + P(A cannot catch all three sunfish)(-2)

⇒ E(X) = \frac{1}{8}.10 + \frac{7}{8}.(-2)

⇒ E(X) = \frac{-4}{8} = -\frac{1}{2}

Question 5: Find the expected value of the outcome when a die is rolled. Given that the die is not fair, the probability of getting a 6 is 0.4 and the rest of the numbers are equally likely. 

Solution: 



Consider X is a random variable that represents the value that comes when a die is rolled. 

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

Now, since the die is not fair die, 

P(6) = 0.4 

P(1) = P(2) = P(3) = P(4) = P(5) = 0.12

E(X) = \sum x_{i}P(X = x_i)

⇒ E(X) = P(X = 1)(1) + P(X = 2)(2) + P(X = 3)(3) + P(X = 4)(4) + P(X = 5)(5) + P(X = 6)(6)

⇒ E(X) = (0.12)(1) + (0.12)(2) + (0.12)(3) + (0.12)(4) + (0.12)(5) + (0.4)(6)

⇒ E(X) = (0.12)(1 + 2 + 3+ 4+ 5) + 2.4

⇒ E(X) = 1.8 + 2.4 

⇒E(X) = 4.2




My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!