# Random Variable

We can define a random variable for a quantity of interest by assigning a numerical value to each event in a sample space . The sum of the probabilities for all values of a random variable is $1$ .

**
Example 1:
**

In an experiment of tossing a coin twice, the sample space is

$\text{{HH,HT,TH,TT}}$ .

In this experiment, we can define random variable $X$ as the total number of tails. Then $X$ takes the values $0,1$ and $2$ .

The table illustrates the probability distribution for the above experiment.

$\begin{array}{|llll|}\hline \text{Number}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{of}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{Tails}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\left(X\right)\hfill & 0\hfill & 1\hfill & 2\hfill \\ \text{Probability}\hfill & \frac{1}{4}\hfill & \frac{1}{2}\hfill & \frac{1}{4}\hfill \\ \hline\end{array}$

The notation $P\left(X=x\right)$ is usually used to represent the probability of a random variable, where the $X$ is random variable and $x$ is one of the values of random variable.

$P\left(X=0\right)=\frac{1}{4}$ is read as "The probability that $X$ equals $0$ is one-fourth."

The above definition and example describe discrete random variables... those that take a finite or countable number of values. A random variable may also be continuous, that is, it may take an infinite number of values within a certain range.

**
Example 2:
**

A dart is thrown at a dartboard of radius $9$ inches. If it misses the dartboard, the throw is discounted. Define a random variable $X$ as the distance in inches from the dart to the center.

$0\le X<9$