3.2. The Method of Conditional Probabilities 43
the derandomization procedure. With each such state we associate a weight w.
The weight W(dl,... ,d i) is defined as the conditional expectation E[Z[yl -=
dl,..., Yi -- di]. In other words, we consider a modification of A where only
Yi+t,.-., Y, are chosen randomly with probabilities Pi+l,...,Pn and where the
bits YI,.--, Yi have been fixed to dl,..., di. Then the weight
w(dl,..., di)
is the
expected output of this modified algorithm.
In particular, we have w 0 = E[Z]. Furthermore,
w(dl,...,dn)
= E[Z[yl =
dl,...,yn = dn] is the output of A when all bits Yl,-..,Yn are fixed, i.e. the
output of a deterministic algorithm.
The derandomization by the method of conditional probabilities is based on the
assumption that the weights
w(dl,...,
di) can be computed in polynomial time.
If this is not possible, one may try to estimate the weights. This method is called
method of pessimistic estimators. An example of an application of this method
is presented in Section 3.4.
Now we can give an outline of the derandomized algorithm.
for i := 1 to n do
if w(dt,... ,di-l,0) > w(dt,..., di-1,1)
then di :-- 0
else di :-= 1
Run the algorithm A where the random choices are replaced by dl,..., d, and
output the result of A.
In order to prove that the output of A for this choice of dl,. 9 dn is at least E[Z]
we consider the relation between W(dl,..., di) and the weights w(dl,..., di, 0)
and W(dl,..., di,
1). A simple manipulation yields
w(dl,...,di) = E[Zlyl = dl,...,yi = di]
: (1
-p{+I)E[Z[yl =- dl,... ,Yi = di,yi+l =-
13]
+Pi+x E[Z[yl
= dl,... ,Yi = di, yi+l =
1]
= (1
-pi+l)w(dl,...,di,O) +pi+lW(dl,...,di,1).
(3.1)
This equality should be also intuitively clear. It says that after choosing yl =
dl,..., y~ = d~ the following two procedures yield the same result:
1. We randomly choose yi+l,..., Yn and compute the expectation of the output.
2. First we choose Yi+x = 0 and afterwards
Yi+2,..., Yn
randomly and compute
the expectation of the output. Then we choose yi+l = 1 and afterwards
Yi+2,.-., yn randomly and compute the expectation of the output. Finally,
we compute the weighted mean of both expectations.
From (3.1) we conclude
w(dl,...,
di) <~ max{w(dl,..., di, 0), w(dl,..., di, 1)},
(3.2)