4

Imagine a gun that is shooting a ball in a square of $(0,1) \times (0,1)$ as the figure below,

enter image description here

So we can assume that the coordinates $(X,Y)$ are random variables with a uniform distribution on $(0,1)$ so if we let $W$ to be the random variable "distance to the origin" I want to compute $P(W<d)$, then I want to know

$$P(W<d)=P(\sqrt{X^2+Y^2}<d)=P(X^2+Y^2<d^2)$$

Am I right?, and in case that I am, How can I compute this probability?.

Thanks in advance.

user162343
  • 3,245
  • 1
    It seems correct. Just to point that you are using the euclidean distance, but exist a lot of difference distance functions. If im not wrong you want to divide the area or the quarter circle that represent $W<d$ between the full area. – Masacroso Aug 20 '16 at 20:57
  • Yes of course but assuming Euclidean space :) – user162343 Aug 20 '16 at 20:57
  • Well, if you are sure of the uniformity assumption, then you have just specified one quadrant of a circle (of radius $d$). The probability then is the area of that quadrant. (as the area of the square is $1$). – lulu Aug 20 '16 at 20:57
  • @lulu Yes but that is when $d<1$ right? – user162343 Aug 20 '16 at 20:58
  • @user162343 Absolutely right. If $d$ is bigger than $1$ you have to compute an integral (well, geometry will work here as well). – lulu Aug 20 '16 at 21:01
  • @lulu Can you elaborare more please :) – user162343 Aug 20 '16 at 21:02
  • 2
    Integral is probably easier to describe. Say that $1<d<\sqrt 2$. Then draw the picture. The circle meets the top line of the square when $x=\sqrt {d^2-1}$. Thus the area you want is a rectangle of dimensions $1\times \sqrt {d^2-1}$ and the region of area $\int_{\sqrt {d^2-1}}^1 \sqrt {d^2-x^2},dx$. – lulu Aug 20 '16 at 21:18
  • 1
    To do it with geometry you need to work out the area of a circular region cut out by the chord a distance $\sqrt {d^2-1}$ from the center, and then subtract that area cut out by the chord a distance $1$ from the center. Might be a good exercise, but I expect the integral is quicker. – lulu Aug 20 '16 at 21:20
  • @lulu Can you give me some time please, just to get the idea, but please don't disconnect so if I have a question Can I ask you? – user162343 Aug 20 '16 at 21:23
  • I have to go make/eat dinner, but I'll sign in again later, no problem. Good luck! – lulu Aug 20 '16 at 21:26
  • 1
    Using geometry I found $P=d^2(\pi / 4 -2 \tan^{-1} \sqrt{d^2-1})+\sqrt{d^2-1}$ – N74 Aug 20 '16 at 21:39
  • @N74 Can you elaborate in how you found that? – user162343 Aug 20 '16 at 23:54
  • I used the hint by @lulu: from the area of the quarter of circle of radius $d$ I subtracted a circular sector whose angle is $2\sqrt {d^2-1}$ then I added the triangle under that sector. – N74 Aug 21 '16 at 07:11
  • Obviously my result is for $d>1$. I have a picture of the "solution" but I don't know how to post it from my phone. – N74 Aug 21 '16 at 10:15
  • @lulu can you elaborate more in the explanation of the integral please? Thanks in advance – user162343 Aug 21 '16 at 19:53
  • Do you mean..."where did the integral come from?" or "how do I compute it?"? – lulu Aug 21 '16 at 20:01
  • First of all where did it come from :) – user162343 Aug 21 '16 at 20:02
  • I drew the picture. The red one in the post below is fine. I see that region in question is a rectangle with a circular sector attached to it. The rectangle is easily described. The circular sector is the region trapped below by the $x$-axis, to the right by $x=1$ and on top by $y=\sqrt {d^2-x^2}$. The area is therefore as I said in my comment. – lulu Aug 21 '16 at 20:04
  • Ok but is missing the black one right ? – user162343 Aug 21 '16 at 20:05
  • To carry out the integral, note that the indefinite integral is given by $$\int \sqrt {d^2-x^2}dx=\frac 12\left( x\sqrt {d^2-x^2}+d^2\tan^{-1}\frac {x}{\sqrt {d^2-x^2}}\right)+C$$ – lulu Aug 21 '16 at 20:07
  • Yes, you could do it by removing the black region as well. No problem. – lulu Aug 21 '16 at 20:08
  • Right the thing is that the above integral just give me the red part of the below picture and I want the black one too so that no matter where the ball lies it takes care of it right ? – user162343 Aug 21 '16 at 20:09
  • @lulu I got it you are taking care of both regions right? the thing now is, how did you compute it ? – user162343 Aug 21 '16 at 20:15
  • Well, as a matter of fact, I used Wolfram Alpha. But you don't need to...substituting $x=d\sin z$ should get the job done. – lulu Aug 21 '16 at 22:57
  • Ok let me see thanks a lot in advance, if I have trouble can I let you know ? – user162343 Aug 21 '16 at 23:01

1 Answers1

2

Comment: Let's try a simulation of a million shots and see if it agrees with analytic answers for $d =$ .25, .5, .75, 1.2, and 1.25 (to about 2 places):

m = 10^6;  x = runif(m);  y = runif(m)
mean(x^2 + y^2 < .25^2)
## 0.049144
mean(x^2 + y^2 < .5^2)
## 0.196488
mean(x^2 + y^2 < .75^2)
## 0.442155
mean(x^2 + y^2 < 1^2)
## 0.785169
mean(x^2 + y^2 < 1.25^2)
## 0.971806

Here is a plot for lots of values of $d$:

enter image description here

Note: If your target is circular and your distribution of shots is standard uncorrelated bivariate normal, then the distance from the bull's eye (origin) has a Rayleigh distribution; see Wikipedia.

Addendum: The plot below shows 50,000 of your random points. Red region for $d = .75$ (result trivial from geometry $\pi(.75)^2/4=0.4417865$); red and blue regions together for $d = 1.2$ (analytic result not trivial, see @lulu's Comment). The vertical red line in the upper plot is the boundary between trivial and nontrivial.

enter image description here

BruceET
  • 51,500
  • Right, the thing is that integral is extremely difficult to compute right ? – user162343 Aug 21 '16 at 01:41
  • Not sure, past my bedtime. Many people on this site are fantastic at multiple integration. Willing to wait for verdict of expert. – BruceET Aug 21 '16 at 07:53
  • 1
    The integral can be pretty easy to find... just look at the second picture above, you have to find the area of a rectangle (for $0<x<\sqrt{d^2-1}$) and of the area under the circle of radius $d$ centered in the origin for $\sqrt{d^2-1}<x<1$ – N74 Aug 21 '16 at 10:21
  • I am back :), bu What about the black part in the last picture above? – user162343 Aug 21 '16 at 14:04
  • $P(\sqrt{2} \ge W \ge 1.2) = 1 - P(W < 1.2).$ – BruceET Aug 21 '16 at 17:31
  • Thanks @BruceET but then which will be conclusion because you have computed a lot of things but I can't distinguish the conclusion or the goal :) – user162343 Aug 21 '16 at 18:03
  • Trying to provide intuition to help with analytic solution. Lots of good help here, in the Comments and maybe my Answer. Your turn. – BruceET Aug 21 '16 at 18:09
  • @BruceET Yes but just to clarify, the desire integral is the area of the rest of the square erasing the 4th part of the circle right? So we cannot solve that analytically then you approximate it am I right ? – user162343 Aug 21 '16 at 19:52