4.6.27Theory of Computation

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

2,156 words10 min readdifficulty · medium1 backlinks

WHAT is NP-hard?


WHY does the definition use reductions?

Deriving the structure from first principles

We want to formalize "LL is at least as hard as the whole class NP."

  1. "At least as hard as AA" should mean: solving LL gives solving AA cheaply.
  2. The cheapest meaningful glue is polynomial-time translation (so the hardness, not the translation, dominates).
  3. A clean translation is a function ff computable in poly time with xA    f(x)L.x \in A \iff f(x) \in L. This is the many-one (Karp) reduction ApLA \le_p L.
  4. "At least as hard as every AA\in NP" \Rightarrow require this for all ANPA \in \text{NP}.

That literally is the definition of NP-hard. Nothing extra (like LL\in NP) was needed — which is precisely why NP-hard can stick out above NP.

Figure — NP-hard — harder than NP, may not be in NP

HOW reductions compose (the engine of NP-hardness proofs)


Worked examples


Common mistakes (steel-manned)


Recall Feynman: explain to a 12-year-old

Imagine a classroom of homework problems called "NP." A problem is NP-hard if it's a "master key": if you could solve it fast, you could quickly solve every problem in that classroom by first translating them into it. But here's the surprise — the master key might belong to a problem from a totally different, even more impossible room (like "will this computer program ever stop?"). It's a key strong enough to open the NP room, even if it itself lives somewhere harder. So "NP-hard" means at least as tough as the whole NP class, not "a member of it."


Active-recall flashcards

What is the definition of an NP-hard problem?
A problem LL such that every AA\in NP reduces to it in polynomial time (ApLA\le_p L for all AA\inNP) — at least as hard as all of NP.
NP-complete vs NP-hard?
NP-complete = NP-hard AND in NP; NP-hard alone does not require membership in NP.
Give an NP-hard problem that is NOT in NP.
The Halting Problem (undecidable, hence no poly-time verifier) — or optimization TSP (not a decision problem).
Why can an NP-hard problem fail to be in NP?
NP needs a yes/no decision problem with a poly-time-checkable certificate; NP-hard only demands a hardness lower bound, so optimization/undecidable problems qualify as hard but lack the certificate/type.
To prove a new problem LL is NP-hard, what do you do?
Reduce a KNOWN NP-hard problem KK to LL (KpLK\le_p L); by transitivity all of NP reduces to LL.
Which reduction direction proves NP-hardness — into or out of LL?
INTO LL: known-hard pL\le_p L. Reducing LL into something easy proves LL is easy, not hard.
State and justify transitivity of p\le_p.
If ApBA\le_p B and BpCB\le_p C then ApCA\le_p C, via h=gfh=g\circ f; poly∘poly is poly and answers are preserved.
If P=NPP=NP, do all NP-hard problems become poly-time?
No — only those also in NP (NP-complete). Undecidable NP-hard problems like HALT stay unsolvable.
Why is SAT NP-hard?
Cook–Levin: any NP machine's poly-time accepting computation can be encoded as a Boolean formula satisfiable iff input is accepted, in poly size.

Connections

  • NP-complete — NP-hard and in NP
  • Cook–Levin Theorem
  • Polynomial-time many-one reduction
  • Class NP — verifier and certificate definition
  • Halting Problem — undecidability
  • P vs NP
  • 3-SAT and reduction templates
  • Decision vs Optimization problems

Concept Map

every A reduces via

to

defined by all NP reducing to L

plus membership in NP

requires

absent so outside NP

still NP-hard

no verifier yet NP-hard

builds new

composes via

Problems in NP

Poly-time many-one reduction

NP-hard

NP-complete

Short certificate verifiable in poly time

Transitivity of reductions

Halting Problem undecidable

Optimization or counting problems

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, NP-hard ka matlab hai: ek problem jo NP class ke har problem se kam se kam utni hi mushkil hai. Formally, agar koi AA \in NP hai, to use polynomial time mein hamari problem LL mein convert (reduce) kar sakte hain. Iska seedha matlab — agar LL fast solve ho jaye, to poori NP class fast solve ho jaye. Isliye LL ek "master key" jaisa hai.

Ab twist yahan hai: NP-hard hone ke liye LL ka NP mein hona zaroori nahi. NP mein hone ke liye problem decision (haan/naa) type honi chahiye aur uska ek chhota certificate poly time mein verify hona chahiye. Lekin NP-hard sirf "neeche se bound" deta hai (kam se kam itni hard). Isliye Halting Problem (jo undecidable hai, koi algorithm hi nahi) ya optimization TSP (jo decision problem hi nahi) — ye NP-hard hain par NP ke bahar baithe hain. Yahi line yaad rakho: "harder than NP, may not be in NP."

Proof technique simple hai aur yahi 80/20 hai: naya problem LL NP-hard sabit karne ke liye poori NP ko dobara reduce mat karo — bas ek already-known NP-hard problem (jaise 3-SAT) ko LL mein reduce karo: KpLK \le_p L. Transitivity ki wajah se ApKpLA \le_p K \le_p L, to saari NP automatically LL mein chali gayi. Direction yaad rakhna: known-hard ko LL ke andar daalo, ulta nahi — warna tum galti se LL ko easy sabit kar doge.

Yaad rakhne ka mantra: "All complete are hard; not all hard are complete." NP-complete = NP-hard + NP mein. NP-hard akela = difficulty ka floor, jo upar undecidable tak ja sakta hai.

Go deeper — visual, from zero

Test yourself — Theory of Computation

Connections