NP (nondeterministic polynomial time) is the class of decision problems for which 'yes' instances have polynomial-length certificates verifiable in polynomial time. Equivalently, NP consists of problems solvable by a nondeterministic TM in polynomial time. Every problem in P is in NP (a certificate is the solution itself), but whether P = NP is the most famous open problem in computer science. NP captures many natural combinatorial search problems including satisfiability, graph coloring, and the traveling salesman problem.
For each NP problem, identify what the certificate is and write a polynomial-time verifier. For 3-SAT, the certificate is a satisfying assignment; for Hamiltonian Cycle, it is the cycle itself. This verifier-based definition is often more intuitive than the NTM-based definition.
You have already studied the class P — problems solvable by a deterministic Turing machine in polynomial time. NP extends this in a subtle but powerful way: it captures problems where checking a proposed solution is easy, even if finding one might not be.
The cleanest definition of NP is via verifiers. A decision problem L is in NP if there exists a polynomial-time algorithm V (the verifier) such that: for every 'yes' instance x, there is a string c (the certificate or witness) where V(x, c) accepts, and for every 'no' instance x, no string c makes V(x, c) accept. The certificate c must have length polynomial in |x|. For 3-SAT, c is a satisfying truth assignment; for Hamiltonian Cycle, c is the cycle itself; for Graph Coloring, c is the coloring. In each case, you can check the certificate in polynomial time — just verify it satisfies the constraints — even though finding the certificate may require searching through exponentially many possibilities.
The equivalent definition uses nondeterministic Turing machines (NTMs). An NTM can "guess" an entire certificate in one step and then verify it in polynomial time. NP is exactly the class of problems solvable by an NTM in polynomial time. Both definitions are equivalent: an NTM guess corresponds exactly to the existential certificate. The NTM formulation makes it easy to see that P ⊆ NP — any deterministic TM is a special case of an NTM — but the verifier formulation is usually more intuitive.
The P vs. NP question asks whether every NP problem is also in P. Informally: if checking a solution is easy, is finding one also easy? Most computer scientists believe P ≠ NP — that there are problems where verification is genuinely easier than search — but no proof exists. This is not merely a technical question; a proof that P = NP would imply polynomial-time algorithms for thousands of optimization and search problems, while a proof that P ≠ NP would rigorously confirm the hardness of problems like 3-SAT, protein folding, and cryptographic key recovery.
It is also worth distinguishing NP from co-NP, the class of problems whose *complements* are in NP. For Hamiltonian Cycle, co-NP asks: "does this graph have NO Hamiltonian cycle?" — and there is no known short certificate for a 'no' answer. Whether NP = co-NP is another major open question. These classes sit at the foundation of complexity theory, and understanding NP through its certificate definition is the essential first step toward NP-completeness.