How to show a problem is NP-complete


This is the first post in a series of posts where I will attempt to give visual, easy to understand, proofs of NP-completeness for a selection of decision problems. I created these while studying them back in college. Hopefully, they’ll be helpful for someone.

In this post, I will give a “template” which can be used (and will be used for the proofs I post). I will assume the reader is familiar with decision problems and the complexity classes P, NP and NP-hard. If not, please see the Wikipedia article on NP-completeness, or better yet, take a look in Chapter 34 of Introduction to Algorithms (or “CLRS” after its authors).

For decision problem AA:

ANP-complete    ANPNP-hard A \in \text{NP-complete} \iff A \in \text{NP} \cap \text{NP-hard}

In other words, we will need to show that AA is in NP, and in NP-hard.

Showing the problem is in NP

For a decision problem AA to be in NP, it is sufficient to show that a certificate (an encoding of a solution to the problem) can be verified to represent a solution to the decision problem in polynomial time.

Sufficient proof

  • Certificate for instance of AA can be verified in polynomial time.

Showing the problem is NP-hard

For a decision problem AA to be NP-hard, it is sufficient to show that any instance bb of another decision problem BB, which is already known to be NP-hard, can be reduced to an instance aa of AA, such that the reduction of bb into aa can be performed in polynomial time. We express the existence of such a reduction as:

BPA B \leq_\text{P} A

In other words: AA is at least as hard as BB

Sufficient proofs

  • Any instance bb of BB can be reduced to an aa instance of AA in polynomial time; and

  • Decision aa is “Yes”     b\iff b is “Yes”

Conclusion

Using knowledge about other problems already proven to be NP-complete, and some creativity, we are now ready to attempt proving NP-completeness.