Practice / Probability for ML

Continuous random variables: densities, CDFs, expectation and the uniform, exponential and normal

Ten problems on continuous random variables: normalizing a density and integrating it for a probability, a CDF turned into a density, a median and a mean with an infinite variance, expectation and variance by integration, the uniform distribution and a density above 1, the exponential's CDF, mean, median and memorylessness, standardizing a normal with z-values and a percentile, the density of Y = X² through its CDF, inverse-CDF sampling and the minimum of independent exponentials, with worked solutions and the mistakes of reading a density as a probability, dropping the |dx/dy| in a change of variables, taking the exponential's mean as λ, dividing by σ² and taking the mean as the median.

Before you start

A continuous random variable takes values in an interval: a waiting time, a measurement, the output of a regression model. No single value has positive probability, so its distribution is described by a density f(x)f(x), and probabilities are areas under it. Everything from the discrete case carries over with sums replaced by integrals: E[X]=∫xf(x) dxE[X] = \int x f(x)\,dx instead of ∑x p(x)\sum x\,p(x). What does not carry over is reading f(x)f(x) as a probability. A density can be larger than 11; only its integral over an interval is a probability. These ten problems normalize densities, move between the density and the cumulative distribution function, work through the uniform, exponential and normal distributions, and end with the two tools behind sampling: transforming a variable through its CDF, and the inverse CDF that turns a uniform random number into any distribution.

  • A density ff has f(x)≥0f(x) \ge 0 and ∫−∞∞f(x) dx=1\int_{-\infty}^{\infty} f(x)\,dx = 1, and P(a<X<b)=∫abf(x) dxP(a < X < b) = \int_a^b f(x)\,dx. In particular P(X=a)=0P(X = a) = 0, so << and ≤\le give the same probabilities.
  • The CDF is F(x)=P(X≤x)=∫−∞xf(t) dtF(x) = P(X \le x) = \int_{-\infty}^x f(t)\,dt. It rises from 00 to 11, P(a<X≤b)=F(b)−F(a)P(a < X \le b) = F(b) - F(a), and f=F′f = F' wherever FF is differentiable.
  • Expectation. E[X]=∫xf(x) dxE[X] = \int x f(x)\,dx and E[g(X)]=∫g(x)f(x) dxE[g(X)] = \int g(x) f(x)\,dx; Var⁡(X)=E[X2]−(E[X])2\operatorname{Var}(X) = E[X^2] - (E[X])^2. The median mm solves F(m)=12F(m) = \tfrac12.
  • Uniform(a,b)(a, b): f(x)=1b−af(x) = \frac{1}{b - a} on (a,b)(a, b), mean a+b2\frac{a + b}{2}, variance (b−a)212\frac{(b - a)^2}{12}.
  • Exponential(λ)(\lambda): f(x)=λe−λxf(x) = \lambda e^{-\lambda x} for x≥0x \ge 0, F(x)=1−e−λxF(x) = 1 - e^{-\lambda x}, P(X>x)=e−λxP(X > x) = e^{-\lambda x}, mean 1λ\frac1\lambda, variance 1λ2\frac{1}{\lambda^2}. λ\lambda is a rate, events per unit time; 1λ\frac1\lambda is the average wait.
  • Normal(μ,σ2)(\mu, \sigma^2): f(x)=1σ2πe−(x−μ)2/(2σ2)f(x) = \frac{1}{\sigma\sqrt{2\pi}}e^{-(x - \mu)^2/(2\sigma^2)}. Standardize with Z=X−μσZ = \frac{X - \mu}{\sigma}, which is Normal(0,1)(0, 1) with CDF Φ\Phi. Useful values: Φ(1)=0.8413\Phi(1) = 0.8413, Φ(2)=0.9772\Phi(2) = 0.9772, Φ(1.2816)=0.9\Phi(1.2816) = 0.9, and Φ(−z)=1−Φ(z)\Phi(-z) = 1 - \Phi(z).
  • Change of variables. For Y=g(X)Y = g(X), find FY(y)=P(g(X)≤y)F_Y(y) = P(g(X) \le y) as a probability about XX, then differentiate. For an increasing gg this gives fY(y)=fX(x) ∣dxdy∣f_Y(y) = f_X(x)\,\big|\frac{dx}{dy}\big| with x=g−1(y)x = g^{-1}(y).

