P vs. NP — What Is The Difference Between Solving A Problem And Recognizing Its Solution? (2024)

COMPUTER SCIENCE

Diving into the most notorious open question in computer science and its far-reaching philosophical consequences.

P vs. NP — What Is The Difference Between Solving A Problem And Recognizing Its Solution? (3)

From the dawn of history, Humans have been a problem-solver species. From early agriculture to space exploration, solving mathematical problems seems to be a critical factor in human survival. Since the ’70s, some computational problems that once were tedious to solve have become solvable in a split of a second, mainly due to the exponential growth in processing power. However, some unique problems remain indifferent towards technological advancement, as even for the most powerful computers, solving them takes more time then a human lifetime, even if the problem is within a reasonable scale. In fact, modern encryption relies on the fact that it’s effectively impossible to factor the product of large primes. These problems seem to share a common difficulty that is at the heart of the P versus NP enigma — What is feasible, and what is effectively impossible?

P vs. NP — What Is The Difference Between Solving A Problem And Recognizing Its Solution? (4)

In 1859, the Irish mathematician William Hamilton illustrated a mathematical game which is called Icosian. This game was played on a wooden dodecahedron surface, which consists of 20 corners (vertices). Each of these corners was labeled with the name of a city. The game’s objective was to find a cycle that visits every vertex exactly once and then returns to the starting point. This kind of path is called a Hamiltonian cycle. This simple game gave birth to a significant problem in Graph Theory named The Hamiltonian Cycle Decision Problem — Given an arbitrary graph, how can we know whether it contains a Hamiltonian cycle?

P vs. NP — What Is The Difference Between Solving A Problem And Recognizing Its Solution? (5)

Given a Graph, determine whether it contains an Hamiltonian cycle.

One approach to solving this problem is by traversing any possible path in the graph and checking whether the path is a Hamiltonian cycle. However, since the number of possible paths can reach up to n!, even a graph with only 40 vertices might contain more then Quattuordecillion (10⁴⁵) paths, making the problem almost impossible to solve in a reasonable time, even for the most powerful processors. Furthermore, even if we somehow manage to build a super-processor that can handle this computation, due to the factorial dependency between the number of vertices to the number of paths, even the slightest addition of vertices to the graph would require a radical increase in processing power. We can say that the radical nature of the factorial growth makes this problem more difficult than other problems. This is the intuition behind the hardness of Mathematical problems — A problem is considered harder if the resources required to solve it grows radically when the input grows.

To formalize this idea, computer scientists use the scale of Time complexity. Time complexity refers to how many steps are needed to solve a problem and how the number of required steps scales up with the problem's size. Given an algorithm, the algorithm’s Time Complexity is described as an asymptotical function that is dependent on the algorithm’s input size. It is used to classify algorithms according to how their number of steps or space requirements grow as the input size grows.

“The asymptotic viewpoint is inherent to computational complexity theory, and reveals structure which would be obscured by finite, precise analysis.”

— Avi Wigderson

P vs. NP — What Is The Difference Between Solving A Problem And Recognizing Its Solution? (6)

A fundamental distinction is made between algorithms that have a Polynomial Time Complexity, where their complexity function is a Polynom, to those that have a more radical complexity function. This distinction is made mainly because Polynomial growth is considered to be more moderate than others, in the sense that large changes in the input size would not cause a radical increment in required steps . A Polynom is a construct that involves only the operations of addition, subtraction, multiplication, and non-negative integer exponents, thus never introduces an Exponential or a Factorial growth. The choice of polynomial-time to represent efficient computation seems arbitrary; however, it has justified itself over time from many perspectives. For instance, the closure of polynomials under addition, multiplication, and composition preserve the notion of efficiency under natural programming practices, such as chaining programs into a sequence or nesting a program within another program.

Algorithms that have a Polynomial Time Complexity are referred to as “efficient”.

Over the years, there were many tryouts to solve the Hamiltonian Cycle Decision Problem efficiently. One of them is the Held-Karp algorithm, which manages to solve this problem in Exponential time. Still, no known algorithm can solve this problem in Polynomial-time, and therefore, it’s still considered a hard problem.

P vs. NP — What Is The Difference Between Solving A Problem And Recognizing Its Solution? (7)
P vs. NP — What Is The Difference Between Solving A Problem And Recognizing Its Solution? (8)

However, an interesting phenomenon occurs: Even though we can't efficiently solve this problem, given a path in the graph, we can at least efficiently check whether it is a Hamiltonian cycle — Since the maximal number of vertices in a simple cycle is n, then the time required to traverse a path is polynomially bounded to n.

This phenomenon occurs in other difficult problems, such as the Sudoku Decision Problem — Given an incomplete Sudoku grid, we wish to know whether it has at least one valid solution. Any proposed Sudoku solution can be easily verified, and the time to check a solution grows polynomially as the grid gets bigger. However, all known algorithms for finding solutions take, for difficult examples, time that grows exponentially as the grid gets bigger. Similar to the Hamiltonian Path decision problem, there isn’t any known algorithm that can efficiently solve the Sudoku decision problem, but, given a solution, the solution could be efficiently verified. It appears that many other decision problems share this property — Regardless of whether they can be solved efficiently, their proposed solutions can be efficiently verified. This set of problems is defined as NP.

A Decision Problem is in NP if its solutions can be efficiently verified.

The acronym NP stands for nondeterministic polynomial time (despite the common belief that NP means “Not P”).

Thinking further about the relationship between the solvability of a problem and its solutions' verifiability brings us to the next point: If a decision problem is efficiently solvable, then its solutions must be efficiently verifiable. Why? Because if a decision problem is efficiently solvable, it means that we can find its solutions efficiently. Then, given a proposed solution, we can verify it simply by comparing it with the problem’s actual solutions. Put differently, the correctness of the algorithm generating the solution automatically certifies that solution. From this conclusion, it is evident that NP — the set of all decision problems in which their solutions are efficiently verifiable, contains a subset of problems that are also efficiently solvable. This subset is defined as P.

P is the set of all decision problems that are efficiently solvable. P is a subset of NP.

P vs. NP — What Is The Difference Between Solving A Problem And Recognizing Its Solution? (9)

The Hamiltonian Path Decision Problem has an efficient algorithm that can verify its solutions; hence, it is in NP. One may wonder whether this problem is in P. Well, on the one hand, there is no knowledge about an efficient algorithm that solves this problem. On the other hand, there is no proof that such an algorithm doesn’t exist. In fact, there is still a chance that such an algorithm does exist and hasn’t been discovered yet. The same goes for the Sudoku Decision Problem, and, in fact, for many other major problems, including the Boolean satisfiability problem, the Travelling salesman problem, the Subset sum problem, the Clique problem, the Graph coloring problem, and others — Even though we have proved that those problems are in NP, there is no proof of the fact that they are outside of P. This is exactly what the P=NP question is all about:

Do P and NP are actually the same? If Yes, it means that all the problems in NP can be efficiently solved even though we still haven’t found the mysterious algorithms that achieve that. Otherwise, there are problems in NP that are impossible to solve efficiently, and any attempt to do so would mean a complete waste of our time and efforts.

Most of the time, not being able to solve problems efficiently is a negative thing. However, in some cases, we could gain from a problem’s “hardness”. The main attribute of problems that are in NP and not in P is that it is hard to solve them, but easy to verify their solutions. This kind of asymmetry is especially useful in the field of Cryptography — Information can be “locked behind” a hard problem. Any brute-force attack would fail to unlock the information in a reasonable time, whereas any previous knowledge about the solution (a “key”) could be verified efficiently and therefore permit access. The most prominent example of this concept is the RSA public-key Cryptosystem, which is based on the Prime Factorization Problem.

Given two positive integers n and k, decide whether n has a prime factor smaller than k.

— The Prime Factorization Decision Problem

This problem is known to be in NP since its solutions can be efficiently verified: Given an integer c, it takes a Polynomial-time to know whether c is a prime smaller than k and is a factor of n. However, no known algorithm can solve this problem in Polynomial-time. Therefore, using two considerably large prime numbers, it is possible to compute their multiplication, which is used to generate a public key and a private key. The public key can be known by everyone, and it is used for encrypting messages. Messages encrypted with the public key can only be decrypted in a reasonable amount of time using the private key, assuming that there is no efficient way to factorize a large integer into its prime factors.

P vs. NP — What Is The Difference Between Solving A Problem And Recognizing Its Solution? (10)

However, if P=NP, then the last assumption is false. Why? If P equals NP, then the Prime Factorization Problem is in P, meaning that it can be solved efficiently. Hence, once such an algorithm is found, any public key could be decrypted in a reasonable amount of time without the need for a private key, making the entire RSA Cryptosystem completely vulnerable, at least in the theoretical sense.

But the negative sides of P being equal to NP are relativity insignificant compared to the potential benefits it holds. There are literally thousands of NP problems in Mathematics, Optimization, Artificial Intelligence, Biology, Physics, Economics, and Industry, which arise naturally out of different necessities, and whose efficient solutions will benefit us in numerous ways. Proving that P=NP would mean that all those difficult problems can be solved in a Polynomial-time, which would lead to a massive intellectual pursuit after those remarkable algorithms. Once revealed, those algorithms would potentially boost human progress far beyond our grasp.

P vs. NP — What Is The Difference Between Solving A Problem And Recognizing Its Solution? (11)

Even such consequences may pale into insignificance compared to the revolution an efficient method for solving NP problems would cause in mathematics itself.

P vs. NP — What Is The Difference Between Solving A Problem And Recognizing Its Solution? (12)

Consider the well-known Pythagorean theorem as an example, which states the relation a²+b²=c² between the legs and the hypotenuse of a right triangle. This theorem has 370 known proofs. Each of those proofs is a possible solution for the following decision problem: “Is the Pythagorean theorem correct?”. This idea can be generalized:

If T is a theorem and p is its proof, then p is a solution for the decision problem: “Is T correct?”

This relation between mathematical theorems to decision problems allows us to generalize the discussion regarding P versus NP — If a proof’s correctness can be verified in Polynomial-time, then the corresponding decision problem is in NP (Since the proof is a proposed solution for that decision problem). In a world where P equals NP, such a decision problem is in P, meaning that it can be solved in Polynomial-time. Solving such a decision problem is essentially finding proof for theorem T. This could imply, to some extent, that proving a mathematical theorem is not significantly harder then inspecting the correctness of a given proof.

P equals NP may imply that proving a mathematical theorem is not fundamentally harder than verifying the correctness of its proof.

The last conclusion is truly remarkable considering that every mathematical proof can be formalized into a series of well-defined logical statements, which could be processed by a computer program to verify that proof automatically. Hence, P equals NP would mean that proving mathematical theorems can be done by a simple computer program.

“P equals NP would transform mathematics by allowing a computer to find a formal proof of any theorem which has a proof of a reasonable length, since formal proofs can easily be recognized in polynomial time.”

— Stephen Cook

One psychological reason people feel that P=NP is unlikely is that tasks as prooving mathematical theorems often require a degree of creativity, which we do not expect a simple computer program to have.

P vs. NP — What Is The Difference Between Solving A Problem And Recognizing Its Solution? (13)

“We admire Wiles’ proof of Fermat’s Last Theorem, the scientific theories of Newton, Einstein, Darwin, Watson and Crick, the design of the Golden Gate bridge and the Pyramids, and sometimes even Hercule Poirot’s and Miss Marple’s analysis of a murder, precisely because they seem to require a leap which cannot be made by everyone, let alone by a simple mechanical device”

— Avi Wigderson

The above point leads us to a discussion about the very nature of the human brain. While science is extremely far from understanding the brain’s mechanism, the laws of physics govern its behavior. As such, and like every other natural process, the brain is an efficient computational device. Hence, any solution to any problem that has been recognized by the brain, has been, by definition, recognized efficiently. Therefore, P equals NP may imply that the brain is capable of solving those problems with the same efficiency.

“If P = NP, any human or computer would have the sort of reasoning power traditionally ascribed to deities, and this seems hard to accept.”

— Avi Wigderson

The idea by which amazing discoveries such as Wiles’s proof of Fermat’s Last Theorem or Einstein’s relativity could be produced by a mindless robot is not intuitive for most people, as they share a strong opinion by which creativity has been absolutely essential for reaching such insights.

P vs. NP — What Is The Difference Between Solving A Problem And Recognizing Its Solution? (14)

“If P=NP, then the world would be a profoundly different place than we usually assume it to be. Everyone who could appreciate a symphony would be Mozart.”

— Scott Aaronson

Complexity theorists generally believe that P doesn't equal NP, and such a beautiful world cannot exist. In 2000, the Clay Math Institute named the P versus NP problem as one of the seven most important open questions in mathematics and had offered a million-dollar prize for a proof that determines whether or not P = NP.

🎗 For more, visit my blog.

P vs. NP — What Is The Difference Between Solving A Problem And Recognizing Its Solution? (2024)

FAQs

What is the difference between P problem and NP problem? ›

'P' stands for 'Polynomial Time', problems that can be solved relatively quickly by a computer. 'NP' stands for 'Nondeterministic Polynomial Time', problems for which a solution can be checked quickly. The question (P vs NP) is whether every problem whose solution can be checked quickly can also be solved quickly.

