# Random Variables and Distributions

Mathematics I · Data Analysis and Probability · https://tryals.app/learn/mathematics-i/random-variables-and-distributions

## Random Variables and PMF vs PDF

A **random variable** turns random outcomes into numbers, letting us do math with chance. It maps qualitative results to quantitative values.

| Type | Values | Probability Rule | Total Sum / Area |
| --- | --- | --- | --- |
| **Discrete** | Countable / separate | **Probability mass function** $P(X = x)$ | Sum to 1 |
| **Continuous** | Any value in a range | **Probability density function** $f(x)$ via areas | Area is 1 |

For continuous variables, $P(a \le X \le b) = \int_a^b f(x)\, dx$. 

**Common pitfall:** For a **continuous** variable, the probability of any **single exact value** is **zero** ($P(X = c) = 0$). Probability lives in intervals, not points; a point has zero width and zero area.

## Expectation and Variance

Two core numbers summarise a random variable:

- **Expected value** ($E[X]$): The long-run average, or centre of mass. Discrete: $\sum x\, P(X = x)$. Continuous: $\int x f(x)\, dx$.
- **Variance** ($\operatorname{Var}(X)$): Expected squared deviation $E[(X - \mu)^2]$, measuring spread. Standard deviation is its square root.

Expectation is **linear**: $E[aX + b] = a\,E[X] + b$, and $E[X + Y] = E[X] + E[Y]$ for **any** variables, whether independent or not.

Variance is **not** linear: $\operatorname{Var}(aX) = a^2\operatorname{Var}(X)$. Crucially, variances add ($\operatorname{Var}(X + Y) = \operatorname{Var}(X) + \operatorname{Var}(Y)$) only for **independent** variables.

## Practice questions

5 of this lesson's 11 practice questions, with answers. The full set is in the app.

### 1. Order the steps for computing the expected value of a discrete random variable.

**Answer:**

1. List every value the random variable can take
2. Attach to each value its probability from the mass function
3. Multiply each value by its probability
4. Add all of those products together
5. Read the total as the long-run average of the variable

**Why:** Expectation is a weighted sum, so every value must be paired with its own weight before anything is added. Averaging the values without weighting them is a different (and usually wrong) number, it silently assumes all outcomes are equally likely.

Page: https://tryals.app/practice/mathematics-i/random-variables-and-distributions/order-the-steps-for-computing-the-expected-value-of-a-discrete-random

### 2. Complete the statement about a continuous random variable X.

**Answer:** For a continuous random variable, the probability P(X = 3) equals **0**.

**Why:** A single point has no width, so it encloses no area and carries no probability. The density value at 3 is generally positive but it is a _density_, not a probability, and it can even exceed 1. Only intervals carry probability here.

Page: https://tryals.app/practice/mathematics-i/random-variables-and-distributions/complete-the-statement-about-a-continuous-random-variable-x

### 3. The expected value of a lottery ticket is negative, and millions are bought weekly. Is that irrational?

A. Not necessarily, since expected value assumes money is valued linearly
B. Yes, unless the ticket is bought as part of a syndicate
C. Yes, negative expected value is decisive and buying is a straightforward error
D. No, because the expected value calculation omits the jackpot

**Answer:** A. Not necessarily, since expected value assumes money is valued linearly

**Why:** Expected value assumes linear utility, and money is not linear, the millionth pound is worth far less than the first, and a life-changing jump can outrank the arithmetic. Insurance is the same trade run in reverse, which is why buying both is not the contradiction it appears to be.

Page: https://tryals.app/practice/mathematics-i/random-variables-and-distributions/the-expected-value-of-a-lottery-ticket-is-negative-and-millions-are

### 4. Select every statement that is true for all random variables X and Y.

A. E[2X + 5] = 2 E[X] + 5
B. E[X + Y] = E[X] + E[Y]
C. Var(X + Y) = Var(X) + Var(Y)
D. Var(X) can be negative
E. Var(X + 5) = Var(X)

**Answer:** A. E[2X + 5] = 2 E[X] + 5; B. E[X + Y] = E[X] + E[Y]; E. Var(X + 5) = Var(X)

**Why:** Expectation is linear unconditionally, and shifting a variable by a constant slides the whole distribution without altering its spread. Variances add only for independent variables, and variance is an average of squares, so it can never be negative.

Page: https://tryals.app/practice/mathematics-i/random-variables-and-distributions/select-every-statement-that-is-true-for-all-random-variables-x-and-y

### 5. For a continuous random variable, P(X = 3) = 0 for every single value - yet X certainly takes SOME value. How can every individual outcome have probability zero?

A. Because a continuous variable never actually takes any exact value, only approximate ones.
B. Because probability is area under a density, and a point has none.
C. Because the probabilities are so small they are rounded down to zero for practical purposes.
D. Because continuous variables have infinitely many outcomes, so their probabilities cannot be defined at all.

**Answer:** B. Because probability is area under a density, and a point has none.

**Why:** For a continuous variable probability is area under a density, and the area over a region of zero width is zero, so P(X = 3) = 0 while P(2.9 < X < 3.1) is positive. The probability is exactly zero rather than merely small, which is why a probability-zero event is not an impossible one, and why 'exactly 180 cm' is not a question the model answers.

Page: https://tryals.app/practice/mathematics-i/random-variables-and-distributions/for-a-continuous-random-variable-p-x-3-0-for-every-single-value
