Once again, there was a nice maths puzzle on http://www.futilitycloset.com/ last week (but without further reference). The question was the following, “*Five points are located in an equilateral triangle with 10-inch sides (or on its perimeter). What’s the maximum distance between the two closest points*?” Actually, this is simply an application of Dirichlet’s pigeonholes theorem, as mentioned in the answer of the puzzle, “*Connect the midpoints of the triangle’s sides to make four smaller triangles. Because there are five points, two of them must fall within one of these triangles. The maximum distance between these two is 5 inches*.”

Thus, with Dirichlet’s pigeonholes theorem, we know not only the maximal minimum distance, but also where points must be (on corners of inside triangles). Here, there might be two possibilities (with also the different shapes obtained using rotations),

Further, we also observe that this result is valid not only with five points, but with six. And if we go further, e.g. with nine points, we have the following

So actually, it is possible to have a simple conjecture: let denote the number of points, and let be so that

then the minimal distance is . Which can be visualized below,

Based on that pigeonhole theorem, I have the intuition that this result is valid (here we just count the number of inside-triangles), but can we check if this is correct or not ? One idea might be to draw points randomly, and so see where points might end, or at least the maximal distance obtained over millions of random draws… But standard monte carlo might take a while… so we can use two ideas. One idea is from quasi-monte carlo techniques: since we want points to be to be as separate as possible, we do not need to draw randomly in the triangle, but perhaps we can draw randomly points on some grid. A second idea from the latin hypercube technique (and that pigeonholes theorem): instead to generating points randomly in the triangle, perhaps we can draw them in specific regions. For instance, with five points, we know that 4 points have to be in those sub-triangles, and the additional point in any one of those triangle. And because of symmetry, with five points, we can claim that this additional point has to be specifically in one sub-triangle. A random sample with five points within the same sub-triangle will be useless (and a waste of computational time).

With the following code, we define a grid, for a triangle, either upward, or downward, starting from some point (on the left), with a given length, and a given number of subdivision.

TRIANGLES=function(xinf,yinf,l,n,updown="up"){ X=NA;Y=NA for(i in n:1){ u=xinf+seq(0+(n-i)/2/(n-1),1-(n-i)/2/(n-1),length=i)*l if(updown=="up") v=rep(yinf+(n-i)*sqrt(3)/2*l/(n-1),i) if(updown=="down") v=rep(yinf-(n-i)*sqrt(3)/2*l/(n-1),i) X=c(X,u);Y=c(Y,v)} return(cbind(X[-1],Y[-1]))}

Here are grid with respectively 20 and 50 points on the lower side. It is then possible to define 4 grids, corresponding to the four sub-triangles,

k=3;st=6 firstgrid=TRIANGLES(0,0,(k-2)/(k-1),k-1) secondgrid1=TRIANGLES( firstgrid[1,1],firstgrid[1,2],1*(k-2)/(k-1),st) secondgrid2=TRIANGLES( firstgrid[2,1],firstgrid[1,2],1*(k-2)/(k-1),st) secondgrid3=TRIANGLES( firstgrid[3,1],firstgrid[3,2],1*(k-2)/(k-1),st) secondgrid4=TRIANGLES( firstgrid[3,1],firstgrid[3,2],1*(k-2)/(k-1),st,updown="down")

Then, we just draw randomly five points on that grid, in the four sub-triangles,

N=5 Dmax=0 setpointmax=matrix(0,4,2) indice=c(1:4,sample(1:4,size=N-4,replace=FALSE)) tindice=table(indice) indice1=sample(1:nrow(secondgrid1),size= tindice[1],replace=FALSE) indice2=sample(1:nrow(secondgrid2),size= tindice[2],replace=FALSE) indice3=sample(1:nrow(secondgrid3),size= tindice[3],replace=FALSE) indice4=sample(1:nrow(secondgrid4),size= tindice[4],replace=FALSE) setpoint=rbind(secondgrid1[indice1,],secondgrid2[indice2,], secondgrid3[indice3,],secondgrid4[indice4,])

No, we can run a code, where we keep in mind locations of the five points each time we beak a record,

D=min(dist(setpoint,"euclidean")) if(D>Dmax){Dmax=D setpointmax=setpoint}

Here are some locations obtained after running the algorithm a few times (with five points)

On the graph below, we can visualize the time it takes before having a record, and the convergence towards 1/2 (which is the true value of the maximal distance)

The convergence is slow… extremely slow… However, we can run the same code for more than five points, e.g. seven points (actually, here sub-triangles are not used here, and it looks like we have been lucky here, since the convergence was rather fast),

Cite this blog post

Arthur Charpentier (2012, April 16). Pigeonholes and triangles. *Freakonometrics*. Retrieved May 25, 2024, from https://doi.org/10.58079/oul5