Approximation ratios and inapproximability
Compare a feasible solution against a certified optimum bound, prove the vertex-cover factor two, and separate exact hardness from approximation barriers.
On this page
The question for today
What you’ll understand
- State multiplicative guarantees with the correct direction for minimization and maximization.
- Prove a two-approximation for unweighted vertex cover using a maximal matching.
- Explain why an approximation-hardness claim needs a gap-preserving reduction and an explicit complexity assumption.
When finding an exact optimum appears computationally difficult, an algorithm may still guarantee a useful feasible answer. A proven approximation ratio compares that answer with the unknown optimum on every permitted instance. The proof often avoids computing the optimum by building a lower bound or upper bound that any solution must respect. This converts a heuristic-looking construction into a quantitative theorem, while making clear what is guaranteed and what remains an empirical hope.
Put feasibility and the ratio in the definition
For a minimization problem with nonnegative costs, a factor alpha algorithm returns a feasible solution of cost at most alpha times optimum, where alpha is at least one. Feasibility also implies its cost is at least optimum. For maximization, a common convention requires value at least optimum divided by alpha. State the convention because some literature instead reports a fraction at most one. If optimum is zero, the multiplicative inequality still has meaning and forces a zero-cost answer in the minimization setting; dividing by zero to quote a numerical ratio does not.
A ratio is a worst-case guarantee over the specified instance family, with a separate polynomial-time requirement in the encoded input length. It need not describe typical performance. An additive error bound, an expected ratio for a randomized algorithm, and a high-probability guarantee are distinct statements. Comparing a returned cost with the best answer found by another heuristic does not certify its ratio to the true optimum. An independent bound on what any feasible solution can achieve supplies the missing reference point.
A matching supplies the lower bound
For unweighted vertex cover on a finite undirected simple graph, greedily build a maximal matching M: choose an edge, keep it, and remove all edges incident to its endpoints before continuing. Return both endpoints of every chosen edge. The returned set covers every edge, because an uncovered edge would be disjoint from all chosen endpoints and could have extended the matching, contradicting maximality. Maximal need not mean maximum-size; no largest-matching computation is required.
Every vertex cover must include at least one endpoint of every matching edge. Matching edges are vertex-disjoint, so these obligations require distinct selected vertices, yielding optimum at least |M|. The returned cover has exactly 2|M| vertices, so its size is at most twice optimum. This proof combines a feasible construction with a lower-bound certificate. It applies to unit vertex costs. Selecting both endpoints under arbitrary weights can be arbitrarily poor, because the matching argument counts vertices rather than their costs.
Hardness of exact solutions is not a ratio barrier
NP-hardness of exact optimization does not automatically rule out good approximations. To prove a particular approximation threshold impossible under a complexity assumption, one commonly constructs a gap reduction: yes source instances have optimum in one range, while no source instances have optimum in a separated range. An approximation stronger than that gap would distinguish the two. The reduction must preserve the allowed family, objective orientation, polynomial encoding size, and any promises; a yes/no reduction without a quantitative gap is insufficient.
A simple barrier illustrates the role of assumptions without claiming a sharp vertex-cover threshold. For integer-valued graph objectives bounded by n, a fully polynomial approximation scheme with sufficiently tiny error can reveal the exact integer optimum. Handle the empty graph directly. For a vertex-cover instance with n at least one, choosing epsilon = 1/(2n) in a hypothetical FPTAS gives cost at most optimum plus optimum/(2n), hence at most optimum plus one half because optimum is at most n. The returned cost is an integer strictly below optimum plus one, forcing exact optimality. Its time would remain polynomial because an FPTAS is polynomial in both input length and 1/epsilon. Thus such an FPTAS for general vertex cover would imply P = NP. A PTAS allows arbitrary dependence on 1/epsilon and does not support that same runtime conclusion.
Work it through
Certify an imperfect cover
On the path 1−2−3−4−5, a maximal matching selects edges (1,2) and (3,4). Find the returned cover, compare it with an optimum, and distinguish the actual ratio from the guarantee.
The endpoint algorithm returns C = {1,2,3,4}, which touches all four edges. The matching is maximal: the only unused vertex is 5, and it has no unused neighbor.
The two disjoint matching edges imply every cover has at least two vertices. The set {2,4} covers every edge, so that lower bound is attained and the optimum is exactly two.
The returned cost four divided by optimum two gives actual ratio two on this instance. The general proof guarantees at most two on every graph, but other matching choices or other graphs can achieve smaller actual ratios.
This run attains the factor-two bound. A nonoptimal answer can still carry a rigorous approximation certificate.
The living notebook
Explore the model
Interactive lab · modular
Check a matching certificate on a visible cycle
Pause and reset, then set both controls to modulus 6 and additive step 1. Interpret consecutive residues as an undirected six-cycle and predict that edges (0,1), (2,3), (4,5) form a matching of size three. Step through the orbit while checking on paper that all six returned endpoints cover it and {0,2,4} is an optimum of size three. For a fresh comparison, pause and reset, then set modulus 5 and step 1; a matching of size two gives a four-vertex cover, while an optimum has size three. The orbit is a graph aid, not a matching or approximation solver.
- Residue r0
- 0
- Orbit period · m/gcd(m,a)
- 12
- Distinct residues visited
- 1 of 12
Addition modulo m starts at zero: rₙ = na mod m. Playback advances two additions per second. The orbit has period m/gcd(m,a), including period one for a = 0. This is not a cryptographic security test or a primality algorithm. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA matching lower bound can certify a ratio even when the optimum is unknown; on small cycles you can check the optimum separately.
Pause & reason
Check your understanding
Your turn
Try it yourself
For a star with center c and four leaves, run the endpoint algorithm on any first edge. Give its cost, the exact optimum, and its ratio. Then explain why arbitrary vertex weights invalidate this counting proof.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
After choosing one edge, all remaining edges touch the center. For weights, consider an expensive leaf paired with a cheap center.
Compare with the solution
Any chosen edge yields the center and one leaf, so the returned cost is two. The center alone covers every edge, proving optimum one and ratio two. With weights, let the center cost one and each leaf cost a large number W. The endpoint rule still returns a center and a leaf at cost W+1, while optimum is one. The ratio grows without bound as W increases. The unweighted lower bound counts one vertex per matching edge; it does not control the cost of selecting both weighted endpoints.
Keep the idea
Take it with you
- Approximation theorems require a feasible output and a bound relative to the true optimum.
- Maximal matching yields a polynomial-time factor-two cover under unit vertex costs.
- Exact NP-hardness, PTAS/FPTAS guarantees, and gap-based inapproximability must be distinguished.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.