Content-Type: text/html

# Complexity classes P and NP

HomePage | RecentChanges | Preferences
You can edit this page right now! It's a free, community project

In [complexity theory]?, the class P consists of all those decision problems that can be solved on a deterministic sequential machine in an amount of time that is polynomial in the size of the input; the class NP consists of all those decision problems whose positive solutions can be verified in polynomial time given the right information, or equivalently, whose solution can be found in polynomial time on a non-deterministic machine. The biggest open question in theoretical computer science concerns the relationship between those two classes:

  Is P = NP ?

Most people think that the answer is probably "no"; some people believe the question may be undecidable from the currently accepted axioms. A $1,000,000 price has been offered for a correct solution.

In essence, the P = NP question asks: if positive solutions to a YES/NO problem can be verified quickly, can the answers also be computed quickly? Here is an example to get a feeling for the question. Suppose the problem is to decide whether a given natural number with n digits is composite or prime. If the number is composite, the output should be YES, otherwise it should be NO. No fast algorithms are known for this problem, where "fast" means "finishing in a number of steps that is at most a fixed power of n". However, positive answers can be verified quickly given the right information: checking that 69799 = 223 * 313 is much easier than finding the factorization of 69799 in the first place. The information needed to verify a positive answer is also called a certificate. So we conclude that given the right certificates, positive answers to our problem can be verified quickly (i.e. in polynomial time) and that's why this problem is in NP. It is not known whether the problem is in P.

We will now define the two classes formally.

A decision problem is a problem that takes as input some string and requires as output either YES or NO. If there is an algorithm (say a Turing machine, or a LISP or Pascal program with unbounded memory) which is able to produce the correct answer for any input string of length n in at most nk steps, where k is some constant independent of the input string, then we say that the problem can be solved in polynomial time and we place it in the class P. Intuitively, we think of the problems in P as those that can be solved reasonably fast.

Now suppose there is an algorithm A(w,C) which takes two arguments, a string w which is an input string to our decision problem, and a string C which is a "proposed certificate", and such that A produces a YES/NO answer in at most nk steps (where n is the length of w and k doesn't depend on n). Suppose furthermore that

  w is a YES instance of the decision problem if and only if there exists C such that A(w,C) returns YES.

Then we say that the problem can be solved in non-deterministic polynomial time and we place it in the class NP. We think of the algorithm A as a verifier of proposed certificates which runs reasonably fast.

To attack the P = NP question, the concept of NP-completeness? has been introduced. Informally, the NP-complete problems are the "toughest" problems in NP. This means that if an NP-complete problem could be shown to be in P, then it would follow that P = NP. Unfortunately, many important problems have been shown to be NP-complete and not a single fast algorithm for any of them is known.

See also:

- A [$1,000,000 offer] from the Clay Mathematics Institute for a solution of the P versus NP question.

HomePage | RecentChanges | Preferences
You can edit this page right now! It's a free, community project
Edit text of this page | View other revisions
Last edited August 16, 2001 7:26 pm (diff)
Search: