Random Variables: Discrete and Continuous
So far, we have talked about probability in terms of events. To move further in statistics, we need a way to represent outcomes using numbers.
This is where random variables come into play. They form the bridge between probability and numerical analysis.
What Is a Random Variable?
A random variable is a variable whose value depends on the outcome of a random experiment.
In simple words, it assigns a numerical value to each possible outcome.
Random variables allow us to apply mathematical tools to probability problems.
Simple Example
Consider tossing a coin:
- If Heads occurs → assign value 1
- If Tails occurs → assign value 0
The value obtained (0 or 1) is a random variable because it depends on chance.
Types of Random Variables
Random variables are mainly classified into two types:
- Discrete Random Variables
- Continuous Random Variables
Discrete Random Variables
A discrete random variable takes only specific, countable values. These values are usually whole numbers.
There are gaps between possible values, meaning not every value within a range is possible.
Numerical Example (Discrete)
Let X represent the number of heads obtained when tossing two coins.
Possible values of X:
- 0 (no heads)
- 1 (one head)
- 2 (two heads)
Here, X can take only these three values, so it is a discrete random variable.
Real-World Examples (Discrete)
- Number of students in a class
- Number of defective products
- Number of customers visiting a store
Continuous Random Variables
A continuous random variable can take any value within a given range. These values are measurable and can include decimals.
There are no gaps between possible values.
Numerical Example (Continuous)
Let X represent the time (in minutes) taken to complete a task.
X could be:
- 5 minutes
- 5.2 minutes
- 5.25 minutes
Because X can take infinitely many values within a range, it is a continuous random variable.
Real-World Examples (Continuous)
- Height of a person
- Weight of a package
- Temperature of a room
- Time taken to finish a race
Key Differences Between Discrete and Continuous
| Aspect | Discrete Random Variable | Continuous Random Variable |
|---|---|---|
| Possible values | Countable values | Infinite values within a range |
| Nature | Usually whole numbers | Measured values |
| Examples | Number of calls, number of items | Height, weight, time |
Why Random Variables Are Important
Random variables allow us to:
- Represent random outcomes numerically
- Apply probability formulas
- Build probability distributions
- Model real-world uncertainty
Almost all advanced topics in statistics and data science are built on random variables.
Quick Check
Is the number of emails received in a day a discrete or continuous random variable?
Discrete random variable, because emails are counted.
Practice Quiz
Question 1:
Which of the following is a continuous random variable?
- A. Number of students
- B. Time taken to complete a task
- C. Number of goals scored
B — Time taken to complete a task.
Question 2:
Can a discrete random variable take decimal values?
No. Discrete random variables take countable values.
Question 3:
Which type of random variable is used for measuring height?
Continuous random variable.
Mini Practice
Classify the following as discrete or continuous:
- Number of cars passing a signal in an hour
- Amount of rainfall in a day
Number of cars is discrete. Amount of rainfall is continuous.
What’s Next
In the next lesson, we will study the Normal Distribution, one of the most important probability distributions in statistics.