Problems

  1. ·

    XX has density f(x)=cx2f(x) = cx^2 for 0≤x≤30 \le x \le 3 and 00 elsewhere. Find cc, the CDF, and P(1<X<2)P(1 < X < 2).

  2. ·

    XX has CDF F(x)=1−1x2F(x) = 1 - \dfrac{1}{x^2} for x≥1x \ge 1 and F(x)=0F(x) = 0 for x<1x < 1. Find its density, P(2<X<4)P(2 < X < 4), the median, E[X]E[X] and E[X2]E[X^2].

  3. ··

    XX has density f(x)=2xf(x) = 2x on [0,1][0, 1]. Find E[X]E[X], E[X2]E[X^2], Var⁡(X)\operatorname{Var}(X), the standard deviation and the median.

  4. ·

    X∼Uniform⁡(2,8)X \sim \operatorname{Uniform}(2, 8). Find its density, P(3<X<5)P(3 < X < 5), E[X]E[X] and Var⁡(X)\operatorname{Var}(X). Then for W∼Uniform⁡(0,0.5)W \sim \operatorname{Uniform}(0, 0.5), find the density and P(0.3<W<0.31)P(0.3 < W < 0.31).

  5. ··

    Requests arrive at a server at a rate of 0.50.5 per minute, so the wait XX for the next one is Exponential(0.5)(0.5). Find the mean wait, P(X>4)P(X > 4), the median wait and P(X>6∣X>2)P(X > 6 \mid X > 2).

  6. ··

    Show by integration that an Exponential(λ)(\lambda) variable has E[X]=1λE[X] = \frac1\lambda and Var⁡(X)=1λ2\operatorname{Var}(X) = \frac{1}{\lambda^2}.

  7. ··

    Test scores are Normal with mean 100100 and standard deviation 1515. Find the fraction above 130130, the fraction between 8585 and 115115, and the score at the 90th percentile.

  8. ··

    X∼Uniform⁡(0,1)X \sim \operatorname{Uniform}(0, 1) and Y=X2Y = X^2. Find the CDF and density of YY, P(Y<0.25)P(Y < 0.25) and E[Y]E[Y] two ways.

  9. ···

    U∼Uniform⁡(0,1)U \sim \operatorname{Uniform}(0, 1). Show that Y=−ln⁡UλY = -\dfrac{\ln U}{\lambda} is Exponential(λ)(\lambda), and find the sample it gives for U=0.3U = 0.3 and λ=2\lambda = 2. Then find the transformation of UU that samples the variable of Problem 2, and its value at U=0.75U = 0.75.

  10. ···

    Three independent replicas answer a request after Exponential times with rates 11, 22 and 33 per second, and the client takes the first answer. Find the distribution of the response time TT, its mean, P(T>0.5)P(T > 0.5), and the probability that the slowest replica (rate 11) answers first.

Worked solutions

Problem 1

XX has density f(x)=cx2f(x) = cx^2 for 0≤x≤30 \le x \le 3 and 00 elsewhere. Find cc, the CDF, and P(1<X<2)P(1 < X < 2).

  1. ∫03cx2 dx=c⋅273=9c=1\int_0^3 cx^2\,dx = c\cdot\dfrac{27}{3} = 9c = 1, so c=19c = \tfrac19The density must integrate to 11.
  2. F(x)=∫0xt29 dt=x327F(x) = \int_0^x \dfrac{t^2}{9}\,dt = \dfrac{x^3}{27} for 0≤x≤30 \le x \le 3F=0F = 0 below 00 and F=1F = 1 above 33; F(3)=1F(3) = 1 is a check on cc.
  3. P(1<X<2)=∫12x29 dx=8−127P(1 < X < 2) = \int_1^2 \dfrac{x^2}{9}\,dx = \dfrac{8 - 1}{27}From the density.
  4. F(2)−F(1)=827−127=727F(2) - F(1) = \dfrac{8}{27} - \dfrac{1}{27} = \dfrac{7}{27}The same number from the CDF, with no integral left to do.
  5. c=19c = \tfrac19, F(x)=x327F(x) = \tfrac{x^3}{27} on [0,3][0, 3], P(1<X<2)=727≈0.2593P(1 < X < 2) = \tfrac{7}{27} \approx 0.2593The middle third of the range holds about a quarter of the probability, because the density grows like x2x^2.

