MathOverflow is a question and answer site for professional mathematicians. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Lots of simple questions because I am a noob.

You are given 3 points in R^2; A, B, C forming a triangle with area > 0. You pick an arbitrary point inside ABC and an arbitrary direction. After some distance d you will intersect some side of a triangle. The task is to compute the expected d for a given triangle. Also, it would be nice to know the whole distribution. What kind of distribution (e.g. uniform, normal) would it be?

Next, what if I have a complex polygon? Can I combine my knowledge from individual triangles somehow to compute mean and distr. for the convex polygon?

Finally, how about a non-convex polygon?

share|cite|improve this question

If you call the random variable you described X, then it's much easier to compute the expected value of X2. Indeed, for any point P inside triangle ABC, the expected value of X2 where X is the length of a ray through P intersected with the interior of ABC is just the area of ABC divided by π—imagine trying to compute the area of ABC using polar coordinates with origin at P.

You can use a similar trick to write the expected value of X in terms of the average value of 1/d(P, Q) where P and Q are selected uniformly at random from the interior of triangle ABC, but this doesn't seem terribly helpful.

share|cite|improve this answer

We can start by solving the problem for an arbitrary triangle and a fixed direction, say the upward direction, as we can always rotate the whole figure into that position.

In the generic case, no edge of the triangle is horizontal. Thus the triangle has a "top" vertex at (0, 0) -- this is the vertex with the largest y-coordinate. Without loss of generality, rescale so that the edge opposite the vertex at (0, 0) passes through (-1, 0). We'll say that the "height" of this triangle is 1, where by height we mean the length of the vertical dropped from the top vertex.

Then the set of points of vertical distance at least r from the top of the original triangle form a triangle of height 1-r, similar to the original triangle. Thus

$$ Prob(\hbox{vertical distance from top } > r) = (1-r)^2 $$

and this gives the distribution. In particular the expected value of the vertical distance from a random point to the top of the triangle (after the rescaling given above) is 1/3.

If you want to pick a random direction, though, then this gets a lot harder because the rescaling step will act differently for different directions.

share|cite|improve this answer
Trying to draw this. What is r? – S. Donovan Jan 2 '10 at 5:30

For a triangle, this seems relatively easy. construct the voronoi diagram of the sides, which in this case is merely the partition formed by the angle bisectors at each vertex. they intersect at the center of the incircle, forming three triangles. In each triangle, the 'distance to boundary' is really the distance to the corresponding side of the original triangle, and the answer is a straight integration.

share|cite|improve this answer
I think the ray is in a uniformly random direction, not towards the nearest point on the boundary. – Reid Barton Jan 2 '10 at 5:04
ah dang. good point. missed that – Suresh Venkat Jan 2 '10 at 5:08

x is in the triangle. Draw segments that connect x to each vertex and segments perpendicular to each side from x. Then, starting from the nearest perpendicular segment, measure the angle formed by your vector and call it $\theta$. Note the length of the perpendicular, call it R. Then the distance, from x to the side in the direction of the vector, is: $R \sec (\theta)$.

share|cite|improve this answer
This works for the convex... but not for the non-convex. – S. Donovan Jan 2 '10 at 5:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.