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, that ** that **every outcome of the sample space must be given a value by a random variable.

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**

**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 random variable X which assumes values x

_{1}, x_{2}, x_{3},…x_{n }with probability P(x_{1}), P(x_{2}), P(x_{3}), … P(x_{n})Expectation of X is defined as,Â

E(x) =Â [Tex]\sum P(x_{i})x_{i} [/Tex]

## 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.Â

## Properties of Expected Value

Some basic properties of expected values a

- Linearity Principle: For two random variables X and Y =>
**E(X + Y) = E(X) + E(Y)** - For a constant C and a random variable X =>
**E(X + C) = E(X) + C** - For a constant C and a random variable X =>
**E(CX) = C Ã— E(X)**

where,

and**E(X)**represented value of any variable**E(Y)**is Constant**C**

**Term Life Insurance and Death Probability**

**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

Ratio becomesÂ [Tex]\frac{5,00,000}{50,00,000} = \frac{1}{10}[/Tex]. 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Â [Tex]\frac{1}{10}[/Tex]Â 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**

**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 |
---|---|

1 | A |

2 | 110 |

3 | 95 |

4 | 70 |

5 | 75 |

6 | B |

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) =Â [Tex]\sum P(x_{i})x_{i} [/Tex]

[Tex]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 \\[/Tex]

Substituting the expected value,Â

[Tex]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 [/Tex]

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**

**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Â

Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â =Â [Tex]\frac{1}{10}.\frac{1}{10} = \frac{1}{100} [/Tex]

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

Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â =Â [Tex]2.\frac{1}{10}.\frac{9}{10} = \frac{18}{100} [/Tex]

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

Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â =Â [Tex]\frac{9}{10}.\frac{9}{10} = \frac{81}{100} [/Tex]

Substituting these values,Â

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

â‡’ E(X) =Â [Tex]\frac{1}{100}.10000 + \frac{18}{100}.1000 + \frac{81}{100}.(-5) [/Tex]

â‡’ E(X) =Â 100 + 180 – 4.05

â‡’E(X) = 275.95

**Expected Value while Fishing**

**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) =Â [Tex]\frac{10}{20}.\frac{10}{20}.\frac{10}{20} = \frac{1}{8} [/Tex]

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

Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â = 1 –Â [Tex]\frac{1}{8} [/Tex]

Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â =Â [Tex]\frac{7}{8} [/Tex]

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) =Â [Tex]\frac{1}{8}.100 + \frac{7}{8}.(-20)Â [/Tex]

â‡’ E(X) =Â [Tex]\frac{-40}{8} = -5 [/Tex]

**Comparing Insurance with Expected Value**

**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 Rs 80,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 Cost | Probability |
---|---|

Rs 0Â | 30 % |

Rs 10000 | 25 % |

Rs 40,000 | 20 % |

Rs 70,000 | 20 % |

Rs 1,50,000 | 5 % |

**Solution:Â **

Let 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) = 60,000 + 2500 + 5000 + 5000 + 1250

â‡’ E(X) = 73,750

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

Let’s see some problems on these concepts.Â

## Problems on Expected Values

**Problem 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Â [Tex]\frac{1}{6} [/Tex]

E(X) =Â [Tex]\sum x_{i}P(X = x_i) [/Tex]

â‡’ 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) =Â [Tex]\frac{1}{6}(1 + 2 + 3 + 4 + 5 + 6) [/Tex]

â‡’ E(X) = 3

**Problem 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() =Â [Tex]\sum x_{i}P(X = x_i) [/Tex]

â‡’ E(X) = P(X = Phone is working)(2000) + P(X = faulty phone)(10,000)Â

â‡’ E(X) =Â [Tex]\frac{49}{50}.2000 + \frac{1}{50}(-10,000) \\ = 1960 -200 \\ = 1760 [/Tex]

â‡’ E(X) = 1760

**Problem 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() =Â [Tex]\sum x_{i}P(X = x_i) [/Tex]

â‡’ 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) =Â [Tex]\frac{1}{8} [/Tex]

P(X = 1) =Â [Tex]\frac{3}{8} [/Tex]

P(X = 2) =Â [Tex]\frac{3}{8} [/Tex]

P(X = 3) =Â [Tex]\frac{1}{8} [/Tex]

â‡’ E(X) = P(X = 0)(0) + P(X = 1)(1) + P(X =2)(2) + P(X = 3)(3)

â‡’ E(X) =Â [Tex]\frac{1}{8}. 0 + \frac{3}{8}.1 + \frac{3}{8}.2 + \frac{1}{8}.3 [/Tex]

â‡’ E(X) =[Tex]\frac{12}{8} [/Tex]

â‡’ E(X) = 1.5

** Problem 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) =Â [Tex]\frac{5}{10}.\frac{5}{10}.\frac{5}{10} = \frac{1}{8} [/Tex]

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

Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â = 1 –Â [Tex]\frac{1}{8} [/Tex]

Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â =Â [Tex]\frac{7}{8} [/Tex]

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) =Â [Tex]\frac{1}{8}.10 + \frac{7}{8}.(-2)Â [/Tex]

â‡’ E(X) =Â [Tex]\frac{-4}{8} = -\frac{1}{2} [/Tex]

**Problem 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) =Â [Tex]\sum x_{i}P(X = x_i) [/Tex]

â‡’ 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