Skip to main content
ExamExplained
NSW · Maths Advanced
Maths Advanced study scene
§-Syllabus dot point
NSWMaths AdvancedSyllabus dot point

How do we describe a discrete random variable and summarise its distribution with mean and variance?

Define a discrete random variable by its probability distribution, and calculate the expected value, variance and standard deviation

A focused answer to the HSC Maths Advanced dot point on discrete random variables. Probability distributions, expected value, variance, standard deviation, and linear transformations of a discrete random variable, with worked examples.

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

What this dot point is asking

NESA wants you to recognise a discrete random variable, check that its probability distribution is valid, compute the expected value and variance from the distribution, and apply the linear-transformation rules to aX+ba X + b. Everything starts from the probability distribution, the list of values with their probabilities, so reading and validating that table is the first marked move in almost every question.

The answer

A discrete probability distributionA spike graph of the distribution of X over the values 0, 1, 2 and 3 with probabilities 0.1, 0.4, 0.3 and 0.2. The four spike heights are probabilities that sum to 1.xP(X = x)01230.10.20.30.40.10.40.30.2Step 1Each spike height is P(X = x). The four probabilities0.1 + 0.4 + 0.3 + 0.2 = 1, so the distribution is valid.

Discrete random variables and their distributions

A discrete random variable XX takes a countable list of values x1,x2,,xnx_1, x_2, \dots, x_n with probabilities pi=P(X=xi)p_i = P(X = x_i). The list of values with their probabilities is the probability distribution of XX. For it to be valid, two conditions must hold:

  • 0pi10 \le p_i \le 1 for every ii (each is a genuine probability),
  • ipi=1\sum_i p_i = 1 (something must happen).

The spike graph above is the natural picture: each value sits on the horizontal axis and the height of its spike is its probability, so the heights are the pip_i and they must add to 11. The probability that XX falls in some set is the sum of pip_i for the values in that set. For example, P(X2)=P(X=0)+P(X=1)+P(X=2)P(X \le 2) = P(X = 0) + P(X = 1) + P(X = 2) if XX takes integer values from 00.

Expected value

The expected value (or mean) of XX is the long-run average value if we repeated the experiment many times. It is the weighted sum

E(X)=μ=ixipi.E(X) = \mu = \sum_i x_i \, p_i.

The expected value need not be one of the values XX can actually take; it is a balance point, not an outcome.

Expected value of a function of XX

For any function gg,

E(g(X))=ig(xi)pi.E(g(X)) = \sum_i g(x_i) \, p_i.

The most common case is g(x)=x2g(x) = x^2, which gives

E(X2)=ixi2pi.E(X^2) = \sum_i x_i^2 \, p_i.

This is the quantity you build to find the variance, so it is worth setting up as its own column of working.

Variance and standard deviation

The variance of XX measures spread around the mean. By definition it is the expected squared deviation,

Var(X)=σ2=E((Xμ)2)=i(xiμ)2pi,\text{Var}(X) = \sigma^2 = E((X - \mu)^2) = \sum_i (x_i - \mu)^2 p_i,

which is algebraically equivalent (and almost always easier to compute) to

Var(X)=E(X2)[E(X)]2.\text{Var}(X) = E(X^2) - [E(X)]^2.

The standard deviation is σ=Var(X)\sigma = \sqrt{\text{Var}(X)}, in the same units as XX, which is why it is the spread measure you can compare directly against the mean.

Linear transformations

If Y=aX+bY = a X + b for constants aa and bb,

E(Y)=aE(X)+b,Var(Y)=a2Var(X),σY=aσX.E(Y) = a E(X) + b, \qquad \text{Var}(Y) = a^2 \text{Var}(X), \qquad \sigma_Y = |a| \sigma_X.

Shifting XX by bb slides the mean but leaves the spread untouched; scaling by aa multiplies the mean by aa and the standard deviation by a|a| (and the variance by a2a^2). These rules let you find the mean and variance of YY without rebuilding any sums.

Reading a distribution and finding its mean, stage by stage