Problem 2

XX has CDF F(x)=1−1x2F(x) = 1 - \dfrac{1}{x^2} for x≥1x \ge 1 and F(x)=0F(x) = 0 for x<1x < 1. Find its density, P(2<X<4)P(2 < X < 4), the median, E[X]E[X] and E[X2]E[X^2].

  1. f(x)=F′(x)=2x3f(x) = F'(x) = \dfrac{2}{x^3} for x≥1x \ge 1Differentiate the CDF.
  2. P(2<X<4)=F(4)−F(2)=(1−116)−(1−14)=316=0.1875P(2 < X < 4) = F(4) - F(2) = \Big(1 - \dfrac1{16}\Big) - \Big(1 - \dfrac14\Big) = \dfrac{3}{16} = 0.1875Differences of the CDF.
  3. 1−1m2=121 - \dfrac{1}{m^2} = \dfrac12, so m2=2m^2 = 2 and m=2≈1.4142m = \sqrt2 \approx 1.4142The median solves F(m)=12F(m) = \tfrac12.
  4. E[X]=∫1∞x⋅2x3 dx=∫1∞2x2 dx=2E[X] = \int_1^\infty x\cdot\dfrac{2}{x^3}\,dx = \int_1^\infty \dfrac{2}{x^2}\,dx = 2An improper integral that converges.
  5. f(x)=2x3f(x) = \tfrac{2}{x^3}, P(2<X<4)=0.1875P(2 < X < 4) = 0.1875, median 2≈1.414\sqrt2 \approx 1.414, E[X]=2E[X] = 2, E[X2]=∞E[X^2] = \inftyE[X2]=∫1∞2x dxE[X^2] = \int_1^\infty \tfrac2x\,dx diverges, so this heavy-tailed (Pareto) variable has a mean but no finite variance. The mean is pulled above the median by the long right tail.

Problem 3

XX has density f(x)=2xf(x) = 2x on [0,1][0, 1]. Find E[X]E[X], E[X2]E[X^2], Var⁡(X)\operatorname{Var}(X), the standard deviation and the median.

  1. ∫012x dx=1\int_0^1 2x\,dx = 1Check it is a density.
  2. E[X]=∫01x⋅2x dx=23E[X] = \int_0^1 x\cdot2x\,dx = \dfrac23∫012x2 dx=23\int_0^1 2x^2\,dx = \tfrac23.
  3. E[X2]=∫01x2⋅2x dx=24=12E[X^2] = \int_0^1 x^2\cdot2x\,dx = \dfrac24 = \dfrac12Square the value, keep the density as the weight.
  4. Var⁡(X)=12−49=118\operatorname{Var}(X) = \dfrac12 - \dfrac49 = \dfrac{1}{18}The same shortcut as in the discrete case.
  5. E[X]=23E[X] = \tfrac23, E[X2]=12E[X^2] = \tfrac12, Var⁡(X)=118≈0.0556\operatorname{Var}(X) = \tfrac{1}{18} \approx 0.0556, standard deviation ≈0.2357\approx 0.2357, median 12≈0.7071\tfrac{1}{\sqrt2} \approx 0.7071F(x)=x2F(x) = x^2, so F(m)=12F(m) = \tfrac12 gives m=12m = \tfrac{1}{\sqrt2}. The density leans right, so the median is above the mean: the long tail is on the left.

Problem 4

