Consider a rectangle (black one) in the following image. Lets take four random points uniformly on each border then connecting the points one after another (red lines) to get a foursquare inside the rectangle.

enter image description here

If we put a set of random points ($n$ points) uniformly inside the rectangle , I would like to know what is the mathematical expectation of the number of points that are inside the red area?

Since the position of red points are random, I really can't solve this problem.

The probability that each point falls in the red area, is the area of red_line divided by area of rectangle. Since the area it self is a random process, so we need to calculate the expectation of the area of the red line.

Thanks in advance.

  • 2
    $\begingroup$ The expected number should be $n\times\frac{Q}{R}$ where $Q$ is the area of the "foursquare" and $R$ is the area if the rectangle $\endgroup$ Commented Jul 6, 2017 at 21:48
  • 4
    $\begingroup$ The expected number is proportional to the expected area of the foursquare which in terms equals to the difference of the area of rectangle and the sum of expected areas of 4 triangles. For each triangle, the two sides (around the right angle) are independent, so its area is $\frac12 \times\left( \frac12 \right)^2 = \frac18$ of that of the rectangle. This means the expected number is simply $n (1 - 4\times \frac18) = \frac12 n$. $\endgroup$ Commented Jul 6, 2017 at 21:55
  • 1
    $\begingroup$ @quasi The vertices of the foursquare are "four random points uniformly on each other". Even though the sides of triangles at different corners are not independent, the two sides of any triangle are independent. $\endgroup$ Commented Jul 6, 2017 at 21:58
  • 2
    $\begingroup$ @quasi expectation of sum of something = sum of expectation of something even when the items involved are not independent. $\endgroup$ Commented Jul 6, 2017 at 22:01
  • 1
    $\begingroup$ @quasi: the probability of falling inside the quadrilateral is its relative area. $\endgroup$
    – user65203
    Commented Jul 6, 2017 at 22:50

2 Answers 2


WLOG, I am solving for a unit square.

Let the four vertices be at coordinates $x,x',y,y'$ on the respective sides. The area of the quadrilateral is $1$ minus the areas of the four corners,


As $x,x',y,y'$ are uniform independent random variables, their pairwise differences follow independent triangular distributions centered on $0$, and the expectation of the product is the product of the expectations.

Hence, $$E(A)=\frac12.$$


One way of doing it:

Let the vertices of the rectangle be $(0,0),(w, 0),(0, h),(w, h)$.

Then the $4$ red points are $(0, r_1h),(w, r_2h), (r_3w,0), (r_4w,h)$ where $r_n$ are uniformly distributed random numbers between $0$ and $1$.

The area of a particular quadrilateral is

$$\textrm{Area of rectangle} - \textrm{Area of 4 triangles}=hw\left(1-\frac{1}{2}(r_1r_3+r_2(1-r_3)+(1-r_1)r_4+(1-r_4)(1-r_2))\right)$$




The expected number of points inside a particular quadrilateral is $n\left(\frac{\textrm{Area of quadrilateral}}{\textrm{Area of rectangle}}\right)$

We then want to integrate between $0$ and $1$ for each $r_n$ to find the final expectation which gives us:

$$E(\textrm{Number of Points})=\int^1_0\int^1_0\int^1_0\int^1_0{n\left(\frac{\textrm{Area of quadrilateral}}{\textrm{Area of rectangle}}\right)\,\,\,dr_1dr_2dr_3dr_4}$$




  • $\begingroup$ So what is the answer in the end?! what fraction of $n$ are inside? $\endgroup$
    – M a m a D
    Commented Jul 6, 2017 at 22:06
  • $\begingroup$ Could someone verify my answer? Intuitively, I find $\frac{n}{2}$ confusing. $\endgroup$
    – Shuri2060
    Commented Jul 6, 2017 at 22:19
  • $\begingroup$ @Shuri2060 what's so confusing, it is the correct answer. $\endgroup$ Commented Jul 6, 2017 at 22:22
  • $\begingroup$ @achillehui Might be me, but I can think of quadrilaterals which take up more than half the area of the rectangle, but not less than. $\endgroup$
    – Shuri2060
    Commented Jul 6, 2017 at 22:26
  • 2
    $\begingroup$ +1 I'm glad you figure it out yourself. Following is something that should make the answer more intuitive. First fix 3 vertices and vary one of the vertices, say $r_1$. The area of the the foursquare has the form const $r_1$ + const. When one take expectation over $r_1$, the expected area is the same as if you set $r_1$ directly at the midpoint. Do the same thing to other 3 vertices. one find the expected area of foursquare is the same as the rhombus having the midpoints of the edges of rectangle as vertices. i.e. one half of that of the rectangle. $\endgroup$ Commented Jul 6, 2017 at 22:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .