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 w). Suppose furthermore that
To attack the P = NP question, the concept of NP-completeness is very useful. Informally, the NP-complete problems are the "toughest" problems in NP in the sense that they are the ones most likely not to be in P. This means that if a single 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.
The P = NP question has also been addressed using oracles.
All of the above discussion has assumed that P means "easy" and "not in P" means "hard". While this is a common and reasonably accurate assumption in complexity theory, it is not always true in practice, for several reasons: