You already know from
That split has a name. A problem is tractable if we have an algorithm that solves it in polynomial time; it is intractable if every algorithm we know takes exponential time. In this one page you'll learn exactly where that line falls and why it matters, meet the two famous classes P and NP, see why a Sudoku is fiendish to solve but trivial to check, and meet the most famous unanswered question in all of computer science: does P = NP?
The dividing line between tractable and intractable is drawn at polynomial time.
An algorithm runs in polynomial time if its worst-case step count is bounded by
Why draw the line exactly there? Because polynomials behave themselves and exponentials do not.
Double the input to a polynomial algorithm and the work grows by a fixed factor
(
The chart plots the number of steps against the input size
That crossover is the whole story. The polynomial curves are the ones we can live with; the exponential is the one that dooms us. To feel just how violent the gap becomes, look at the actual step counts — imagine each step takes a billionth of a second (a fast modern computer):
The
Computer scientists gather all the tractable decision problems into one big club called
P — for Polynomial time. A problem is in P if there exists an
algorithm that solves it from scratch in polynomial time. If you can name a real algorithm
whose worst case is
Loads of everyday problems live here: sorting a list, searching it, finding the shortest path between two towns, checking whether a number is prime, multiplying two matrices. These are the problems we happily throw at a computer and expect an answer back before we've finished our tea. P is, roughly, "the problems computers are actually good at."
Now here is the subtle, beautiful idea. Forget solving for a moment and think about checking. Suppose someone hands you a proposed answer — a filled-in Sudoku grid, a complete timetable, a suggested route — and simply claims "here, this works." How long does it take you to verify their claim?
NP — Nondeterministic Polynomial time — is the class of problems whose proposed solutions can be checked in polynomial time, even if finding one from scratch might be brutally hard. The magic word is a certificate: a candidate answer that, if correct, lets you confirm "yes" quickly.
Notice something important: every problem in P is also in NP. If you can solve a problem quickly, you can certainly check an answer quickly — just solve it yourself and compare. So P sits inside NP. The interesting problems are the ones in NP that we don't (yet) know how to fit into P: easy to check, seemingly hard to solve.
NP does not stand for "not polynomial" — a very common and tempting misreading. It stands for nondeterministic polynomial. Picture a magical computer that, whenever it faces a choice, splits and tries all options at once — a "nondeterministic" machine. Such a machine could guess the right certificate and then verify it in polynomial time. Real computers can't branch like that, so for us NP is best understood through its equivalent, tamer definition: the problems whose answers can be checked quickly. Same class, far friendlier picture.
Sudoku on the ordinary
The little program below makes that concrete. checkSolution verifies a small completed
grid in a handful of passes — a polynomial-time check. Contrast that with the effort it would take
to discover that grid from a nearly empty one. Press Run.
That gulf — trivial to check, punishing to solve — is exactly what puts a problem in NP but leaves us unsure whether it belongs in P. Which brings us to the million-dollar question.
We know P is a part of NP. The staggering unknown is whether they are actually the same club. Restated in plain words:
Almost everyone believes P
Inside NP sits a special inner circle of the very hardest problems, called NP-complete — problems (like generalised Sudoku, the travelling salesman decision problem, or Boolean satisfiability) that are, in a precise sense, all "equally hard": a fast algorithm for any one of them could be converted into a fast algorithm for all of NP. That's why they're the battleground for P vs NP. Crack one NP-complete problem in polynomial time and you've proved P = NP in a single stroke; that's also strong evidence that nobody will, since so many brilliant people have tried and failed on so many of them.
If a problem is intractable, we can't just give up — real businesses still need delivery routes and timetables. So instead of demanding a perfect answer in exponential time, we settle for a good-enough answer in polynomial time. Two everyday tools:
The travelling salesman problem — find the shortest round-trip visiting every city once — is the poster child. Solving it exactly is intractable, so no courier company on Earth does that. They run heuristics and approximations and cheerfully accept a route that's within a whisker of optimal but computed before lunch. Good-enough-and-fast beats perfect-but-never.
Here's a delicious twist: intractability isn't only a nuisance — sometimes it's exactly what we want. Much of modern cryptography is deliberately built on problems that are easy one way and believed-to-be-hard the other.
The classic case is factoring. Multiplying two big prime numbers together is easy (polynomial). But taking the huge result and recovering the two primes — factoring it back — is believed to be intractable for classical computers. RSA, one of the workhorses of internet security, hides its secret behind exactly this asymmetry: your browser can lock a message with the product, but an eavesdropper would need to factor an enormous number to unlock it, which would take longer than the universe has left. The hardness is the lock. This is also why a proof that P = NP would be a security catastrophe: it would suggest these "one-way" doors might swing open both ways after all.
Do not confuse intractable with uncomputable (or "undecidable") — they are completely different kinds of "hard." An intractable problem can be solved in principle: a correct algorithm exists, it always terminates with the right answer, it just takes an impractically long time (exponential) once the input is sizeable. Given a small enough input, or infinite patience, you'd get there. The difficulty is one of resources, not of possibility.
An undecidable problem is a different universe of impossible: no algorithm can solve it, for any input, ever — no matter how much time you allow. The famous example is the halting problem: there is provably no general program that can look at any other program and always correctly decide whether it will eventually stop or loop forever. That's not "too slow" — it's impossible, and it was proved so by Alan Turing in 1936.
So the ladder of difficulty runs: tractable (solvable and fast) → intractable (solvable but impractically slow) → undecidable (not solvable at all). Intractable sits in the middle. And a final caution: "intractable" means no known polynomial algorithm — because P vs NP is unsolved, we can't yet be certain one doesn't exist.