Quant Memo
Advanced

NP-Hardness and Reductions

What it means to prove a problem is 'NP-hard' — and why showing your new hard-looking problem is really just a disguised version of a known hard problem is the standard way to make that case.

Some problems seem to require checking every possible combination as the input grows — no clever shortcut has ever been found, and computer scientists broadly suspect none exists. NP-hard is the formal label for "at least as hard as the hardest problems whose proposed solutions can be quickly checked, even if finding them seems to require brute force." A quant runs into this constantly: choosing the best subset of assets to hold under a cardinality constraint, or finding an optimal execution schedule under complex constraints, are both problems whose exact solution can require checking an exponentially large number of combinations.

The standard way to prove a new problem is NP-hard is a reduction: show that any instance of a problem already known to be NP-hard (like the classic knapsack or subset-sum problems) can be rewritten, using only a reasonably fast transformation, as an instance of your new problem. If solving your problem quickly would let you solve the known-hard problem quickly too, your problem inherits the hardness — you've reduced the old problem to the new one, borrowing its difficulty.

This matters practically because it tells a quant when to stop looking for an exact algorithm and switch strategy: recognizing that "choose the best 30-stock subset out of 500 under a risk constraint" is a disguised knapsack problem means reaching for approximation methods (greedy heuristics, integer-programming solvers with time limits, genetic algorithms) rather than wasting time hunting for a fast exact solution that almost certainly doesn't exist.

Proving NP-hardness usually means showing a known-hard problem reduces to your problem — a signal to switch from "find the exact answer" to "find a good approximation fast enough to be useful."

Related concepts

Practice in interviews

Further reading

  • Cormen et al., Introduction to Algorithms, ch. 34
ShareTwitterLinkedIn