---
title: "Discrete and continuous random variables"
subject: "Probability and Statistics"
chapter: 2
key: "semester_5/probability_and_statistics:discrete-continuous-rv-mean-variance"
source: https://www.bctengineer.com/q/semester_5/probability_and_statistics/discrete-continuous-rv-mean-variance
site: BCT Engineering
---

# Discrete and continuous random variables

Probability and Statistics · Chapter 2: Discrete Probability Distribution

- Asked in: 2075 Asoj, 4 marks
- Video: [Discrete and continuous random variables | Probability and Statistics | Khan Academy](https://www.youtube.com/watch?v=dOr0NKyD31Q) — Khan Academy
- Answer checked by Claude Sonnet 5.5 on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/probability_and_statistics/discrete-continuous-rv-mean-variance
- Whole chapter: https://www.bctengineer.com/md/semester_5/probability_and_statistics/chapter-2

## Question

Define discrete and continuous random variable. Also describe the procedure to compute mean and variance for both variables.

## Short answer

A discrete random variable takes countable values (e.g., number of heads); a continuous random variable takes any value in an interval (e.g., height). For both, mean μ = E(X) is sum (or integral) of x*pdf/pmf; variance σ^2 = E(X^2)-μ^2, where E(X^2) is sum (or integral) of x^2*pdf/pmf.

## Answer

#### Discrete random variable
A random variable that takes a finite or countably infinite set of separate values, usually obtained by counting. Example: number of defective chips in a sample, number of heads in 3 tosses. It is described by a pmf p(x) with p(x) ≥ 0 and Σ p(x) = 1.

#### Continuous random variable
A random variable that can take any value in an interval of real numbers, usually obtained by measuring. Example: height, time to failure, voltage. It is described by a pdf f(x) with f(x) ≥ 0 and ∫ f(x) dx = 1 over the whole range; P(a ≤ X ≤ b) = ∫ₐᵇ f(x) dx, and P(X = c) = 0 for any single point.

#### Procedure for mean and variance

| Step | Discrete | Continuous |
|---|---|---|
| Mean μ = E(X) | Σ x · p(x) | ∫ x · f(x) dx |
| E(X²) | Σ x² · p(x) | ∫ x² · f(x) dx |
| Variance σ² | E(X²) − [E(X)]² | E(X²) − [E(X)]² |
| Standard deviation | √σ² | √σ² |

Steps:
1. Check that the pmf or pdf is valid (total probability 1).
2. Compute E(X) by the sum or integral above.
3. Compute E(X²) in the same way.
4. Variance = E(X²) − μ² (equivalently E[(X − μ)²]).

The sum or integral is taken over all values of x for which p(x) or f(x) is non-zero.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. A continuous random variable differs from a discrete one in that it:
   A. Takes only countable values
   B. Takes any value in an interval, usually by measuring
   C. Has probabilities that sum to 1 over points
   D. Has P(X = c) greater than 0 for each value
   Answer: B. Continuous variables take values in an interval and are described by a pdf. (Key point: Discrete vs continuous)

2. For a continuous random variable, P(X = c) for a single point c is:
   A. f(c)
   B. 0
   C. 1
   D. Between 0 and 1 depending on c
   Answer: B. Probability is area under f, and a single point has zero width. (Key point: Point probability)

3. The mean is computed as:
   A. Sum of p(x) for discrete; integral of f(x) dx for continuous
   B. Sum of x^2 p(x) for both
   C. Integral for discrete; sum for continuous
   D. Sum of x p(x) for discrete; integral of x f(x) dx for continuous
   Answer: D. E(X) weights each value by its probability, via a sum or an integral. (Key point: Mean formulas)

4. Variance for both types equals:
   A. E(X^2) - [E(X)]^2
   B. E(X^2) + [E(X)]^2
   C. E(X) - E(X^2)
   D. sqrt(E(X))
   Answer: A. Var = E(X^2) - mu^2, equivalently E[(X - mu)^2]. (Key point: Variance)

## Related in Probability and Statistics

- [Continuous random variable; pdf properties](https://www.bctengineer.com/question.md?key=semester_5%2Fprobability_and_statistics%3Acontinuous-rv-pdf-properties) — Probability and Statistics, chapter 3
- [Expectation of discrete variable; P(X≥4)](https://www.bctengineer.com/question.md?key=semester_5%2Fprobability_and_statistics%3Aexpectation-discrete-rv-table) — Probability and Statistics, chapter 2
- [Continuous variable with density 6x(1−x)](https://www.bctengineer.com/question.md?key=semester_5%2Fprobability_and_statistics%3Apdf-6x-1-minus-x) — Probability and Statistics, chapter 3
- [Exponential cdf: P(X>2), mean, variance](https://www.bctengineer.com/question.md?key=semester_5%2Fprobability_and_statistics%3Aexponential-cdf-1-minus-e-2x) — Probability and Statistics, chapter 3, asked 3×
- [pdf k(5+2x): find k, mean, variance](https://www.bctengineer.com/question.md?key=semester_5%2Fprobability_and_statistics%3Apdf-k-5-plus-2x-mean) — Probability and Statistics, chapter 3, asked 2×
- [pdf kx³(4−x)²: k, mean, variance](https://www.bctengineer.com/question.md?key=semester_5%2Fprobability_and_statistics%3Apdf-kx3-4-minus-x-squared) — Probability and Statistics, chapter 3, asked 2×

## Related in other subjects

- [Continuous vs discrete variables, return period formulae](https://www.bctengineer.com/question.md?key=semester_5%2Fengineering_hydrology%3Acontinuous-discrete-variables-return-period) — Engineering Hydrology, chapter 6
- [Define random variables; properties](https://www.bctengineer.com/question.md?key=semester_8%2Fsimulation_and_modeling%3Arn-define-properties-variables) — Simulation and Modeling, chapter 6
- [Moments of random variable; NEB of RC-LPF; output noise power](https://www.bctengineer.com/question.md?key=semester_6%2Fcommunication_systems%3Amoments-neb-rc-lpf) — Communication Systems, chapter 9
- [Continuous-time vs discrete-time signals](https://www.bctengineer.com/question.md?key=semester_4%2Fsignals_and_systems%3Act-vs-dt-signals) — Signals and Systems, chapter 1, asked 3×
