Skip to main content

AI Mathematics · Millennium Prize Problem · Open

P versus NP

If an answer is easy to check, is it also easy to find? Nobody knows. Climb forty small steps and you will understand exactly why that is one of the deepest open questions there is.

What this is

A staircase of forty small steps toward one question: if an answer is quick to check, is it also quick to find? Each step explains one idea and ends with a challenge. Solve it and the next step opens.

It is written for a curious twelve-year-old, and for any adult who never got a straight explanation. Nothing is skipped: by the last step you will have met polynomial time, certificates, reductions, NP-complete problems, the reasons a proof is so hard to find, and what each possible answer would change in the world. Every fact is tied to its source at the foot of its step.

Where AI came in

Nowhere near the answer. No person and no machine has solved P versus NP. It has been open since 1971.

Machines have reached the neighbourhood. In November 2026 an AI system wrote a proof of an algebraic cousin of the question, VP ≠ VNP, and a proof checker verified every step. No human mathematician had checked it at the time of writing, and it does not settle P versus NP. That story is told in One Sign Apart.

Chapter 1 of 8

Recipes

What a problem is, what a recipe is, and how to count the work a recipe does.

Step 1 of 40

A question worth a million dollars

P versus NP is one of six unsolved Millennium Prize Problems. The prize is for a proof.

In the year 2000, the Clay Mathematics Institute picked seven questions that nobody on Earth could answer. It promised one million dollars for each answer. They are called the Millennium Prize Problems.

Since then one of the seven has been solved. Six are still open. One of those six is called P versus NP, and it is the only one that is about computers.

Here is the strange part. You do not need years of university to understand the question. You need puzzles, patience and about forty small steps. This page is those steps. Each one ends with a little challenge. Solve it and the next step opens.

If it is easy to check that an answer is right, is it also easy to find that answer?

You already know the feeling behind it. Finishing a big jigsaw can take a whole weekend. Seeing that a jigsaw is finished takes one glance. Is that gap a law of nature, or have we just not found the clever way yet?

That is the whole question. By the end you will know exactly what every word in it means, why nobody can settle it, and what would happen to the world if somebody did.

Your turn

What is the million dollars offered for?

Step 2 of 40

A problem is a whole family of questions

A problem is a family of instances. Each instance has a size, written n.

In everyday life a problem is one thing. "Where did I leave my shoes?" For a computer scientist a problem is bigger. It is a whole family of questions of the same kind.

Take sorting. "Put these 5 cards in order" is one question. "Put these 5,000 cards in order" is another. The problem called sorting is all of them together: put any pile of cards in order, whatever its size.

Each single question in the family is called an instance. And each instance has a size, which we write with the letter n. For sorting, n is the number of cards: the pile of 5 has n = 5, the pile of 5,000 has n = 5,000. For a maze, n could be the number of rooms.

Why give the size a letter? Because the question this whole page keeps asking is: when n grows, how much more work is there?

Your turn

Which of these is a problem, in the computer scientist's sense?

Step 3 of 40

A recipe that always works

An algorithm is a recipe: clear steps, it always finishes, and it is always right.

To solve a problem you need a method that works on every instance. Such a method is called an algorithm. Think of it as a recipe.

A good recipe has three qualities:

  • Clear. Each step is so plain that nobody has to guess what it means.
  • It finishes. It always comes to an end, and never goes round in circles forever.
  • It is right. At the end the answer is correct, every time, whatever the instance.

A recipe needs no cleverness from whoever follows it. A person can follow it. A machine can follow it. That is all a computer does: it follows recipes, very quickly, without ever getting bored.

Try one. You have a row of cards lying face down, each with a number. You want the biggest number. Put the steps of the recipe in order.

Your turn

Put the recipe for finding the biggest card in the right order.

Step 4 of 40

Count steps, not seconds

We count a recipe's steps as a formula in n. Finding the biggest takes n − 1 comparisons: everyone except the winner must lose once.

How good is a recipe? You could time it with a stopwatch. But a new computer is faster than an old phone, so the stopwatch would mostly measure the machine.

Computer scientists count steps. A step is one tiny action, like comparing two cards. The number of steps belongs to the recipe. It stays the same on any machine.

The champion recipe at work. Press Step and count the comparisons.

Seven cards, six comparisons. The first card becomes champion for free, and every other card costs one comparison. So for n cards the recipe needs n − 1 comparisons.

But is that just luck, a quirk of this one recipe? No, and the reason is worth keeping. Look at what a comparison does. Two cards meet, and the smaller one is out of the running for good. Every comparison knocks out exactly one card.

Now think about the end. To be sure you hold the biggest card, every other card must have lost to something at least once. Otherwise it might still be the biggest. That makes n − 1 cards to knock out, one per comparison. Whatever order you play the matches in, the count comes out the same.

The same eight cards, played two ways. Switch the format and count the matches each time.

Everyone except the winner must lose once. That is why it is n − 1.

This is also how sports tournaments work. A knockout tennis tournament with 128 players needs 127 matches to crown a champion. Each match sends exactly one player home, and everyone but the champion goes home.

This little formula is the real prize. It tells you the work for any size, before you even start.

Your turn

How many comparisons does the champion recipe need to find the biggest of 10 cards?

Step 5 of 40

A clever recipe beats a fast machine

The recipe counts for more than the machine. Halving finds one in a million in 20 steps.

Two recipes can solve the same problem with very different amounts of work. Here is a game that shows it.

I am thinking of a number between 1 and 100. After each guess I will say "higher" or "lower". The slow recipe guesses 1, then 2, then 3. It can need 100 guesses.

There is a better recipe. Guess the middle, 50. Whatever I answer, half of the numbers are gone. Guess the middle of what is left, 25 or 75. Half are gone again. This is called binary search.

No machine upgrade gives you that. A computer a thousand times faster still does the slow recipe a thousand times faster, and no more: on a million numbers it still makes up to a million guesses. The clever recipe makes 20. It does not work faster, it does far less work.

Your turn

Find my number between 1 and 100. You have 7 guesses.

Chapter 2 of 8

Fast and slow

Some recipes stay calm when the problem grows. Others explode.

Step 6 of 40

Everybody shakes hands

Some jobs grow like n², n times n. Double the size, four times the work.

Finding the biggest card needed n − 1 comparisons. Add one card, add one comparison. That is the gentlest kind of growth there is.

Now a different job. At a party, every guest shakes hands once with every other guest. How many handshakes?

Move the slider. Every line is one handshake.

Pick one guest. How many hands does she shake? Everybody's, except her own. With n guests that is n − 1 hands.

Every guest shakes n − 1 hands, so n guests make n × (n − 1). But that counts each handshake twice: when Ana shakes Ben's hand, Ben is shaking Ana's. One handshake, counted once from each side. So the true count is half: n × (n − 1) ÷ 2.

With 10 guests: 45 handshakes. With 20 guests: 190. Twice the guests, about four times the work. With 40 guests: 780, four times more again. Growth like this follows n², n times n. It climbs faster than n, but it stays under control.

Your turn

Five friends meet and everyone shakes hands once with everyone else. How many handshakes?

Step 7 of 40

The rice and the chessboard

Doubling again and again is exponential growth. Ten doublings multiply by about a thousand.

An old legend tells of an inventor who showed the game of chess to a king. The king was delighted and offered any reward. The inventor asked for rice. One grain on the first square of the board, two on the second, four on the third, and so on, doubling each time.

The king laughed. It sounded like a small bag of rice. And at first it was: the whole first row, eight squares, holds just 255 grains.

Tap any square to see how many grains it holds.

Square 10 holds 512 grains. Square 20 holds more than half a million. Square 30, more than half a billion. The last square alone holds 9,223,372,036,854,775,808 grains. The whole board adds up to more than 18 billion billion grains, hundreds of times more rice than the whole world grows in a year.

This is exponential growth. Each step multiplies what came before. Compare it with the handshakes: there, doubling the number of guests made about four times the work. Here, adding just one square doubles it. It looks harmless at the start, and then it runs away from you.

Your turn

Square 1 has 1 grain, square 2 has 2, square 3 has 4. How many grains are on square 11?

Step 8 of 40

Trying every combination

Brute force tries everything. With n switches that means 2ⁿ tries, doubling with each switch.

You find a bicycle lock with 3 dials, each showing a digit from 0 to 9. You do not know the code. What can you do? Try 000, then 001, then 002, all the way to 999.

Trying every possibility, one after another, is called brute force. It always works in the end. The trouble is how long the end can take.

Add dials and watch the number of codes.

Three dials: 10 × 10 × 10 = 1,000 codes. Four dials: 10,000. Every extra dial multiplies the work by ten. Twelve dials: a million million codes. This is exponential growth again, the chessboard in disguise.

The same thing happens with simple on/off switches. One switch has 2 settings. Two switches have 4. Three have 8. Why does it double? Because a new switch can be off or on, so every old setting splits in two. With n switches there are 2ⁿ settings to try.

Your turn

A panel has some on/off switches. You add one more switch. What happens to the number of settings you would have to try?

Step 9 of 40

The great race

At a billion steps a second, n² at n = 100 is instant and 2ⁿ outlasts the universe.

Let us race two recipes on a very fast computer, one that does a billion steps every second. The first recipe needs n² steps. The second needs 2ⁿ steps.

Slide n upward and watch the two clocks.

At n = 10 the second recipe is still fine: 1,024 steps. At n = 30 it needs about a billion steps, one full second. At n = 60 it needs about 36 years.

Why so sudden? Each time n goes up by one, the 2ⁿ clock doubles. From 30 to 60 is thirty doublings in a row. The n² clock, meanwhile, barely moves.

At n = 100 it needs about 40 trillion years. The universe is about 13.8 billion years old. You would have to wait almost three thousand times the age of the universe.

And the n² recipe at n = 100? It takes 10,000 steps. Done in one hundred-thousandth of a second.

No computer wins against 2ⁿ. Only a better recipe does.

Your turn

Your 2ⁿ recipe can handle n = 40 in one hour. You buy a computer a thousand times faster. About how big an n can it handle in one hour now?

Step 10 of 40

The line between fast and slow

Polynomial time (n, n², n³…) is the scientists' meaning of fast. Exponential time (2ⁿ) is slow.

Scientists needed a clear line between calm recipes and explosive ones. In the 1960s they agreed on one.

A recipe runs in polynomial time when its number of steps is at most n multiplied by itself a fixed number of times: n, or n², or n³, or n to any power that does not change with the problem. Such recipes count as fast.

A recipe runs in exponential time when n climbs up into the exponent, as in 2ⁿ. Such recipes count as slow, because they explode like the chessboard.

Look at where n sits. In n³, n stays on the ground and the little 3 never changes: double the size and the work grows 8 times, every time. In 2ⁿ, n has climbed up into the raised spot: add just one to the size and the work doubles. One grows by a fixed amount, the other runs away.

Your turn

Sort these step counts. Which are polynomial (calm) and which explode?

Chapter 3 of 8

Finding and checking

Finding an answer and checking an answer are two different jobs.

Step 11 of 40

Two different jobs

Finding makes an answer from nothing. Checking tests an answer somebody hands you.

Tip a 1,000-piece jigsaw onto the table. Putting it together can take a whole weekend. Now somebody shows you a finished jigsaw and asks, "Is it done properly?" One look tells you. No gaps, the picture makes sense. Yes.

Those are two different jobs. Finding an answer means producing it from nothing. Checking an answer means somebody hands you one and you make sure it is right. A teacher marking a sum does not need to be the one who solved it.

A maze works the same way. Finding the way out may mean dozens of dead ends. But if a friend draws a line through the maze, you only have to follow the line with your finger and see that it never crosses a wall.

Finding wanders through many paths. Checking walks down one.

For the jigsaw and the maze, checking feels much easier than finding. Hold on to that feeling. The whole mystery of P versus NP is whether that feeling is a law of nature or only a feeling.

Your turn

Which of these is checking, and not finding?

Step 12 of 40

Checking a Sudoku

Checking a filled Sudoku means one look at each row, column and box. That is fast.

In a Sudoku, every row, every column and every box must contain each digit exactly once. Solving one from a few starting digits can take a person a long while.

Checking a filled grid is another story. You look at each row, each column and each box, and make sure no digit shows up twice. For the usual 9 by 9 grid that is 27 groups of 9 squares. A patient person does it in a couple of minutes. A computer does it before you can blink.

And bigger grids stay easy to check. A grid n squares wide has n rows, n columns and n boxes, each holding n squares: about 3 × n² looks in all. For 9 by 9 that is 243. That is polynomial, calm growth.

Now you be the checker. Three filled grids are coming. For each one, rule whether it is a correct solution or a broken one. Remember to look at the boxes too.

Your turn

Is each grid a correct solution, or is it broken?

Step 13 of 40

Multiplying and un-multiplying

Multiplying is fast. Factoring, its reverse, has no known fast recipe. Checking a factoring is one multiplication.

A prime number is a whole number above 1 that can only be divided evenly by 1 and by itself: 2, 3, 5, 7, 11, 13 and so on, forever.

Multiplying two primes is easy. You learned the recipe at school, and it is polynomial. Going backwards is another matter. Given only the product, which two primes made it? This is called factoring.

With a small number it is quick. Take 15: does 2 divide it? No. Does 3? Yes, 3 × 5. But the obvious way is to try divisor after divisor, a kind of brute force, and for a huge number there are far too many to try.

Try both directions below. Notice how different they feel.

Nobody has found a fast recipe for factoring on ordinary computers. Nobody has proved that there is none either. Remember that sentence. You will meet its twin many times.

Your turn

First multiply. Then go backwards: which two numbers multiply to 437?

Step 14 of 40

The hint that proves it

A certificate is a short hint that proves a yes and can be checked fast.

Jigsaw, maze, Sudoku, factoring. These puzzles share a pattern. If the answer to "can it be solved?" is yes, there is something small you can show to prove it: the finished picture, the line through the maze, the filled grid, the two primes.

Computer scientists call that something a certificate. Think of it as a hint so good that it settles the matter. Whoever holds it does not need to trust you. They run a quick check and see for themselves.

A good certificate has two qualities. It is short: not much bigger than the puzzle itself. For a Sudoku, the certificate is the filled grid, exactly the size of the puzzle. And it is fast to check: a polynomial recipe can test it.

Picture a magical friend who is always lucky. Ask for the way out of the maze and the friend guesses the right path on the first try. You still would not believe it blindly. You would check. For puzzles with certificates, checking is all you would ever need to do yourself.

Your turn

Someone claims this 400-room maze has a way out. What would be a good certificate?

Step 15 of 40

Yes or no

Every puzzle can be asked as a yes/no question. A fast yes/no recipe gives back the full answer by halving.

To compare problems fairly, scientists put them all in the same shape: a question answered by yes or no. These are called decision problems.

"Find the shortest trip through these cities" becomes "Is there a trip shorter than 500 km?" "Fill in this Sudoku" becomes "Can this Sudoku be filled in at all?"

Does that throw away the interesting part? No, and you already know why. Suppose a machine answers the yes/no question quickly. Ask it: shorter than 500? Yes. Shorter than 250? No. Shorter than 375? Each answer cuts the range in half. This is binary search, the number game from step 5. About ten questions narrow 500 km down to less than one kilometre.

So a fast recipe for the yes/no question gives a fast recipe for the full question, and nothing is lost. From here on, problem will mean a yes/no problem.

Your turn

"Pack the most valuable load into a backpack that carries 10 kg." Which is the yes/no version?

Chapter 4 of 8

P and NP

Two families of problems, and the question that sits between them.

Step 16 of 40

The family called P

P: the yes/no problems that can be solved in polynomial time.

You now have every tool you need for the two most famous names in computer science. Here is the first.

P is the family of all yes/no problems that have a fast recipe.

Fast means polynomial time. The letter P stands for polynomial. A problem belongs to P when somebody has a recipe that answers every instance, whatever its size, in a polynomial number of steps.

  • Is this list in order? Compare each item with the next one: n − 1 comparisons for n items. In P.
  • Is there a road trip from A to B shorter than 300 km? A recipe published by Edsger Dijkstra (1930–2002) in 1959 finds the shortest route quickly. In P.
  • Is this number prime? For centuries nobody knew a recipe that was both fast and always right. In 2002 three computer scientists in India, Manindra Agrawal, Neeraj Kayal and Nitin Saxena, found one. In P.

Your turn

What puts a problem in P?

Step 17 of 40

The family called NP

NP: the yes/no problems whose yes answers can be checked in polynomial time. It does not mean "not polynomial".

Here is the second name. It rests on the certificates of the last chapter.

NP is the family of all yes/no problems where every yes can be checked fast.

A problem belongs to NP when each instance whose answer is yes has a certificate, a short hint, that a polynomial recipe can check. "Can this Sudoku be completed?" is in NP: the filled grid is the certificate. "Does this maze have a way out?" is in NP: the path is the certificate.

Notice what NP does not ask. It does not ask how the certificate was found. A blank Sudoku might cost you an afternoon, and that does not matter here. Once someone has the answer, checking is fast, and that is all NP needs.

Your turn

What does it mean for a problem to be in NP?

Step 18 of 40

P lives inside NP

Everything in P is also in NP. Fast to solve implies fast to check.

How do the two families fit together? Start with any problem in P. It has a fast recipe for solving.

Now somebody brings you an instance and claims the answer is yes. Can you check the claim quickly? Of course. Ignore whatever hint they offer and run your fast recipe yourself. If it says yes, the claim was true. It is like a teacher who can do every sum in her head: she does not need your working to mark your answer.

So every problem that is fast to solve is also fast to check. Every problem in P is in NP.

P sits inside NP. This part is proved, and nobody doubts it.

The picture shows P as a region inside NP. Checking that a list is in order and finding shortest routes sit in the inner region. The open question is about the ring around it. Is there anything in that ring at all?

Your turn

"Is this list in order?" is in P. Is it also in NP?

Step 19 of 40

The question

P versus NP asks: is everything that is fast to check also fast to solve? Open since 1971.

Everything fast to solve is fast to check. Does it also go the other way?

Is every problem that is fast to check also fast to solve? Is P equal to NP?

Two possible pictures of the world. Exactly one of them is true, and nobody knows which.

If P = NP, the ring is empty. Every puzzle whose solutions can be checked quickly could also be solved quickly, by a recipe nobody has found yet. The 250-digit number of step 13 could, in principle, be factored by a recipe whose steps grow calmly with its size, the way the checking does.

If P ≠ NP, the ring holds problems that are truly harder to solve than to check, for any recipe that could ever exist.

Your jigsaw feeling says the ring is full. Most scientists feel the same. Nobody has been able to prove it.

Your turn

Suppose somebody proves that P = NP. What would that mean?

Chapter 5 of 8

The puzzle zoo

Four famous puzzles. Try them with your own hands.

Step 20 of 40

Three colours for a map

Three-colouring a map is in NP: a coloured map is a certificate. No fast recipe is known.

Time to meet the animals that live in NP. Each of the next four puzzles is famous, and each one is easy to check and, as far as anyone knows, hard to solve. Try them with your own hands. First, a map.

Colour every country so that no two countries sharing a border have the same colour. You have only three colours. The yes/no question is: can this map be coloured with three?

It is in NP. If the answer is yes, the coloured map is the certificate. Checking it is a walk along the borders: at each one, are the two sides different colours? One look per border, and you are done.

Why so hard? Each country has 3 choices, and the choices multiply, just like the dials of the bicycle lock. For a map of n countries there are 3ⁿ ways to paint it. The map below has 11 countries: 177,147 ways, and only 6 of them work. For 50 countries there would be more than 700 billion trillion ways. Brute force is hopeless. Nobody knows a fast recipe.

Your turn

Colour the map with three colours so that no neighbours match.

Step 21 of 40

The exact load

Subset sum: do some of these numbers add up to the target? 2ⁿ choices, one quick addition to check.

A small ferry floats level only when it carries exactly the right load. On the quay stand eight crates, each with its weight painted on the side.

The question: is there a choice of crates that weighs exactly 90 kg? Scientists call this puzzle subset sum, because you are looking for a subset (a handful picked from the pile) of the numbers with a given sum.

Each crate is either on the ferry or off it. That is one on/off switch per crate, so n crates give 2ⁿ possible loads. You have met that number before. For 8 crates: 256 loads. For 100 crates: more than a million trillion trillion.

Notice the trap. A load can be too light, and adding one crate can make it too heavy. Nothing tells you which crate to swap. Finding the load means hunting. But once someone points at four crates and says "these", the certificate is in your hands: add them up, and you know.

Your turn

Load the ferry with exactly 90 kg.

Step 22 of 40

The travelling salesperson

Travelling salesperson: is there a round trip within budget? The number of trips explodes, yet checking one is easy.

A seller must visit every town on the map once and come back home. Fuel is expensive. The yes/no question: is there a round trip no longer than a given budget?

This is the travelling salesperson problem, one of the most studied puzzles in all of mathematics. Delivery vans, school buses, and the drills that make holes in circuit boards all face it every day.

How many round trips are there? Leave home, pick the first town, then the next from those left, and so on: the choices multiply, and each one is smaller by one. With 7 towns, 360. With 10 towns, 181,440. With 20 towns, 60,822,550,204,416,000. The count grows even faster than 2ⁿ.

And still it is in NP. A proposed trip is a certificate: add up its legs, compare with the budget. Seven towns, seven legs, seven additions.

Your turn

Visit all seven towns and return home in at most 1,310 km.

Step 23 of 40

The lamps

SAT: can one setting of the switches satisfy every rule? It is in NP, and it is the heart of the story.

The last animal looks like a toy. It will turn out to be the most important puzzle of the whole story.

You have a row of switches. Each can be on or off. You also have a set of lamps. Each lamp has its own rule, such as: "I light up if switch A is on, or switch B is off, or switch D is on." One true condition is enough to light a lamp.

The question: is there a setting of the switches that lights every lamp at once?

Why is that tricky? Because the lamps pull against each other. Flip switch A on to please one lamp, and another lamp that wanted A off goes dark. Every fix can break something somewhere else.

Scientists call it satisfiability, or SAT for short, because you try to satisfy all the rules together. With n switches there are 2ⁿ settings. The certificate is one setting that works, and checking it means looking at each lamp once.

Your turn

Find the setting that lights all nine lamps.

Chapter 6 of 8

One key for every lock

The puzzles of the zoo turn out to be the same puzzle in different costumes.

Step 24 of 40

A puzzle in a costume

A reduction translates one problem into another. A fast recipe for the second then solves the first.

A school must fit seven exams into three days. Some pupils sit two of the exams, and nobody can be in two rooms at once. So two exams that share a pupil must fall on different days. Can it be done?

Draw a dot for each exam. Draw a line between two exams whenever a pupil sits both. Now give each dot a day, so that dots joined by a line get different days.

Look at what you are doing. Dots are countries. Lines are borders. Days are colours. The timetable puzzle is the map-colouring puzzle wearing a costume.

Scientists call this a reduction: a fast recipe that translates every instance of one problem into an instance of another, keeping the yes/no answer the same. A timetable that works gives a colouring that works, and the other way round.

Think of a translator who turns any French question into an English one. If you have a brilliant friend who only speaks English, every French question can now reach that friend. So if anybody ever finds a fast recipe for colouring, timetables come for free: translate, colour, translate back. In a reduction the translating itself must be quick, or the shortcut is lost on the way.

Your turn

Give every exam a day. Exams joined by a line share a pupil and need different days.

Step 25 of 40

Cook's surprise

Cook–Levin theorem: every NP problem translates into SAT. A fast recipe for SAT would solve all of NP.

In 1971 Stephen Cook proved something that nobody had expected. Leonid Levin proved it too, on the other side of the world, without knowing of Cook's work.

Every problem in NP can be translated into the lamps puzzle.

Every one. Sudoku, maps, ferries, salespeople, and every NP problem that anybody will ever invent. Each can be put into the costume of switches and lamps by a fast translation. This is the Cook–Levin theorem.

Every problem in NP translates into SAT, the lamps puzzle.

How can that be true? Here is the idea. A problem in NP has a fast checker, and a checker is a recipe run by a computer. A computer is built from millions of tiny switches that follow simple rules: this one turns on only if those two are on, that one flips whatever it is given.

Now leave the switches that hold the certificate free, and write every other rule as a lamp. Add one last lamp: "the checker says yes". The question "is there a certificate that this checker accepts?" has become "is there a setting of these switches that lights every lamp?" And that is a lamps puzzle.

The consequence is enormous. A fast recipe for the lamps puzzle would be a fast recipe for everything in NP at once.

Your turn

Suppose a fast recipe for the lamps puzzle (SAT) is found. What follows?

Step 26 of 40

Karp's twenty-one

NP-complete problems are in NP, and all of NP translates into each of them. Thousands are known.

One year later, in 1972, Richard Karp (born 1935) turned the surprise into an avalanche. He showed that 21 well-known puzzles, the lamps puzzle among them, all share its power: the lamps translate into each of the other 20, among them graph colouring and the exact-load puzzle of the ferry.

Follow the chain, like passing a message down a line of translators. Everything in NP translates into lamps (that was Cook and Levin). Lamps translate into colouring (that was Karp). So everything in NP translates into colouring, in two quick hops. The same goes for each of Karp's puzzles.

A problem with both of these qualities is called NP-complete: it is in NP, and every problem in NP can be translated into it. The NP-complete problems are the hardest problems in NP. Each one holds all the others inside it, the way one master key holds the shape of every lock in the building.

A few of the thousands of known NP-complete problems, joined by translations.

Your turn

What makes a problem NP-complete?

Step 27 of 40

All for one

A fast recipe for one NP-complete problem gives P = NP. A proof that one has none gives P ≠ NP.

This is the turning point of the whole story. The NP-complete problems are tied together so tightly that they share one fate, like climbers roped to one another on a mountain.

The NP-complete problems sit at the far edge of NP. They stand or fall together.

Suppose someone finds a fast recipe for just one of them, say map colouring. Every problem in NP translates into map colouring. So every problem in NP gets a fast recipe: translate, colour, translate back. Then P = NP.

