Simple Algorithm
Algorithms & Data Structures · Optimal · 30 min

Hardness of Approximation & the PCP Theorem

Why some problems cannot even be approximated well.

A random assignment satisfies, on average, 7/87/8 of the clauses of any formula with three distinct literals per clause. Håstad proved that doing even slightly better, 7/8+ε7/8 + \varepsilon, is NP-hard. Results like this flow from one of the deepest theorems in computer science: every NP proof can be rewritten so that a verifier who reads only a constant number of its bits catches any false claim.

What you’ll learn

  • Define gap problems, show why an approximation algorithm would solve them, and derive simple gaps (general TSP, chromatic number, bin packing) from NP-completeness alone.
  • State the PCP theorem, prove its equivalence with the NP-hardness of gap-MAX-3SAT, and outline Dinur's proof by gap amplification.
  • Derive optimal hardness results with gap-preserving reductions: 7/8+ε7/8 + \varepsilon for MAX-3SAT from Håstad's 3-LIN theorem, and clique hardness from the FGLSS graph.
  • State the Unique Games Conjecture, explain why its imperfect completeness is essential, and summarize what it implies and what has been proven toward it.

Gap problems

How do you prove that even approximating a problem is hard? Reducing the exact problem to it proves nothing, since an approximation algorithm never claims exactness. Instead you reduce to a gap: instances whose optimum is either high or much lower, with nothing in between.

Some gaps fall straight out of NP-completeness, because the objective takes only a few small values:

ProblemNP-hard questionConsequence, unless P = NP
TSP with arbitrary distancesHamiltonian cycle: is the optimum nn, or more than αn\alpha n?no ratio at all
Chromatic numberis χ(G)=3\chi(G) = 3, or χ(G)≥4\chi(G) \ge 4?no ratio below 4/34/3
Bin packingdo the items fit into 2 bins (the partition problem)?no ratio below 3/23/2
Edge coloringdoes a cubic graph need 3 or 4 colors? (Holyer, 1981)no ratio below 4/34/3, although Vizing's theorem gives Δ+1\Delta + 1 colors, an additive error of 1
Additive and asymptotic guarantees can slip past such small-optimum gaps. For coloring, the PCP theorem gives far more: approximating the chromatic number within n1−εn^{1-\varepsilon} is NP-hard (Zuckerman, 2007).

MAX-3SAT resists this trick. The Cook–Levin reduction turns a no instance into an unsatisfiable formula, but possibly one in which every clause except one can be satisfied: a gap of 1/m1/m for mm clauses. Hardness for a constant fraction needs formulas in which every assignment violates a constant fraction of the clauses, a robustness that no classical reduction produces. That is what the PCP theorem supplies.

Check your understanding

Deciding whether a graph is 3-colorable is NP-complete. What does this alone imply for approximating the chromatic number, unless P = NP?

  1. Nothing: gap arguments apply only to maximization problems
  2. No polynomial-time algorithm achieves a ratio below 4/34/3
  3. Some polynomial-time algorithm achieves ratio exactly 4/34/3
  4. No polynomial-time algorithm achieves a ratio below 3
Show the answer

B. No polynomial-time algorithm achieves a ratio below 4/34/3

An algorithm with ratio ρ<4/3\rho < 4/3 uses at most ρ⋅3<4\rho \cdot 3 < 4 colors, so exactly 3, on every 3-colorable graph, while any proper coloring of other graphs uses at least 4. Counting its colors would decide 3-colorability.

The PCP theorem

The inclusion ⊇\supseteq is easy: a nondeterministic machine guesses the at most q 2r=nO(1)q\,2^{r} = n^{O(1)} proof bits the verifier could ever read and runs it on all 2r2^r coin sequences. The content is ⊆\subseteq: every NP statement has a proof of polynomial length that can be checked by reading a constant number of its bits, with any false claim caught at least half the time. The proofs grew out of interactive proofs and the theorem MIP=NEXP\mathrm{MIP} = \mathrm{NEXP} (Babai, Fortnow & Lund, 1991), and their authors, with Feige, Goldwasser and Lovász, shared the 2001 Gödel Prize.

