38 3 Fundamental Complexity Classes
time he merely shrugs his shoulders. The RP adviser is very cautious. When
the prospects for an investment are poor, she advises against the investment,
and when the prospects are good, she only recommends the investment half of
the time. If she advises against an investment, we can’t be sure if she is doing
this because she knows the prospects are poor or because she is cautious. With
the
ZPP adviser, on the other hand, we always know whether he has given
good advice or is being cautious. With the
co-RP adviser the situation is like
that with the
RP adviser, only the tendencies are reversed. His advice is risky.
We won’t miss any good investments, but we are only warned about poor
investments at least half of the time. If we have both a conservative adviser
and an aggressive adviser, that is, both an
RP and a co-RP adviser, we should
be able to avoid mistakes. This is formalized in the following theorem.
Theorem 3.4.3.
ZPP = RP ∩ co-RP and ZPP
∗
= RP
∗
∩ co-RP
∗
.
Proof. We will only prove the first equality. The proof is, however, correct
for all bounds ε(n), and so the second equality follows as well. The inclusion
ZPP ⊆ RP ∩ co-RP follows from Theorem 3.4.2, so we only need to show that
RP ∩ co-RP ⊆ ZPP.
If L ∈
RP ∩ co-RP, then there are polynomially bounded RP algorithms A
and
A for L and L, respectively. We run both algorithms, one after the other,
which clearly leads to a polynomially bounded randomized algorithm. Before
we describe how we will make our decision about whether x ∈ L, we will
investigate the behavior of the algorithm pair (A,
A).
• Suppose x ∈ L.Thensincex/∈
L, A rejects the input, which we will
denote by
A(x) = 0. Since x ∈ L, A accepts x with probability at least
1/2, which we denote with A(x)=1|0. So
A,
A
is (1|0, 0).
• Suppose x/∈ L. Analogously,
A,
A
is (0, 1|0).
The combined algorithm (A,
A) has three possible results (since (1, 1) is
impossible). These results are evaluated as follows:
• (1, 0): Since A(x)=1,x must be in L. (If x/∈ L,thenA(x) = 0.) So we
accept x.
• (0, 1): Since
A(x)=1,x must be in L. (If x ∈ L,thenA(x) = 0.) So we
reject x.
• (0, 0): One of the algorithms has clearly made an error, but we don’t know
which one, so we output “?”.
The new algorithm is error-free. If x ∈ L,then
A(x) = 0 with certainty,
and A(x) = 1 with probability at least 1/2, so the new algorithm accepts x
with probability at least 1/2. If x/∈ L, then it follows in an analogous way
that the new algorithm rejects with probability at least 1/2. All together, this
implies that the new algorithm is a
ZPP algorithm for L.