Polynomial-Time Reductions

Suppose you are handed a scheduling problem for a hospital's operating rooms. After weeks of effort, you cannot find an efficient algorithm. Should you keep trying, or is there reason to suspect no efficient algorithm exists at all? The theory of polynomial-time reductions gives a rigorous way to answer this question. It does so without solving the problem outright. Instead, it relates the problem to other problems whose difficulty is already understood. A reduction is a translation device. It converts instances of one problem into instances of another. This conversion preserves the yes/no answer. If we can translate problem AA into problem BB efficiently, then an efficient algorithm for BB would immediately yield an efficient algorithm for AA. This single observation is simple to state but subtle to wield. It is the engine behind essentially every hardness proof in computer science. This includes the classification of NP-complete problems. It also includes modern impossibility results in cryptography and fine-grained complexity. The big picture is this: instead of proving from scratch that a problem is hard, we prove it is at least as hard as a problem already known to be hard. This turns a sprawling landscape of thousands of computational problems into a connected web. In this web, difficulty flows along reduction arrows. Once one problem in the web is nailed down as intractable (assuming a widely believed conjecture like P≠NPP \neq NP), the hardness spreads to everything reachable by reductions. This article gives a precise definition of the Karp (many-one) reduction. It works through the mechanics of constructing one. It proves exactly why hardness transfers along the relation A≤pBA \le_p B. It also walks through a full worked reduction with a diagram. It sets up the machinery needed to state and prove the Cook-Levin Theorem. It also helps classify the standard catalogue of NP-complete problems.

Key takeaways
  • A Karp (many-one) reduction A≤pBA \le_p B is a polynomial-time computable function ff mapping instances of AA to instances of BB such that x∈A  ⟺  f(x)∈Bx \in A \iff f(x) \in B.
  • Reductions transfer hardness upward: if A≤pBA \le_p B and AA is hard, then BB is at least as hard as AA.
  • To prove BB is NP-hard, reduce a known NP-hard problem AA into BB — never the other direction.
  • Correctness of a reduction requires proving both directions of the iff, not just constructing a plausible-looking mapping.
  • Reductions must run in polynomial time in ∣x∣|x|; the size of f(x)f(x) is therefore also polynomially bounded.
  • The reducibility relation ≤p\le_p is transitive, letting hardness proofs chain together into long reduction sequences.
The core insight

A polynomial-time reduction A≤pBA \le_p B shows that solving BB efficiently would solve AA efficiently too, so BB inherits every bit of AA's difficulty.

The idea

A decision problem is a language L⊆{0,1}∗L \subseteq \{0,1\}^*: a set of strings (encoding instances) that should be accepted. Given two decision problems AA and BB, a Karp reduction (also called a many-one reduction, written A≤pBA \le_p B) is a function f:{0,1}∗→{0,1}∗f : \{0,1\}^* \to \{0,1\}^* satisfying two conditions: 1. Efficiency: ff is computable by a deterministic algorithm running in time polynomial in ∣x∣|x|, the length of the input. 2. Correctness (the reduction property): for every string xx,

x∈A  ⟺  f(x)∈B.x \in A \iff f(x) \in B.

The function ff takes an instance of AA and produces an instance of BB — not a solution, not a proof, just a translated instance whose membership status matches the original. This is the crucial subtlety: ff never needs to look at whether x∈Ax \in A actually holds; it only needs to construct an instance of BB that will turn out to be a yes-instance exactly when xx was a yes-instance of AA. It helps to separate two distinct roles that reductions play, both essential vocabulary going forward. When we say "AA reduces to BB," we mean A≤pBA \le_p B: AA's difficulty is at most BB's difficulty, because a BB-solver gives an AA-solver. This is used to prove BB is hard, by reducing a known-hard problem into BB. Confusing the direction of the arrow is the single most common error when learning this material — reducing BB into AA proves nothing about AA's hardness, it only shows AA is at least as hard as BB, which is often useless if BB is easy. A problem BB is called NP-hard if every problem in NP reduces to it: A≤pBA \le_p B for all A∈NPA \in \mathrm{NP}. A problem that is NP-hard and itself in NP is NP-complete. Proving NP-hardness of some new problem BB directly from the definition would require exhibiting a reduction from every problem in NP — an infinite family. The escape hatch, formalized by the Cook-Levin Theorem, is that it suffices to reduce just one already-known NP-hard problem AA into BB, because A≤pBA \le_p B combined with (every problem in NP) ≤pA\le_p A gives, by transitivity, (every problem in NP) ≤pB\le_p B.