Suppose instead someone proves that just one of them, say the lamps puzzle, has no fast recipe at all. Then NP holds something that P does not, so P ≠ NP. And none of the NP-complete problems can have a fast recipe. Why? If one of them did, the lamps could be translated into it and solved fast after all, which was just proved impossible.

Thousands of puzzles. One question. Either all of them are easy, or none of them is.

So the million-dollar question can be asked in a very small way. Is there a fast recipe for three-colouring a map? Nobody knows.

Your turn

Tomorrow someone publishes a correct, fast recipe for the travelling salesperson's yes/no puzzle, which is NP-complete. What has happened?

Step 28 of 40

Hard-looking is not the same as hard

Some hard-looking problems turned out easy. Factoring is in NP, with no fast recipe known and no proof that it is NP-complete.

Be careful with the word hard. A problem can look hard for centuries and then turn out to be easy.

Telling whether a number is prime looked hard. In 2002 it was proved to be in P. Planning the best use of limited resources, a puzzle called linear programming, looked hard as well. In 1979 Leonid Khachiyan (1952–2005) proved that it is in P too.

The lesson: hard means proved hard, not merely unsolved so far. A puzzle nobody has cracked yet may only be waiting for a cleverer recipe.

And some problems sit in between. Factoring is in NP, since the factors are a certificate. No fast recipe is known. Yet nobody has managed to prove it NP-complete, and most experts doubt that it is.

The map of NP as most experts imagine it. Only the positions inside P and inside the NP-complete zone are proved.

Your turn

Place each problem where today's knowledge puts it.

Chapter 7 of 8

Why nobody can prove it

More than fifty years of trying, and what the trying has taught.

Step 29 of 40

Proving a never

P ≠ NP means no fast recipe exists, among infinitely many. Proving a never is possible in mathematics, but hard.

The two possible answers ask for very different kinds of proof.

To prove P = NP, one fast recipe for one NP-complete problem would be enough. Show it, let everyone test it, done.

To prove P ≠ NP, you must show that no fast recipe exists. None of the ones people have tried, and none of the infinitely many that nobody has thought of yet, including strange ones that look nothing like today's ideas. You must prove a never.

Think of the difference between "there is a cat in this house" and "there is no cat anywhere in the world". For the first, you show the cat. For the second, showing is impossible: you need a reason that rules out every hiding place at once.

Can a never be proved at all? Yes. Mathematics has done it before. More than two thousand years ago, Greek mathematicians proved that no fraction, however complicated, multiplied by itself gives exactly 2. They did not test fractions one by one. They found a reason that covers them all. In 1936 Alan Turing (1912–1954) proved that some yes/no problems have no recipe of any kind, fast or slow.

Your turn

Why is P ≠ NP so much harder to prove than it sounds?

Step 30 of 40

What the experts expect

Most experts expect P ≠ NP: 88 in 100 in the latest poll. That is an expectation, not a proof.

Without a proof, what do the people who study this believe? A computer scientist named William Gasarch has asked them, in three polls published in 2002, 2012 and 2019.

Share of researchers answering William Gasarch's polls who said they think P ≠ NP, by year of publication.

In the first poll, 61 in every 100 who answered thought P ≠ NP. In the second it was 83. In the third it was 88. The belief that finding is truly harder than checking has grown stronger.

Why do they think so? Thousands of NP-complete problems are known. Many are worth fortunes to industry. Brilliant people have hunted for a fast recipe for each of them for more than fifty years. Because they are all roped together, a single success on any one of them would have settled everything. There has been none.

Your turn

In the poll published in 2019, 88 in 100 researchers thought P ≠ NP. What does that prove?

Step 31 of 40

Three walls

Three results (1975, 1994, 2008) show that known families of proof methods cannot settle P versus NP.

Here is one of the strangest facts in the story. Researchers have not only failed to prove P ≠ NP. They have proved that their favourite ways of proving things cannot do the job.

Three results showing that whole families of proof methods cannot settle P versus NP.

In 1975 Theodore Baker, John Gill and Robert Solovay showed that a first large family of proof methods can never settle the question, in either direction. In 1994 Alexander Razborov and Steven Rudich showed the same for a second family, under an assumption about secret codes that most experts accept. In 2008 Scott Aaronson and Avi Wigderson closed off a third.

How can you prove that a method fails without knowing the answer? The first wall used a clever trick. It built two imaginary worlds, each with a magic helper for computers: in one world P equals NP, in the other it does not. The methods of that family work just as well in both worlds, so they cannot tell them apart. A tool that cannot tell those worlds apart cannot settle the question in ours.

Imagine a locked door and a large ring of keys. One by one, you prove that each kind of key on your ring has the wrong shape for this lock. You have not opened the door. But you have learned something real: the key that opens it must be of a new kind.

That is why many researchers think a solution will need mathematics that does not exist yet.

Your turn

What did the three "walls" show?

Step 32 of 40

False alarms

More than a hundred claimed proofs have failed. A proof counts only after others have checked it.

A million-dollar prize and a question a child can understand: of course many people have announced a solution.

For years the mathematician Gerhard Woeginger (1964–2022) kept a public list of such announcements. It grew past one hundred. Some claimed P = NP, others P ≠ NP. Not one has survived checking by other experts.

The most famous alarm rang in August 2010, when Vinay Deolalikar, a researcher at HP Labs, sent out a proof that P ≠ NP. The news travelled around the world. Experts read it together, online, in the open. Within about a week they had found gaps that could not be repaired.

