Math 2.0

Computer science Definition

NP-hardness

Builds on NPPolynomial-time reductionFormal language

Definition

Let Σ\Sigma be a finite alphabet, and let H⊆Σ∗H \subseteq \Sigma^* be a language. The language HH is NP-hard when A≤pHA \le_p H for every A∈NPA \in \mathrm{NP}. Here NP is the class NP, and ≤p\le_p is polynomial-time reducibility.

Remarks

Example: the halting problem HALT\mathrm{HALT}, the set of pairs (M,w)(M, w) such that the Turing machine MM halts on input ww, is NP-hard. Let A∈NPA \in \mathrm{NP}, decided by a nondeterministic machine NN. Let MNM_N be a deterministic machine that simulates all branches of NN on its input, halts if some branch accepts, and loops forever otherwise. Map ww to (MN,w)(M_N, w). Since MNM_N is fixed, this map is computable in polynomial time, and w∈Aw \in A exactly when MNM_N halts on ww. So A≤pHALTA \le_p \mathrm{HALT}, though HALT\mathrm{HALT} is not decidable and so not in NP.

Non-example: the empty language is not NP-hard. Reducing a language AA to it needs f(x)∈∅f(x) \in \emptyset for x∈Ax \in A, so only A=∅A = \emptyset reduces to it, while NP contains nonempty languages.

Since ≤p\le_p is transitive, a language is NP-hard as soon as some NP-hard language reduces to it. Some authors use Cook reductions instead of Karp reductions in this definition.

Reading path

To understand this page from the ground up, read these 4 pages in order. The foundations come first.

Show the path as a graph
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Formal language concept
  2. NP concept
  3. Polynomial-time reduction concept
  4. NP-hardness definition

Further reading

  1. Web https://en.wikipedia.org/wiki/NP-hardness
About this page
TagAGHWGCM8GY
URIm2://AGHWGCM8GY
Kinddefinition
WritingW0 stub
MSC68Q17, 68Q15
DefinesNP-hardness
UsesNP, Polynomial-time reduction, Formal language
Changed3 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.