How it works

Constructing a valid reduction A≤pBA \le_p B is a design task with a fixed recipe. You are given an arbitrary instance xx of AA (you do not get to assume anything about xx beyond that it is some valid encoding of an AA-instance), and you must build, using only polynomial time and space, an instance y=f(x)y = f(x) of BB such that the two yes/no answers agree.

Step-by-step recipe: 1. Understand both problems' input/output semantics precisely. What counts as a valid instance of AA? Of BB? What does "yes" mean for each? 2. Design the gadget. Identify how the combinatorial structure of AA (variables, constraints, graph edges, whatever the objects are) can be encoded using the vocabulary of BB's objects. This is the creative core of the proof. 3. Specify ff as an explicit polynomial-time algorithm. Write pseudocode that reads xx and outputs yy. 4. Prove the forward direction: if x∈Ax \in A, then f(x)∈Bf(x) \in B. Usually done by taking a witness/certificate for x∈Ax \in A and explicitly constructing a corresponding witness for f(x)∈Bf(x) \in B. 5. Prove the backward direction: if f(x)∈Bf(x) \in B, then x∈Ax \in A. Usually done by taking a witness for f(x)∈Bf(x) \in B and decoding it back into a witness for x∈Ax \in A. This direction is the one most often shortchanged in sloppy proofs — it must be argued with equal rigor. 6. Verify the size and time bound. Confirm ∣f(x)∣|f(x)| is polynomial in ∣x∣|x|, and that steps 1–3 run in polynomial time (which, in particular, guarantees ∣f(x)∣|f(x)| is polynomial, since a polynomial-time algorithm cannot write more than a polynomial number of output symbols). Here is this recipe expressed generically, followed by the concrete, fully worked reduction 3-SAT ≤p\le_p Independent Set that is used throughout the rest of the article. ``` FUNCTION Reduce_A_to_B(x): // x is an instance of A // 1. Parse x according to A's format parsed <- Parse(x) // 2. Build gadgets that encode parsed's structure using B's vocabulary y <- BuildInstanceOfB(parsed) // must run in poly(|x|) time // and produce |y| = poly(|x|) RETURN y // y is an instance of B // Correctness obligation (proved separately, not executed): // x in A <=> Reduce_A_to_B(x) in B ```

Concrete instance: 3-SAT ≤p\le_p Independent Set.

  • 3-SAT instance (AA): a Boolean formula φ=C1∧C2∧⋯∧Cm\varphi = C_1 \wedge C_2 \wedge \cdots \wedge C_m in conjunctive normal form, each clause CiC_i a disjunction of exactly 3 literals. Question: is there a truth assignment satisfying every clause?
  • Independent Set instance (BB): a graph G=(V,E)G = (V,E) and an integer kk. Question: is there a set S⊆VS \subseteq V with ∣S∣≥k|S| \ge k such that no two vertices in SS are joined by an edge?

The gadget. For each clause Ci=(ℓi1∨ℓi2∨ℓi3)C_i = (\ell_{i1} \vee \ell_{i2} \vee \ell_{i3}), create a triangle of three vertices, one per literal occurrence, and connect all three with edges (so at most one vertex per triangle can be chosen in any independent set). Then, for every pair of vertices across different triangles that represent complementary literals (one is xjx_j, the other ¬xj\neg x_j), add a conflict edge between them. Set k=mk = m, the number of clauses. ``` FUNCTION ThreeSAT_to_IndependentSet(phi): V <- empty set, E <- empty set m <- number of clauses in phi FOR each clause C_i = (l_i1, l_i2, l_i3) in phi: create vertices v_i1, v_i2, v_i3 add v_i1, v_i2, v_i3 to V add edges (v_i1,v_i2), (v_i2,v_i3), (v_i1,v_i3) to E // triangle FOR each pair of vertices v_ip, v_jq (i != j): IF literal at v_ip is the negation of literal at v_jq: add edge (v_ip, v_jq) to E // conflict edge k <- m RETURN (G = (V,E), k) ``` This algorithm clearly runs in time O(m2)O(m^2) (at most 3m3m vertices, and all pairs are checked once), which is polynomial in ∣φ∣|\varphi|.

