Past exam of the mathematics course of the University of Cambridge 2002 iii Paper 34 5 Solution Created 2026-10-03 Updated 2026-10-14
For the metric travelling salesman problem, a tour is a polynomial-size complexity certificate: list the vertices in cyclic visiting order. In polynomial time verify that every vertex occurs exactly once, add the encoded integer edge costs and compare the sum with the threshold. The certificate has bits, and addition uses a number of bits polynomial in the input length. If validity of the metric input is not treated as a promise, nonnegativity, symmetry and all triangle inequalities can also be checked in polynomial time. Therefore the decision problem belongs to NP.
An evaluation algorithm immediately decides a threshold instance by computing the optimum and comparing it with . Conversely, suppose there is a polynomial-time decision algorithm. The optimum is an integer in , where is the largest edge cost; any fixed cyclic ordering gives the upper bound. Binary search on this interval using threshold queries finds the exact minimum. It makes queries, and every queried threshold has polynomial encoding length. Thus the time is polynomial in the bit length, even when is numerically large. Zero-cost and trivial small instances can be handled directly. ConsequentlyThis concerns the optimum value; constructing an optimal tour is the separate optimization task.
For the hardness reduction, start with an undirected graph on vertices and form the complete graph with costsThese costs satisfy the triangle inequality, since every direct cost is at most two and every two-edge path costs at least two. Set the threshold to . Every tour has exactly edges, each costing at least one. Hence it has cost at most precisely when all its edges came from , which is precisely the existence of a Hamiltonian cycle in . The construction and threshold encoding are polynomial-time. Thus the assumed NP-completeness of the Hamiltonian circuit problem gives NP-hardness of metric TSP; together with its NP membership this proves NP-completeness of metric TSP decision.
For the approximation, compute a minimum spanning tree . Deleting any one edge of an optimal tour leaves a spanning tree, so nonnegative costs implyDouble every tree edge. The resulting connected multigraph has even degrees and hence an Euler circuit, of cost . Traverse it and skip previously visited vertices, except for the final return to the start. Each skip replaces a path by its direct edge; repeated use of the triangle inequality shows that no replacement increases cost. The result is a tour visiting every vertex exactly once and satisfyingThe Euler traversal and shortcutting take polynomial time, so the assumed polynomial-time MST routine supplies the requested polynomial-time algorithm. This is the double-tree approximation for metric TSP. In the relative-error convention, when the optimum is positive, explaining the printed term “1-approximation”; in the multiplicative convention it is a factor-two approximation. If the optimum is zero, the same bound forces the returned tour to have zero cost as well.
Past exam of the mathematics course of the University of Cambridge 2012 iii Paper 42 3 b Solution Created 2026-10-03 Updated 2026-10-07
Reduce the Hamiltonian cycle decision problem to the metric travelling salesman problem. Given a simple graph on vertices, form the complete graph with distance on original edges and distance on nonedges. These symmetric distances satisfy the triangle inequality, since a direct distance is at most and any two positive edge distances sum to at least .
A tour has edges, each of cost at least . It has cost at most exactly when every edge is an original graph edge, that is, exactly when the original graph has a Hamiltonian cycle. The construction and threshold are polynomial in the input size. Thus the metric travelling salesman problem is NP-hard; its rational-cost threshold version is also in NP because a tour is a polynomial-size certificate.
Allowing repeated vertex visits does not reduce the optimum for a complete metric instance. Given a closed walk visiting every vertex, keep the vertices in order of first appearance and shortcut the portions between them, including the final return. The triangle inequality makes the resulting Hamiltonian tour no more expensive. Conversely a Hamiltonian tour is an allowed closed walk. Hence the two optimal costs are equal, and the repeated-visit metric version remains NP-hard. If travel is described on a sparse graph, taking its shortest-path metric gives the corresponding closed-walk formulation rather than an easier exact problem.