P vs NP asks one question: if a computer can check an answer quickly, can it also find that answer quickly? Most people believe the answer is no (P ≠ NP). Nobody has proved it, and a lot of the internet’s security quietly depends on it being true.
I’d heard of P vs NP for years without really getting why anyone outside academia should care. Dan Hollick’s explainer, written amid rumours of a proof on the way, finally made it click for me:
What happens if P = NP? An explainer on P vs NP and what it means for cryptography.
— View on X
Here’s how I understand it now.
P: easy to solve
A P problem can be solved in polynomial time. As the input grows, the work grows like n, n² or n³, which is predictable and manageable.
Looking up a name in a phone book is a good example. The book is sorted, so even a huge one is quick to search.
NP: easy to check
An NP problem is one where a proposed answer can be checked in polynomial time, even if finding it seems very hard.
Sudoku is the example that works for me. Solving a big puzzle is hard because there are so many possibilities to try. But if you hand me a filled grid, I can check every row, column and box quickly. Scale the grid to 1,000×1,000 and checking is still quick, while solving explodes.
Every P problem is also in NP: if you can solve it fast, you can check it fast. The open question is the other direction. Is every problem that’s easy to check also easy to solve, and we just haven’t found the clever method yet? That would be P = NP.
Why this matters to me as a developer
Encryption like RSA relies on a “one-way door”. Multiplying two huge primes is easy. Given only the product, finding those two primes is believed to be impractically slow. Your private key is built from the primes, and your public key from the product.
If P = NP, one-way functions wouldn’t exist. Checking a guess at the primes is easy, so finding them would be easy too. And it wouldn’t stop at RSA: almost every cryptographic scheme, post-quantum ones included, rests on some problem being easy to check and hard to solve.
Why we might be fine anyway
This was the part I found reassuring:
- Polynomial doesn’t mean fast. An n¹⁰⁰ algorithm is polynomial and also useless in practice. A proof that P = NP might not come with an algorithm anyone can run.
- A proof might not even include an algorithm. It could show one exists without telling us what it is.
- P ≠ NP wouldn’t guarantee safety either. Factoring is in NP, but nobody has proved it’s one of the hardest NP problems. It could turn out to be easy on its own, even if P ≠ NP. Shor’s algorithm already factors fast on a large enough quantum computer.
So the real risk to your keys isn’t the P vs NP proof itself. It’s someone finding a fast method for the specific problem your encryption depends on.
We live in interesting times. AI is helping us make progress on problems that have been stuck for decades, and it’s also challenging assumptions we’ve built everything on. Whichever way P vs NP goes, I’m excited to see what becomes possible next.