What would solving P vs NP mean? ›

The P versus NP problem is to determine whether every language accepted by some nondeterministic algorithm in polynomial time is also accepted by some (deterministic) algorithm in polynomial time.

Is the p vs np problem solvable? ›

While the P versus NP problem is generally considered unsolved, many amateur and some professional researchers have claimed solutions.

How do you determine whether a problem is NP-hard or P? ›

  1. if an NP-hard or NP-complete problem is proven to have an easy solution,then it will lead to the fact : NP=P.
  2. if any NP( or NP-complete) problem is proven to not have an easy solution, then it will lead to the fact that : NP!=P.
Oct 22, 2015

What is P vs NP for dummies? ›

Thus, P problems are said to be easy, or tractable. A problem is called NP if its solution can be guessed and verified in polynomial time, and nondeterministic means that no particular rule is followed to make the guess.

Why is p vs np so hard? ›

The answer is complexity. It's much more difficult to quickly find a solution to an NP problem than a P problem. Computers can easily check solutions to NP problems, but devising an algorithm that can propose solutions to NP problems in a reasonable time is much more difficult.

What would happen if P vs NP is solved? ›

If P=NP, then the world would be a profoundly different place than we usually assume it to be. There would be no special value in 'creative leaps,' no fundamental gap between solving a problem and recognizing the solution once it's found.

Can a problem be both P and NP complete? ›

If P = NP, the answer to your question is that all problems in NP are both in P and in NP-Complete. If P != NP, the answer to your question is that there are problems known to be in NP, which are known not to be NP-complete but for which no polynomial-time algorithm is yet known.

What is an example of a NP-complete problem? ›

NP-complete problem, any of a class of computational problems for which no efficient solution algorithm has been found. Many significant computer-science problems belong to this class—e.g., the traveling salesman problem, satisfiability problems, and graph-covering problems.

Are P and NP decision problems? ›

NP problems are a class of decision problems where a proposed solution can be verified in time that is polynomial in relation to the input. Conceptually, P problems are a subset of NP problems, which makes sense.

Can AI solve p vs np? ›

AI, with its advanced pattern recognition and data processing capabilities, is ideally positioned to tackle the P vs NP problem. Machine learning algorithms can process and analyze vast datasets much faster than humans, identifying patterns that could lead to a solution.

Can NP problems be reduced to P? ›

Therefore, if any NP-complete problem has a polynomial time algorithm, then P = NP. See Figure 22.1 for the relation between P,NP,NP-complete and NP-hard. an NP-complete problem can be reduced to it; if we can do that, we know all problems in NP can be reduced to it by the definition of NP-hard.

What is the difference between P and NP class problem? ›

The difference between the two classes is that a problem is in P if there exists an algorithm which can solve the problem in polynomial time, while a problem is in NP if there exists a verification procedure which can check the solution in polynomial time.

How to identify a NP problem? ›

One of the most definitive ways to identify an NP-complete problem is by using a technique called “polynomial-time reduction.” If you can transform a known NP-complete problem into the problem you're trying to solve (in polynomial time), then the problem in question is also NP-complete.

What is a NP-hard problem in layman's terms? ›

NP-hard problems are a class of problems in computer science that are considered 'hard' or 'difficult' to solve. NP stands for "nondeterministic polynomial time" and an NP-hard problem is one where no efficient solution exists or is known.

What is the relationship between p and np? ›

A mathematical expression that involves N's and N2s and N's raised to other powers is called a polynomial, and that's what the “P” in “P = NP” stands for. P is the set of problems whose solution times are proportional to polynomials involving N's.

What does NP problem mean? ›

Numbers and Mathematics. A problem is called NP (nondeterministic polynomial) if its solution can be guessed and verified in polynomial time; nondeterministic means that no particular rule is followed to make the guess.

References

Top Articles
Latest Posts
Article information

Author: Maia Crooks Jr

Last Updated:

Views: 5746

Rating: 4.2 / 5 (43 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Maia Crooks Jr

Birthday: 1997-09-21

Address: 93119 Joseph Street, Peggyfurt, NC 11582

Phone: +2983088926881

Job: Principal Design Liaison

Hobby: Web surfing, Skiing, role-playing games, Sketching, Polo, Sewing, Genealogy

Introduction: My name is Maia Crooks Jr, I am a homely, joyous, shiny, successful, hilarious, thoughtful, joyous person who loves writing and wants to share my knowledge and understanding with you.