Let x be a random real number, uniformly distributed between 0 and 1. For sanity’s sake, and since it does not effect the calculations, we’ll say that x is never 0.
x defined as such, it has a very nice property. Given two numbers a and b in the interval (0,1], assuming that a is less than b, the probability that a < x < b is given by P(a < x < b) = b – a. For example, the probability that x is less than 0.5 is clearly 0.5, since half the interval is less than 0.5 – but also because P(0 < x < 1/2) = 1/2 – 0 = 1/2. This is me trying to explain probability theory, without explaining probability theory.
Given such a random number x, let [1/x] be 1/x rounded to the nearest integer. Now, the question is this: What is the probability that [1/x] is even?
To calculate the probability of something, we first have to break it down into a convenient set of events. If [1/x] is even, then one of the following must happen: It must equal 0, or 2, or 4, or … any even integer.
So, let’s analyze those terms. First, it’s interesting to note that on x in (0,1], 1/x minimizes at 1. Thus, 1/x can never be rounded to 0. We’ve simplified our computation, at the very least by a single term.
Second, what does it take for [1/x] = 2*n? 1/x must be within a half of 2*n, on either side. In other words, an equivalent event is 2*n – 1/2 < 1/x < 2*n + 1/2. If 1/x is in that range, it will be rounded to 2*n.
Taking the inequality and inverting it, we can re-express it in terms of x by itself – convenient, given our previous discussion of inequalities involving x.
We can now use the stated formula for P(a < x < b) on this interval!
And from there, the rest is algebra.
I might’ve lied when I said it was simple algebra. The above series of fractions, alternating in sign, and with numerators of the odd numbers, is very close to being the Leibniz, or Gregory, formula for Pi.
Applying that, we can reduce our summation, in a most incredible way,
How about that? Pi showing up, in interesting places, yet again. I invite you to try to explain, heuristically, what that pi is doing here, because it is certainly there, no mistake. A quick experiment on a million random numbers gives an experimental probability of 0.49224. The above calculated value is approximately 0.429204. Very good agreement!
And, an interesting calculation.