X∼Uniform⁡(2,8)X \sim \operatorname{Uniform}(2, 8). Find its density, P(3<X<5)P(3 < X < 5), E[X]E[X] and Var⁡(X)\operatorname{Var}(X). Then for W∼Uniform⁡(0,0.5)W \sim \operatorname{Uniform}(0, 0.5), find the density and P(0.3<W<0.31)P(0.3 < W < 0.31).

  1. f(x)=18−2=16f(x) = \dfrac{1}{8 - 2} = \dfrac16 on (2,8)(2, 8)Constant height, area 11.
  2. P(3<X<5)=5−36=13P(3 < X < 5) = \dfrac{5 - 3}{6} = \dfrac13For a uniform, probability is length over total length.
  3. E[X]=2+82=5E[X] = \dfrac{2 + 8}{2} = 5 and Var⁡(X)=(8−2)212=3\operatorname{Var}(X) = \dfrac{(8 - 2)^2}{12} = 3From E[X2]=∫28x26 dx=512−818=28E[X^2] = \int_2^8 \tfrac{x^2}{6}\,dx = \tfrac{512 - 8}{18} = 28 and 28−25=328 - 25 = 3.
  4. fW(w)=10.5=2f_W(w) = \dfrac{1}{0.5} = 2 on (0,0.5)(0, 0.5)A density of 22 is fine: the interval is only 0.50.5 long, so the area is still 11.
  5. f=16f = \tfrac16, P(3<X<5)=13P(3 < X < 5) = \tfrac13, E[X]=5E[X] = 5, Var⁡(X)=3\operatorname{Var}(X) = 3; fW=2f_W = 2, P(0.3<W<0.31)=0.02P(0.3 < W < 0.31) = 0.022×0.01=0.022 \times 0.01 = 0.02: the density times a short width approximates the probability of a short interval (Mistake 1).

Problem 5

Requests arrive at a server at a rate of 0.50.5 per minute, so the wait XX for the next one is Exponential(0.5)(0.5). Find the mean wait, P(X>4)P(X > 4), the median wait and P(X>6∣X>2)P(X > 6 \mid X > 2).

  1. E[X]=10.5=2E[X] = \dfrac{1}{0.5} = 2 minutesHalf an arrival per minute is one every two minutes on average.
  2. P(X>4)=e−0.5⋅4=e−2≈0.1353P(X > 4) = e^{-0.5\cdot4} = e^{-2} \approx 0.1353The survival function e−λxe^{-\lambda x}.
  3. 1−e−0.5m=121 - e^{-0.5m} = \dfrac12, so m=ln⁡20.5=2ln⁡2≈1.3863m = \dfrac{\ln 2}{0.5} = 2\ln2 \approx 1.3863 minutesThe median solves F(m)=12F(m) = \tfrac12.
  4. P(X>6∣X>2)=e−3e−1=e−2≈0.1353P(X > 6 \mid X > 2) = \dfrac{e^{-3}}{e^{-1}} = e^{-2} \approx 0.1353X>6X > 6 is contained in X>2X > 2, so the intersection is X>6X > 6.
  5. Mean 22 minutes, P(X>4)≈0.1353P(X > 4) \approx 0.1353, median ≈1.386\approx 1.386 minutes, P(X>6∣X>2)≈0.1353P(X > 6 \mid X > 2) \approx 0.1353Memorylessness: after two minutes with nothing, the chance of waiting four more is the same as it was at the start. The continuous version of the geometric distribution.

Problem 6

Show by integration that an Exponential(λ)(\lambda) variable has E[X]=1λE[X] = \frac1\lambda and Var⁡(X)=1λ2\operatorname{Var}(X) = \frac{1}{\lambda^2}.

  1. E[X]=∫0∞xλe−λx dx=[−xe−λx]0∞+∫0∞e−λx dxE[X] = \int_0^\infty x\lambda e^{-\lambda x}\,dx = \Big[-xe^{-\lambda x}\Big]_0^\infty + \int_0^\infty e^{-\lambda x}\,dxParts with u=xu = x and dv=λe−λx dxdv = \lambda e^{-\lambda x}\,dx, so v=−e−λxv = -e^{-\lambda x}.
  2. E[X]=0+1λE[X] = 0 + \dfrac1\lambdaxe−λx→0xe^{-\lambda x} \to 0 as x→∞x \to \infty, and ∫0∞e−λx dx=1λ\int_0^\infty e^{-\lambda x}\,dx = \tfrac1\lambda.
  3. E[X2]=∫0∞x2λe−λx dx=0+∫0∞2xe−λx dx=2λE[X]=2λ2E[X^2] = \int_0^\infty x^2\lambda e^{-\lambda x}\,dx = 0 + \int_0^\infty 2xe^{-\lambda x}\,dx = \dfrac2\lambda E[X] = \dfrac{2}{\lambda^2}Parts again with u=x2u = x^2; the remaining integral is 2λ\tfrac2\lambda times the one in step 1.
  4. Var⁡(X)=2λ2−1λ2=1λ2\operatorname{Var}(X) = \dfrac{2}{\lambda^2} - \dfrac{1}{\lambda^2} = \dfrac{1}{\lambda^2}The shortcut.
  5. E[X]=1λE[X] = \tfrac1\lambda and Var⁡(X)=1λ2\operatorname{Var}(X) = \tfrac{1}{\lambda^2}The standard deviation equals the mean. For λ=0.5\lambda = 0.5 in Problem 5, both are 22 minutes.

Problem 7

Test scores are Normal with mean 100100 and standard deviation 1515. Find the fraction above 130130, the fraction between 8585 and 115115, and the score at the 90th percentile.

  1. z=130−10015=2z = \dfrac{130 - 100}{15} = 2Standardize: subtract the mean, divide by the standard deviation.
  2. P(X>130)=1−Φ(2)=1−0.97725≈0.0228P(X > 130) = 1 - \Phi(2) = 1 - 0.97725 \approx 0.0228About 2.3%2.3\%.
  3. P(85<X<115)=Φ(1)−Φ(−1)=2Φ(1)−1≈0.6827P(85 < X < 115) = \Phi(1) - \Phi(-1) = 2\Phi(1) - 1 \approx 0.6827z=±1z = \pm1; by symmetry Φ(−1)=1−Φ(1)\Phi(-1) = 1 - \Phi(1).
  4. x=100+15×1.2816≈119.22x = 100 + 15 \times 1.2816 \approx 119.22Solve Φ(z)=0.9\Phi(z) = 0.9 for z=1.2816z = 1.2816, then undo the standardization: x=μ+σzx = \mu + \sigma z.
  5. P(X>130)≈0.0228P(X > 130) \approx 0.0228, P(85<X<115)≈0.6827P(85 < X < 115) \approx 0.6827, 90th percentile ≈119.2\approx 119.2Within one standard deviation of the mean lies about 68%68\% of a normal distribution, and beyond two standard deviations on one side lies about 2.3%2.3\%.

Problem 8

X∼Uniform⁡(0,1)X \sim \operatorname{Uniform}(0, 1) and Y=X2Y = X^2. Find the CDF and density of YY, P(Y<0.25)P(Y < 0.25) and E[Y]E[Y] two ways.

  1. FY(y)=P(X2≤y)=P(X≤y)=yF_Y(y) = P(X^2 \le y) = P(X \le \sqrt y) = \sqrt y for 0≤y≤10 \le y \le 1X≥0X \ge 0, so X2≤yX^2 \le y exactly when X≤yX \le \sqrt y.
  2. fY(y)=ddyy=12yf_Y(y) = \dfrac{d}{dy}\sqrt y = \dfrac{1}{2\sqrt y} on (0,1)(0, 1)Equivalently fX(y) ∣dxdy∣=1⋅12yf_X(\sqrt y)\,\big|\tfrac{dx}{dy}\big| = 1\cdot\tfrac{1}{2\sqrt y}. It is unbounded near 00 and still integrates to 11.
  3. P(Y<0.25)=FY(0.25)=0.5P(Y < 0.25) = F_Y(0.25) = 0.5Y<0.25Y < 0.25 exactly when X<0.5X < 0.5.
  4. E[Y]=∫01y⋅12y dy=∫01y2 dy=13E[Y] = \int_0^1 y\cdot\dfrac{1}{2\sqrt y}\,dy = \int_0^1 \dfrac{\sqrt y}{2}\,dy = \dfrac13From the density of YY.
  5. FY(y)=yF_Y(y) = \sqrt y, fY(y)=12yf_Y(y) = \tfrac{1}{2\sqrt y} on (0,1)(0, 1), P(Y<0.25)=0.5P(Y < 0.25) = 0.5, E[Y]=13E[Y] = \tfrac13Check without fYf_Y: E[X2]=∫01x2 dx=13E[X^2] = \int_0^1 x^2\,dx = \tfrac13. Squaring numbers in (0,1)(0, 1) crowds them toward 00, which is where the density piles up.

