Saturday, June 10, 2017

An Expected Value problem II

We saw the explicit expression for the expected distance from a random point inside a rectangle to an edge of the rectangle in the previous post. We deal with a similar problem here.

There are a lot of reference in the internet to find the expected distance between two random points in a rectangle (Stack Exchange post). Here we ask 'what is the expected distance between two random points in a right angled triangle?'.

Basically the question is conceptually simple and the expression for the expected value can be readily written as follows:

$\mathbb{E}_T(L)=\displaystyle\int\limits_0^a \int\limits_0^{mx}\int\limits_0^a\int\limits_0^{mu}\sqrt{(x-u)^2+(y-v)^2}\,dv\,du\,dy\,dx$

where the right angled triangle is formed by the points $(0, 0)$, $(a, 0)$, and $(a, b)$. Also, for simplicity we used $m=b/a$.

Now, the difficulty of this integral (and the one that makes it different from the rectangle case) is the variable limits of the integral. In case of a rectangle, all the limits would be constants which makes it a little easier.

I'm not going to go through all the details and trouble I went through to solve this. But it is a combination of both Mathematica and a lot of paper work. Finally, after a few days and hell-a-lot completely messed up ideas later, I ended up with the following explicit expression for the expected value.

$\mathbb{E}_T(L)=\displaystyle\frac{a^3+b^3+2 d^3}{15 d^2}+\frac{a^2 }{15 b}\left(\frac{b^3}{d^3}+1\right)\text{csch}^{-1}\left(\frac{a}{b}\right)+ \frac{b^2}{15 a}\left(\frac{a^3}{d^3}+1\right) \text{csch}^{-1}\left(\frac{b}{a}\right)$

where $d=\sqrt{a^2+b^2}$.

I also wrote a small python program in an Online IDE to verify the correctness of this result.

For example, for $a=2$ and $b=3$, the formula gives

$\mathbb{E}_T(L)=\displaystyle\frac{1}{195} \left(35+26 \sqrt{13}\right)+\frac{4}{45} \left(1+\frac{27}{13 \sqrt{13}}\right) \text{csch}^{-1}\left(\frac{2}{3}\right)+\frac{3}{10} \left(1+\frac{8}{13\sqrt{13}}\right) \text{csch}^{-1}\left(\frac{3}{2}\right) \approx 1.047156999$

whereas the simulation gives $1.047117963$ after $10^8$ trials (takes about 200 secs).

Now for completion sake we also give the expected length of two random points in a rectangle. Here we have,

$\mathbb{E}_R(L)=\displaystyle\frac{a^5+b^5-\left(a^4-3 a^2 b^2+b^4\right)d}{15 a^2 b^2}+\frac{a^2}{6 b}\text{csch}^{-1}\left(\frac{a}{b}\right)+\frac{b^2 }{6 a}\text{csch}^{-1}\left(\frac{b}{a}\right)$

One of the nice things of putting these two together is, now we can also get an expression for the length of two random points lying on opposite sides of diagonal $AC$ of rectangle $ABCD$. Denoting this expected length by $\mathbb{E}_D(L)$ (D denoting diagonal), we have this relation from which we can find the required value.

$\mathbb{E}_R(L)=\displaystyle\frac{1}{4}\mathbb{E}_T(L)+\frac{1}{4}\mathbb{E}_T(L)+\frac{1}{2}\mathbb{E}_D(L)$

I tried to get an expression but it doesn't factor nicely but so it better left out. Hope you enjoyed this.


Until then
Yours aye
Me

No comments:

Post a Comment