Home Â» What Are Random Variables?

# What Are Random Variables?

A random variable, typically denoted as X, is a variable whose possible values are outcomes of a random process.

There are two types of random variables: discrete and continuous.

### Discrete Random Variables

AÂ discrete random variableÂ is a variable which can take on only a countable number of distinct values like 0, 1, 2, 3, 4, 5â€¦100, 1 million, etc. Some examples of discrete random variables include:

• The number of times a coin lands on tails after being flipped 20 times.
• The number of times a dice lands on the numberÂ 4Â after being rolled 100 times.
• The number of defective widgets in a box of 50 widgets.

AÂ probability distributionÂ for a discrete random variable tells us the probability that the random variable takes on certain values.

For example, suppose we roll a fair die one time. If we let X denote the probability that the die lands on a certain number, then the probability distribution can be written as:

• P(X=1): 1/6
• P(X=2): 1/6
• P(X=3): 1/6
• P(X=4): 1/6
• P(X=5): 1/6
• P(X=6): 1/6

Note:

Â

For a probability distribution to be valid, it must satisfy the following two criteria:

Â

1.Â The probability for each outcome must be between 0 and 1.

2.Â The sum of all of the probabilities must add up to 1.

Â

Notice that the probability distribution for the die roll satisfies both of these criteria:

Â

1. The probability for each outcome is between 0 and 1.

2. The sum of all of the probabilities add up to 1.

We can use a histogram to visualize the probability distribution:

AÂ cumulative probability distributionÂ for a discrete random variable tells us the probability that the variable takes on a valueÂ equal to or less thanÂ some value.

For example, the cumulative probability distribution for a die roll would look like:

• P(Xâ‰¤1): 1/6
• P(Xâ‰¤2):Â 2/6
• P(Xâ‰¤3):Â 3/6
• P(Xâ‰¤4):Â 4/6
• P(Xâ‰¤5):Â 5/6
• P(Xâ‰¤6):Â 6/6

The probability that the die lands on a one or less is simply 1/6, since it canâ€™t land on a number less than one.

The probability that it lands on a two or less is P(X=1) + P(X=2) = 1/6 + 1/6 = 2/6.

Similarly, the probability that it lands on a three or less isÂ P(X=1) + P(X=2) + P(X=3) = 1/6 + 1/6 + 1/6 = 3/6, and so on.

We can also use a histogram to visualize the cumulative probability distribution:

### Continuous Random Variables

AÂ continuous random variableÂ is a variable which can take on an infinite number of possible values. Some examples of continuous random variables include:

• Weight of an animal
• Height of a person
• Time required to run a marathon

For example, the height of a person could be 60.2 inches, 65.2344 inches, 70.431222 inches, etc. There are an infinite amount of possible values for height.

Rule of Thumb:

Â

If you canÂ countÂ the number of outcomes, then you are working with a discrete random variable â€“ e.g. counting the number of times a coin lands on heads.

Â

But if you canÂ measureÂ the outcome, you are working with a continuous random variable â€“ e.g. measuring height, weight, time, etc.

AÂ probability distributionÂ for a continuous random variable tells us the probability that the random variable takes on certain values.

However, unlike a probability distribution for discrete random variables, a probability distribution for a continuous random variable can only be used to tell us the probability that the variable takes on a rangeÂ of values.

For example, suppose we want to know the probability that a burger from a particular restaurant weighs a quarter-pound (0.25 lbs). SinceÂ weightÂ is a continuous variable, it can take on an infinite number of values.

For example, a given burger might actually weight 0.250001 pounds, or 0.24 pounds, or 0.2488 pounds. The probability that a given burger weights exactly .25 pounds is essentially zero.

Thus, we could only use a probability distribution to tell us the probability that a burger weighs less than 0.25 lbs, more than 0.25 lbs, or between some range (e.g between .23 lbs and .27 lbs).