# Different solution for a probability question

I got the following problem:

Find the probability that for two arbitrary numbers $$x$$ and $$y$$ with $$x,y \in [0,1]$$ they satisfy $$x+y<1$$ and $$xy<\frac1{10}$$.

In short words the sum of the two numbers is less than $$1$$ and their product is less than $$\frac{1}{10}$$.

I am aware that it's possible to solve this using double integrals, that means first to find the total probability which is of course $$1$$ since $$x,y \in [0,1]$$ can happen in a square who's edge is $$1$$.

And for the favourable probability to find the surface on this $$1$$ by $$1$$ square who satisfies $$x+y <1$$ and $$xy<\frac{1}{10}$$, but I don't have so much knowledge with double integrals, basically to set the bounds for the integrals and so on.

Is there a simpler solution that doesn't require so much analysis knowledge?

• Are you familiar with single integrals and setting their bounds? if so, you can find the answer with single integrals since the joint PDF is uniform and this problem amounts to finding ratios of areas that can be solved with single integrals. Feb 11, 2019 at 17:19
• @StatsStudent I am familiar mostly with any kind of integrals (single, double, line-integrals, surface integrals), that is how I know that this can be solved using double integrals. My problem is setting their bounds which I'm having hard time with, that is why I'm asking help for an alternative route.
– user227352
Feb 11, 2019 at 17:25
• Got it, thanks. That's helpful. Would it be helpful to show you how to find the bounds in double-integrals, or would you prefer we demonstrate how to solve this with a single integral? It's not clear if you have trouble determining the bounds with single integrals. Feb 11, 2019 at 17:26
• Well, I just want to understand. If it's not possible to avoid analysis then I have plenty of time for any method since I'm in vacation so I will try to read and take any suggestions, but to be honest I don't imagine how single integrals can work here directly. Maybe there is a (pseudo) reduction from double integrals to single ones and it gives the impression that there was a single integral?
– user227352
Feb 11, 2019 at 17:30
• stats.stackexchange.com/questions/240325/… is very closely related. The techniques used there apply here directly.
– whuber
Feb 11, 2019 at 20:23

It's always a good idea to graph problems like this first. To understand what to graph exactly, we proceed as follows: First, we can prepare the graph by initially "framing-out" the area support (or area where there is positive probability under the joint probability density function or PDF). In this case both $$X$$ and $$Y$$ are independent and uniformly distributed on the interval $$[0,1]$$, which implies that the joint PDF is uniform with PDF given by:

$$\begin{eqnarray*} f_{X,Y}(x,y) & = & \begin{cases} 1, & 0

since the joint PDF of two independent random variables is simply the product of the PDFs of each of the random variables. Now, we know that the area of positive probability is the area bounded by the unit square so this can be drawn on our graph (the light purple lines shown in the graph shown below). Now you are being asked to find the probability that $$X$$ and $$Y$$ satisfy $$X+Y<1$$ and $$XY<\frac{1}{10}$$. After re-arranging terms, in symbols, this becomes

$$\begin{eqnarray*} P\left(X+Y<1\,\text{and}\,XY<\frac{1}{10}\right) & = & P\left(Y<1-X\,\cap\,Y<\frac{1}{10X}\right) \end{eqnarray*}$$

Geometrically, this amounts to finding the density under the area bounded by the inequalities $$y<1-x$$ and $$y<\frac{1}{10x}$$. We can draw on our graph the line of $$y=1-x$$ and shade in pink the area where $$y$$ is less than this line. This is shown as the areas marked as III and IV on the figure below. Similarly, we can draw the equation $$y=\frac{1}{10x}$$ in the area of support and shade in light blue the area under this equation (areas I, III, and V). Now, note that we are only interested in the areas that are under both $$y<1-X$$ and $$y<\frac{1}{10x}$$, within the unit square which is the area where the pink and blue shading overlaps in the figure, or the area by III and inside the unit square. The probability associated with this area can be determined in two ways:

1. We can perform single-variable integration in three pieces (or through some other single-variable integral with subtraction) and sum the resulting areas; or
2. We can perform double-integration of area IV and then subtract this from the area of the triangle formed by $$y<1-x$$ and the unit square (areas III and IV).

