22 INTRODUCTION
U = 0.11111110000000011110000110...
Figure 1.1 Written in binary, an actual uniform over [0,1] contains an infinite sequence of
bits, each of which is uniform over {0,1}. Any computer-generated randomness only contains
a finite number of such bits.
U was in line 4, where U was compared to a number. On average, only two bits will
be needed to make such a comparison.
To see why, consider a concrete example. Suppose it is necessary to determine if
U ≤ 2/3. In binary, 2/3 is written 0.101010101010.... Suppose the first bit of U is
0. Then U = 0.0 ... and no matter how the rest of th e digits are filled out, U ≤ 2/3.
So only if the first bit is 1 will more bits of U be needed. Suppose the first and second
bits are 1. Then U = 0.11...and now no ma tter how the rest of the bits are filled out,
U > 2/3.
After k bits are chosen, the only way to need the k + 1st bit is if the first k bits
match the number to be compared against exactly. Each bit has a 1/2 chance of
failing to match the bit of the number, and so a geometric number of bits with mean
1/(1/2)=2 are needed before being able to determine if U < a.
So it is possible to treat the uniform U as
∑
∞
i=1
B
i
/2
i
,whereB
i
is the ith bit in
the binary expansion of U .ThenB
1
,B
2
,... are an iid sequence of Bernoulli random
variables with mean 1/2.
Of course, since there are an infinite number of bits, it is possible to take this sin-
gle uniform, and break it up into two uniforms. The first uniform uses the odd bits in
U, and the second uses the even. So U
1
=
∑
∞
i=1
B
2i−1
/2
i
and U
2
=
∑
∞
i=1
B
2i
/2
i
.Since
U
1
and U
2
are u sing independent Bernoulli random variables, they are independent
of each other.
This can be taken further. Along the idea of Cantor diagonalization, this sequence
of bits can be turned into an iid sequence of uniforms.
Here is how this works. Let B
1
be the first binary digit of U
1
.ThenB
2
is the
second binary digit of U
1
and B
3
is the first binary digit of U
2
.ThenB
4
is the third
binary digit of U
1
, B
5
is the second binary digit of U
2
,andB
6
is the first binary digit of
U
3
. Continuing in this fashion, the {B
i
} sequence of random bits allows construction
of U
1
,U
2
,U
3
,..., each of which is independent and has Unif([0,1]) distribution.
Therefore a single U ∼ Unif([0,1]) can be viewed as an in finite sequence of iid
Unif([0,1]) random variables! The point is not to do this in practice, but by realiz-
ing this equivalence, all the randomness used by any randomized algorithm can be
summarized by a single uniform, which simplifies th e notation considerably.
In other words, any randomized algorithm can be written as a deterministic func-
tion
φ
(x,U),wherex is the deterministic input to the problem, and U ∼ Unif([0 , 1])
represents all the randomness used by the algorithm.
When a randomized algorithm that takes one step in a Markov chain is written in
this fashion, call the algorithm an update function. Update functions are the building
blocks of many perfect simulation algorithms (see Chapter 3).