The P vs. NP Problem
Study Notes: The P versus NP Problem and Related Questions
What the P versus NP problem asks
P is the class of decision problems that can be solved by a deterministic algorithm in polynomial time. A running time such as n2 or n7 is polynomial in the input size n.
NP is the class of decision problems for which a proposed “yes” answer can be checked in polynomial time. Equivalently, a problem is in NP if a correct answer can be verified efficiently when a suitable certificate, or witness, is provided.
The central question is whether these classes are equal:
Since a problem that can be solved efficiently can also have its solution checked efficiently, P is contained in NP. The unresolved issue is whether every problem whose solutions can be checked efficiently can also be solved efficiently.
NP-complete problems are problems that are in NP and are at least as hard as every other problem in NP, in the sense that every NP problem can be transformed into them efficiently. If any NP-complete problem has a polynomial-time algorithm, then P=NP. Conversely, if P=NP, no NP-complete problem has a polynomial-time algorithm.
The problem is sometimes described intuitively as asking whether exhaustive search can always be “telescoped”: can a search through a huge number of possibilities be replaced by a much more efficient method?
Why the problem matters beyond practical computing
The significance of P versus NP is not limited to whether computers can complete particular tasks faster. It is a foundational question about the limits of efficient computation: which tasks can be solved feasibly, and which can only be checked feasibly once a solution is known?
The problem is often compared with fundamental questions in other sciences, such as how life began or whether a single equation governs the cosmos. The comparison emphasizes that some questions are considered important because they probe basic features of the world or of human knowledge, even before their practical applications are fully understood.
A major result could also be valuable even if it did not immediately settle P versus NP. Work on a deep problem can produce new techniques, concepts, and related results along the way. Thus, the intellectual value of the problem is not exhausted by its final yes-or-no answer.
Practical difficulty and the meaning of “solving” a problem
Practitioners routinely solve instances of problems that are theoretically NP-complete. This is not a contradiction. The classification concerns worst-case computational difficulty: it says that some instances may be extremely hard, not that every instance is hard or that no instance can be solved.
In practical settings, problem solvers use several strategies:
They solve the particular instances that arise in their applications rather than every possible instance.
They exploit structure or patterns that occur in real data.
They use heuristics, approximation methods, or specialized algorithms.
They accept solutions that are good enough for their purposes rather than requiring an ideal solution in every case.
Consequently, proving a problem NP-complete does not mean that the problem will never be solved. It may mean that the acceptable meaning of “solved” must change: a solution might be approximate, tailored to a restricted class of instances, or not guaranteed to work quickly in every case.
By contrast, finding a polynomial-time algorithm for a previously difficult problem can be a major achievement. It shows that the problem can be solved efficiently for all input sizes, according to the polynomial-time model.
Hardness at different scales: finding a useful “soft spot”
Understanding computational hardness requires more than distinguishing “easy” from “impossible.” Many applications need to locate a useful middle range: instances should be difficult enough to impose a meaningful cost, but not so difficult that legitimate users cannot handle them.
Computational cost as a defense against spam
One proposed way to discourage spam is to require a sender to perform a small amount of computation for each message. Sending millions of messages would then incur a substantial total cost, even if the cost of sending one message were modest.
A sender might be required to solve a computational puzzle and attach its solution to the email. If the task is easy for a single message but expensive when repeated at very large scale, it could make mass messaging less attractive. The same broad idea is associated with proof of work: a user demonstrates that a certain computational effort has been spent.
The challenge is to calibrate the task. A problem that is too easy provides little protection; one that is too hard burdens ordinary users. Small instances of a problem may be trivial, while very large instances may be infeasible. A useful system therefore depends on understanding the transition between these regimes.
For example, generalized Sudoku is computationally hard in the relevant theoretical sense, but a small, easy Sudoku puzzle is not a meaningful barrier. The particular size and construction of the puzzle matter.
Randomness and repeated shuffling
A related example is card shuffling. One shuffle may leave detectable structure in the deck, while repeated shuffles can make the ordering sufficiently random for practical purposes. The number of repetitions needed depends on what is being shuffled and how randomness is measured.
This illustrates a general computational question: how much work is enough to transform a highly structured object into one that is sufficiently random or sufficiently hard to predict? In cryptography, related transformations are used not merely to create randomness but to make information difficult for an outsider to recover.
Worst-case hardness, average-case hardness, and computational puzzles
A proof that P=NP would establish an important form of worst-case hardness: at least some instances of certain problems cannot be solved in polynomial time. But worst-case hardness alone does not automatically provide what practical applications need.
Worst-case complexity
Worst-case complexity asks how difficult the hardest instances of a problem can be as input size grows. A problem may have a few extremely difficult instances while most instances encountered in practice are easy.
Average-case complexity
For applications such as cryptography or computational defenses, it matters how hard instances drawn from a particular distribution are. Average-case complexity studies expected difficulty under specified ways of generating instances.
A useful application needs more than proof that one difficult instance exists. It needs a reliable method for producing instances that are typically difficult for an attacker.
Computational puzzles
Security often requires a further distinction between a hard problem and a usable computational puzzle. A puzzle is designed so that the system’s legitimate designer or operator knows how to solve it, while an attacker does not.
For example, a system designer may choose a secret key and know the corresponding solution, while someone without the key faces a difficult task. This asymmetry allows legitimate operation while obstructing attackers.
Thus, even a proof of P=NP would leave important questions open:
How are hard instances generated?
Are typical instances hard, or only exceptional worst-case instances?
Can legitimate users solve the instances efficiently while attackers cannot?
These questions connect complexity theory to the practical design of cryptographic systems and other security mechanisms.
Why proving P=NP is difficult
The distinction between efficient and inefficient computation is not well understood. Even the relationships among familiar complexity classes may be more complicated than current diagrams suggest.
One example is the possibility that a randomized polynomial-time class such as RP could solve problems currently believed to require exponential time. Researchers generally consider such a collapse unlikely, but the example illustrates how little is known about the exact boundaries of efficient computation.
Proving P=NP would require showing that no polynomial-time algorithm can solve an NP-complete problem. It is not enough to show that known algorithms fail, or that a particular style of algorithm is slow. A proof must rule out every possible algorithm, including methods that have not yet been imagined.
Even restricted versions of this challenge remain open. For example, researchers can ask whether algorithms with extremely limited memory—such as logarithmic space—can solve problems such as CLIQUE. Such questions examine what happens when a computer’s resources are tightly constrained, but they are still difficult because ruling out all algorithms remains a demanding task.
Barriers to proof
Several barrier results show that broad families of familiar proof techniques are insufficient to establish certain separations, including P=NP and some weaker complexity questions. These results are sometimes described as “no-go” theorems.
A barrier result does not show that the desired theorem is false or unprovable. Instead, it shows that specified methods cannot establish it. The practical implication is that researchers likely need genuinely new ideas rather than simply more elaborate versions of known arguments.
Some newer approaches seek to connect efficient algorithms for one task with impossibility results for another. Such connections can turn a computational procedure into evidence that other problems cannot be solved efficiently. These approaches use structural relationships among problems and can draw on ideas resembling human problem-solving or intuition, rather than attacking the target problem in isolation.
Quantum computing and NP-complete problems
Quantum computers would use physical systems governed by quantum mechanics to store and manipulate information. Possible information-bearing properties include the spin of electrons or the energy levels of atoms. The physical principles underlying quantum computation have been tested experimentally on small scales, although constructing large-scale quantum computers remains a separate challenge.
Quantum mechanics allows a system to be represented as a combination of multiple states. This can suggest that a quantum computer might explore many candidate solutions in parallel. However, quantum parallelism does not by itself make an answer easy to obtain.
At the end of a computation, the system must be measured. Measurement changes the quantum system and gives only limited information about the states it represented. Even if one state corresponds to a desired solution, the probability of obtaining that solution through measurement may be very low. Simply encoding many possible candidates at once therefore does not solve an NP-complete search problem.
Factoring and Shor’s algorithm
Peter Shor showed that a quantum computer could factor integers efficiently, if a sufficiently capable quantum computer could be built. Integer factoring is important because some widely used cryptographic systems rely on the presumed difficulty of factoring large numbers on classical computers.
This result does not show that quantum computers efficiently solve NP-complete problems. Factoring has mathematical structure that Shor’s algorithm exploits. It remains unknown whether comparable exploitable structure exists in general NP-complete search problems.
Quantum computation therefore changes the study of computational difficulty, but it does not automatically eliminate the central uncertainty surrounding NP-completeness.
Logic as a way to characterize computation
Logic offers a way to describe computational problems in terms of what can be expressed in a formal language.
Fagin’s Theorem characterizes NP over finite structures: a problem belongs to NP if and only if membership can be expressed using existential second-order logic. Informally, a statement in this logic can assert that there exists some additional relation or structure that makes a specified property true.
This gives a logical interpretation of the certificate idea. For an input to an NP problem, a certificate can be viewed as an additional structure whose existence witnesses that the input has a “yes” answer. The theorem connects computational complexity with the expressive power of logic.
Because a formal theorem can be intricate, applying it incorrectly can lead to a plausible-looking but invalid proof. Even experts may initially miss a mistake if the faulty step appears to rely on a specialized result that its author understands well.
Could P versus NP be independent of mathematics?
A mathematical statement is independent of a set of axioms if it can be neither proved nor disproved from those axioms, assuming the axioms are consistent.
The Continuum Hypothesis provides an example from set theory. It asks whether there is an infinity strictly between the size of the integers and the size of the real numbers. The statement was shown to be independent of the standard basic axioms of mathematics: those axioms do not determine whether it is true or false.
This raises the question of whether P versus NP might also be independent of accepted mathematical axioms. The existence of proof barriers can make that possibility seem worth considering, because barriers show that known methods do not suffice.
However, a barrier to particular methods is not a proof of independence. One view is that P versus NP concerns ordinary, concrete computation and is unlike questions that lie far outside everyday mathematical intuition. On that view, the usual axioms should be strong enough to settle the problem, even though new proof techniques may be needed.
The important distinction is between two claims:
Known proof methods may be insufficient.
No proof is possible from the accepted axioms.
The first does not establish the second.
Consequences of possible answers
If P=NP
If P=NP, then every problem in NP would have a polynomial-time algorithm. This would have dramatic consequences for problems whose solutions are currently believed to be difficult to find.
Many cryptographic systems rely on the assumption that certain computational tasks are infeasible. If P=NP and the resulting algorithms were practical, many such systems could fail, threatening privacy and allowing codes to be broken. The actual impact would depend on the algorithms’ running times and constants, not merely on the formal equality.
It is also possible that a polynomial-time algorithm could be extraordinarily complicated, with such large exponents or constants that it would be useless in practice. In that case, P=NP would hold mathematically without making every associated task practically easy.
If P=NP
A proof of P=NP would be a major theoretical result, but it would not by itself explain which instances are hard, how hard typical instances are, or how to construct useful security puzzles.
Such a proof would likely require a much deeper understanding of feasible computation. It could also yield important results about other computational problems and limitations, because proving the separation would require techniques powerful enough to exclude a vast range of possible algorithms.
Polynomial time does not always mean practical
The definition of polynomial time is a useful dividing line, but it is not a perfect measure of practical efficiency. An algorithm with running time n42 is polynomial, yet might be unusable for large inputs. Conversely, a very slowly growing non-polynomial running time might be manageable for some input sizes or applications.
Therefore, researchers care about more than the formal question of whether a running time is polynomial. Strong lower bounds or upper bounds could represent major progress even without resolving P versus NP:
A lower bound such as n1000 for a relevant problem would establish formidable difficulty, even though it would not prove an exponential lower bound.
An algorithm with running time such as nlogn would be a substantial improvement over an exponential-time method, even though it is not polynomial.
The exact polynomial-versus-non-polynomial distinction is a powerful shorthand for feasibility, but practical judgments also depend on the exponent, constants, input sizes, and application requirements. The challenge is that general lower bounds for important problems remain far from the kinds of strong bounds researchers would like to prove.
Human abilities and computational limits
People can recognize patterns and perceive some features of the world faster than current machines. This does not necessarily show that the tasks are inherently beyond computation. It may reflect the difference between a capability shaped by a long evolutionary history and software developed over a much shorter period.
The brain’s information-processing methods are not fully understood. It may use procedures that researchers have not yet discovered or that are difficult to describe in conventional algorithmic terms. Studying computational limits may therefore also help researchers understand computational capabilities: clearer theories of what machines can and cannot do could illuminate the methods that biological systems use.
Evidence, secrecy, and claims about powerful algorithms
It is logically possible that a secret organization has discovered a powerful algorithm related to P=NP and has chosen not to reveal it. But public evidence can inform how plausible such a claim seems.
For example, if an organization relied on weakening encryption standards or obtaining passwords from technology companies, that could suggest it did not possess a general method for efficiently breaking the cryptographic systems in question. This is an inference, not a proof: secret behavior can have multiple explanations, and public observations cannot rule out every hidden capability.
The broader lesson is that claims about secret computational breakthroughs are difficult to verify. A proposed algorithm needs rigorous analysis and reproducible evidence, not merely the assertion that it works on selected examples.
Why claimed proofs often fail
Claims to have proved P=NP or P=NP are common, but many fail for recognizable reasons. Two recurring patterns illustrate the challenge.
Claimed algorithms for P=NP
A proposed algorithm may appear to solve an NP-complete problem quickly on a few small examples. But testing a finite number of inputs cannot establish a polynomial-time bound for all input sizes.
An algorithm that works quickly on a graph with a few hundred vertices does not settle how its running time grows for much larger graphs. The crucial question is whether its performance can be bounded mathematically for every input size.
Claimed lower bounds for P=NP
Some arguments assume that every algorithm for a problem such as CLIQUE or satisfiability must operate in a particular, apparently obvious way. They then show that algorithms of that form take a long time.
The danger lies in the word “obvious.” A correct lower-bound proof must account for every possible algorithm, including methods that do not resemble the familiar approaches. An unexamined assumption about what an algorithm “must” do can leave open precisely the possibility the proof needs to exclude.
Community scrutiny and mathematical credibility
A proof of such importance must withstand detailed examination by specialists. This can create a practical difficulty for a researcher without established connections in the field: editors and experts receive many claimed proofs, and they cannot subject every submission to unlimited review. At the same time, fame alone does not make an argument correct; careful scrutiny is essential regardless of the claimant’s reputation.
False proofs can still have lasting value when they provoke useful research. An attempted algorithm may lead to a counterexample, while analysis of why an approach fails may produce a genuine lower bound or a new barrier theorem. In that sense, a failed proof can contribute to the field if its failure reveals a substantive limitation.
History also shows that accepting a flawed proof because of the author’s influence can damage research communities. Mathematical arguments must be evaluated on their logic and evidence, not on political or professional authority.

Ask anything
We've read this whole study set, so questions about it get the best answers.