Problem 9

U∼Uniform⁡(0,1)U \sim \operatorname{Uniform}(0, 1). Show that Y=−ln⁡UλY = -\dfrac{\ln U}{\lambda} is Exponential(λ)(\lambda), and find the sample it gives for U=0.3U = 0.3 and λ=2\lambda = 2. Then find the transformation of UU that samples the variable of Problem 2, and its value at U=0.75U = 0.75.

  1. P(Y>y)=P(−ln⁡U>λy)=P(U<e−λy)P(Y > y) = P\big(-\ln U > \lambda y\big) = P\big(U < e^{-\lambda y}\big)Multiply by −1-1 and exponentiate; exe^x is increasing, so the inequality keeps its direction.
  2. P(Y>y)=e−λyP(Y > y) = e^{-\lambda y} for y≥0y \ge 0For a uniform, P(U<u)=uP(U < u) = u. That is the exponential survival function.
  3. U=0.3U = 0.3, λ=2\lambda = 2: y=−ln⁡0.32≈0.6020y = -\dfrac{\ln 0.3}{2} \approx 0.6020One uniform random number becomes one exponential sample.
  4. In general X=F−1(U)X = F^{-1}(U) has CDF FF: P(F−1(U)≤x)=P(U≤F(x))=F(x)P(F^{-1}(U) \le x) = P(U \le F(x)) = F(x)Inverse-CDF sampling. For the exponential, F−1(u)=−ln⁡(1−u)λF^{-1}(u) = -\tfrac{\ln(1 - u)}{\lambda}, and 1−U1 - U is uniform too, which gives the formula above.
  5. Y=−ln⁡UλY = -\tfrac{\ln U}{\lambda} is Exponential(λ)(\lambda), with y≈0.602y \approx 0.602 for U=0.3U = 0.3; for Problem 2, X=11−UX = \tfrac{1}{\sqrt{1 - U}}, which is 22 at U=0.75U = 0.75Solve u=1−1x2u = 1 - \tfrac{1}{x^2} for xx. This is how libraries turn a uniform random number generator into samples from other distributions.

Problem 10

Three independent replicas answer a request after Exponential times with rates 11, 22 and 33 per second, and the client takes the first answer. Find the distribution of the response time TT, its mean, P(T>0.5)P(T > 0.5), and the probability that the slowest replica (rate 11) answers first.

  1. P(T>t)=P(X1>t)P(X2>t)P(X3>t)=e−te−2te−3t=e−6tP(T > t) = P(X_1 > t)P(X_2 > t)P(X_3 > t) = e^{-t}e^{-2t}e^{-3t} = e^{-6t}The minimum is above tt only if all three are; independence lets the probabilities multiply.
  2. T∼Exponential⁡(6)T \sim \operatorname{Exponential}(6), so E[T]=16E[T] = \dfrac16 secondThe rates add.
  3. P(T>0.5)=e−3≈0.0498P(T > 0.5) = e^{-3} \approx 0.0498The survival function at 0.50.5.
  4. P(X1=T)=∫0∞e−t⋅e−5t dt=16P(X_1 = T) = \int_0^\infty e^{-t}\cdot e^{-5t}\,dt = \dfrac{1}{6}Replica 1 answers at tt (density e−te^{-t}) and the other two are still busy (probability e−2te−3te^{-2t}e^{-3t}).
  5. T∼Exponential⁡(6)T \sim \operatorname{Exponential}(6), E[T]=16≈0.167E[T] = \tfrac16 \approx 0.167 s, P(T>0.5)≈0.0498P(T > 0.5) \approx 0.0498, P(replica 1 first)=16P(\text{replica 1 first}) = \tfrac16In general each replica wins with probability its rate over the total, λiλ1+λ2+λ3\tfrac{\lambda_i}{\lambda_1 + \lambda_2 + \lambda_3}, so the others win with 26\tfrac26 and 36\tfrac36.

Where this goes wrong

1. The density read as a probability

In the discrete case p(x)=P(X=x)p(x) = P(X = x), and the density looks like it should mean the same.

  1. W∼Uniform⁡(0,0.5)W \sim \operatorname{Uniform}(0, 0.5) has density fW(w)=2f_W(w) = 2Right so far: Problem 4.
  2. “The density at 0.30.3 is the probability of 0.30.3.”The step that causes the mistake: a density is probability per unit length, not probability.
  3. P(W=0.3)=fW(0.3)=2P(W = 0.3) = f_W(0.3) = 2A probability can never be 22. For a continuous variable P(W=0.3)=0P(W = 0.3) = 0; the density only becomes a probability when multiplied by a width, so P(0.3<W<0.31)≈2×0.01=0.02P(0.3 < W < 0.31) \approx 2 \times 0.01 = 0.02.

2. Change of variables without |dx/dy|

The density of Y=g(X)Y = g(X) is found by substituting the inverse into the density of XX.

  1. X∼Uniform⁡(0,1)X \sim \operatorname{Uniform}(0, 1), Y=X2Y = X^2, and x=yx = \sqrt yRight so far: Problem 8.
  2. “fY(y)=fX(y)=1f_Y(y) = f_X(\sqrt y) = 1.”The step that causes the mistake: it moves the height of the density but not the width of the intervals, which squaring shrinks near 00.
  3. YY is Uniform(0,1)(0, 1), so P(Y<0.25)=0.25P(Y < 0.25) = 0.25But Y<0.25Y < 0.25 is exactly X<0.5X < 0.5, which has probability 0.50.5. The factor ∣dxdy∣=12y\big|\tfrac{dx}{dy}\big| = \tfrac{1}{2\sqrt y} is what keeps probabilities equal, and going through the CDF, FY(y)=yF_Y(y) = \sqrt y, never loses it.

3. The exponential's mean taken as λ

The rate is the parameter in the formula, and it is read as the average.

  1. Requests arrive at λ=0.5\lambda = 0.5 per minute, and the wait is Exponential(0.5)(0.5)Right so far: Problem 5.
  2. “The parameter of the distribution is its mean.”True of the Poisson count, not of the exponential wait.
  3. E[X]=λ=0.5E[X] = \lambda = 0.5 minutesHalf an arrival per minute means a wait of 10.5=2\tfrac{1}{0.5} = 2 minutes on average: E[X]=1λE[X] = \tfrac1\lambda, as Problem 6 shows. A check by units: λ\lambda is per minute, and a wait has to come out in minutes.

4. Standardizing with the variance

The normal is written Normal(μ,σ2)(\mu, \sigma^2), and the second parameter goes in the denominator.

  1. Scores are Normal(100,152)(100, 15^2): μ=100\mu = 100, σ2=225\sigma^2 = 225Right so far: Problem 7.
  2. “z=x−μσ2z = \dfrac{x - \mu}{\sigma^2}.”The step that causes the mistake: ZZ has to be unitless, and x−μx - \mu is in points while σ2\sigma^2 is in points squared.
  3. z=30225≈0.1333z = \tfrac{30}{225} \approx 0.1333, so P(X>130)=1−Φ(0.1333)≈0.4470P(X > 130) = 1 - \Phi(0.1333) \approx 0.4470Nearly half the class above 130130 would put 130130 barely above average. Divide by the standard deviation: z=3015=2z = \tfrac{30}{15} = 2 and P(X>130)≈0.0228P(X > 130) \approx 0.0228.

5. The mean taken as the median

For a normal, half the probability is below the mean, and the same is assumed of every distribution.

  1. The wait in Problem 5 has mean 22 minutesRight so far.
  2. “Half the waits are shorter than the average wait.”True for a symmetric distribution; the exponential is skewed right.
  3. P(X<2)=0.5P(X < 2) = 0.5P(X<2)=1−e−1≈0.6321P(X < 2) = 1 - e^{-1} \approx 0.6321: the long right tail pulls the mean up, so most waits are shorter than average. The median is 2ln⁡2≈1.3862\ln 2 \approx 1.386 minutes.

Print this set: continuous-random-variables-and-densities.pdf (problems, answers, and worked solutions on separate pages).

Read the guide: Continuous random variables: probability is area under the density, and the CDF does the integrating