# Average area of a random circle inside a triangle

Pick a random point inside a triangle $(0,0)(1,0)(0,1)$ (with uniform distribution) and draw a largest circle around it, which fully lies inside the triangle. What is the expected value of the circle area?

I solved the problem, but I don't have an answer to check my solution. Numerical experiments are not really conclusive. Let $r$ be the radius of the circle. Then we have three distinct regions. They are defined as follows:

$$r_1=x,~~~\text{if }(x,y) \in \Omega_1=\left(x<y \text{ and } y<1-(1+\sqrt{2})x \right)$$

$$r_2=y,~~~\text{if }(x,y) \in \Omega_2=\left(x>y \text{ and } y<(\sqrt{2}-1)(1-x) \right)$$

$$r_3=\frac{1}{\sqrt{2}} (1-x-y)~~~\text{otherwise } ((x,y) \in \Omega_3)$$

I found $r_3$ by minimizing the function:

$$s(x)=\sqrt{(x_0-x)^2+(y_0-1+x)^2}$$

Now about the distribution. Since it's uniform inside the triangle with area equal to $\frac{1}{2}$, we get:

$$f(x,y)=2$$

Next, as I understand it, to find the expected value for $r^2$, we need to integrate this function in each region, and then multiply by its area, divided by the area of the triangle and multiplied by $f(x,y)$:

$$<r^2>=4S_1 \int_{\Omega_1} x^2 dy ~dx+4S_2 \int_{\Omega_2} y^2 dy~ dx+2S_3 \int_{\Omega_3} (1-x-y)^2 dy~ dx$$

$$S_1=S_2=\frac{1}{2} \left(1-\frac{1}{\sqrt{2}} \right)$$

$$S_3=\frac{1}{2}-S_1-S_2=\left(\frac{1}{\sqrt{2}}-\frac{1}{2} \right)$$

Curiously, for the third region the value is twice of that for two other regions combined:

$$4S_1 \int_{\Omega_1} x^2 dy ~dx+4S_2 \int_{\Omega_2} y^2 dy=\frac{17-12 \sqrt{2}}{24}$$

$$2S_3 \int_{\Omega_3} (1-x-y)^2 dy~ dx=\frac{17-12 \sqrt{2}}{12}$$

The answer I get after evaluating all the double integrals, is:

$$<r^2>=\frac{17-12 \sqrt{2}}{8}=0.00368$$

$$\pi <r^2>=0.01156$$

However, the numerical experiments in Mahtematica (using the regions I defined) suggest the value approximately two times larger.

Can you spot where did I make a mistake? If all the steps are correct, maybe I made a mistake with integration, however I used Mathematica to check them.

Edit

Thanks to all the comments and answers. So, the correct value is:

$$<r^2>=2 \int_{\Omega_1} x^2 dy ~dx+2 \int_{\Omega_2} y^2 dy~ dx+ \int_{\Omega_3} (1-x-y)^2 dy~ dx$$

$$<r^2>=\frac{10-7 \sqrt{2}}{24}+\frac{10-7 \sqrt{2}}{24}+\frac{5 \sqrt{2}-7}{12}=\frac{3-2 \sqrt{2}}{12}$$

$$\pi<r^2> =0.04492$$

Which is the same value as Henning got by other means. Apparently, my simulation in Mathematica is wrong, I'll check it later.

• The correct formula will be $$\Bbb{E}[r^2] = \int_{\triangle} r^2 f(x, y) \, dxdy = \sum_{i=1}^{3} \int_{\Omega_i} 2 r_i^2 \, dxdy.$$ – Sangchul Lee Mar 24 '16 at 9:54
• Why are you multiplying the integrals by $4S_1,4S_2$ etc? Suppose the radius of the circle was always 1. Then you would expect your expected value to come out as 1. I would have thought you just take $\int_{\Omega_1}+\int_{\Omega_2}+\int_{\Omega_3}$ and divide the result by $\frac{1}{2}$ (because that is the total area). – almagest Mar 24 '16 at 9:59
• So the areas of the regions don't matter? – Yuriy S Mar 24 '16 at 10:00
• They do matter in a sense: a larger area "contributes more" to the answer through the corresponding integral $\int_{\Omega_i}$ (see the above comments). – zhoraster Mar 24 '16 at 10:05
• @zhoraster: On the other hand they don't matter in the sense that the expectation is the same for each of the regions separately anyway! – hmakholm left over Monica Mar 24 '16 at 10:28

Let's consider a simpler problem first:

If you select a point uniformly in a triangle with base $b$ and height $h$, what is the expected value of the square of the distance from the base?

Simple symmetry and dimensional considerations ought to tell us that this will be independent of $b$ and proportional to $h^2$, so we can compute it by considering the easy case $b=2, h=1$ where the $y$ coordinate varies between $0$ and $1$ with probability distribution function $f(y) = 2(1-y)$, and the expectation we're after is $$\int_0^1 2(1-y)y^2\,dy = \int_0^1 (2y^2 - 2y^3)\,dy = \left[ \frac23 y^3 - \frac12 y^4 \right]_0^1 = \frac16$$ so in the case with arbitrary $h$ the expectation will be $\frac16 h^2$.

Now for the full question. In your triangle the point falls into one of three regions with some probability distribution. But each region has the same height, namely the inradius of the triangle -- so the expectation is the same in each of the cases.

$\dfrac16$ of the area of the inscribed circle.
For the particular triangle in the question, the radius of the incircle is the solution to $\sqrt2 r + r = \frac{\sqrt2}2$, so $$r=\frac{\sqrt2}{2+2\sqrt2}$$ and the expected area is $$\frac\pi6 \cdot \frac{2}{(2+2\sqrt2)^2} = \frac{\pi}{3(4+8+8\sqrt2)} = \frac{\pi}{36+24\sqrt2}$$
If $\triangle$ denotes the triangle and $\bigcirc$ the circle, then to be found is:
$$\mathbb{E}\left(\text{area of }\bigcirc\right)=\int_{\triangle}\pi r\left(x,y\right)^{2}f\left(x,y\right)dxdy=2\pi\int_{\triangle}r\left(x,y\right)^{2}dxdy=$$$$2\pi\left[\int_{\Omega_{1}}r\left(x,y\right)^{2}dxdy+\int_{\Omega_{2}}r\left(x,y\right)^{2}dxdy+\int_{\Omega_{3}}r\left(x,y\right)^{2}dxdy\right]=$$$$2\pi\left[\int_{\Omega_{1}}x^{2}dxdy+\int_{\Omega_{2}}y^{2}dxdy+\int_{\Omega_{3}}\left(1-x-y\right)^{2}dxdy\right]$$