# Inside an not Equilateral Triangle what is the sum of distances from a random point to 3 sides

Given an not Equilateral Triangle with following side sizes: 45,60,75. Find a sum of distances from a random located point inside a triangle to its three sides.

Note 1: Viviani's theorem related only to equilateral triangles.

Note 2: Fermat point is related to the minimization of distances from a random point inside the triangle and its vertices.

As we can see that both notes are not helpful to solve that problem.

I have been given that puzzle during an hour an a half exam. There were only 6 minutes to solve that problem. Afters many hours I still do not have an answer. I will be very glad to get some assistance or maybe the whole solution

Regards, Dany B.

• Note that this particular triangle is rectangular. – Justpassingby Jan 29 '16 at 8:28
• Is the idea that we should assume a uniform probability distribution and compute the expected value? Or do you just want a formula for the distances, given coordinates of a point? – Justpassingby Jan 29 '16 at 8:31
• indeed this is rectangular. I didn't pay attention to that earlier. – danybutvinik Jan 29 '16 at 8:47
• we should assume uniform probability distribution – danybutvinik Jan 29 '16 at 8:47

I understand that a point $P$ is chosen at random inside a triangle $ABC$ according to a uniform probability distribution, and you want the expected value of the sum of the distances from $P$ to the sides of the triangle.

The distance from $P = (x,y)$ to one of the sides is a linear function $ax + by + c$ of the coordinates $x, y$. Thus the sum of the distances is also linear. Therefore the average value is the average of the values for $P = A$, $P = B$ and $P = C$, i.e. the average of the three altitudes of the triangle.

In the present case the altitudes are $36, 45, 60$. So the expected value is $47$.

• I have some questions: – danybutvinik Jan 29 '16 at 9:49
• 1. given three sides of the triangle - 75,60,45. What do you mean by referring to 36,45,60 as altitudes ? 2. Where 36 came from ? Thanks – danybutvinik Jan 29 '16 at 9:51
• In a triangle $ABC$, the altitude $h_a$ from $A$ is the distance from $A$ to side $BC$. Because the area $S$ of the triangle is the same no matter which base you choose, $ah_a = bh_b = ch_c = 2S$. Your triangle is a right triangle, so the legs are altitudes, i.e. $h_a = b, h_b = a$. The other altitude $h_c$ is found by computing $ab/c$. $45 \times 60/ 75 = 36$. – David Jan 29 '16 at 17:23
• Hi @David, I understand that the sum of the distances is also linear, but how do your inference go to the next sentence? (Therefore the average value is the average of the values for P=A, P=B and P=C) – David Chen Mar 23 '18 at 4:04

Given a rectangular triangle with sides $a\leq b\leq c$ we will compute the sum of the distances for an arbitrary interior point. Choose orthonormal coordinates such that the hypotenuse goes through the origin and the other sides are horizontal or vertical. Let $a$ be the height of the vertical side. All interior points have positive coordinates so we can avoid absolute value signs.

The distance from $p(x,y)$ to the horizontal side is $y.$ The distance to the vertical side is $b-x.$ The distance to the hypotenuse $H\leftrightarrow \frac{a}{b}x-y=0$ is

$$\frac{\frac{a}{b}x-y}{\sqrt{\left(\frac{a}{b}\right)^2+1}}=\frac{ax-by}{c}$$

where we have used $a^2+b^2=c^2.$

The sum of the distances is

$$s(x,y)=y+4-x+\frac{ax-by}{c}=\left(\frac{a}{c}-1\right)x+\left(1-\frac{b}{c}\right)y+b.$$

Integration gives

$$\int_{x=0}^b\int_{y=0}^{\frac{ax}b}s(x,y)dy\ dx=\frac{ab}6\left(a+b+\frac{ab}c\right).$$

The expected value of the sum of the distances is obtained after dividing this integral by the surface area $ab/2,$ giving

$$\overline{s}=\frac{a+b+\frac{ab}c}3=47.$$

Afterthought. The terms $a,$ $b$ and $ab/c$ in the numerator are the three heights of the triangle so the average sum of the distances is equal to the average of the three heights.

• Is there a simple explanation of the fact in the Afterthought(which is the one cited by @David ), namely: "The average sum of the distances is equal to the average of the three heights"? – sdd Jun 11 '18 at 12:37

Let $(x,y)$ be a point in a semi-circle with diameter inclined at $\sin ^{-1} \frac35$ to x-axis having sides proportional to Pythagorean triplet (8,6,10) as given.

The three perpendicular distance to sides of a scalene triangle are $(x,y, 4 x/5 + 3 y/5) ,$

totaling to $\dfrac {9 x + 8 y} {5}$ which is variable , needing to be averaged.

If it were constant, a result like those from Viviani, Fermat would have been in existence now for more than two centuries.