A variable or process with a numerical outcome is a random variable. We usually represent it with a capital letter such as X, Y, or Z. For example, the amount of money a single student will spend on their textbooks is a random variable.
[!def] Expected Value of a Discrete Random Variable If X takes outcomes \(x_1,...,x_k\) with probabilities \(P(X=x_1),...P(X=X_k)\), the expected value of \(X\) is the sum of each outcome multiplied by its corresponding probability: \(E(X)=x_1 \cdot P(X=x_1)+...+P(X=x_k)\) \(=\sum_{i=1}^{k} x_iP(X=x_i)\) We can represent \(E(X)\) as \(\mu\)
The expected value for a random variable represents the average outcome. Expected value \(=E(X)=\mu\)
This value corresponds to the center of gravity in physics.
Variability in Random Variables¶
[!def] General Variance Formula If \(X\) takes outcomes \(x_1,...x_k\)with probabilities \(P(X=x_1),...,P(X=x_k)\) and expected value \(\mu = E(X)\), then the variance of \(X\) denoted by \(Var(X)\) or \(\sigma^2\) is \(\(\begin{align} \sigma^2 &= (x_1-\mu)^2 \cdot P(X=x_1)+...+(x_k-\mu)^2 \cdot P(X=x_k) \\ &= \sum_{j=1}^k (x_j-\mu)^2P(X=x_j) \end{align}\)\) The standard deviation of X, labelled \sigma, is the square root of the variance.
Example¶
The following example uses numbers about the rate of student textbook purchase. 20% of students buy neither of the two textbooks, so they spend $0 (1). 55% of students buy only one textbook, spending $137 (2). Finally, 25% of students buy both, spending $170 (3).
- \(x_i =\) dollar amount
- \(x_i \times P(X=x_i)\) = dollar amount * probability
Example 2¶
The bookstore offers a textbook for $159 and a study guide for $41. They know that 25% of students buy the textbook and 60% buy both the textbook and supplement.
- What proportion of students don’t buy either book? Assume no students buy the supplement without the textbook
| Neither | One | Both | Total |
|---|---|---|---|
| 15 | 25 | 60 | 100 |
- Let Y represent the revenue from a single student. Write out the probability distribution of Y
| i | 1 | 2 | 3 | Total |
|---|---|---|---|---|
| \(x_i\) | $0 | $159 | $200 | - |
| \(P(X=x_i)\) | 0.15 | 0.25 | 0.6 | 1 |
- Compute the expected revenue from a single student
| i | 1 | 2 | 3 | Total |
|---|---|---|---|---|
| \(x_i\) | $0 | $159 | $200 | - |
| \(P(X=x_i)\) | 0.15 | 0.25 | 0.6 | 1 |
| \(x_i \times P(X=x_i)\) | 0 | 39.75 | 120 | 159.75 |
- Find the standard deviation to describe the variability associated with the revenue from a single student
| i | 1 | 2 | 3 | Total |
|---|---|---|---|---|
| \(x_i\) | $0 | $159 | $200 | - |
| \(P(X=x_i)\) | 0.15 | 0.25 | 0.6 | 1 |
| \(x_i \times P(X=x_i)\) | 0 | 39.75 | 120 | 159.75 |
| \(x_i - E(X)\) | -159.75 | -0.75 | 40.25 | |
| \((x_i - E(X))^2\) | 25,520.0625 | 0.5625 | 1620.0625 | |
| \((x_i - E(X))^2 \times P(X=x_i)\) | 3828.01 | 0.141 | 972.0375 | 4800.1885 |
Linear Combinations of Random Variables¶
A linear combination of two random variables is a fancy name for an expression like \(aX+bY\). For example, imagine a student is going to buy textbooks for the upcoming semester, and they are also going to try to sell their textbooks from last semester. Assume all new textbooks have the same price, $50, and all old textbooks have the same price, $25. The combination for the total amount of gain or loss in money could be represented as \(a25-b50\).
[!info] To compute the average value of a linear combination of random variables, plug in the average of each individual random variable and compute the result: \(a\cdot E(X) + b \cdot E(Y)\)
[!def] Variance of linear combinations of random variables \(Var(aX+bY)=a^2\cdot Var(X)+b^2 \cdot Var(Y)\) This equality assumes that the variables are independent. The standard deviation may be found by taking the square root of the variance.