Solutions: Practice Problems II: Continuous Random Variables

1. Finding the Constant

(a) Since \(f_X\) must integrate to 1:

\[ \int_0^1 cx\,dx=1 \] \[ c\cdot \frac12=1 \] \[ c=2 \]

(b)

\[ E[X]=\int_0^1 x(2x)\,dx = 2\int_0^1 x^2\,dx = \frac{2}{3} \]

2. Direct Probability and Expectation

Here \(f_X(x)=2x\) for \(0<x<1\).

(a)

\[ P(X>0.7)=\int_{0.7}^{1}2x\,dx = \left[x^2\right]_{0.7}^{1} = 1-0.49 = 0.51 \]

(b)

\[ E[X]=\int_0^1 x(2x)\,dx = 2\int_0^1 x^2\,dx = \frac{2}{3} \]

(c)

\[ E[X^2]=\int_0^1 x^2(2x)\,dx = 2\int_0^1 x^3\,dx = \frac12 \] \[ \mathrm{Var}(X)=E[X^2]-(E[X])^2 = \frac12-\left(\frac23\right)^2 = \frac12-\frac49 = \frac{1}{18} \]

3. Joint Density

(a) We need:

\[ \int_0^1\int_x^1 cx\,dy\,dx=1 \] \[ \int_0^1 cx(1-x)\,dx=1 \] \[ c\int_0^1(x-x^2)\,dx=1 \] \[ c\left(\frac12-\frac13\right)=1 \] \[ \frac{c}{6}=1 \] \[ c=6 \]

(b)

\[ f_X(x)=\int_x^1 6x\,dy = 6x(1-x),\quad 0<x<1 \]

(c) For fixed \(y\), the possible \(x\)-values satisfy \(0<x<y\):

\[ f_Y(y)=\int_0^y 6x\,dx = 3y^2,\quad 0<y<1 \]

(d) They are not independent. If independent, we would need

\[ f_{X,Y}(x,y)=f_X(x)f_Y(y) \]

on a rectangular support. But the support is triangular: \(0<x<1,\ x<y<1\). The condition \(y>x\) creates dependence.

4. Conditional Expectation: Word Problem

Let \(Y\) be the hidden true signal level. The problem says \(Y\) is equally likely to be anywhere between 0 and 2, so \(Y\sim \mathrm{Uniform}(0,2)\).

The measurement is true signal plus noise:

\[ X=Y+\text{noise} \]

where the noise has mean 0 and variance 1.

(a)

\[ E[X\mid Y]=Y \] \[ E[X]=E[E[X\mid Y]]=E[Y]=\frac{0+2}{2}=1 \]

(b) Use the law of total variance:

\[ \mathrm{Var}(X)=E[\mathrm{Var}(X\mid Y)]+\mathrm{Var}(E[X\mid Y]) \] \[ \mathrm{Var}(X)=E[1]+\mathrm{Var}(Y) \] \[ =1+\frac{(2-0)^2}{12} \] \[ =1+\frac13 = \frac43 \]

5. Covariance

Let \(X\sim \mathrm{Uniform}(-1,1)\) and \(Y=X^2\).

(a)

\[ E[X]=0 \]

by symmetry.

\[ E[Y]=E[X^2]=\int_{-1}^{1}x^2\cdot \frac12\,dx = \frac12\cdot \frac{2}{3} = \frac13 \] \[ E[XY]=E[X^3]=\int_{-1}^{1}x^3\cdot \frac12\,dx=0 \]

again by symmetry.

(b)

\[ \mathrm{Cov}(X,Y)=E[XY]-E[X]E[Y] \] \[ =0-(0)\left(\frac13\right)=0 \]

(c) They are not independent because \(Y=X^2\) is completely determined by \(X\). Knowing \(X\) tells you \(Y\). This is an example where zero covariance does not imply independence.

6. Exponential: Memorylessness

For \(X\sim \mathrm{Exponential}(\lambda)\):

\[ P(X>t)=e^{-\lambda t} \]

(a)

\[ P(X>5\mid X>2) = \frac{P(X>5)}{P(X>2)} = \frac{e^{-5\lambda}}{e^{-2\lambda}} = e^{-3\lambda} \]

(b) By memorylessness, once \(X>2\), the expected additional waiting time is \(1/\lambda\). Therefore:

\[ E[X\mid X>2]=2+\frac{1}{\lambda} \]

7. Transformation

Let \(X\sim \mathrm{Uniform}(0,1)\) and \(Y=-\ln(X)\).

(a) For \(t\ge 0\):

\[ P(Y<t)=P(-\ln X<t) \] \[ =P(\ln X>-t) \] \[ =P(X>e^{-t}) \] \[ =1-e^{-t} \]

For \(t<0\):

\[ P(Y<t)=0 \]

So the CDF is:

\[ F_Y(t)= \begin{cases} 0, & t<0,\\ 1-e^{-t}, & t\ge 0. \end{cases} \]

(b) Differentiate:

\[ f_Y(t)=e^{-t},\quad t\ge 0 \]

and \(f_Y(t)=0\) otherwise. Thus \(Y\sim \mathrm{Exponential}(1)\).

8. What do you need?

This problem should be interpreted as: the entire batch came from one machine, but we do not know which one.

Using the sample mean of 100 components:

If Machine A made the batch:

\[ \bar X\mid A \approx \mathcal{N}\left(10,\frac{4}{100}\right) = \mathcal{N}(10,0.04) \]

If Machine B made the batch:

\[ \bar X\mid B \approx \mathcal{N}\left(12,\frac{4}{100}\right) = \mathcal{N}(12,0.04) \]

The observed average is \(11.2\), which is closer to 12 than to 10. So Machine B is more likely.

To make a fully precise Bayes calculation with a continuous observation, one should use either densities at \(11.2\) or an interval such as \(11.15<\bar X<11.25\). Using densities:

\[ \frac{f_{\bar X\mid A}(11.2)}{f_{\bar X\mid B}(11.2)} = \exp\left( -\frac{(11.2-10)^2}{2(0.2)^2} + \frac{(11.2-12)^2}{2(0.2)^2} \right) \] \[ = \exp\left( -\frac{1.44}{0.08} + \frac{0.64}{0.08} \right) = \exp(-18+8) = e^{-10} \]

Since the priors are equal,

\[ P(A\mid \bar X=11.2) = \frac{e^{-10}}{1+e^{-10}} \]

which is very small. Machine B is much more likely.

9. Averages and Quantiles

Parts (a) and (b), as written

For \(n=100\), mean 10, variance 4:

\[ \bar X_n \approx \mathcal{N}\left(10,\frac{4}{100}\right) = \mathcal{N}(10,0.04) \]

So the standard deviation of \(\bar X_n\) is \(0.2\).

(a)

\[ P(\bar X_n>10.5) = P\left(Z>\frac{10.5-10}{0.2}\right) = P(Z>2.5) \] \[ \approx 0.0062 \]

(b) We want the lower 5th percentile:

\[ P(\bar X_n<c)=0.05 \] \[ c=10+z_{0.05}(0.2) \] \[ z_{0.05}\approx -1.645 \] \[ c\approx 10-1.645(0.2)=9.671 \]

Part (c)

Let \(F\) be the event that the machine is faulty.

\[ P(F)=0.10,\quad P(F^c)=0.90 \]

From part (b), the threshold \(c\) was chosen so that only 5% of good shipments are rejected:

\[ P(\bar X<c\mid F^c)=0.05 \]

When the machine is working correctly, using CLT:

\[ \bar X\mid F^c \approx \mathcal{N}\left(10,\frac{4}{100}\right) = \mathcal{N}(10,0.04) \] \[ \mathrm{SD}(\bar X\mid F^c)=0.2 \]

So the threshold is:

\[ c=10+z_{0.05}(0.2) \] \[ c\approx 10-1.645(0.2)=9.671 \]

When the machine is faulty, using CLT

\[ \bar X\mid F \approx \mathcal{N}\left(5,\frac{16}{100}\right) = \mathcal{N}(5,0.16) \] \[ \mathrm{SD}(\bar X\mid F)=0.4 \]

Therefore:

\[ P(\bar X<c\mid F) = P\left(Z<\frac{9.671-5}{0.4}\right) \] \[ = P(Z<11.6775) \approx 1 \]

Now use Bayes' rule:

\[ P(F\mid \bar X<c) = \frac{P(\bar X<c\mid F)P(F)} {P(\bar X<c\mid F)P(F)+P(\bar X<c\mid F^c)P(F^c)} \] \[ \approx \frac{1(0.10)} {1(0.10)+0.05(0.90)} \] \[ = \frac{0.10}{0.145} \approx 0.6897 \]

So, if the shipment is rejected, the probability that the machine was actually faulty is about \(0.69\).