###### Apply Transformations

Transformations allow us to find the distribution of a function of random variables.... **Read More**

The **expected value of a discrete random variable** is the sum of all the values the variable can take times the probability of that value occurring.

$$ {E} \left( {X} \right)=\sum { {x}. {p} \left( {x} \right)} $$

The expected value of random variable \(X\) is often written as \({E} \left( {X} \right)\) or \({ \mu }\) or \({ \mu }\text{X}\).

Given the experiment of rolling a single die, calculate the expected value.

**Solution**

Using the result:

$$ {E} \left( {X} \right)=\sum { {x}.{p} \left( {x} \right)} $$

We have:

$$ {E} \left( {X} \right) =1\times \left(\cfrac{1}{6}\right)+2\times \left(\cfrac{1}{6}\right)+3\times \left(\cfrac{1}{6}\right)+4\times \left(\cfrac{1}{6}\right)+5\times \left(\cfrac{1}{6}\right)+6\times \left(\cfrac{1}{6}\right)= 3.5 $$

If \(\alpha\) and \(\beta\) are constants, then:

$$E(\alpha X)=a\bullet E(X)=a\bullet \sum{x\bullet P(x)}$$

And

$$E(\alpha X+\beta)=\alpha E(X)+\beta$$

If \(X\) is a continuous random variable with a probability density function \({f}\left( {x} \right)\), then the expected value (or mean) of \(X\) is given by

$$ E\left( X \right) =\int _{ -\infty }^{ \infty }{ xf\left( x \right)dx } $$

Where \(f(x)\) is the probability density function of \(x\).

Given the following probability density function of a continuous random variable:

$$ f\left( x \right) =\begin{cases} \cfrac { x }{ 2 } , & 0< x < 2 \\ 0, & otherwise \end{cases} $$

Calculate \(E(X)\).

$$ E\left( X \right) =\int _{ -\infty }^{ \infty }{ xf\left( x \right) dx } =\int _{ 0 }^{ 2 }{ x\bullet \frac { x }{ 2 } \bullet dx={ \left[ \frac { { x }^{ 3 } }{ 6 } \right] }_{ x=0 }^{ x=2 }=\frac { 8 }{ 6 } =\frac { 4 }{ 3 } } $$

The **mode of a discrete random variable** is the value that is most likely to occur.

Given the experiment of rolling two dice simultaneously, what is the mode of the probability distribution of the sum of the two dice?

**Solution**

As shown in the table below, the most likely value is 7 with a probability of \(\frac{6}{36}\) so the mode is 7.

$$ \begin{array}{c|c} {\bf x} & {\bf p(x)} \\ \hline 2 & {1}/{36} \\ \hline 3 & {2}/{36} \\ \hline 4 & {3}/{36} \\ \hline 5 & {4}/{36} \\ \hline 6 & {5}/{36} \\ \hline 7 & {6}/{36} \\ \hline 8 & {5}/{36} \\ \hline 9 & {4}/{36} \\ \hline 10 & {3}/{36} \\ \hline 11 & {2}/{36} \\ \hline 12 & {1}/{36} \\ \end{array} $$

As shown in the table below, the most likely value is 7 with a probability of \(\cfrac{6}{36}\), so the mode = 7.

The **mode of a continuous random variable** is the value at which the probability density function, \(f(x)\), is at a maximum.

It is a value that is most likely to lie within the same interval as the outcome.

Consequently, often we will find the mode(s) of a *continuous random variable* by solving the equation:

$$ {f}^{\prime} \left( \text{x} \right)=0 $$

**Remember:** For the case of *continuous random variables,* the probability of a specific value occurring is 0, \(P(X=k)=0\), and the mode is a specific value.

Given the following probability density function of a continuous random variable, find the mode of the distribution. $$ f\left( x \right) =\begin{cases} -{ x }^{ 2 }+2x-\cfrac { 1 }{ 6 } , & 0 < x < 2 \\ 0, & otherwise \end{cases} $$ To find the maximum of \(f(x)\), find the first derivative and set that value equal to zero as shown below:

\( {f}^{\prime} (x)= -2x+2=0 \)

Then solve for \(x\).

\(-2x = -2\)

\(x = 1\)

So, the mode of the distribution is 1.

Th**e median of a discrete distribution** is the value of \(X\) for which \(P(X \le x)\) is greater than or equal to 0.5 and \(P(X \ge x)\) is greater than or equal to 0.5.

Given the following probability density function of a discrete random variable, calculate the median of the distribution:

$$ {f}\left( {x} \right) =\begin{cases} 0.2,{x}=1,4 & \\ 0.3,{x}=2,3, & \end{cases} $$

**Solution**

The median of the distribution above is 2 because:

$$ P(X \le 2) = P(X=1)+P(X=2) = .2+.3 = .5$$

and,

$$P(X \ge 2) = P(X=2)+P(X=3)+P(X=4) = .3+.3+.2 = .8. $$

The **median of a continuous distribution** can be defined by the value \(c\) in the formula shown below:

$$ \int _{ -\infty }^{ c }{ f\left( x \right)dx=0.5 } $$

That is, it is the value for which the area under the curve from negative infinity to \(c\) is equal to 0.5. The median is also referred to as the 50^{th} percentile.

Given the following probability density function of a continuous random variable, find the median of the distribution.

$$ {f}\left( {x} \right)=\begin{cases} -{x}^{ 2 }+2 {X}-\frac {1}{6}, & 0 < x < 2\\ 0, & \text{otherwise}\\ \end{cases}$$

**Solution**

We need,

$$ \begin{align*} & {P}\left({x}\le{{m}}\right)=0.5 \\ &\Rightarrow \int _{ -\infty }^{ {m} }{ \left(-{ {x} }^{2}+2{x}-\cfrac{1}{6}\right){dx}=0.5}\\ &=\left[-\cfrac{{ {x} }^{3}}{3}+{ {x} }^{2}-\cfrac{1}{6} { {x} }\right]_{{ {x} }=0}^{ { {x} }={ {m} }}=0.5 \\ &=-\cfrac{{ {m} }^{3}}{3}+{ {m} }^{2}-\cfrac{1}{6}\times {c}=0.5 \\ &\Rightarrow { {m} }=1 \end{align*} $$

In general, the ** p^{th} percentile of a discrete distribution** is the value of \(x\) for which \(P(X \le x)\) is greater than or equal to \(\frac {p}{100}\) and \(P(X \ge x)\) is greater than or equal to \(1-\frac {p}{100}\).

Given the following probability density function of a discrete random variable, calculate the 75^{th} percentile of the distribution:

$$ {f}\left( {x} \right) =\begin{cases} 0.2,{x}=1,4 & \\ 0.3,{x}=3,4 & \end{cases} $$

**Solution**

We need:

$$ {P}\left({X} \le {{p} }_{0.75} \right) = .75 $$

So,

$$ \begin{align*} {P}\left({X} \le {3} \right) & = {P}\left({X} = {1} \right) + {P}\left({X} = {2} \right) + {P}\left({X} = {3} \right)=0.2 + 0.3 + 0.2 \\ & = 0.7 < 0.75 \\ {P}\left({X} \le {4} \right) & = {P}\left({X} = {1} \right) + {P}\left({X} = {2} \right) + {P}\left({X} = {3} \right) + {P}\left({X} = {4} \right) \\ & = 0.2 +0.3 + 0.2 + 0.3 = 1.0 > 0.75 \\ {P}\left({X} \le {4} \right) & =({P}\left({X} = {4} \right)=0.2 < 0.25 = 1 – \left( \cfrac{75}{100} \right) \end{align*} $$

So, the 75^{th} percentile of the distribution is 4.

In general, the p^{th} percentile of a **continuous distribution** can be defined as the value of \(C\) for which:

$$ \int _{ -\infty }^{ \infty }{ {f}\left( {x} \right) {dx} }=\cfrac{ {p} }{100} $$

Given the following probability density function of a continuous random variable, find the 25^{th} percentile:

$$ {f}\left( {x} \right)=\begin{cases} -\text{x}^2+2\text{x}-\frac {1}{6}, & 0 < \text{x} < 2\\ 0, & \text{elsewhere}\\ \end{cases}$$

**Solution**

We need:

$$ \begin{align*} &{P}\left({x}\le{{c}}\right)=0.25 \\ &\Rightarrow \int _{ 0 }^{ {c} }{ \left(-{ {x} }^{2}+2{x}-\cfrac{1}{6}\right){dx}=\cfrac{25}{100}=0.25}\\ &\int _{ 0 }^{ c}{ \left(-{ {x} }^{2}+2{x}-\cfrac{1}{6}\right) {dx}=0.25} \\ &\left[-\cfrac{ { {x} }^{3} }{3}+2 {x}-\cfrac{1}{6} {x} \right]_{{{x}}=0}^{{x}={c}}=0.25 \\ &-\cfrac{ { {c} }^{3} }{3}+{ {c} }^{2}-\cfrac{1}{6}\times{ {c} }=0.25 \\ &{ {c} }=0.69 \end{align*} $$

**Learning Outcome**

**Topic 2.c: Univariate Random Variables – Explain and calculate expected value, mode, median, percentile, and higher moments.**