# Computers and Intractability: A Guide to the Theory of NP-Completeness (Series of Books in the Mathematical Sciences)

All
Stack Overflow 10

This Year
Stack Overflow 1

This Month
Stack Overflow 2

I assume that you are looking for intuitive definitions, since the technical definitions require quite some time to understand. First of all, let's remember a preliminary needed concept to understand those definitions.

Decision problem: A problem with ayesornoanswer.Now, let us define those

complexity classes.## P

P is a complexity class that represents the set of all decision problems that can be solved in polynomial time. That is, given an instance of the problem, the answer yes or no can be decided in polynomial time.ExampleGiven a graph connected

`G`

, can its vertices be coloured using two colours so that no edge is monochromatic?Algorithm: start with an arbitrary vertex, color it red and all of its neighbours blue and continue. Stop when you run out of vertices or you are forced to make an edge have both of its endpoints be the same color.

## NP

NP is a complexity class that represents the set of all decision problems for which the instances where the answer is "yes" have proofs that can be verified in polynomial time.This means that if someone gives us an instance of the problem and a certificate (sometimes called a witness) to the answer being yes, we can check that it is correct in polynomial time.

ExampleInteger factorisationis in NP. This is the problem that given integers`n`

and`m`

, is there an integer`f`

with`1 < f < m`

, such that`f`

divides`n`

(`f`

is a small factor of`n`

)?This is a decision problem because the answers are yes or no. If someone hands us an instance of the problem (so they hand us integers

`n`

and`m`

) and an integer`f`

with`1 < f < m`

, and claim that`f`

is a factor of`n`

(the certificate), we can check the answer inpolynomial timeby performing the division`n / f`

.## NP-Complete

NP-Complete is a complexity class which represents the set of all problems`X`

in NP for which it is possible to reduce any other NP problem`Y`

to`X`

in polynomial time.Intuitively this means that we can solve

`Y`

quickly if we know how to solve`X`

quickly. Precisely,`Y`

is reducible to`X`

, if there is a polynomial time algorithm`f`

to transform instances`y`

of`Y`

to instances`x = f(y)`

of`X`

in polynomial time, with the property that the answer to`y`

is yes, if and only if the answer to`f(y)`

is yes.Example`3-SAT`

. This is the problem wherein we are given a conjunction (ANDs) of 3-clause disjunctions (ORs), statements of the formwhere each

`x_vij`

is a boolean variable or the negation of a variable from a finite predefined list`(x_1, x_2, ... x_n)`

.It can be shown that

every NP problem can be reduced to 3-SAT. The proof of this is technical and requires use of the technical definition of NP (based on non-deterministic Turing machines). This is known asCook's theorem.What makes NP-complete problems important is that if a deterministic polynomial time algorithm can be found to solve one of them, every NP problem is solvable in polynomial time (one problem to rule them all).

## NP-hard

Intuitively, these are the problems that are

at least as hard as the NP-complete problems. Note that NP-hard problemsdo not have to be in NP, andthey do not have to be decision problems.The precise definition here is that

a problem.`X`

is NP-hard, if there is an NP-complete problem`Y`

, such that`Y`

is reducible to`X`

in polynomial timeBut since any NP-complete problem can be reduced to any other NP-complete problem in polynomial time, all NP-complete problems can be reduced to any NP-hard problem in polynomial time. Then, if there is a solution to one NP-hard problem in polynomial time, there is a solution to all NP problems in polynomial time.

ExampleThe

halting problemis an NP-hard problem. This is the problem that given a program`P`

and input`I`

, will it halt? This is a decision problem but it is not in NP. It is clear that any NP-complete problem can be reduced to this one. As another example, any NP-complete problem is NP-hard.My favorite NP-complete problem is the Minesweeper problem.

## P = NP

This one is the most famous problem in computer science, and one of the most important outstanding questions in the mathematical sciences. In fact, the Clay Institute is offering one million dollars for a solution to the problem (Stephen Cook's writeup on the Clay website is quite good).

It's clear that P is a subset of NP. The open question is whether or not NP problems have deterministic polynomial time solutions. It is largely believed that they do not. Here is an outstanding recent article on the latest (and the importance) of the P = NP problem: The Status of the P versus NP problem.

The best book on the subject is Computers and Intractability by Garey and Johnson.

Unfortunately, the best two books I am aware of (Garey and Johnson and Hopcroft and Ullman) both start at the level of graduate proof-oriented mathematics. This is almost certainly necessary, as the whole issue is very easy to misunderstand or mischaracterize. Jeff nearly got his ears chewed off when he attempted to approach the matter in too folksy/jokey a tone.

Perhaps the best way is to simply do a lot of hands-on work with big-O notation using lots of examples and exercises. See also this answer. Note, however, that this is not quite the same thing: individual algorithms can be described by asymptotes, but saying that a

problemis of a certain complexity is a statement aboutevery possible algorithmfor it. This is why the proofs are so complicated!It's not easy to say all things about complexity, but I think wiki has a good explanation on it and for startup is good, see:

and about optimization you can look at web and wiki to find it, but with five line your friends give a good sample for introduction, but these are not one night effort for understanding their usage, calculation, and thousand of theory.

In all you can be familiar with them as needed, reading wiki, more advance reading books like Gary and Johnson or read Computation Complexity, a modern approach, but do not expect you know everything about them after that. Also you can see this lecture notes: http://www.cs.rutgers.edu/~allender/lecture.notes/.

The most straightforward way is to prove that there is a polynomial time solution to the problems in the class NP-complete. These are problems that are in NP and are reducable to one of the known np problem. That means you could give a faster algorithm to prove the original problem posed by Stephen Cook or many others which have also been shown to be NP-Complete. See Richard Karp's seminal paper and this book for more interesting problems. It has been shown that if you solve one of these problems the entire complexity class collapses. edit: I have to add that i was talking to my friend who is studying quantum computation. Although I had no clue what it means, he said that a certain proof/experiment? in the quantum world could make the entire complexity class, i mean the whole thing, moot. If anyone here knows more about this, please reply.

There have also been numerous attempts to the problem without giving a formal algorithm. You could try to count the set. Theres the Robert/Seymore proof. People have also tried to solve it using the tried and tested diagonlization proof(also used to show that there are problems that you can never solve). Razborov also showed that if there are certain one-way functions then any proof cannot give a resolution. That means that new techniques will be required in order to solve this question.

Its been 38 years since the original paper has been published and there still is no sign of a proof. Not only that but lot of problems that mathematicians had been posing before the notion of complexity classes came in has been shown to be NP. Therefor many mathematicians and computer scientists believe that some of the problems are so fundamental that a new kind of maths may be needed to solve the problem. You have to keep in mind that the best minds human race has to offer have tackled this problem without any success. I think it should be at least decades before somebody cracks the puzzle. But even if there is a polynomial time solution the constants or the exponent could be so large that it would be useless in our problems.

There is an excellent survey available which should answer most of your questions: http://www.scottaaronson.com/papers/pnp.pdf.