← All problemsFree · Python · 40 min

Algorithm design / guarantees under an adversary

The Product Audit

Check a claimed matrix product with a random vector instead of multiplying again. Work out how often the check misses, see why the vector's range matters more than repeating, and write an audit that catches errors built to fool shortcuts.

0 / 3 graded parts passSaved in this browser · loading saved work…
Jump to your work ↓

A cloud service multiplies large matrices for its clients. A client sends A and B, and the service sends back C, claiming C=AB. The figure shows a claim with n=3. Multiplying again to check would cost as much as doing the work, about n3 steps. The client wants a check that costs about n2.

A210131024×B102310021=?C42410516104
The service claims C = AB.

Freivalds' check: pick a random vector r, then compare A(Br) with Cr. Each side takes matrix-vector products only. If C=AB, the two always agree. If not, they usually differ, and this problem asks how usually.

Background: Polynomials in Algorithm Design.

easy · Part A

How often the 0/1 check misses

For the A, B and C in the figure, draw each entry of r from {0,1} at random, independently. What is the probability that the check misses, that is, A(Br)=Cr even though C≠AB?

Explore in the sandbox

Experiment here, then copy a rule into the editor and test its guarantees.