DerivationProof
  1. x∈L ⇒ φx is satisfiable,∣φx∣ ≤ 2r⋅q 2q clausesx \in L\ \Rightarrow\ \varphi_x \text{ is satisfiable}, \qquad \abs{\varphi_x}\ \le\ 2^r\cdot q\,2^q \text{ clauses}

    PCP ⇒ gap. Given xx, list the 2r=nO(1)2^r = n^{O(1)} coin sequences RR. For each, the verifier's decision is a function of qq proof bits: write it as a CNF with at most 2q2^q clauses of width qq, and split each clause into at most qq clauses of width 3 with fresh variables. If x∈Lx \in L, the correct proof satisfies everything:

  2. fraction unsatisfied ≥ 2r/22r⋅q 2q = 12q 2q,ρ = 1−12q 2q\text{fraction unsatisfied}\ \ge\ \frac{2^r/2}{2^r\cdot q\,2^q}\ =\ \frac{1}{2q\,2^q}, \qquad \rho\ =\ 1 - \frac{1}{2q\,2^q}

    If x∉Lx \notin L, every assignment, read as a proof, is rejected on at least half of the coin sequences, and each rejection leaves at least one of that sequence's clauses unsatisfied:

  3. ρ ⌈1/(1−ρ)⌉ ≤ e−1 < 12\rho^{\,\lceil 1/(1-\rho)\rceil}\ \le\ e^{-1}\ <\ \tfrac12

    Gap ⇒ PCP. Given xx, compute the formula of the reduction; the proof is an assignment. Pick a random clause, using O(log⁡n)O(\log n) coins, read its 3 variables and accept if it is satisfied. Satisfiable formulas are always accepted; otherwise each test fails with probability at least 1−ρ1 - \rho, and ⌈1/(1−ρ)⌉\lceil 1/(1 - \rho)\rceil independent tests bring the soundness below 12\tfrac12:

Predict before you look

A verifier reads q=3q = 3 proof bits. Following the proof above, what percentage of the clauses of φx\varphi_x is guaranteed to be unsatisfied by every assignment when x∉Lx \notin L?

Show the answer

2.08 %

1/(2q 2q)=1/(2⋅3⋅8)=1/48≈2.08%1/(2q\,2^q) = 1/(2 \cdot 3 \cdot 8) = 1/48 \approx 2.08\%. Half of the coin sequences reject, and each contributes at most q 2q=24q\,2^q = 24 clauses, of which at least one fails. Small, but a constant: no assignment comes within 2% of satisfying the formula.

The original proofs used algebra: low-degree polynomials over finite fields, locally testable encodings and the recursive composition of verifiers. Dinur (2007) found a combinatorial proof that starts from a tiny gap and amplifies it.

DerivationDinur's gap amplification, in outline
  1. gap0 = 1/m\mathrm{gap}_0\ =\ 1/m

    Start. 3-coloring is NP-hard, so for a constraint graph with mm edges it is NP-hard to tell value 1 from value at most 1−1/m1 - 1/m:

  2. gap → Ω(gap)\mathrm{gap}\ \to\ \Omega(\mathrm{gap})

    Preprocess into a constraint graph that is a constant-degree expander, losing a constant factor in the gap:

  3. gap → Ω(t)⋅gap\mathrm{gap}\ \to\ \Omega(\sqrt t)\cdot\mathrm{gap}

    Power. Let each vertex hold opinions about all vertices within distance tt, and check constraints along random walks. On an expander the gap grows by a factor of order t\sqrt t (until it reaches a constant), while the alphabet grows to size ∣Σ∣dO(t)\abs{\Sigma}^{d^{O(t)}}:

  4. size × C O(log⁡m) = mO(1)\text{size}\ \times\ C^{\,O(\log m)}\ =\ m^{O(1)}

    Reduce the alphabet back to constant size by composing with an assignment tester, a small PCP for each constraint, again losing only a constant factor. With tt a large constant, each round at least doubles the gap and multiplies the size by a constant CC, so O(log⁡m)O(\log m) rounds reach a constant gap with polynomial size:

Optimal inapproximability

The imperfect completeness of the first statement is unavoidable: whether a linear system is exactly satisfiable is decided by Gaussian elimination. The proofs use the long code and Fourier analysis of Boolean functions on top of the PCP theorem and Raz's parallel repetition theorem (1998). The second statement follows from the first, up to completeness, by a one-line gap-preserving reduction:

DerivationFrom 3-LIN to 3-SAT
  1. equation satisfied⇒4 of 4 clauses,violated⇒3 of 4\text{equation satisfied} \Rightarrow 4 \text{ of } 4 \text{ clauses}, \qquad \text{violated} \Rightarrow 3 \text{ of } 4

    Replace each equation x⊕y⊕z=bx \oplus y \oplus z = b by the 4 clauses that each exclude one of the 4 assignments violating it. An assignment that satisfies the equation satisfies all 4 clauses; one that violates it falsifies exactly one:

  2. 4s+3(1−s)4 = 3+s4\frac{4s + 3(1 - s)}{4}\ =\ \frac{3 + s}{4}

    If a fraction ss of the equations is satisfied, the fraction of satisfied clauses is

  3. 3+12+ε4 = 78+ε4\frac{3 + \tfrac12 + \varepsilon}{4}\ =\ \frac78 + \frac{\varepsilon}{4}

    So systems with 1−ε1 - \varepsilon of the equations satisfiable become formulas with 1−ε/41 - \varepsilon/4 of the clauses satisfiable, and systems with at most 12+ε\tfrac12 + \varepsilon become formulas where no assignment satisfies more than:

DerivationProof
  1. ∣V(Gx)∣ ≤ 2r⋅2q\abs{V(G_x)}\ \le\ 2^r\cdot 2^q

    The graph. Vertices are accepting views: pairs (R,a)(R, a) of a coin sequence RR and answers aa to the qq queries asked on RR that the verifier accepts. Two views are adjacent when they have different coin sequences and agree on every proof position both of them read.

  2. ω(Gx) ≥ 2r⋅max⁡πPr⁡[π accepted]\omega(G_x)\ \ge\ 2^r\cdot\max_\pi \Pr[\pi \text{ accepted}]

    A proof gives a clique. For a fixed proof π\pi, the views it induces on the coin sequences it passes are pairwise consistent:

  3. ω(Gx) = 2r⋅max⁡πPr⁡[π accepted]\omega(G_x)\ =\ 2^r\cdot\max_\pi\Pr[\pi \text{ accepted}]

    A clique gives a proof. The views of a clique have distinct coin sequences and consistent answers, which together define a partial proof, accepted on every coin sequence of the clique. So the two quantities are equal:

  4. ratio 2k on 2O(klog⁡n)=nO(k) vertices\text{ratio } 2^k \text{ on } 2^{O(k \log n)} = n^{O(k)} \text{ vertices}

    With r=O(log⁡n)r = O(\log n), q=O(1)q = O(1) and kk independent repetitions of the verifier (s=2−ks = 2^{-k}), the graph stays polynomial for every constant kk, so clique is NP-hard to approximate within any constant. Randomness-efficient repetition gives nδn^{\delta}, and Håstad (1999) and Zuckerman (2007) pushed the bound to n1−εn^{1 - \varepsilon}.