I'll show the calculation of both Methods $$1$$ and $$2$$.

# Method 1

Because the joint PDF is uniform over the unit square, then the probability we are seeking is simply the sum of the area of interest since the density over the entire area of support is constant. Note this method only works in cases where the joint density is uniform over the area of positive probability. To use this method, we have to find a suitably smooth function over which we can integrate. Unfortunately, this doesn't exist here. However, we can partition the area we are interested in integrating at point of discontinuity or where the function under which we want to integrate changes so that the function is piecemeal smooth. This means we can break the graph into three places by dropping a vertical line at those points where the graph of $$y=1-x$$ and $$y=\frac{1}{10x}$$ intersect (the red and blue dots on Figure 1). The second graph, Figure 2, shows these points with the corresponding vertical lines dropped to the $$x$$-axis that divide up III into the three areas marked by A, B, and C. So Areas A and C can be obtained by integrating under $$y=1-x$$ from $$x=0$$ to the first intersecting points and then from the second intersecting point to $$x=1$$, respectively. Area B can be obtained by integrating under the equation $$y=\frac{1}{10x}$$ between the two points where it intersects with the line given by $$y=1=x$$ (the red and blue points).

Before we can proceed with integration we must obtain the bounds of integration for A, B, and C, so we need to find the $$x$$-values where the equations $$y=1-x$$ and $$y=\frac{1}{10x}$$ intersect. This can be found by setting the right-hand-side (RHS) of each equation equal to one another and then solving for $$x$$ through the use of the quadratic formula:

$$\begin{eqnarray*} 1-x & = & \frac{1}{10x}\\ & \implies & x(1-x)=\frac{1}{10}\\ & \implies & x^{2}-x+\frac{1}{10}=0\\ & \implies & x=\frac{1-\sqrt{3/5}}{2}=\frac{\sqrt{5}-\sqrt{3}}{2\sqrt{5}}\,\text{or}\,x=\frac{1+\sqrt{3/5}}{2}=\frac{\sqrt{5}+\sqrt{3}}{2\sqrt{5}} \end{eqnarray*}$$

By substitution, we find that the red point in the graphic is given by $$\left(\frac{1-\sqrt{3/5}}{2},\,\frac{1+\sqrt{3/5}}{2}\right)$$ and the blue point by $$\left(\frac{1+\sqrt{3/5}}{2},\,\frac{1-\sqrt{3/5}}{2}\right)$$. Now, we can finally integrate areas A, B, and C with the boundaries of integration appropriately set:

### Area A:

$$\begin{eqnarray*} \int_{0}^{\frac{1-\sqrt{3/5}}{2}}1-xdx & = & \left.x-\frac{x^{2}}{2}\right|_{0}^{\frac{1-\sqrt{3/5}}{2}}\\ & = & \frac{\sqrt{5}-\sqrt{3}}{2\sqrt{5}}-\frac{5-2\sqrt{5}\sqrt{3}+3}{40}\\ & \approx & 0.1063508327 \end{eqnarray*}$$

### Area B:

$$\begin{eqnarray*} \frac{1}{10}\int_{\frac{1-\sqrt{3/5}}{2}}^{\frac{1+\sqrt{3/5}}{2}}x^{-1}dx & = & \left(\frac{1}{10}\right)\left.x^{-1}\right|_{\frac{1-\sqrt{3/5}}{2}}^{\frac{1+\sqrt{3/5}}{2}}\\ & = & \left(\frac{1}{10}\right)\log\left(\frac{1+\sqrt{3/5}}{2}\right)-\left(\frac{1}{10}\right)\log\left(\frac{1-\sqrt{3/5}}{2}\right)\\ & = & \left(\frac{1}{10}\right)\log\left[\left(\frac{1+\sqrt{3/5}}{2}\right)\left(\frac{2}{1-\sqrt{3/5}}\right)\right]\\ & = & \left(\frac{1}{10}\right)\log\left(\frac{\sqrt{5}+\sqrt{3}}{\sqrt{5}-\sqrt{3}}\right)\\ & \approx & 0.2063437069 \end{eqnarray*}$$

## Area C:

$$\begin{eqnarray*} \int_{\frac{1+\sqrt{3/5}}{2}}^{1}1-xdx & = & \frac{1}{2}-\frac{\sqrt{5}+\sqrt{3}}{2\sqrt{5}}+\frac{5+2\sqrt{5}\sqrt{3}+3}{40}\\ & = & \frac{5+2\sqrt{5}\sqrt{3}+3}{40}-\frac{\sqrt{3}}{2\sqrt{5}}\\ & \approx & 0.0063508327 \end{eqnarray*}$$

So the total area in III, the probability of interest, and the solution to the problem is given by $$\displaystyle{A+B+C=\frac{1}{2}\left(1-\sqrt{\frac{3}{5}}\right)+\frac{1}{10}\log\left(\frac{\sqrt{5}+\sqrt{3}}{\sqrt{5}-\sqrt{3}}\right)\approx0.3190453723}$$

## Method 2

When you can use double integrals, things become much easier. To use a double integral, you essentially need to find bounds in the $$x$$-direction and $$y$$-direction for the region you are interested in integrating the probability density function over (region III). In the $$x$$-direction, the bounds go from 0 to 1. The lower bound in the $$y$$-direction is the $$x$$- axis. However, again, we see the upper bound in the $$y$$-direction is not smooth because of the sudden changes in the bounds of integration at the break points previously described. But, if you look closely, you will notice that area IV has a smooth function on both the upper- and lower-bounds in the $$y$$-direction and there are single points in the $$x$$-direction. So we can find the area of III by finding the area of the pink triangle (area III and IV) by using the simple geometry formula $$\frac{1}{2}\times \text{base}\times \text{height}$$ (you could also use integration here, but why do more work?) and subtract out the area of IV found through double-integration. The resulting value will be the probability we area after. So let's start this method by finding the area in IV. We know already that this area is bounded on the top by $$y=1-x$$ and on the bottom by $$y=\frac{1}{10x}$$. For the bounds of $$x$$ we simply examine the graph and see area IV goes no further to the left than the red point given by $$\left(x=\frac{1-\sqrt{3/5}}{2},\,y=\frac{1+\sqrt{3/5}}{2}\right)$$ and no further to the right than the blue point given by $$\left(x=\frac{1+\sqrt{3/5}}{2},\,y=\frac{1-\sqrt{3/5}}{2}\right)$$. The $$x$$-values at these points will serve as the upper and lower bounds in the direction of $$x$$. So now, we proceed to computing the integral, the area of IV, or the probability of interest under the density function $$f_{X},_{Y}(x,y)=1$$ bounded by the region given by IV:

$$\begin{eqnarray*} \text{Area IV} & = & \int_{\frac{1-\sqrt{3/5}}{2}}^{\frac{1+\sqrt{3/5}}{2}}\int_{\frac{x^{-1}}{10}}^{1-x}1dydx\\ & = & \int_{\frac{1-\sqrt{3/5}}{2}}^{\frac{1+\sqrt{3/5}}{2}}1-x-\frac{x^{-1}}{10}dx\\ & = & \left.x-\frac{x^{2}}{2}-\frac{1}{10}\log(x)\right|_{\frac{1-\sqrt{3/5}}{2}}^{\frac{1+\sqrt{3/5}}{2}}\\ & = & \left[\frac{1+\sqrt{3/5}}{2}-\left(\frac{1}{2}\right)\left(\frac{1+\sqrt{3/5}}{2}\right)^{2}-\frac{1}{10}\log\left(\frac{1+\sqrt{3/5}}{2}\right)\right]-\left[\frac{1-\sqrt{3/5}}{2}-\left(\frac{1}{2}\right)\left(\frac{1-\sqrt{3/5}}{2}\right)^{2}-\frac{1}{10}\log\left(\frac{1-\sqrt{3/5}}{2}\right)\right]\\ & = & \frac{\sqrt{3}}{\sqrt{5}}-\frac{\sqrt{3}\sqrt{5}}{10}+\frac{1}{10}\log\left(\frac{\sqrt{5}-\sqrt{3}}{\sqrt{5}+\sqrt{3}}\right)\\ & = & \frac{\sqrt{3}}{2\sqrt{5}}+\frac{1}{10}\log\left(\frac{\sqrt{5}-\sqrt{3}}{\sqrt{5}+\sqrt{3}}\right) \end{eqnarray*}$$

