Problem 1

Find an example of two discrete random variables X and Y (on the same sample space) such that X and Y have the same distribution (i.e., same PMF and same CDF), but the event X = Y never occurs.

There are of course many examples, here is one:

P(X=0)=P(X=1)=1/2, and Y=1-X, so P(Y=0)=P(1-X=0)=P(X=1)=1/2 and P(Y=1)=P(X=0)=1/2 but P(X=Y)=0

Problem 2

Consider the following game: first we press a button, and a computer gives us random variable \(X\sim U[0,10]\). If X is less then 4 we roll a fair die, otherwise we roll a die which gives the number i proportional to i2. (that means P(i)=c*i2). Let Y be the number rolled. Find the distribution function of Y.

First note that

\[ \begin{aligned} &1=\sum_{i=1}^6 ci^2 = 91c\\ &c = \frac1{91} \end{aligned} \]

By the law of total probability we have

\[ \begin{aligned} &P(Y=i) = P(Y=i|X<4)P(X<4)+P(Y=i|X>4)P(X>4)=\\ &\frac{1}{6}\frac{4-0}{10-0}+\frac{i^2}{91}\frac{10-4}{10-0} =\\ &\frac{1}{15}+\frac{i^2}{91}\frac{3}{5}=\frac{91+9i^2}{1365} \end{aligned} \]

therefore

\[ \begin{aligned} &y<1: F(y) = 0\\ &1\le y< 2: F(y) = \frac{91+9*1^2}{1365}=\frac{100}{1365}\\ &2\le y< 3: F(y) = F(1)+\frac{91+9*2^2}{1365}=\frac{227}{1365}\\ &3\le y< 4: F(y) = F(2)+\frac{91+9*3^2}{1365}=\frac{399}{1365}\\ &4\le y< 5: F(y) = F(3)+\frac{91+9*4^2}{1365}=\frac{634}{1365}\\ &5\le y< 6: F(y) = F(4)+\frac{91+9*5^2}{1365}=\frac{950}{1365}\\ &y\ge 6: F(y)=1 \end{aligned} \]

Problem 3

Consider the following random variable X: we roll a fair die. If the number i comes up \(X\sim U[0,i]\). Find the distribution function of X. Draw the graph.

Let Y be the roll of the die, then

\[ \begin{aligned} &F_X(x)=P(X\le x) = \\ &\sum_{i=1}^6 P(X\le x|Y=i)P(Y=i) = \\ &\frac16\sum_{i=1}^6 P(X\le x|Y=i) \end{aligned} \]

Note that

\[F_X(1.5) = \frac16\sum_{i=1}^6 P(X\le 1.5|Y=i)\] but \(P(X\le 1.5|Y=1)=1\) because here \(X\sim U[0,1]\), whereas \(P(X\le 1.5|Y=i)=\frac{1.5}{i}\) when \(i>1\). Therefore

\[ \begin{aligned} &x<0: F_X(x)=0\\ &0<x<1: F_X(x) = \frac16\sum_{i=1}^6 \frac{x-0}{i-0} = \frac{x}{6}\sum_{i=1}^6\frac1{i}\\ &1<x<2: F_X(x) = \frac1{6}+\frac{x}6\sum_{i=2}^6 \frac{1}{i}\\ &2<x<3: F_X(x) = \frac2{6}+\frac{x}6\sum_{i=3}^6 \frac{1}{i}\\ &3<x<4: F_X(x) = \frac3{6}+\frac{x}6\sum_{i=4}^6 \frac{1}{i}\\ &4<x<5: F_X(x) = \frac4{6}+\frac{x}6\sum_{i=5}^6 \frac{1}{i}\\ &5<x<6: F_X(x) = \frac5{6}+\frac{x}{36}\\ &x>6: F_X(x)=1 \end{aligned} \]

x=seq(-1,7,length=1000)
y=0*x
y[x>0]=x[x>0]/6*sum(1/c(1:6))
y[x>1]=1/6+x[x>1]/6*sum(1/c(2:6))
y[x>2]=2/6+x[x>2]/6*sum(1/c(3:6))
y[x>3]=3/6+x[x>3]/6*sum(1/c(4:6))
y[x>4]=4/6+x[x>4]/6*sum(1/c(5:6))
y[x>5]=5/6+x[x>5]/36
y[x>6]=1
plot(x,y,type="l")

Problem 4

Consider a density of the following shapes:

f=function(x, a=0.2) {
  y <- 0*x
  y[x>0&x<a] <- (x[x>0&x<a]/a)^2
  y[x>a&x<1] <- (x[x>a&x<1]-1)/(a-1)
  y
} 
x <- seq(-0.2, 1.2, length=1000)
plot(x, f(x, 0.5), type="l", ylab="",  yaxt = "n", xaxt="n", ylim=c(-0.3,1.1))
abline(h=0)
abline(v=0)
text(c(0, 0.5, 1), rep(-0.2, 3), c("0","a", 1))

so f increases quadraticaly from 0 to some a and then decreases linearly to 0 at 1. Find an expression for the distribution function F(x;a). Find F(0.6; 0.2). (Note that the quadratic function has a vertex at 0).

The density is of the form

\[ \begin{aligned} &f(x) =cx^2;0<x<a \\ &f(x) = ca^2\frac{x-1}{a-1};a<x<1\\ \end{aligned} \] for some number c.ย This because we have f(0)=0, f(a-)=ca2, f(a+)=ca2 and f(1)=0.

Now

\[ \begin{aligned} &0<x<a\\ &F(x)=\int_{\infty}^{x} f(x) dx = \\ &\int_0^x ct^2 dt = ct^3/3|_0^x = cx^3/3\\ &a<x<1\\ &F(x)=F(a)+\int_a^x ca^2\frac{t-1}{a-1} dt =\\ &ca^3/3+ca^2\frac{(t-1)^2}{2(a-1)}|_a^x = \\ &ca^3/3+ca^2\frac{(x-1)^2}{2(a-1)}-ca^2\frac{(a-1)^2}{2(a-1)} = \\ &ca^3/3+ca^2\frac{(x-1)^2}{2(a-1)}-ca^2(a-1)/2 \end{aligned} \] of course

\[1=F(1)=ca^3/3-ca^2(a-1)/2=c[3a^2-a^3]/6\] so \[c=\frac{6}{3a^2-a^3}\]

and finally

\[F(0.6; 0.2)=\\\frac{6}{3*0.2^2-0.2^3}\left[0.2^3/3+0.2^2\frac{(0.6-1)^2}{2(0.2-1)}-0.2^2(0.2-1)/2\right]=\\0.786\]

integrate(f, 0, 0.6, a=0.2)$value/integrate(f, 0, 1, a=0.2)$value
## [1] 0.7857145