Figure
Gadget construction for 3-SAT ≤p Independent Set: one triangle per clause, conflict edges between complementary literals
φ = (x₁ ∨ x₂ ∨ ¬x₃) ∧ (¬x₁ ∨ x₂ ∨ x₃) ∧ (x₁ ∨ ¬x₂ ∨ x₃) x₁ x₂ ¬x₃ C₁ ¬x₁ x₂ x₃ C₂ x₁ ¬x₂ x₃ C₃ Solid triangle edges: at most one vertex per clause chosen. Dashed red edges: connect complementary literals (x_j and ¬x_j) across clauses. Independent set of size k = 3 exists ⇔ φ is satisfiable (pick one consistent literal per clause).

Complexity & correctness

Complexity of the reduction itself. The reduction must run in time polynomial in the size of the input instance xx. This is not a minor technicality: if the translation itself took exponential time, an efficient algorithm for BB would not yield an efficient algorithm for AA, since the translation step would dominate the running time. In the 3-SAT-to-Independent-Set example, with mm clauses the construction creates O(m)O(m) vertices and checks O(m2)O(m^2) pairs for conflicts, giving O(m2)O(m^2) time — polynomial, as required. A polynomial-time bound also automatically forces ∣f(x)∣|f(x)| to be polynomially bounded, since an algorithm cannot output more symbols than time steps it takes.

Why hardness transfers — the composition argument. This is the theorem that makes the whole machinery worthwhile. > Claim. If A≤pBA \le_p B and AA is NP-hard, then BB is NP-hard. > > Proof. Since AA is NP-hard, for every problem C∈NPC \in \mathrm{NP} we have C≤pAC \le_p A, via some polynomial-time reduction gg. We are given a polynomial-time reduction ff witnessing A≤pBA \le_p B. Define h=f∘gh = f \circ g, i.e. h(x)=f(g(x))h(x) = f(g(x)). > > Polynomial time: gg runs in time p(∣x∣)p(|x|) for some polynomial pp, producing an output g(x)g(x) of length at most p(∣x∣)p(|x|). Then ff runs in time q(∣g(x)∣)≤q(p(∣x∣))q(|g(x)|) \le q(p(|x|)) for some polynomial qq. The composition q(p(∣x∣))q(p(|x|)) is again a polynomial in ∣x∣|x| (a polynomial composed with a polynomial is a polynomial). So hh runs in polynomial time. > > Correctness: x∈C  ⟺  g(x)∈Ax \in C \iff g(x) \in A (since gg witnesses C≤pAC \le_p A), and g(x)∈A  ⟺  f(g(x))∈Bg(x) \in A \iff f(g(x)) \in B (since ff witnesses A≤pBA \le_p B). Chaining these, x∈C  ⟺  h(x)∈Bx \in C \iff h(x) \in B. > > Hence C≤pBC \le_p B for every C∈NPC \in \mathrm{NP}, so BB is NP-hard. ■\blacksquare This proof is exactly why ≤p\le_p is called transitive: A≤pBA \le_p B and C≤pAC \le_p A together give C≤pBC \le_p B. In practice, to prove a new problem BB is NP-hard, you only ever need to exhibit one reduction from one already-established NP-hard problem AA — the transitivity handles the rest, because that established problem already carries reductions in from all of NP.