The two diagrams here use the distribution P(X=0)=0.1P(X=0)=0.1, P(X=1)=0.4P(X=1)=0.4, P(X=2)=0.3P(X=2)=0.3, P(X=3)=0.2P(X=3)=0.2.

Stage 1, read the distribution and check it is valid. Whether it arrives as a two-row table or as the spike graph above, the first move is the same: confirm the probabilities are between 00 and 11 and sum to 11. Here 0.1+0.4+0.3+0.2=10.1 + 0.4 + 0.3 + 0.2 = 1, so the distribution is valid and you can build calculation columns from it. (If a constant were involved, you would solve pi=1\sum p_i = 1 for it first.)

Stage 2, find the expected value as the balance point. The mean is the weighted sum E(X)=0(0.1)+1(0.4)+2(0.3)+3(0.2)=1.6E(X) = 0(0.1) + 1(0.4) + 2(0.3) + 3(0.2) = 1.6. Picture the probabilities as weights placed along the axis: E(X)E(X) is the point where the bar would balance, marked by the fulcrum below. Note that 1.61.6 is not one of the values XX can take, which is exactly what "balance point, not an outcome" means.

The expected value is the balance pointThe same spike graph with a triangular fulcrum marking the mean of X at 1.6 on the axis, the balance point of the probability weights.xP(X = x)01230.10.20.30.40.10.40.30.2E(X)=1.6Step 2E(X) = Σ x P(X = x) = 0(0.1)+1(0.4)+2(0.3)+3(0.2) = 1.6.It is the balance point of the distribution, not a value X must take.

Presenting a distribution as a table

In the exam a discrete distribution is usually laid out as a two-row table: the values xix_i on top and the probabilities pip_i underneath. Reading it correctly is the first marked step. Check the probabilities sum to 11 (solve for any unknown if a constant is involved), then build the calculation columns you need: xipix_i p_i for the mean and xi2pix_i^2 p_i for E(X2)E(X^2). Laying the work out in columns keeps the arithmetic tidy and is exactly what markers look for.

Interpreting expected value and variance

The expected value is the balance point of the distribution: if you placed the probabilities as weights along a number line, E(X)E(X) is where it would balance, as the fulcrum in the diagram shows. The variance measures how widely the values spread around that balance point, in squared units, and the standard deviation brings it back to the original units so it can be compared with the mean. A small standard deviation means the outcomes cluster tightly around the mean; a large one means they are spread out. This interpretation is what justifies the linear-transformation rules: shifting every value left or right slides the balance point but leaves the spread untouched, while stretching the scale stretches both.

Why E(X2)μ2E(X^2) - \mu^2 is the practical formula

The definition Var(X)=(xiμ)2pi\text{Var}(X) = \sum (x_i - \mu)^2 p_i is conceptually clear but arithmetically painful because it subtracts μ\mu inside every term. The equivalent E(X2)μ2E(X^2) - \mu^2 is almost always faster: build one extra column of xi2pix_i^2 p_i, sum it, and subtract the square of the mean. The two formulas are algebraically identical, so use the second to compute and quote the first to explain.

How exam questions ask about discrete random variables

  • "Show that the table is a valid probability distribution" or "find the value of kk." Check 0pi10 \le p_i \le 1 and solve pi=1\sum p_i = 1 for any unknown.
  • "Find P(X2)P(X \le 2)" or "P(X1)P(X \ge 1)." Add the relevant pip_i; for "at least" it is often quicker to use 1P(the rest)1 - P(\text{the rest}).
  • "Find the expected value / mean." Compute the weighted sum xipi\sum x_i p_i, showing the products.
  • "Find the variance / standard deviation." Build E(X2)=xi2piE(X^2) = \sum x_i^2 p_i, then Var(X)=E(X2)μ2\text{Var}(X) = E(X^2) - \mu^2, then square-root for σ\sigma.
  • "Let Y=aX+bY = aX + b. Find E(Y)E(Y) and Var(Y)\text{Var}(Y) / σY\sigma_Y." Apply E(Y)=aE(X)+bE(Y) = aE(X) + b, Var(Y)=a2Var(X)\text{Var}(Y) = a^2\text{Var}(X), σY=aσX\sigma_Y = |a|\sigma_X.

Edge cases worth knowing

  • An unknown probability via the sum. If one entry is missing or given as kk, find it from pi=1\sum p_i = 1 before any mean or variance work.
  • The mean is not an attainable value. E(X)E(X) is a balance point, so a fair die has mean 3.53.5 even though you can never roll 3.53.5. Do not "round it to a face".
  • A symmetric distribution. If the probabilities are symmetric about a central value, that value is the mean immediately, with no weighted sum required.
  • Negative-looking variance. Variance is a sum of squared terms times probabilities, so it can never be negative; a negative result signals an arithmetic slip, usually E(X)2E(X)^2 confused with E(X2)E(X^2).

Exam-style practice questions

Practice questions written in the style of NESA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

2022 HSC Q244 marksThe discrete random variable XX has probability distribution P(X=0)=0.2P(X = 0) = 0.2, P(X=1)=0.5P(X = 1) = 0.5, P(X=2)=0.2P(X = 2) = 0.2, P(X=3)=0.1P(X = 3) = 0.1. Find E(X)E(X) and Var(X)\text{Var}(X).
Show worked answer →

E(X)=xP(X=x)=00.2+10.5+20.2+30.1=0+0.5+0.4+0.3=1.2E(X) = \sum x P(X = x) = 0 \cdot 0.2 + 1 \cdot 0.5 + 2 \cdot 0.2 + 3 \cdot 0.1 = 0 + 0.5 + 0.4 + 0.3 = 1.2.

For the variance, first compute E(X2)=00.2+10.5+40.2+90.1=0.5+0.8+0.9=2.2E(X^2) = 0 \cdot 0.2 + 1 \cdot 0.5 + 4 \cdot 0.2 + 9 \cdot 0.1 = 0.5 + 0.8 + 0.9 = 2.2.

Var(X)=E(X2)[E(X)]2=2.21.44=0.76\text{Var}(X) = E(X^2) - [E(X)]^2 = 2.2 - 1.44 = 0.76.

Markers reward the explicit weighted sum for E(X)E(X), the use of E(X2)μ2E(X^2) - \mu^2 for the variance, and clean arithmetic.

2021 HSC Q253 marksA discrete random variable XX has E(X)=5E(X) = 5 and Var(X)=4\text{Var}(X) = 4. Let Y=3X2Y = 3 X - 2. Find E(Y)E(Y) and the standard deviation of YY.
Show worked answer →

Linearity of expectation: E(Y)=E(3X2)=3E(X)2=3(5)2=13E(Y) = E(3 X - 2) = 3 E(X) - 2 = 3(5) - 2 = 13.

Variance scales by the square of the coefficient and is unchanged by adding a constant: Var(Y)=Var(3X2)=9Var(X)=36\text{Var}(Y) = \text{Var}(3 X - 2) = 9 \text{Var}(X) = 36.

Standard deviation: σY=36=6\sigma_Y = \sqrt{36} = 6.

Markers expect explicit use of E(aX+b)=aE(X)+bE(a X + b) = a E(X) + b and Var(aX+b)=a2Var(X)\text{Var}(a X + b) = a^2 \text{Var}(X), with the standard deviation as the positive square root.

Practice questions

Original practice questions graded from foundation to exam level, each with a full worked solution. Try them before revealing the solution.

foundation2 marksA discrete random variable XX has P(X=1)=0.3P(X = 1) = 0.3, P(X=2)=0.5P(X = 2) = 0.5 and P(X=4)=kP(X = 4) = k. Find kk, then find E(X)E(X).
Show worked solution →

Use the fact that the probabilities must sum to 11.

0.3+0.5+k=1k=0.2.0.3 + 0.5 + k = 1 \quad\Rightarrow\quad k = 0.2.

Compute the mean as the weighted sum.

E(X)=1(0.3)+2(0.5)+4(0.2)=0.3+1.0+0.8=2.1.E(X) = 1(0.3) + 2(0.5) + 4(0.2) = 0.3 + 1.0 + 0.8 = 2.1.

Marker's note: one mark for k=0.2k = 0.2 from pi=1\sum p_i = 1, one for E(X)=2.1E(X) = 2.1 from the explicit weighted sum. Forgetting to solve for kk first, or reading the missing value straight off as a probability, loses the first mark.

foundation3 marksThe discrete random variable XX has P(X=2)=0.25P(X = 2) = 0.25, P(X=3)=0.5P(X = 3) = 0.5 and P(X=6)=0.25P(X = 6) = 0.25. Find E(X)E(X) and Var(X)\text{Var}(X).
Show worked solution →

Find the mean first.

E(X)=2(0.25)+3(0.5)+6(0.25)=0.5+1.5+1.5=3.5.E(X) = 2(0.25) + 3(0.5) + 6(0.25) = 0.5 + 1.5 + 1.5 = 3.5.

Build E(X2)E(X^2) as the weighted sum of squared values.

E(X2)=4(0.25)+9(0.5)+36(0.25)=1+4.5+9=14.5.E(X^2) = 4(0.25) + 9(0.5) + 36(0.25) = 1 + 4.5 + 9 = 14.5.

Apply Var(X)=E(X2)μ2\text{Var}(X) = E(X^2) - \mu^2.

Var(X)=14.53.52=14.512.25=2.25.\text{Var}(X) = 14.5 - 3.5^2 = 14.5 - 12.25 = 2.25.

Marker's note: one mark for E(X)=3.5E(X) = 3.5, one for E(X2)=14.5E(X^2) = 14.5, one for Var(X)=2.25\text{Var}(X) = 2.25. Using E(X2)E(X)E(X^2) - E(X) instead of E(X2)[E(X)]2E(X^2) - [E(X)]^2 is the trap that loses the final mark.

core3 marksA discrete random variable XX has E(X)=8E(X) = 8 and Var(X)=5\text{Var}(X) = 5. Let W=42XW = 4 - 2X. Find E(W)E(W), Var(W)\text{Var}(W) and the standard deviation of WW.
Show worked solution →

Apply linearity of expectation. Writing W=2X+4W = -2X + 4,

E(W)=2E(X)+4=2(8)+4=12.E(W) = -2 E(X) + 4 = -2(8) + 4 = -12.

Scale the variance by the square of the coefficient. The added constant has no effect:

Var(W)=(2)2Var(X)=4(5)=20.\text{Var}(W) = (-2)^2 \text{Var}(X) = 4(5) = 20.

Take the positive square root for the standard deviation.

σW=20=25.\sigma_W = \sqrt{20} = 2\sqrt{5}.

Marker's note: one mark for E(W)=12E(W) = -12, one for Var(W)=20\text{Var}(W) = 20 (squaring the 2-2, ignoring the +4+4), one for σW=25\sigma_W = 2\sqrt{5}. Using 2-2 rather than (2)2(-2)^2 on the variance, or letting the +4+4 change the variance, is the standard error.

core4 marksA spike graph shows the probability distribution of a discrete random variable XX. There are four spikes: at x=0x = 0 the height is 0.40.4, at x=1x = 1 the height is 0.30.3, at x=2x = 2 the height is 0.20.2, and at x=3x = 3 the height is 0.10.1. (a) Confirm the distribution is valid. (b) Find P(X2)P(X \ge 2). (c) Find E(X)E(X) and the standard deviation of XX, giving the standard deviation to two decimal places.
Show worked solution →

Part (a): read the spike heights as probabilities and check they sum to 11.

0.4+0.3+0.2+0.1=1,0.4 + 0.3 + 0.2 + 0.1 = 1,

and each height lies between 00 and 11, so the distribution is valid.

Part (b): add the probabilities of the values 22 and 33.

P(X2)=P(X=2)+P(X=3)=0.2+0.1=0.3.P(X \ge 2) = P(X = 2) + P(X = 3) = 0.2 + 0.1 = 0.3.

Part (c): mean, then variance via E(X2)μ2E(X^2) - \mu^2.

E(X)=0(0.4)+1(0.3)+2(0.2)+3(0.1)=0+0.3+0.4+0.3=1.0.E(X) = 0(0.4) + 1(0.3) + 2(0.2) + 3(0.1) = 0 + 0.3 + 0.4 + 0.3 = 1.0.

E(X2)=0(0.4)+1(0.3)+4(0.2)+9(0.1)=0+0.3+0.8+0.9=2.0.E(X^2) = 0(0.4) + 1(0.3) + 4(0.2) + 9(0.1) = 0 + 0.3 + 0.8 + 0.9 = 2.0.

Var(X)=2.01.02=1.0σ=1.0=1.00.\text{Var}(X) = 2.0 - 1.0^2 = 1.0 \quad\Rightarrow\quad \sigma = \sqrt{1.0} = 1.00.

Marker's note: one mark for confirming validity in (a), one for P(X2)=0.3P(X \ge 2) = 0.3 in (b), one for E(X)=1.0E(X) = 1.0 and one for σ=1.00\sigma = 1.00 in (c). Reading the spike heights off the graph correctly is the marked first move; misreading a height sinks every later part.

core3 marksA game costs $5 to play. A discrete random variable XX gives the dollar prize won, with P(X=0)=0.5P(X = 0) = 0.5, P(X=4)=0.3P(X = 4) = 0.3 and P(X=20)=0.2P(X = 20) = 0.2. Find the expected prize E(X)E(X), and hence state whether a player expects to make a profit or a loss per game.
Show worked solution →

Compute the expected prize as the weighted sum.

E(X)=0(0.5)+4(0.3)+20(0.2)=0+1.2+4.0=5.2.E(X) = 0(0.5) + 4(0.3) + 20(0.2) = 0 + 1.2 + 4.0 = 5.2.

Compare with the $5 cost. The expected prize is $5.20, which exceeds the $5 cost, so the expected profit per game is

5.25=0.2,5.2 - 5 = 0.2,

a profit of $0.20 per game for the player.

Marker's note: one mark for E(X)=5.2E(X) = 5.2 from the weighted sum, one for subtracting the $5 cost, one for stating the $0.20 expected profit with the correct direction. Comparing the largest prize against the cost, rather than the expected value, is the conceptual trap.

exam5 marksA discrete random variable XX takes the values 0,1,2,30, 1, 2, 3 with P(X=x)=c(x+1)P(X = x) = c(x + 1) for some constant cc. (a) Show that c=0.1c = 0.1. (b) Find E(X)E(X) and Var(X)\text{Var}(X). (c) A prize is defined by Y=50X+20Y = 50X + 20 dollars. Find the mean prize and the standard deviation of the prize, giving the standard deviation to the nearest cent.
Show worked solution →

Part (a): the probabilities must sum to 11. The four probabilities are c(0+1),c(1+1),c(2+1),c(3+1)c(0+1), c(1+1), c(2+1), c(3+1), that is c,2c,3c,4cc, 2c, 3c, 4c:

c+2c+3c+4c=10c=1c=0.1,c + 2c + 3c + 4c = 10c = 1 \quad\Rightarrow\quad c = 0.1,

as required. The distribution is P(X=0)=0.1P(X = 0) = 0.1, P(X=1)=0.2P(X = 1) = 0.2, P(X=2)=0.3P(X = 2) = 0.3, P(X=3)=0.4P(X = 3) = 0.4.

Part (b): mean, then variance via E(X2)μ2E(X^2) - \mu^2.

E(X)=0(0.1)+1(0.2)+2(0.3)+3(0.4)=0+0.2+0.6+1.2=2.0.E(X) = 0(0.1) + 1(0.2) + 2(0.3) + 3(0.4) = 0 + 0.2 + 0.6 + 1.2 = 2.0.

E(X2)=0(0.1)+1(0.2)+4(0.3)+9(0.4)=0+0.2+1.2+3.6=5.0.E(X^2) = 0(0.1) + 1(0.2) + 4(0.3) + 9(0.4) = 0 + 0.2 + 1.2 + 3.6 = 5.0.

Var(X)=5.02.02=5.04.0=1.0.\text{Var}(X) = 5.0 - 2.0^2 = 5.0 - 4.0 = 1.0.

Part (c): apply the linear-transformation rules to Y=50X+20Y = 50X + 20.

