# Frog makes two jumps (uniform distribution)

I received this problem on my exam, although I thought I answered it right, it was marked as wrong.

There is a frog on a line. The frog starts from a point 0 and makes two successive jumps: first it jumps to the right(in the positive direction) then it jumps to the left(in the negative direction). Each jump has length that is independent uniformly distributed random variable. The length of the first jump is uniformly distributed on the interval $$[0,2]$$, the length of the second jump is uniformly distributed on the interval $$[0,4]$$. What is the probability that the frog’s final position is more than 1 from its starting point?

My solution:

We need to find distribution function of the sum of two random variables $$X$$ (un.distributed on $$[0,2])$$ and $$Y$$(un.distributed on $$[-4,0]$$): $$Z=X+Y$$.

Distribution function of the sum of two uniformly distributed random variables $$X$$ (on $$[0,b]$$) and $$Y$$ (on $$[0,a]$$) where $$a\leqslant b$$:

$$F(z)=\frac{z^2}{2ab} \qquad0\leqslant z\leqslant a$$ $$F(z)=\frac{a}{2b}+\frac{(z-a)}{b}\qquad a\leqslant z\leqslant b$$ $$F(z)=1-\frac{(a+b-z)^2}{2ab}\qquad b\leqslant z\leqslant(a+b)$$

In order to find the desired distribution function we need to shift the graph to the left: $$F(z)=\frac{(z+4)^2}{16} \qquad-4\leqslant z\leqslant-2$$

$$F(z)=\frac{1}{4}+\frac{(z+2)}{4}\qquad -2 \leqslant z \leqslant 0$$

$$F(z)=1-\frac{(2-z)^2}{16}\qquad 0 \leqslant z \leqslant 2$$

The answer to this problem: $$1-F(1)+F(-1)=1-15/16+1/2=7/16$$

I cannot explain why this answer isn’t correct (I also don’t know the correct answer). Thanks!

• You need to put a space between "\leqslant" and the next variable name. – kccu May 16 at 20:21
• Simulations seem to bear out that the probability is $9/16$. – Brian Tung May 16 at 21:00

The correct answer, if I understand the problem, is $$9/16$$. I prefer a geometric approach to such problems that involve pairs of independent uniform distributions, since area is proportional to probability.

Specifically, since the first length is uniform on $$[0, 2]$$, and the second length is uniform on $$[0, 4]$$, the ordered pair consisting of the two lengths is uniform on $$[0, 2] \times [0, 4]$$.

We then notice that the area of this rectangle that is between $$y = x-1$$ and $$y = x+1$$ is $$7/2$$, out of a total area of $$8$$, so the probability of being within $$1$$ unit of the starting point is $$(7/2)/8 = 7/16$$, and the probability of being more than $$1$$ unit away from the starting point is therefore $$1-7/16 = 9/16$$.

I don't see how you can simply plug in some values and shift the function $$F$$ to get the distribution you are trying to find. $$F$$ deals with the sum of two uniform random variables whose ranges share a left endpoint, while you want the sum of two uniform random variables where the left endpoint of one range is the right endpoint of the other.

I would draw a picture: $$(X,Y)$$ is uniformly distributed on the rectangle $$[0,2] \times [-4,0]$$, so the joint density of these random variables is $$f_{X,Y}(x,y)=\frac{1}{8}1_{[0,2]\times[-4,0]}(x,y).$$ You want to know $$P(X+Y < -1\text{ or }X+Y > 1)$$, but it is simpler to compute $$P(-1\leq X+Y\leq 1)$$, i.e., $$P(-X-1 \leq Y \leq -X+1)$$. The set of outcomes satisfying this is described by the set $$E=\{(x,y) \mid 0 \leq x \leq 2, -4 \leq y \leq 0, \text{ and }-x-1 \leq y \leq -x+1\}.$$ Now simply integrate the joint density over $$E$$: $$P(-X-1 \leq Y \leq -X+1)=P((X,Y) \in A) = \int_E f_{X,Y}(x,y) \ dy dx.$$ Since $$f_{X,Y}(x,y)$$ is constant $$(1/8$$) on $$E$$, this is just $$\frac{1}{8}\cdot(\text{Area of }E)$$. You can easily calculate the area of $$E$$ by sketching it and breaking it up into triangles/rectangles/parallelograms.

Finally, since we computed the probability of the complement of the event we wanted, we should take $$1-\frac{1}{8}\cdot(\text{Area of }E)$$.

Consider on the other hand the probability that the frog's final position is less than or equal to 1 from the starting point.

Further let $$X$$ denote the forward jump and $$Y$$ denote the backward jump. Then $$X \sim U(0,2) \,{and } \,Y \sim U(0,4)$$.

Consider first the case when $$X = x \leq 1$$. Then for the frog to lie within $$1$$ units of the initial position, $$Y$$ can take value from $$0 \,{to} \,(1+x)$$. It is easy to figure out why. The probability of this event is then equal to,

$$\int_0^1 \int_0^{1+x}\frac{1}{8}\, dydx = \int_0^1 \frac{1+x}{8}\, dx = \frac{3}{16}$$

Next, consider the case when $$X = x > 1$$. In this case it can be observed that $$Y$$ should between $$x-1\, { and }\, x+1$$. The probability of this event will then be,

$$\int_1^2 \int_{x-1}^{x+1}\frac{1}{8}\,dydx = \int_1^2 \frac{2}{8}\, dx = \frac{1}{4}$$

And thus, we get the probability that the final position of the frog lies within $$1$$ unit of its initial position to be equal to $$\frac{3}{16} + \frac{1}{4} = \frac{7}{16}$$.

So the required probability that the final position is more than $$1$$ from the starting point is equal to $$1-\frac{7}{16} = \frac{9}{16}$$

I'd be inclined to use the direct approach. Half the time the first jump will be more than $$1$$ unit. When that's the case, the second jump will leave you more than $$1$$ unit from the origin exactly half the time. So this case contributes a probability of $$\frac 14$$ to the final result.

The other half of the time the first jump will be $$x$$ units, where $$x \leq 1$$. In that case, the second jump will leave you more than $$1$$ unit from the origin with probability $$\frac {3-x}{4}$$. So this case contributes a probability of:

$$\frac 12 \int_0^1 \frac{3-x}{4}dx=\frac 12(\frac 34 -\frac 18)=\frac{5}{16}.$$

The two cases are mutually exclusive and they "cover the waterfront," so adding the probabilities gets you your final answer of $$\frac{9}{16}.$$