This is science working as it should. A proof is a certificate, in exactly the sense you learned. Writing a long proof is like filling a giant Sudoku: one wrong square, hidden deep inside, and the whole grid fails. So a proof only counts once others have checked it, line by line.

The Clay Institute asks that a solution be published in a recognised journal, that at least two years pass, and that mathematicians in general accept it, before any prize is considered.

Your turn

When does a claimed proof of P versus NP count as a real one?

Step 33 of 40

Would a quantum computer do it?

Quantum computers could factor fast, but no fast quantum recipe is known for NP-complete problems.

Quantum computers follow the odd rules of very small things, such as atoms. People often say they "try every answer at once". That is not how they work, and it leads to wrong ideas about what they can do.

What is true: in 1994 Peter Shor (born 1959) found a recipe by which a large quantum computer could factor numbers in polynomial time. Machines big enough to do that to real codes have not been built yet. If they are, some of today's secret codes will fall, and new codes are already being introduced to resist them.

But remember the last chapter. Factoring is not known to be NP-complete. It may sit in the in-between zone. So cracking it would not drag the rest of NP along. For the NP-complete problems, no fast quantum recipe is known.

The best general quantum trick for blind searching was found by Lov Grover in 1996. It turns 2ⁿ tries into roughly the square root of that. A big saving, and still exponential. With 100 switches, 2¹⁰⁰ tries shrink to 2⁵⁰. Now add 100 more switches: the quantum machine needs 2¹⁰⁰ again. The explosion is only postponed. In 1997 four researchers proved that for blind searching, no quantum recipe can do better.

Your turn

What is known about quantum computers and NP-complete problems?

Chapter 8 of 8

If someone solves it

What each possible answer would change, for codes, for science and for people.

Step 34 of 40

Three endings

Three endings: P ≠ NP; P = NP with a usable recipe; P = NP with an unusable one.

You now understand the question as well as most adults ever will. So what happens to the world on the day it is answered? It depends on which ending we get. There are really three.

Three ways the story could end.
  • Ending one: P ≠ NP is proved. The ring is real. Some problems are truly harder to solve than to check, forever.
  • Ending two: P = NP, with a recipe people can use. Somebody shows a fast, practical recipe for an NP-complete problem.
  • Ending three: P = NP, with a recipe nobody can use. The recipe is polynomial on paper but needs something like n¹⁰⁰ steps. Or the proof shows that a fast recipe must exist without telling anyone how fast it is, or giving a recipe anyone could run.

How bad is n¹⁰⁰? With just 10 towns it means a 1 followed by 100 zeros, more steps than there are atoms in the visible universe. Polynomial, and hopeless.

Newspapers usually talk only about ending two, because it is the most dramatic. Most experts expect ending one. Ending three is the one that people forget, and it would be the strangest: the families would be equal, and daily life would not change at all.

Your turn

Which ending would change everyday life the most, and quickly?

Step 35 of 40

If the wall is real

If P ≠ NP, daily life goes on with near-best answers, and we learn that finding is truly harder than checking.

Start with the ending most experts expect: someone proves P ≠ NP.

On the surface, little changes. Engineers already treat NP-complete problems as hard. They would keep doing what they do today, and what they do today is clever.

  • Settle for nearly the best. In 1976 Nicos Christofides found a fast recipe for the salesperson's puzzle on ordinary maps whose trip is guaranteed to be at most one and a half times the shortest possible. If the best trip is 1,000 km, his is never longer than 1,500 km.
  • Solve the instances that real life sends. NP-complete describes the worst instances of a problem. Typical ones are often much kinder. Programs called SAT solvers now handle lamp puzzles from industry with millions of switches.
  • Push the exact answer further. In 2006 a program named Concorde found the shortest possible trip through 85,900 points on a computer chip, and proved that no shorter one exists.

Underneath, a great deal would change. Humanity would hold its first proof that a natural, everyday kind of search cannot be shortcut by any recipe. The three walls tell us such a proof needs new mathematics, and new mathematics has a habit of being useful in places nobody planned.

And we would know something about the universe itself: that finding is truly harder than checking. That limit would bind every ordinary computer that will ever be built, however fast.

Your turn

A delivery company faces an NP-complete routing problem every morning. If P ≠ NP is proved, what should it do?

Step 36 of 40

Secret codes

Today's internet codes assume some things are easy to check and hard to find. A practical P = NP would break them.

Now the dramatic ending: P = NP, with a recipe people can run. The first thing to break would be secrecy.

When you send a private message or buy something online, a little padlock appears on the screen. Behind it is an idea from the 1970s called public-key cryptography. It rests on one-way streets: operations that are easy to do and, as far as anyone knows, extremely hard to undo. Think of an open padlock that anyone can snap shut, but only the owner of the key can open again.

Here is a one-way street you have already walked. Multiplying two huge primes is easy. Factoring the result is not. The big product can be shown to the whole world; the two primes stay the secret.

Now think like a checker. Somebody who guesses the secret key can test the guess quickly: try it and see whether the message opens. A right key is a certificate. So breaking such a code is a problem of the NP kind, and with a fast, practical recipe for NP it could be done.

Bank transfers, private messages, medical records, digital signatures that prove who sent what, the software updates on every phone: all of it leans on these one-way streets.

Your turn

Why would a practical P = NP recipe break the codes that protect the internet?

Step 37 of 40

Five possible worlds

Impagliazzo's five worlds range from Algorithmica (P = NP) to Cryptomania (public-key codes work). We seem to live in the last.

In 1995 the computer scientist Russell Impagliazzo drew a map of the possibilities. He described five worlds we might be living in. All five agree with everything known today. He gave them names.

Read them as a staircase. Each step down, finding gets a little harder. At the top, every puzzle is easy and nothing can be hidden. Secrets only become possible in the last two worlds, because there hardness is what keeps a message safe. Hard puzzles are the price of privacy.

Russell Impagliazzo's five worlds. Nobody knows which one is ours.
  • Algorithmica. P = NP, or something just as good. Every puzzle with checkable answers is solved fast. No secret codes of the usual kind.
  • Heuristica. NP-complete problems have nasty worst instances, but the instances that turn up in practice are easy. Codes cannot hide behind easy instances, so there is no secrecy here either.
  • Pessiland. Hard instances are easy to stumble on, yet there are still no one-way streets to build codes from. The worst of both: hard puzzles and no privacy.
  • Minicrypt. One-way streets exist. Two people who already share a secret key can talk privately, but strangers cannot set up a secret over an open line.
  • Cryptomania. Public-key codes are possible. Two strangers can agree on a secret while the whole world listens.

Our daily life is built as if we lived in Cryptomania. Most experts think we do. Nobody has proved it.

Your turn

In which world can two strangers who have never met agree on a secret code over the open internet?

Step 38 of 40

The optimiser's dream

A practical P = NP would give best answers wherever answers can be checked fast, and only there.

Codes would be the loss. What would be the gain in a world with a practical P = NP recipe?

A huge share of human work is searching for a good arrangement among too many possibilities. The timetable with no clashes. The delivery round that burns the least fuel. The way to pack the most parcels into a truck. The layout of billions of parts on a computer chip. Many of these are NP-complete or closely tied to NP-complete problems. Today we settle for good answers. With such a recipe we could ask for the best one.

How do you get the best from a yes/no recipe? Ask "is there a round under 200 km?", then under 100, then under 150, halving the gap each time, just as you hunted a hidden number. A handful of questions pins down the shortest round.

Science would feel it too. Designing a protein, the kind of molecule that does most of the work in living cells, can be written as a search of the same family, and some versions of it are proved to be as hard as NP-complete problems.

Your turn

A practical P = NP recipe exists. Which of these would it solve, and which would it not touch?

Step 39 of 40

Mathematics, and the creative leap

A proof is a certificate. With a practical P = NP, short proofs could be found as easily as they are checked.

One consequence of a practical P = NP reaches deeper than all the others. It concerns discovery itself.

A mathematical proof is a certificate. Checking one is patient, mechanical work: is each line allowed by the rules? Computers already do this with programs called proof checkers. Finding a proof is the hard part. It can take a brilliant person a lifetime, or humanity several centuries.

"Does this statement have a proof shorter than a million lines?" is a yes/no question with a fast check. It is in NP. So with a practical recipe for NP, a machine could find a proof of any statement that has a reasonably short one. It could even write the proof out line by line, by the same halving trick that turns a yes/no recipe into a full answer. Gödel saw this in his 1956 letter: for such questions, he wrote, the thinking of a mathematician could be completely replaced by machines.

The other Millennium Prize Problems would be within reach of the same machine, if they have proofs of reasonable length. And far beyond mathematics, wherever recognising a good answer is quick, producing one would be quick as well.

Read that again as an argument. Our whole experience says that recognising a great idea is easier than having one. If P ≠ NP, that experience is not a weakness of ours. It is how the mathematical universe is built.

Your turn

Why would a practical P = NP recipe let machines find mathematical proofs?

Step 40 of 40

The whole argument, in your hands

Is finding truly harder than checking? Open since 1971, and now you know exactly what is being asked.

You started with a row of cards and a champion. You have reached one of the deepest open questions people have ever asked.

Squeezed into one line, it asks: is finding ever truly harder than checking?

It is a question about puzzles. It is also a question about codes, medicines, timetables and proofs, about what machines will be able to do, and about whether a flash of insight can ever be replaced by a recipe. Whoever answers it, in either direction, will have told us something permanent about the limits of knowledge.

Nobody knows who that will be. It might take a kind of mathematics that has not been invented. It might take someone who first met the question on a page like this one.

One last challenge. Rebuild the whole argument, from the first idea to the open question.

Your turn

Put the seven links of the argument in order.

You can now explain a Millennium Prize Problem

If somebody asks you what P versus NP is, here is the whole thing in six sentences.

  1. We measure a recipe by how its number of steps grows with the size of the problem: polynomial growth is fast, exponential growth is hopeless.
  2. P is the family of yes/no problems that can be solved fast.
  3. NP is the family of yes/no problems whose yes answers can be checked fast, given a short hint.
  4. Thousands of famous puzzles, from map colouring to the travelling salesperson, are NP-complete: a fast recipe for any one of them would solve everything in NP.
  5. Nobody has found such a recipe in more than fifty years, and nobody has proved that none exists.
  6. Most experts expect that finding is truly harder than checking, and if they are wrong, secret codes fall and discovery itself changes.
Every source used on this page

For teachers and reviewers: open every step without solving the puzzles, or clear your progress on this device.