4.6.27 · D3Theory of Computation

Worked examples — NP-hard — harder than NP, may not be in NP

2,466 words11 min readBack to topic

The scenario matrix

Every NP-hardness situation sits in one of these cells. The examples below are labelled with the cell they cover.

# Case class What distinguishes it Is it in NP? Example
A Seed — hardness from scratch proven hard directly via Cook–Levin Theorem, not by inheriting Yes (NP-complete) Ex 1: SAT
B Inherited hardness (decision, in NP) one reduction from a known-hard problem Yes (NP-complete) Ex 2: Clique
C Undecidable (above NP, no algorithm) hard and no decider exists No Ex 3: HALT
D Optimization (wrong type for NP) outputs a number, not yes/no No Ex 4: TSP-opt
E Counting (#P-style, wrong type) outputs a count, not yes/no No Ex 5: #SAT
F Degenerate / trivial input empty or fixed instance — does hardness survive? edge Ex 6: SAT on 0 clauses
G Real-world word problem translate a story into the framework Ex 7: exam scheduling
H Exam twist: wrong reduction direction catch the classic mistake Ex 8: direction trap

We now fill every cell.


Example 1 — Cell A: the seed (SAT is NP-hard directly)


Example 2 — Cell B: inherited hardness, still in NP


Example 3 — Cell C: undecidable, NP-hard, NOT in NP


Example 4 — Cell D: optimization, wrong type for NP


Example 5 — Cell E: counting, also wrong type


Example 6 — Cell F: degenerate / trivial inputs


Example 7 — Cell G: real-world word problem


Example 8 — Cell H: exam twist (the direction trap)


Recall Which cell is each poster child in?

HALT lives in cell ::: C (undecidable, NP-hard, not in NP) TSP-optimization lives in cell ::: D (optimization output, wrong type for NP) SAT proven via Cook–Levin lives in cell ::: A (the seed, NP-complete) To prove new NP-hard you reduce ::: a known-hard problem into (known-hard ), never into it