E(Y)=50E(X)+20=50(2.0)+20=120,E(Y) = 50 E(X) + 20 = 50(2.0) + 20 = 120,

so the mean prize is $120. For the standard deviation,

Var(Y)=502Var(X)=2500(1.0)=2500σY=2500=50,\text{Var}(Y) = 50^2 \text{Var}(X) = 2500(1.0) = 2500 \quad\Rightarrow\quad \sigma_Y = \sqrt{2500} = 50,

so the standard deviation of the prize is $50.00.

Marker's note: one mark for showing c=0.1c = 0.1 via pi=1\sum p_i = 1 in (a); one for E(X)=2.0E(X) = 2.0 and one for Var(X)=1.0\text{Var}(X) = 1.0 in (b); one for E(Y)=120E(Y) = 120 and one for σY=50.00\sigma_Y = 50.00 (scaling by 50|50|, not 50250^2) in (c). Multiplying the standard deviation by 50250^2 instead of 5050, or letting the +20+20 change the spread, is the classic slip.

exam5 marksTwo fair four-sided dice, each with faces numbered 1,2,3,41, 2, 3, 4, are rolled and XX is the larger of the two numbers showing (if both show the same number, XX is that number). (a) Show that P(X=3)=516P(X = 3) = \frac{5}{16}. (b) Complete the probability distribution of XX and find E(X)E(X). (c) Find Var(X)\text{Var}(X), leaving your answer as an exact fraction.
Show worked solution →

Part (a): count outcomes where the larger value is 33. There are 4×4=164 \times 4 = 16 equally likely ordered outcomes. The larger equals 33 when both dice are at most 33 but not both at most 22. The number of outcomes with both at most 33 is 3×3=93 \times 3 = 9; with both at most 22 is 2×2=42 \times 2 = 4. Hence

P(X=3)=9416=516,P(X = 3) = \frac{9 - 4}{16} = \frac{5}{16},

as required.

Part (b): build the whole distribution the same way. With P(X=k)=k2(k1)216=2k116P(X = k) = \dfrac{k^2 - (k-1)^2}{16} = \dfrac{2k - 1}{16},

P(X=1)=116,P(X=2)=316,P(X=3)=516,P(X=4)=716,P(X = 1) = \tfrac{1}{16}, \quad P(X = 2) = \tfrac{3}{16}, \quad P(X = 3) = \tfrac{5}{16}, \quad P(X = 4) = \tfrac{7}{16},

and these sum to 1+3+5+716=1\frac{1 + 3 + 5 + 7}{16} = 1. The mean is

E(X)=1(1)+2(3)+3(5)+4(7)16=1+6+15+2816=5016=258.E(X) = \frac{1(1) + 2(3) + 3(5) + 4(7)}{16} = \frac{1 + 6 + 15 + 28}{16} = \frac{50}{16} = \frac{25}{8}.

Part (c): variance via E(X2)μ2E(X^2) - \mu^2 in exact fractions.

E(X2)=1(1)+4(3)+9(5)+16(7)16=1+12+45+11216=17016=858.E(X^2) = \frac{1(1) + 4(3) + 9(5) + 16(7)}{16} = \frac{1 + 12 + 45 + 112}{16} = \frac{170}{16} = \frac{85}{8}.

Var(X)=858(258)2=85862564=68062564=5564.\text{Var}(X) = \frac{85}{8} - \left(\frac{25}{8}\right)^2 = \frac{85}{8} - \frac{625}{64} = \frac{680 - 625}{64} = \frac{55}{64}.

Marker's note: one mark for the counting argument giving P(X=3)=516P(X = 3) = \frac{5}{16} in (a); one for the full distribution and one for E(X)=258E(X) = \frac{25}{8} in (b); one for E(X2)=858E(X^2) = \frac{85}{8} and one for Var(X)=5564\text{Var}(X) = \frac{55}{64} in (c). Working in exact fractions throughout avoids rounding error; the common trap is (258)2=62564\left(\frac{25}{8}\right)^2 = \frac{625}{64} mis-squared as 6258\frac{625}{8}.

ExamExplained