Bertand’s paradox [R details]

Some may have had reservations about the “randomness” of the straws I plotted to illustrate Bertrand’s paradox. As they were all going North-West/South-East. I had actually made an inversion between cbind and rbind in the R code, which explained for this non-random orientation. Above is the corrected version, which sounds “more random” indeed. (And using wheat as the proper, if weak, colour!) The outcome of a probability of 1/2 has not changed, of course. Here is the R code as well:


lacorde=rep(0,10^3)
plot(0,0,type="n",xlim=c(-2,2),ylim=c(-2,2))

for (t in 1:10^3){

 #distance from O to chord
 dchord=10

 while (dchord>1){
 #Generate "random" straw in large box till it crosses unit circle

 a=runif(2,-10,10)
 b=runif(2,-10,10)

 #endpoints outside the circle
 if ((sum(a^2)>1)&&(sum(b^2)>1)){

 theta=abs(acos(t(b-a)%*%a/sqrt(sum((b-a)^2)*sum(a^2))))
 theta=theta%%pi
 thetb=abs(acos(t(a-b)%*%b/sqrt(sum((b-a)^2)*sum(b^2))))
 thetb=thetb%%pi

 #chord inside
 if (max(abs(theta),abs(thetb))<pi/2)
 dchord=abs(sin(theta))*sqrt(sum(a^2))
 }
 }

 lacorde[t]=2*sqrt(1-dchord)
 if (runif(1)<.1) lines(rbind(a,b),col="wheat")
 }

lecercle=cbind(sin(seq(0,2*pi,le=100)),cos(seq(0,2*pi,le=100)))
lines(lecercle,col="sienna")

As a more relevant final remark, I came to the conclusion (this morning while running) that the probability of this event can be anything between 0 and 1, rather than the three traditional 1/4, 1/3 and 1/2. Indeed, for any distribution of the “random” straws, hence for any distribution on the chord length L, a random draw can be expressed as L=F⁻¹(U), where U is uniform. Therefore, this draw is also an acceptable transform of a uniform draw, just like Bertrand’s three solutions.

7 Responses to “Bertand’s paradox [R details]”

  1. Christopher Torr Says:

    Hi, I have tried using your R program to generate chords but when I try to run it, it doesn’t come up with the diagram that you show. It just shows an empty circle. Is there perhaps something that I could try to make it work? Many thanks, Chris

  2. […] Bertand’s paradox [R details] – Some may have had reservations about the “randomness” of the straws I plotted to illustrate Bertrand’s paradox. As they were all going North-West/South-East. I had actually made an inversion between cbind and rbind in the R code, which explained for this non-random orientation. Above is the corrected version, which sounds “more random” indeed. (And using wheat as the proper, if weak, colour!) The outcome of a probability of 1/2 has not changed, of course. Here is the R code as well: […]

  3. […] Bertand’s paradox [R details] […]

  4. Corey: I realise this second post is completely unrelated to Jaynes’ approach. This was simply an R exercise in studying an arbitrary version of “random draws”. If I try to get back to Jaynes’ point, it always boils down to the same issue of missing a reference measure, i.e. the translation of absolute randomness. So in a sense it is not so far from my simulation experiment: there is an infinite number of ways of turning a uniform simulation (in dimension 1, 2, or more) into a “random chord” and no way of comparing them… Furthermore, the invariance argument is coherent but not definitive, in that I can introduce more and more transforms until there is no distribution that remains invariant under all transforms. Playing devil’s advocate, I could also add that the notion of invariance offers some similarity with frequency: if I am given a circle why should I consider the continuum of all possible circles uder translation-scale transforms. I need to condition on the given circle, not on different circles that have not been observed (to paraphrase Jeffreys).

    • By “this line of argument” I meant both posts, not just this one. I commented here because it was more recent; maybe I should have commented on the original post instead.

      The point about introducing more transforms seems fair; Jaynes makes a similar point somewhere, but I can’t remember if it’s in PT:LOS or his original article entitled “The Well-Specified Problem”. But when I try to think of another invariance transform in the Bertrand problem, I can’t come up with anything concrete. Can you find one that would over-specify the problem?

      On your devil’s advocacy, I’m not seeing the similarity with frequency, but if one accepts Jaynes’s guiding principle, then the reason one doesn’t condition on the given circle is because there is no specific given circle. Since the problem doesn’t given a circle, one does indeed need a solution that doesn’t pick out one particular circle as special. (But I think I’m just repeating myself here.)

  5. I can’t help but feel that this line of argument is not in contact with the point Jaynes is trying to make. His argument is about probability distributions as carriers of information, not about the definition of randomness in this particular problem. His guiding principle (as paraphrased by me) is, “A purported solution to a problem should be invariant to details of the situation not specified in the problem statement.”

    In the maxent section, the argument is basically that to choose a distribution with lower entropy would be to assume information that is not actually available; to choose one with a higher entropy would violate the constraints of the information that is available. The invariance argument is a variation on this theme. Since the problem statement doesn’t mention the size or location of the circle, a probability distribution that purports to solve the problem ought not to depend on these details. Otherwise, the purported solution is assuming information not available in the problem statement.

    For example, we know that if the lines follow a distribution that fails scale invariance, then we could inscribe a new circle with the same center as the original circle but with a slightly different radius, compute the distribution of chord lengths with respect to the new circle, and obtain a different distribution than the one with respect to the original circle. If one proposes such a distribution as a basis for calculating the solution to the Bertrand problem, then one is privileging the scale of the original circle, even though there is no information in the problem statement to justify doing so.

    Such a distribution is just as “random” as a scale-invariant distribution, which is why Jaynes doesn’t declare the other solutions invalid. But if you’re less concerned with randomness per se and more concerned with avoiding assuming information not in evidence, I think you have good reason to prefer Jaynes’s solution.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.