And finally, to calculate the probability of interest, we simply need to subtract the probability calculated immediately above (Area IV) from the area of the triangle with vertices at $$(0,0)$$, $$(1,0)$$, and $$(0,1)$$ (Area III and IV):

$$\begin{eqnarray*} \text{Area III} & = & \text{Area III}+\text{Area IV}-\text{Area IV}\\ & = & \text{Triangle with vertices at}\,(0,0)\,(0,1)\,(1,0)-\text{Area IV}\\ & = & \frac{1}{2}\left(\text{base}\right)\left(\text{height}\right)-\text{Area IV}\\ & = & \frac{1}{2}(1)(1)-\left[\frac{\sqrt{3}}{2\sqrt{5}}+\frac{1}{10}\log\left(\frac{\sqrt{5}-\sqrt{3}}{\sqrt{5}+\sqrt{3}}\right)\right]\\ & = & \frac{\sqrt{5}-\sqrt{3}}{2\sqrt{5}}-\frac{1}{10}\log\left(\frac{\sqrt{5}-\sqrt{3}}{\sqrt{5}+\sqrt{3}}\right)\\ & \approx & 0.3190453723 \end{eqnarray*}$$

and this is the same answer as the one we obtained using Method 1.$$\blacksquare$$

• No problem. I tried to be a detailed as possible to help you grasp both the single integral approach as well as the double-integral approach and how to find the boundaries. Feb 12, 2019 at 3:25
• +1 for drawing the picture. But seeing it ought to suggest exploiting its symmetry: change the variables $(X,Y)$ to $U=(X-Y)/\lambda$ and $V=(X+Y)/\lambda$ with $\lambda^2=10/4.$ The problem quickly simplifies to computing an integral of the form $$\int_0^\sqrt{\lambda^2-1}\left(\lambda- \sqrt{1+x^2}\right)\mathrm{d}x.$$ (This is proportional to half the area of the pink lune in your picture.) At that point, consult any Calculus textbook or table of integrals.
– whuber
Feb 12, 2019 at 14:39
• It's an excellent point, @whuber, but I was afraid to further complicate an explanation for the OP who has already expressed trepidation when computing boundaries. I didn't want to introduce additional topics at once, but I'm glad you did for other who might come along and find the post. Feb 12, 2019 at 14:53
• Awesome to hear, @Reformed! Glad this could help. Do try to enhance your learning too with the code provided by @user2974951. It's a good technique that can usually be used to verify answers (and sometimes get the answers when analytical techniques fail). R is freely downloadable. Feb 12, 2019 at 15:10
• I understand and appreciate your motivation. I was concerned only that the basic statistical idea might have been lost in all the calculations that followed, which although perhaps of some practical importance to the student, are conceptually irrelevant.
– whuber
Feb 12, 2019 at 16:16

Alternatively using simulations

> x=runif(1e6)
> y=runif(1e6)
> mean(ifelse(x+y<1 & x*y<0.1,T,F))

 0.319823


Edit: explanation of what is going on

we simulate 1 million random numbers (1e6) from the (standard) uniform distribution (so range 0 to 1), for both $$x$$ and $$y$$ coordinates (paired points $$x$$ and $$y$$). Then we simply check how many of these coordinates satisfy your conditions, and we take the average. This is your result.

• Thanks! What program is this? And where can I learn to do it for myself?
– user227352
Feb 12, 2019 at 12:43
• @Reformed R (r-project.org). Feb 12, 2019 at 12:44
• @Reformed There is plenty of material online for R, a quick google search will give you all the information you need. Also it is quite commonly used on this site. Feb 12, 2019 at 12:44
• @StatsStudent I agree, this is just a dirty numerical result. It was meant as an addition to your answer. Feb 12, 2019 at 15:06
• @Reformed The runif function (which samples randomly from the uniform distribution) by default uses the standard normal distribution, so the code is equivalent to runif(1e6,0,1). ifelse check whether the first argument is true, if it is it returns the second argument, else the third argument. Feb 15, 2019 at 8:18