The Traveling Salesperson Problem and P vs NP Explained
3 min
3 min
Suppose I give you a route through five cities.
You can calculate its total distance in seconds.
But what if I ask you to find the shortest possible route among every arrangement?
This is the traveling salesperson problem.
Visit every city exactly once, return to where you started, and make the total journey as short as possible.
Here's one possible route. Its length is about 16.61 units.
Once a route is given, checking it is straightforward.
Verify that every city appears exactly once.
Add the distances, then compare the total with a chosen limit.
This route is shorter than 17 units, and we can confirm that quickly.
But can we do better? Yes, here is another route.
Its length is exactly 14 units. That's shorter than our first route.
Finding a better route was possible, but how do we know whether 14 is the absolute minimum?
To prove that a route is shortest, we must rule out every shorter alternative.
With only five cities, we can check all 12 distinct round trips.
But as the number of cities grows, that simple strategy becomes enormously expensive.
Here's why the problem becomes difficult.
With five cities, there are just 12 distinct round trips.
With 10, more than 180,000. With 15, over 43 billion.
And with 20, more than 60 quadrillion. The number of possibilities grows explosively.
Computer scientists use the letter P for decision problems that can be solved by algorithms whose running time grows at most polynomially with the input size.
These are the problems considered efficiently solvable in complexity theory.
NP describes decision problems where a yes answer can be supported by a certificate that is checked in polynomial time.
For our route problem, the certificate is the proposed tour.
We can check its order, calculate its length, and verify whether it stays within the required limit.
Every problem in P is also in NP. But are the two classes actually equal?
Could every efficiently verifiable yes answer also be found by an efficient algorithm?
Nobody knows. That's the P versus NP problem.
This question reaches far beyond travel routes.
Related complexity questions appear in scheduling, logistics, optimization, and mathematical problem-solving.
A discovery about P versus NP would change our understanding of what computers can efficiently calculate.
Checking a proposed answer and discovering one are fundamentally different tasks.
P versus NP asks whether that apparent difference reflects a genuine limit of efficient computation, and the answer remains one of mathematics' great open questions.
End of transcript · 414 words
TranslateMom transcribes and translates videos from X, TikTok, YouTube and Instagram. Paste a link and you get a page like this one, in your language.