Correctness of an individual reduction. For the 3-SAT ≤p\le_p Independent Set construction above, correctness requires proving both directions of the iff. (⇒\Rightarrow) If φ\varphi is satisfiable, then GG has an independent set of size k=mk=m. Take a satisfying assignment. In each clause, at least one literal is true; pick one true literal per clause and select its corresponding vertex in that clause's triangle — this gives exactly mm vertices, one per triangle. No two selected vertices lie in the same triangle (so no triangle edge is violated), and no two selected vertices are complementary literals — because if both xjx_j and ¬xj\neg x_j were selected, the assignment would have to make both true, which is impossible. So no conflict edge is violated either. This set of mm vertices is independent. (⇐\Leftarrow) If GG has an independent set SS of size ≥m\ge m, then φ\varphi is satisfiable. Since each triangle is a clique, SS contains at most one vertex per triangle; with mm triangles and ∣S∣≥m|S| \ge m, SS must contain exactly one vertex from every triangle. Because SS is independent, it contains no conflict edge, meaning SS never simultaneously selects both xjx_j and ¬xj\neg x_j for any variable jj. Assign each variable mentioned in SS the truth value matching its selected literal; assign unmentioned variables arbitrarily. Every clause has its selected literal set true, so φ\varphi is satisfied. Both directions are essential: the forward direction shows the translation doesn't lose solutions, and the backward direction shows it doesn't invent fake ones.

Tradeoffs and honesty about scope. A polynomial-time reduction says nothing about how much larger BB's hard instances get, nor about average-case difficulty — it is purely a worst-case, existence-of-instance statement. It also does not directly give an approximation-preserving guarantee: some reductions blow up the "quality" of near-solutions, which is why approximation-hardness needs stronger reduction notions (e.g., gap-preserving or L-reductions). Finally, ≤p\le_p is not symmetric: A≤pBA \le_p B does not imply B≤pAB \le_p A, and conflating the two directions is the most common conceptual error in this subject.

Worked example

Trace the reduction on a concrete small formula, then verify both the constructed instance and the answer transfer correctly. Let

φ=(x1∨x2∨¬x3)∧(¬x1∨x2∨x3)∧(x1∨¬x2∨x3).\varphi = (x_1 \vee x_2 \vee \neg x_3) \wedge (\neg x_1 \vee x_2 \vee x_3) \wedge (x_1 \vee \neg x_2 \vee x_3).

This is exactly the formula in the figure, with m=3m = 3 clauses, so k=3k = 3.

StepDetail
Parse φ\varphi3 clauses, 3 variables (x1,x2,x3x_1,x_2,x_3)
Build trianglesT1={x1,x2,¬x3}T_1 = \{x_1, x_2, \neg x_3\}, T2={¬x1,x2,x3}T_2=\{\neg x_1, x_2, x_3\}, T3={x1,¬x2,x3}T_3=\{x_1,\neg x_2,x_3\}
Add triangle edges3 edges per triangle, 9 total
Add conflict edgesx1x_1–¬x1\neg x_1 (between T1,T2T_1,T_2); ¬x3\neg x_3–x3x_3 (between T1,T2T_1,T_2); ¬x3\neg x_3–x3x_3 (between T1,T3T_1,T_3); x2x_2–¬x2\neg x_2 (between T2,T3T_2,T_3)
Set kkk=3k = 3

Now try the assignment x1=True,x2=True,x3=Truex_1 = \text{True}, x_2 = \text{True}, x_3 = \text{True}. Check clauses: C1=(T∨T∨F)=TC_1 = (T \vee T \vee F) = T; C2=(F∨T∨T)=TC_2 = (F \vee T \vee T) = T; C3=(T∨F∨T)=TC_3 = (T \vee F \vee T) = T. All satisfied, so φ∈3-SAT\varphi \in \text{3-SAT}. Following the forward-direction proof, pick one true literal per clause: from C1C_1 pick x1x_1 (vertex in T1T_1), from C2C_2 pick x2x_2 (vertex in T2T_2), from C3C_3 pick x3x_3 (vertex in T3T_3). Check this set S={x1(T1),x2(T2),x3(T3)}S = \{x_1^{(T_1)}, x_2^{(T_2)}, x_3^{(T_3)}\} is independent:

  • No two lie in the same triangle. ✓
  • Check conflict edges: is x1x_1–¬x1\neg x_1 present? We chose x1x_1 from T1T_1 and x2x_2 from T2T_2, not ¬x1\neg x_1, so this edge does not touch SS. Is x2x_2–¬x2\neg x_2 present? We chose x2x_2, not ¬x2\neg x_2, so no conflict. Is x3x_3–¬x3\neg x_3 present between chosen vertices? We chose x3x_3 from T3T_3, and from T1T_1 we chose x1x_1 (not ¬x3\neg x_3), so no conflict touches SS. ✓

