1win aviator game

Random variables – Examples

Example 1

A waiter at the restaurant starts its shift with $0$ dollars. Every guest gives him $5$ or $10$ dollars as a tip, with $5$ dollar tip being $2$ times more probable than $10$te: dollar one. That morning, the waiter served $4$ guests. Calcula

(a) Probability of waiter getting less than $30$ dollars in tips.
(b) Expected sum of tips after $4$ guests


(a) Let $X$ and $Y$ represent the number of tips of $5$ or $10$ dollars. They are binomial random variables: $X \sim B(4, \frac{2}{3})$, $Y \sim B(4, \frac{1}{3})$. Lets see all the possibilities of getting less than $30$ in total. For easier calculation, we can write all the possibilities in a table.

random-variables-examples 2023

Consequently, there are only two possible outcomes for waiter to get less than $30$ dollars in tips.

$$P(5X+10Y  < 30) = P(\{ X=4, Y=0\} \cup P(\{ X=3, Y=1\}=$$

$$= P(\{ X=4, Y=0\} + P(\{ X=3, Y=1\}$$

Since $X$ and $Y$ are binomial random variables, we can easily calculate these probabilities using the formula we explained in previous lesson: $P(X=k)= \displaystyle{ {n}\choose{k}} \cdot p^{k}\cdot q^{n-k}$

For $X=3$ we have:

$$P(X=3)= \displaystyle{{4}\choose{3}}\cdot \Big(\frac{2}{3}\Big)^{3}\cdot \Big(\frac{1}{3}\Big)^{1}$$

and for $X=4$  we have:

$$P(X=4)= \displaystyle{{4}\choose{4}} \cdot \displaystyle{\Big(\frac{2}{3} \Big)}^{4}\cdot \Big(\frac{1}{3} \Big)^{0}$$

Those two probabilities combined give us:$$P(X=3) + P(X=4)=0.5926$$

(b) We know that the expected value of binomial variable is calculated: $EX=n \cdot p$

$$E[X+Y]=E[5X]+E[10Y] = 5E[X]+10E[Y]= 5 \cdot 4\cdot \frac{2}{3} + 10 \cdot 4\cdot \frac{1}{3} \approx 26.66$$


Example 2

There are $6$ light bulbs in a box. $4$ of them are defected, and $2$ are working properly. We try each light bulb one after another, and throw it away if it’s not working. Let $X$ be the number of trials until we get light. Find the expected value and variance of $X$.


$X$ is the number of trials until the right bulb. However, this is not geometric random variable, since we throw away the one that’s not working. Consequently, the number of bulbs changes with each pick. $X$ can have values $\{1,2,3,4,5\}$. Each of them represents the number of trial in which we got the working bulb.

$\bullet$ $X=1$ we chose the right bulb in the first trial
$\bullet$ $X=2$ we picked defected bulb, and then the one that works properly, and so on…

Lets calculate the probability of each value.

  • $P(X=1) = \frac{2}{6}=\frac{1}{3}$ $\rightarrow$ we picked working light bulb in the first trial
  • $P(X=2) = \frac{4}{6} \cdot \frac{2}{5} =\frac{4}{15}$ $\rightarrow$ first we picked one defected bulb ( there are $4$ of them). The next bulb we picked was working one, but in that moment we had one bulb less in the box, therefore  $\frac{2}{5}$
  • $P(X=3)= \frac{4}{6} \cdot \frac{3}{5} \cdot  \frac{2}{4} =\frac{1}{5}$ $\rightarrow$ Similarly as before, we pulled two defected ones and left them outside of the box. The third light bulb was the one we wanted.

Following the same process,

  • $P(X=4) =\frac{2}{15}$
  • $P(X=5)=\frac{1}{15}$

Finally, the distribution of $X$ looks like this:

random-variables-examples 2023

Let’s calculate expected value:

$$\displaystyle{E[X]= \frac{1}{3}+ 2 \cdot \frac{4}{15} + 3\cdot \frac{1}{5} + 4 \cdot \frac{2}{15} + 5 \cdot \frac{1}{15} =  \frac{7}{3}}$$

And variance is $Var(X)= E[X^{2}]-(E[X])^{2}$

$$\displaystyle{E[X^{2}]=\frac{1}{3}+ 2^{2} \cdot \frac{4}{15} + 3^{2}\cdot \frac{1}{5} + 4^{2}\cdot \frac{2}{15} + 5^{2} \cdot \frac{1}{15} =  7 }$$


Finally, variance is


Example 3 

Random vector $(X,Y)$ has distribution:

random-variables-examples 2023

for $a>0$.

(a) Are random variables X and Y independent?
(b) Are random variables X+Y and X-Y independent?


(a) From the table of distribution of random vector $(X,Y)$ we can find the distribution of each random variable. In this case, they are the same and look like this: random-variables-examples 2023

Remember, $X$ and $Y$ are independent if and only if $$p_{i,j}=P(X=a_{i}, Y=b_{j})=P(X=a_{i}) P( Y=b_{j})=q_{i} r_{j}, \forall i,j \in \mathbb{N}$$

The easier way to check for independence is to look zeros. For example: $$P(X=-a, Y=-a)\stackrel{?}{=} P(X=-a) \cdot P(Y=-a) $$

Which is equal to $$0 \neq \frac{1}{4} \cdot \frac{1}{4}$$ Consequently, $X$ and $Y$ aren’t independent variables.

(b) Firstly, lets find the distributions of $X+Y$ and $X-Y$

The possible outcomes for $X+Y$ are $\{-2a,-a,0,a,2a \}$. However, the probabilities of  $\{-2a,0,2a \}$ are $0$. Why? Lets see:

$\bullet$ $X+Y=-2a \Longleftrightarrow X=-a$ and $ Y=-a$

The probability of $(X=-a, Y=-a)$ can be find in the table of distribution of random vector $(X,Y)$ and it’s equal to $0$. Consequently, $P(X+Y=-2a)=0$. Similarly for $X+Y=0$ and $X+Y=2a$.

$\bullet$ $X+Y=-a \Longleftrightarrow X=-a, Y=0$ or $X=0, Y=-a$

We know that $P(X=-a,Y=0)=\frac{1}{4}$ and $P(X=0,Y=-a)=\frac{1}{4}$. Consequently, $P(X+Y=-a)=\frac{1}{4}+\frac{1}{4}=\frac{1}{2}$. Analogously for $X+Y=a$. Finally, the distribution of $X+Y$ looks like this:

random-variables-examples 2023

Note that we didn’t put values $\{-2a,0,2a \}$ into the table. That’s because their probabilities are equal to $0$.

For $X-Y$ we’ll show another way of finding its distribution. We’ll use one more table that will help us determine the right values. However, it will NOT be the table of distribution. It’s a tool to help us find the right distribution. We’ll write is as the distribution of random vector $(X,Y)$ but instead of writing probabilities, we will write the values of $X-Y$ for each $X$ and $Y$.

random-variables-examples 2023

Consequently, this table represents all the possible values for $X-Y$. For example, if $X=-a$ and $Y=-a$, then the $X-Y=0$ and so on. How do we find the probabilities of each value? We compare this table with the table of $(X,Y)$ and put the probabilities on the same spot they were in that vector.random-variables-examples 2023

The only values that have probabilities different than $0$ are $-a$ and $a$. Other values cannot happen. From this table we have:

$\bullet$ $X-Y=a \Longleftrightarrow (X=0,Y=-a)$ or $(X=a, Y=0)$.

Consequently, $P(X-Y=a)=P(X=0,Y=-a)+P(X=a, Y=0)=\frac{1}{4}+\frac{1}{4}=\frac{1}{2}$. Similarly, $P(X-Y=-a)=\frac{1}{2}$.

Finally, the distribution of $X-Y$ is random-variables-examples 2023

To find if $X+Y$ and $X-Y$ are independent, we need to find the distribution of random vector $(X+Y,X-Y)$.

Lets summary values. The only possible values are combinations of $-a$ and $a$:

random-variables-examples 2023

The number of possible combinations that give us outcome different than $0$ is $4$. The probability of $(X+Y=a, X-Y=a)$ is $\frac{1}{4}$ since they match only once out of $4$ possible outcomes. Probability of $X+Y=a$ and $X-Y=-a$ is $\frac{1}{4}$ because of the same reason.

Consequently, random vector $(X+Y,X-Y)$ has distribution:

random-variables-examples 2023Now that we have the distribution of random vector, it’s easy to see if they are independent.

$\bullet$ $P(X+Y=-a, X-Y=-a)=P(X+Y=-a)\cdot P(X-Y=-a)=\frac{1}{2} \cdot \frac{1}{2}=\frac{1}{4}$

$\bullet$ $P(X+Y=-a, X-Y=a)=P(X+Y=-a)\cdot P(X-Y=a)=\frac{1}{2} \cdot \frac{1}{2}=\frac{1}{4}$

So far the probabilities are equal. Lets see for the last two combinations:

$\bullet$ $P(X+Y=a, X-Y=-a)=P(X+Y=a)\cdot P(X-Y=-a)=\frac{1}{2} \cdot \frac{1}{2}=\frac{1}{4}$

$\bullet$ $P(X+Y=a, X-Y=a)=P(X+Y=a)\cdot P(X-Y=a)=\frac{1}{2} \cdot \frac{1}{2}=\frac{1}{4}$

In conclusion, since all the probabilities are equal, random variables $X+Y$ and $X-Y$ are independent.

Example 4 

There are $10$ bills in a bag. There are four $10$ dollar bills and six $100$ dollar bills. Paul randomly pull one bill and puts it in his wallet. Lets say $X_{1}$ represents the value of the first bill. After that, Mark pulls another bill out of the bag and puts it in his wallet. The value of the second bill is noted with $X_{2}$.

(a) Find the distribution of the random vector $(X_{1}, X_{2})$.
(b) Find the correlation coefficient of random variables $X_{1}$ and $X_{2}$.
(c) Find the expected amount of money in Mark’s wallet.


(a) We know that both $X_{1}$ and $X_{2}$ can have values $10$ or $100$.

To find the distribution of random vector we need to find probability of each possible outcome.

$\bullet$ $P(X_{1}=10, X_{2}=10)=\frac{6}{10}\cdot \frac{5}{9} = \frac{1}{3}$

$\bullet$ $P(X_{1}=10, X_{2}=100)=\frac{6}{10}\cdot \frac{4}{9} = \frac{4}{15}$


$\bullet$ $P(X_{1}=100, X_{2}=10)=\frac{4}{10}\cdot \frac{6}{9} = \frac{4}{15}$

$\bullet$ $P(X_{1}=100, X_{2}=100)=\frac{4}{10}\cdot \frac{3}{9} = \frac{2}{15}$

Finally, the distribution of random vector $(X_{1}, X_{2})$ looks like this:
random-variables-examples 2023

(b) For correlation coefficient we need distributions of $X_{1}$ and $X_{2}$. We can easily read them from the distribution of their random vector. random-variables-examples 2023

Remember, the formula for correlation coefficient is $$\rho (X_{1}, X_{2})= \frac{Cov(X_{1}, X_{2})}{\sqrt{Var(X_{1})} \sqrt{Var(X_{2})}}$$ Remember, covariance is defined as $Cov(X_{1}, X_{2})= E[X_{1}, X_{2}] -E[X_{1}] \cdot E[X_{2}]$

Firstly, lets calculate needed expected values:

$\bullet$ $E[X_{1}, X_{2}]=10 \cdot 10 \cdot \frac{1}{3} + 10 \cdot 100 \cdot \frac{4}{15} + 100 \cdot 10 \cdot \frac{4}{15} + 100 \cdot 100 \cdot \frac{2}{15} = 1900$

$\bullet$ $E[X_{1}]=E[X_{2}]=10 \cdot \frac{3}{5} + 100 \cdot \frac{2}{5} = 46$

Consequently,  $Cov(X_{1}, X_{2})=1900- 46 \cdot 46 = -216$


$\bullet$ $Var(X_{1})=Var(X_{2})= E[X_{1}^{2}]-(E[X_{1}])^{2}=10^{2} \cdot \frac{3}{5} + 100^{^2} \cdot \frac{2}{5} – 46^{2}=1944$

Since $Var(X_{1})=Var(X_{2}), Var(X_{2})=1944$

Finally, $$\rho (X_{1}, X_{2})= \frac{-216}{\sqrt{1944} \sqrt{1944}}=-0.1111$$

(c) To find the expected amount of money in Mark’s wallet we actually need the expected value of $X_{1} +  X_{2}$.
It can have values $20, 110$ and $200$.  He has 20 dollars if $(X_{1}=10,  X_{2}=10)$. The probability of that happening is $\frac{1}{3}$. He has 110 dollars in cases where $(X_{1}=10,  X_{2}=100)$ or $(X_{1}=100,  X_{2}=10)$. We need to add up their probabilities and consequently $P(X_{1} +  X_{2}=110)=\frac{8}{15}$. And finally, Mark has 200 dollars only if $X_{1}=100$ and $X_{2}=100$. Probability of that event is $\frac{2}{15}$. Consequently, the distribution of $X_{1} +  X_{2}$ is: random-variables-examples 2023

Now it’s easy to calculate its expected value. $$E[X_{1} +  X_{2}]=20 \cdot \frac{1}{3} + 110 \cdot \frac{8}{15} + 200 \cdot \frac{2}{15}=92$$