It is an empirical fact that for many combinatorial problems the detection of the existence of a solution is easy, yet no computationally efficient method is known for counting their number…for a variety of problems this phenomenon can be explained.
The class NP captures the difficulty of finding certificates. However, in many contexts, one is interested not just in a single certificate but actually in counting the number of certificates. This chapter studies #P (pronounced “sharp p”), a complexity class that captures this notion.
Counting problems arise in diverse fields such as statistical estimation, statistical physics, network design, and economics, often in situations having to do with estimations of probability. Counting problems are also studied in a field of mathematics called enumerative combinatorics, which tries to obtain closed-form mathematical expressions for counting problems. To give an example, in 1847 Kirchoff showed how the resistance of a network can be determined by counting the number of spanning trees in it, for which he gave a formula involving a simple determinant computation. Results in this chapter will show that for many other natural counting problems, such efficiently computable expressions are unlikely to exist.
In Section 17.1 we give an informal introduction to counting problems and how they arise in statistical estimation. We also encounter an interesting phenomenon: A counting problem can be difficult even though the corresponding decision problem is easy.