So SS is independent with ∣S∣=3=k|S| = 3 = k, confirming GG has the required independent set — exactly as the theorem guarantees. To see the backward direction concretely, suppose instead someone hands us the independent set S′={x1(T1),¬x1(T2),x3(T3)}S' = \{x_1^{(T_1)}, \neg x_1^{(T_2)}, x_3^{(T_3)}\} as a candidate. This is not actually independent, because x1(T1)x_1^{(T_1)} and ¬x1(T2)\neg x_1^{(T_2)} are joined by a conflict edge — illustrating exactly why the conflict-edge gadget is necessary: it is precisely what rules out inconsistent assignments from ever forming an independent set, keeping the two directions of the iff aligned.

Common pitfalls & traps

PitfallWhy it happensFix
Reducing in the wrong directionConfusing "BB is at least as hard as AA" with the reverseTo prove BB hard, construct f:A→Bf: A \to B where AA is already known hard — never f:B→Af: B \to A
Proving only one direction of the iffThe forward direction ("yes maps to yes") often feels more intuitive to constructExplicitly write and check the contrapositive/backward direction; find a witness-decoding argument
Reduction runs in exponential timeGadget construction accidentally involves brute-force search over assignments or subsetsRecheck every loop bound; reductions should only construct structure, never search for a solution
Assuming reductions preserve solution qualityTreating ≤p\le_p as if it were approximation-preservingUse dedicated approximation-preserving reductions (L-reductions, gap reductions) for approximation hardness
Off-by-one in the threshold parameter kkForgetting to match kk exactly to the number of gadgets (e.g., clauses)Re-derive kk from the correctness proof itself, not by guessing

Pioneers & history

Origins · 1 minRichard M. Karp and how this was discovered
RM
Richard M. Karp
1935–present · Formalized many-one polynomial-time reducibility and used it to establish 21 classic NP-complete problems, giving the reduction method its standard name and its first large-scale demonstration.

History
1971
— Stephen Cook proves SAT is NP-complete via a direct, from-scratch reduction from any NP problem, introducing the notion later formalized as polynomial-time reducibility.
1972
— Richard Karp publishes "Reducibility Among Combinatorial Problems," reducing SAT to 21 further problems and establishing the reduction-chaining method as the standard hardness toolkit.
1973
— Leonid Levin independently publishes closely related results in the Soviet Union, leading to the joint name Cook–Levin Theorem for the foundational completeness result.
1979
— Garey and Johnson's "Computers and Intractability" catalogues hundreds of NP-complete problems via reduction chains, cementing ≤p\le_p as the working language of hardness proofs.
1991
— The theory of PCPs (probabilistically checkable proofs) motivates stronger, approximation-preserving reduction notions, extending Karp's original idea to hardness-of-approximation results.

Where this matters

Polynomial-time reductions are the load-bearing wall of computational complexity theory, but their influence reaches directly into engineering practice. When a systems engineer encounters a scheduling, routing, or resource-allocation problem and cannot find a fast algorithm, a reduction from a known NP-hard problem (often Boolean Satisfiability, Vertex Cover, or Traveling Salesman Problem) is the standard way to justify falling back on heuristics, approximation algorithms, or integer-programming solvers instead of searching for an exact polynomial algorithm. Compiler and hardware design use reductions to justify the use of SAT and SMT solvers for verification tasks: showing a verification question reduces from SAT (or to SAT, for solving) tells engineers exactly which off-the-shelf solver technology is appropriate. Cryptographic hardness assumptions are themselves built from reduction arguments — a cryptosystem's security proof is typically a reduction showing that breaking the scheme would let you solve a problem believed to be hard (e.g., factoring or discrete log). Modern fine-grained complexity extends the same idea to distinguish, say, O(n2)O(n^2) from O(n2−ϵ)O(n^{2-\epsilon}) time using reductions from conjectured-hard problems like 3SUM or the Strong Exponential Time Hypothesis, showing the reduction paradigm scales down from "polynomial vs. exponential" to much finer time-complexity questions. All of this rests on the same definitional core introduced here, and sets up the formal statement and proof of the Cook-Levin Theorem as well as the standard reduction web among NP-complete problems.

Ask the tutor: Can you walk me through why the backward direction of a reduction proof is often the harder one to get right, using a reduction other than 3-SAT to Independent Set?

What exactly is the difference between "reduces to" and "is reducible from"?

"AA reduces to BB," written A≤pBA \le_p B, means there is a polynomial-time function translating instances of AA into instances of BB while preserving the yes/no answer. This is the same statement as "BB is reducible from AA" — they describe the same arrow, just read in opposite grammatical directions. The key semantic content is that BB is at least as hard as AA: a fast algorithm for BB gives a fast algorithm for AA. People often misspeak and reduce in the wrong direction when trying to prove hardness, so it helps to always say the sentence "an algorithm for BB would give me an algorithm for AA" out loud before writing any construction.

Why must the reduction function itself run in polynomial time, not just be well-defined?

If constructing f(x)f(x) took, say, exponential time, then even a perfectly fast algorithm for BB would not translate into a fast algorithm for AA — you would spend exponential time just producing the input to hand to the BB-solver. The entire point of a reduction is to bound AA's difficulty by BB's difficulty plus a cheap translation step. If the translation step is expensive, the composed algorithm for AA is expensive too, and the argument that "BB easy implies AA easy" collapses. Polynomial-time computability of ff is therefore not a technicality — it is the condition that makes the entire chain of reasoning valid.

Does A ≤p B imply B ≤p A as well?

No, and assuming so is one of the most common errors. The relation ≤p\le_p is not symmetric in general. A≤pBA \le_p B only claims that a BB-solver can be turned into an AA-solver, not the reverse. In fact, if A≤pBA \le_p B and B≤pAB \le_p A both hold, that is a strictly stronger, separately named condition (sometimes called polynomial-time equivalence), and it does not automatically follow from just one direction. When two problems are shown polynomial-time equivalent, they belong to the same difficulty class with respect to ≤p\le_p, but proving one direction says nothing for free about the other.

How does this relate to the Cook-Levin Theorem?

The Cook-Levin Theorem proves that Boolean satisfiability (SAT) is NP-hard directly, by giving a reduction from an arbitrary NP-verifier's computation into a SAT formula — without assuming any other problem is already hard. This is the seed of the entire reduction web: once SAT is known to be NP-hard, every subsequent NP-hardness proof can simply reduce SAT (or another already-established NP-hard problem) into the new target problem, using the transitivity argument proved in this article. Without Cook–Levin's from-scratch construction, there would be no starting point from which to launch any chain of reductions.

Can a reduction map a "no" instance of A to a "yes" instance of B?

Never, if the reduction is correctly constructed — that would violate the defining iff condition x∈A  ⟺  f(x)∈Bx \in A \iff f(x) \in B. A correct reduction guarantees that no-instances of AA map strictly to no-instances of BB, and yes-instances map strictly to yes-instances. If a proposed construction sometimes sends a no-instance of AA to a yes-instance of BB (or vice versa), it is simply not a valid Karp reduction, and any hardness conclusion drawn from it is invalid. This is exactly why both directions of the correctness proof must be checked with equal care.

Is polynomial-time reduction the only kind of reduction used in complexity theory?

No. Karp (many-one) reductions are the most common and the simplest to reason about, but other notions exist for different purposes. Turing reductions allow the algorithm for AA to make multiple adaptive calls to a BB-oracle, which is more powerful but less convenient for classifying problems within NP. Approximation-preserving reductions, such as L-reductions and gap-preserving reductions, are needed to transfer inapproximability results rather than plain decision hardness. Karp reductions remain the default tool for establishing NP-hardness and NP-completeness because they compose cleanly and their correctness proofs are tractable.

Why do reductions matter if P vs NP is still unsolved?

Reductions give relative hardness results that are unconditionally true, regardless of whether P=NPP = NP. Showing A≤pBA \le_p B is a theorem, proved outright, with no open conjecture involved. What remains conjectural is only the baseline claim that some specific problem (like SAT) is not solvable in polynomial time. Given that widely believed assumption, the entire web of reductions instantly implies thousands of other problems are also intractable. This is precisely why reductions are useful today: they convert one unresolved question (P≠NPP \neq NP?) into a single point of leverage that, if true, certifies the hardness of an enormous, growing catalogue of practical problems.

Before this

Where this leads