### Explain and apply the concepts of random variables

Given a random experiment, with sample space, $$S$$, we can define the possible values of $$S$$ as a random variable. Random variables can be discrete or continuous.

A discrete random variable is a variable whose range of possible values is from a specified list.

A probability density function(sometimes called the probability mass function if the variable is discrete) is a function that describes the relationship between a random variable, $$X$$, and the probability of each value of $$x$$ occurring.

Example

The probability density function shown in the graph below can be written as:

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

The probability density (or mass) function of a discrete random variable has the following properties:

1. $$f \left(x \right) > 0,\quad x € S;\quad$$ meaning all individual probabilities must be greater than zero
2. $${ \Sigma }_{ x\in S }f\left( x \right)=1; \quad$$meaning the sum of all individual probabilities must equal one
3. $$P\left( X\in A \right) ={ \Sigma }_{ x\in A }f\left( x \right) \quad$$,where $$A\subset S;\quad$$meaning the probability of event $$A$$ is the sum of the probabilities of the values of $$X$$ in $$A$$.

If we are interested in cumulative probabilities then we can use the cumulative distribution function, or cdf, which is defined by the function shown below:

$$F\left( x \right) =P\left( X\le x \right) ,\quad \quad -\infty <x<\infty$$

Example

The cumulative distribution function for the probability density function shown above can be written as:

$$F\left( x \right) =\begin{cases} 0, & x<1 \\ .2, & 1\le x<2 \\ .5, & 2\le x<3 \\ .8, & 3\le x<4 \\ 1, & x\ge 4 \end{cases}$$

A continuous random variable is a random variable that has an infinite number of possible values.

The probability density function, $$f(x)$$, of a continuous random variable is a differential equation with the following properties:

1. $$f\left( x \right)\ge 0$$ meaning the function (all probabilities) is always greater than zero
2. $$\int _{ -\infty }^{ \infty }{ f\left( x \right)dx=1 }$$ meaning the sum of all the possible values (probabilities) is one

It is important to note that unlike the probability density function of a discrete random variable, the probability density function of a continuous random variable is not a probability. In order to calculate a probability using a probability density function, the following function must be used;

$$P\left( X < a \right) =P\left( X\le a \right) =F\left( a \right) =\int _{ -\infty }^{ a }{ f\left( x \right) dx }$$

Also, it is important to note that the probability of any individual value of a probability density function is zero, as shown in the formula below:

$$P\left( X=a \right) =\int _{ a }^{ a }{ f\left( x \right) dx=0 }$$

Example

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

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

1. Calculate C.

\begin{align*}& \int _{ 0 }^{ 1 }{ \left( { x }^{ 2 }+C \right) dx=1 } \\& { \left[ \frac { { x }^{ 3 } }{ 3 } +Cx \right] }_{ x=0 }^{ x=1 }=1 \\& {1}/{3} + C = 1 \\& C = {2}/{3} \\\end{align*}

2. Calculate $$P (X > {\frac {1}{2})}$$.

\begin{align*}& \int _{ { {1}/{2}} }^{ 1 }{ \left( { x }^{ 2 }+{ {2}/{3}} \right) dx } \\& { \left[ \frac { { x }^{ 3 } }{ 3 } +{ {2}/{3}}x \right] }_{ x={\frac {1}{2}} }^{ x=1 } \\& \left[ {1}/{3}+{2}/{3} \right] – \left[{1}/{24}+{1}/{3} \right] = {5}/{8} \\\end{align*}

Conditional probabilities of random variables can be calculated in a similar way to empirical conditional

probabilities as shown in the formula below:

$$P\left( A|B \right) =\frac { P\left( A\cap B \right) }{ P\left( B \right) }$$

Let event $$A$$ be $$X > 2$$ and event $$B$$ be $$X < 4$$ then

$$P\left( A|B \right) =\frac { P\left( 2<X<4 \right) }{ P\left( X<4 \right) }$$

Example

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

$$f\left( x \right) =\begin{cases} { x }^{ 2 }+{2}/{3}, & 0 < x < 1 \\ 0, & otherwise \end{cases}$$

1. Calculate $$P \left(X > {\frac {3}{4}} | X > {\frac {1}{2}} \right)$$.

\begin{align*}& P \left(X < {\frac {3}{4}} | X > {\frac {1}{2}} \right ) ={ P \left( {\frac {1}{2}} < X < {\frac {3}{4}} \right) } /{ P \left(X > {\frac {1}{2}} \right)} \\& P \left( {\frac {1}{2}} < X < {\frac {3}{4}} \right) = \\& \int _{ { 1 }/{ 2 } }^{ { 3 }/{ 4 } }{ \left( { x }^{ 2 }+{ 2 }/{ 3 } \right) dx } \\& { \left[ \frac { { x }^{ 3 } }{ 3 } +{ {2}/{3}}x \right] }_{ x={ {1}/{2}} }^{ x={3}/{4} } = .265625 \\& {.265625}/\left({5}/{8} \right) = .425 \\\end{align*}

Learning Outcome

Topic 2.a – b: Univariate Random Variables – Explain and apply the concepts of random variables, probability and probability density functions, cumulative distribution functions & Calculate conditional probabilities.