# Random Variable

{% hint style="success" %}
A random variable is a variable that is subject to randomness, which means it can take on different values.
{% endhint %}

* In statistics, it is normal to use an `X` to denote a random variable.&#x20;
* The random variable takes on different values depending on the situation.
* Each value of the random variable has a probability or percentage associated with it.

### Discrete Random Variables

A discrete random variable is a variable that represents numbers found by counting. For example, number of marbles in a jar, number of students present or number of heads when tossing two coins.

{% hint style="info" %}
X is discrete because the numbers that X represents are isolated points on the number line.
{% endhint %}

The number of heads that can come up when tossing two coins is a discrete random variable because heads can only come up a certain number of times: 0, 1, or 2. Also, we want to know the probability associated with each value of the random values.

![A probability distribution for the number of heads (our random variable) when you toss two coins.](https://2552912007-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzGBVuquaFNrwdmJna0%2F-MBLKyQzjNz1tzqYl7-2%2F-MBLLQjobSmoEVRMDxZG%2FScreen%20Shot%202020-07-03%20at%202.23.54%20PM.png?alt=media\&token=3d9d9060-ffdf-4ea0-868a-85866e19fbe1)

A probability distribution has all the possible values of the random variable and the associated probabilities.&#x20;

### Continuous Random Variables

{% hint style="success" %}
When we have to use intervals for our random variable or all values in an interval are possible, we call it a continuous random variable.
{% endhint %}

Thus, continuous random variables are random variables that are found from measuring - like the height of a group of people or distance traveled while grocery shopping or student test scores.

{% hint style="info" %}
In this case, X is continuous because X represents an infinite number of values on the number line.
{% endhint %}

![](https://2552912007-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzGBVuquaFNrwdmJna0%2F-MBLKyQzjNz1tzqYl7-2%2F-MBLM49Eq5jWnXDh1wjj%2FScreen%20Shot%202020-07-03%20at%202.26.45%20PM.png?alt=media\&token=acd4f913-4edb-4633-a851-e3a62108e059)

Like the coin example, the random variable (in this case, the intervals) would have certain probabilities or percentages associated with it. And this would be a probability distribution for the test scores.

In the study of probability, we are interested in finding the probabilities associated with each value of these random variables.

![](https://2552912007-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LzGBVuquaFNrwdmJna0%2F-MBLMIN2nWH15JmYcSG3%2F-MBLMaH7vjJ4JWnFHNND%2FScreen%20Shot%202020-07-03%20at%202.28.45%20PM.png?alt=media\&token=7ecee868-2672-4922-92da-9cc086057110)

**Sum of Probabilities for a Distribution**\
On the above, in each table, the sum of all probabilities add up to 1 or 100%. However, for continuous random variables, we can construct a histogram of the table with relative frequencies, and the area under the histogram is also equal to 1.
