Visual walkthrough — NP-hard — harder than NP, may not be in NP
We assume you know nothing. Every word — "reduction", "certificate", "polynomial time" — gets a picture before it gets used.
Step 1 — What is a "problem" here, and what does "answer" mean?
WHAT. In this whole topic a problem means a yes/no question about an input string. The input is written on a strip — call it . The problem is really the set of all inputs whose answer is "yes". We call that set a language and write it .
- is shorthand for "the answer to the question, on input , is yes."
- means the answer is no.
WHY. Before we can say one problem is "harder" than another, we need a single, uniform shape for every problem. Turning every question into "is this string in this set?" makes them comparable — apples to apples.
PICTURE. Two bins. Every possible input string flies in and lands in the YES bin or the NO bin. The problem is the YES bin.
Step 2 — What is the class NP? (the room of problems with checkable proofs)
WHAT. A problem is in NP when a yes answer always comes with a short certificate — a proof slip — that a fast checker can verify. Formally there is a verifier and a polynomial bound so that:
Term by term:
- — the input string (the question).
- — the certificate, the proof slip; the means "there exists some slip."
- — the slip is short: its length is at most a polynomial in the input length. ( is a fixed whole number.)
- — the verifier reads and the slip and, in polynomial time, agrees.
WHY. "Polynomial time" is our meaning of fast: the work grows like , not like . We demand the slip be short and the check be fast — otherwise "having a proof" would be free and meaningless.
PICTURE. A locked YES answer, a proof slip handed to a small fast machine ; if nods, the input is in the YES bin.
Step 3 — What is a reduction? (pouring one problem into another)
WHAT. A polynomial-time many-one reduction from to , written , is a translator function that:
- runs in polynomial time, and
- converts every input of problem into an input of problem preserving the answer:
Term by term:
- — the translator; you feed it an -question, it prints an -question.
- "polynomial time" — the translation itself is cheap, so it can never be the source of hardness.
- — the two-way arrow guarantees yes stays yes and no stays no. Both directions matter (a one-way arrow would let the translator lie).
WHY. This is the machinery of "at least as hard as." If a fast solver for existed, you could solve any -question by: translate with , then ask the -solver. Cheap translate + fast solve = fast overall. So being easy would drag down to easy too — meaning is at least as hard as .
PICTURE. A funnel: -instances pour in on the left, come out on the right as -instances, YES-lids staying YES, NO-lids staying NO.
Step 4 — Define NP-hard: make all of NP pour in
WHAT. is NP-hard when every problem in NP reduces to it:
Term by term:
- — "for every problem in the NP room", not just one.
- — each of them pours into by its own translator.
WHY. Step 3 gave " at least as hard as one problem ." To capture "at least as hard as the whole class", we simply demand it for all members at once. Notice what is absent: nowhere did we write "." NP-hardness is a lower bound on difficulty and says nothing about a ceiling.
PICTURE. Every problem-bubble in the NP cloud sends its own funnel down into . sits below (harder), catching all of them.
Step 5 — The engine: reductions chain (transitivity)
WHAT. If and , then . Two funnels stacked make one funnel.
Let reduce to and reduce to . Build :
- Fast? runs in time , so its output has length ; then runs in time . A polynomial of a polynomial is still a polynomial — still fast.
- Correct? , i.e. .
Symbols:
- — first translate , then .
- — the two polynomial time bounds; is their composition, still polynomial.
WHY. This is why nobody re-reduces all of NP to prove a new problem hard. Prove one link from a known NP-hard , and transitivity does the rest:
PICTURE. Every NP funnel already ends at ; you attach one more short pipe , and now everything drains into .
Step 6 — The seed: Cook–Levin plants the first NP-hard problem
WHAT. Cook–Levin Theorem proves SAT is NP-hard directly: for any , its poly-time verifier's whole computation on is written as one giant Boolean formula . Then
- — a formula whose variables are the tape cells / states at every time-step of the verifier.
- A satisfying assignment of is an accepting certificate — so "formula solvable" = "yes-witness exists".
- The computation table is cells, each constrained by clauses → polynomially many clauses → the translation is poly time.
WHY. Without one problem proven NP-hard from scratch, transitivity has nothing to chain from. Cook–Levin is that first domino. SAT is also in NP (guess the assignment, check fast), so SAT lands NP-complete — floor and roof.
PICTURE. The verifier's step-by-step computation grid becomes a wall of clauses; a satisfying assignment lights up exactly one accepting run.
Step 7 — The twist: a problem that is NP-hard but outside NP
WHAT. Take the Halting Problem .
- It is NP-hard. Reduce 3-SAT into it: given a formula , build a machine that tries all assignments and halts iff one satisfies . Building is poly time, and Since 3-SAT is NP-hard, transitivity (Step 5) makes HALT NP-hard.
- It is not in NP. HALT is undecidable — no algorithm decides it at all. No decider ⇒ no poly-time verifier ⇒ HALT NP.
Symbols:
- — an encoding of "machine run on input " as one string.
- — the empty input; needs no external input, it holds inside.
- "halts iff satisfiable" — the trick that converts "does a yes-witness exist?" into "does this searcher ever stop?".
WHY. This is the whole point of the parent note in one example: NP-hardness only demands the floor (Step 4). HALT sails past the ceiling of NP — it isn't even decidable — yet still catches every NP funnel. That is "harder than NP, may not be in NP."
PICTURE. The NP cloud, the NP-complete rim (floor and roof, e.g. SAT), and far above it the undecidable region where HALT floats — still connected by a funnel to everything below.
The one-picture summary
One map: the NP cloud (problems with short checkable proofs), the NP-complete boundary sitting on the floor and under NP's roof, and the NP-hard region stretching from that floor upward without limit — through the undecidable, where HALT lives. Every arrow is a funnel ; every funnel drains toward greater hardness.
Recall Feynman: the whole walkthrough in plain words
We first agreed every "problem" is just a YES-bin of strings (Step 1). NP is the room of problems where a yes always ships with a short proof slip a fast checker can approve (Step 2). A reduction is a cheap translator that rewrites one problem's questions as another's without flipping any answer — so if the target is easy, the source is easy too (Step 3). Call a problem NP-hard when every problem in the NP room can pour into it through such translators (Step 4) — that says "at least as hard as all of NP", and crucially says nothing about being in NP. To prove new problems hard we don't redo all of NP: funnels chain, so one link from a known-hard problem suffices (Step 5). Cook–Levin plants the first hard problem, SAT, by turning any verifier's computation into a formula (Step 6). And then the twist: the Halting Problem catches every funnel too — it's NP-hard — yet it's undecidable, floating above NP's roof entirely (Step 7). Master key strong enough to open the NP room, even though it lives in a harder room. That's the picture.
Recall Quick self-test
Which direction proves NP-hard? ::: Reduce a known NP-hard problem into (), never . Why is HALT not in NP? ::: It is undecidable, so no decider and hence no poly-time verifier can exist. What extra condition turns NP-hard into NP-complete? ::: Also being in NP (having a short poly-time-checkable certificate). Why does transitivity let us reuse one reduction? ::: and give , so one new link inherits hardness from all of NP.