 
Summary: CMPSCI 611: Advanced Algorithms
Micah Adler
Problem Set 3 Out: November 3, 2003
Due: 5 PM, November 10, 2003
1. Say we are given three nn matrices, X , Y , and Z, and we wish to determine whether or not XY = Z.
We could of course multiply XY directly, but in this problem we develop a randomized algorithm for
testing XY ?
= Z more quickly.
(a) Consider the case where XY 6= Z, and let W = XY Z. Let i be any row of W that is not 0
(the vector consisting of n zeros). Let R be any binary vector of length n, and let R 0 be a binary
vector that is the same as R, except that the ith entry of R 0 is a 1 if and only if the ith entry of
R is a 0. Show that either RW 6= 0 or R 0 W 6=
0.
(b) Given any n n matrices X , Y and Z, and binary vector R, show how to compute R(XY Z)
in time O(n 2 ).
(c) Using parts (a) and (b), describe a randomized algorithm for testing XY ?
= Z in O(n 2 ) time.
Prove that your algorithm returns the correct answer with probability at least 1=2 for any matrices
X , Y and Z.
(d) Describe how to improve the probability that your algorithm returns the correct answer to any