ProblemBest algorithmNP-hard to beatIf the Unique Games Conjecture holds
MAX-E3SAT7/87/8 (random assignment)7/8+ε7/8 + \varepsilon (Håstad, 2001)same
MAX-E3LIN21/21/2 (random assignment)1/2+ε1/2 + \varepsilon (Håstad, 2001)same
MAX-CUTαGW≈0.8786\alpha_{GW} \approx 0.8786 (Goemans & Williamson)16/17+ε16/17 + \varepsilon (Håstad, 2001; Trevisan, Sorkin, Sudan & Williamson, 2000)αGW+ε\alpha_{GW} + \varepsilon (Khot, Kindler, Mossel & O'Donnell, 2007)
Vertex cover22−ε\sqrt2 - \varepsilon (Khot, Minzer & Safra, 2018), after 1.3606 (Dinur & Safra, 2005)2−ε2 - \varepsilon (Khot & Regev, 2008)
Set coverln⁡n\ln n (greedy)(1−ε)ln⁡n(1 - \varepsilon)\ln n (Dinur & Steurer, 2014)same
Maximum cliquebarely better than the trivial nnn1−εn^{1-\varepsilon} (Håstad, 1999; Zuckerman, 2007)same
Maximization ratios are fractions of the optimum, minimization ratios multiples of it. The rows where the third column already meets the second are the problems whose approximability is completely settled.

Unique Games and the frontier

Telling value 1 from value below 1 is easy. Within a connected component, the label of one vertex forces the labels of its neighbors, and theirs, and so on, so trying all kk labels for one vertex settles the whole component:

python
def unique_games_satisfiable(n, k, constraints):
    """constraints: (u, v, p) means label[v] == p[label[u]], p a permutation of range(k)."""
    adj = [[] for _ in range(n)]
    for u, v, p in constraints:
        inv = [0] * k
        for a, b in enumerate(p):
            inv[b] = a
        adj[u].append((v, p))
        adj[v].append((u, inv))
    label = [None] * n
    for s in range(n):
        if label[s] is not None:
            continue
        for guess in range(k):                    # k guesses for s fix its whole component
            trial, stack, ok = {s: guess}, [s], True
            while stack and ok:
                u = stack.pop()
                for v, p in adj[u]:
                    if v not in trial:
                        trial[v] = p[trial[u]]
                        stack.append(v)
                    elif trial[v] != p[trial[u]]:
                        ok = False                # contradiction: this guess fails
                        break
            if ok:
                for v, a in trial.items():
                    label[v] = a
                break
        else:
            return None                            # no label for s works: unsatisfiable
    return label

O(k(n+m))O(k(n + m)) time. Tested against brute force on 3,000 random small instances. With value 1−ε1 - \varepsilon the thread can be cut anywhere, and propagation proves nothing; that is where the conjecture puts the hardness.

If true, it pins down the approximability of many problems exactly:

  • Vertex cover: 2−ε2 - \varepsilon is NP-hard (Khot & Regev, 2008), so the matching algorithm is optimal.
  • MAX-CUT: αGW+ε\alpha_{GW} + \varepsilon is NP-hard (Khot, Kindler, Mossel & O'Donnell, 2007, with the Majority Is Stablest theorem of Mossel, O'Donnell & Oleszkiewicz, 2010), so the Goemans–Williamson SDP is optimal.
  • Every constraint satisfaction problem: a basic SDP relaxation achieves the best possible ratio, whatever the constraints (Raghavendra, 2008).

The evidence cuts both ways. Arora, Barak and Steurer (2010) give an algorithm that, on a unique game of value 1−ε1 - \varepsilon, finds a labeling satisfying a large fraction of the constraints in time 2nγ2^{n^{\gamma}}, with γ→0\gamma \to 0 as ε→0\varepsilon \to 0. So the conjecture's gap problem is solvable in subexponential time: unique games are much easier than 3-SAT is believed to be, and any reduction proving the conjecture must blow up instance sizes by a polynomial whose degree grows as ε\varepsilon shrinks. On the other side, the 2-to-2 theorem (Khot, Minzer & Safra, 2018, completing work with Dinur and Kindler) proves the analogous statement for games whose constraints allow each label two partners, with imperfect completeness. It makes vertex cover NP-hard to approximate within 2−ε\sqrt2 - \varepsilon, and it proves the Unique Games Conjecture with completeness about 12\tfrac12 in place of 1−ε1 - \varepsilon.

Check your understanding

The gap problem of the Unique Games Conjecture, with completeness 1−ε1 - \varepsilon, can be solved in time 2nγ(ε)2^{n^{\gamma(\varepsilon)}} with γ(ε)→0\gamma(\varepsilon) \to 0. Assuming the Exponential Time Hypothesis (3-SAT needs time 2Ω(n)2^{\Omega(n)}), what does this imply about a reduction from 3-SAT that would prove the conjecture?

  1. No such reduction can exist, so the conjecture is false
  2. It must produce instances of size ncn^{c} with cc growing as ε\varepsilon shrinks; a reduction of size O(n)O(n) for every ε\varepsilon would contradict the hypothesis
  3. It must run in exponential time
  4. Nothing: running times of algorithms say nothing about reductions
Show the answer

B. It must produce instances of size ncn^{c} with cc growing as ε\varepsilon shrinks; a reduction of size O(n)O(n) for every ε\varepsilon would contradict the hypothesis

Compose the reduction, producing size N=ncN = n^{c}, with the algorithm: 3-SAT would be solved in time 2Nγ=2ncγ2^{N^{\gamma}} = 2^{n^{c\gamma}}. The hypothesis forces cγ≥1c\gamma \ge 1, so c≥1/γ(ε)c \ge 1/\gamma(\varepsilon), which grows without bound. Reductions of this kind, with blow-up depending on ε\varepsilon, are allowed, so the conjecture survives.

Key takeaways

  • Hardness of approximation is proved through gap problems: an algorithm with ratio below c/sc/s decides Gap[c,s]\mathrm{Gap}[c, s]. Small optima give easy gaps (chromatic number 4/34/3, bin packing 3/23/2, general TSP unbounded).
  • The PCP theorem, NP=PCP(O(log⁡n),O(1))\mathrm{NP} = \mathrm{PCP}(O(\log n), O(1)), is equivalent to the NP-hardness of gap-MAX-3SAT for a constant gap; Dinur proved it combinatorially by amplifying a 1/m1/m gap through expander powering and alphabet reduction.
  • Håstad's theorems make the random assignment optimal for MAX-E3SAT (7/87/8) and MAX-E3LIN2 (1/21/2); gap-preserving reductions and the FGLSS graph carry such gaps to other problems, up to n1−εn^{1-\varepsilon} for clique.
  • The Unique Games Conjecture would make the known algorithms optimal for vertex cover (2), MAX-CUT (αGW\alpha_{GW}) and every CSP (basic SDP); the 2-to-2 theorem proved part of it, giving 2−ε\sqrt2 - \varepsilon for vertex cover.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

Which statement is the PCP theorem?

  1. Every NP statement has a proof of constant length
  2. Every NP optimization problem can be approximated within some constant factor
  3. Every NP statement has a polynomial-length proof that a randomized verifier checks by reading a constant number of its bits, accepting true claims always and false ones with probability at most 12\tfrac12
  4. NP equals P for problems whose verifiers may use randomness
Show the answer

C. Every NP statement has a polynomial-length proof that a randomized verifier checks by reading a constant number of its bits, accepting true claims always and false ones with probability at most 12\tfrac12

NP=PCP(O(log⁡n),O(1))\mathrm{NP} = \mathrm{PCP}(O(\log n), O(1)): the proofs stay polynomially long, but checking them needs only O(log⁡n)O(\log n) random bits and O(1)O(1) queries. Equivalently, gap-MAX-3SAT is NP-hard for some constant gap.

Question 2

A uniformly random assignment satisfies 7/87/8 of the clauses of a MAX-E3SAT instance in expectation. What does Håstad's theorem add?

  1. That a semidefinite program achieves 7/8+ε7/8 + \varepsilon
  2. That, even on satisfiable formulas, finding an assignment satisfying a 7/8+ε7/8 + \varepsilon fraction is NP-hard, so the random assignment is optimal
  3. That 7/87/8 is achievable only in expectation, never deterministically
  4. That MAX-E3SAT has a PTAS
Show the answer

B. That, even on satisfiable formulas, finding an assignment satisfying a 7/8+ε7/8 + \varepsilon fraction is NP-hard, so the random assignment is optimal

Håstad proved that telling satisfiable formulas from those where at most 7/8+ε7/8 + \varepsilon of the clauses can be satisfied is NP-hard. A polynomial algorithm guaranteeing 7/8+ε7/8 + \varepsilon would tell them apart, so the trivial algorithm is optimal unless P = NP.

Question 3

In the reduction from 3-LIN to 3-SAT, each equation becomes 4 clauses. If an assignment satisfies 60% of the equations, what fraction of the clauses does it satisfy?

  1. 60%
  2. 85%
  3. 90%
  4. 97.5%
Show the answer

C. 90%

Satisfied equations keep all 4 of their clauses, violated ones keep 3: (4⋅0.6+3⋅0.4)/4=3.6/4=90%(4 \cdot 0.6 + 3 \cdot 0.4)/4 = 3.6/4 = 90\%. The general formula (3+s)/4(3 + s)/4 maps s=12+εs = \tfrac12 + \varepsilon to 78+ε4\tfrac78 + \tfrac{\varepsilon}{4}.

Question 4

Why does the Unique Games Conjecture concern instances of value 1−ε1 - \varepsilon rather than satisfiable instances?

  1. Because satisfiable unique games can be recognized in polynomial time: fixing one label per component determines all the others
  2. Because unique games never have value exactly 1
  3. Because completeness 1 would make the conjecture trivially true
  4. Because the PCP theorem forbids perfect completeness
Show the answer

A. Because satisfiable unique games can be recognized in polynomial time: fixing one label per component determines all the others

Each constraint is a bijection, so a label on one vertex forces its neighbors, and so on through the component; trying all kk labels decides satisfiability in O(k(n+m))O(k(n + m)) time. Hardness can only live in nearly satisfiable instances.

Further reading

  • S. Arora, C. Lund, R. Motwani, M. Sudan & M. Szegedy, "Proof verification and the hardness of approximation problems," Journal of the ACM 45(3) (1998).
  • I. Dinur, "The PCP theorem by gap amplification," Journal of the ACM 54(3) (2007).
  • J. Håstad, "Some optimal inapproximability results," Journal of the ACM 48(4) (2001).
  • S. Khot, "On the power of unique 2-prover 1-round games," Proceedings of STOC (2002).
  • S. Arora & B. Barak, Computational Complexity: A Modern Approach (Cambridge University Press, 2009), chapters 11 and 22.