# How does a co-NP problem differ from an NP (its complement) one?

I have quite a hard time understanding co-NP problems.

If we can reduce every problem to decision problem. NP problems should accept YES instances -> instances where the answer is yes. So for example for Traveling Salesman problem, we would ask "Is there a path that visits every city, and is shorter than N" ?

For co-NP problem, they should accept NO instance -> answer to them is NO. But given this, how would we formulate co-NP problem to Traveling Salesman problem I mentioned earlier? if we formulate it "Isn't there a path that visits every city and is shorter than N"? If there wasn't the path, the answer would be YES -> so it would be YES problem, if the answer was NO, we would have to try the path which would be same as YES problem.

So what is the difference? Was my co-NP decision problem to said TSP correct?

I have read wiki and tried to find some sources but nothing helped...

Thanks for help!

• The title you have chosen is not well suited to representing your question. Please take some time to improve it; we have collected some advice here. Thank you! – Raphael Nov 25 '18 at 17:03
• I think you've twisted your thoughts around a non-issue. For this, I recommend you view decision problems as languages (see e.g. here), not as computational tasks. – Raphael Nov 25 '18 at 17:05

A co-NP problem differs from its complementary NP problem exactly by being its complement! That's the whole story.

NP problems should accept YES instances -> instances where the answer is yes.

I think you've confused yourself. Every problem, of any complexity, is a division of all possible instances into "yes" instances and "no" instances. For TSP, the "yes" instances are the maps where the salesperson can visit all the cities within the distance requirement and for co-TSP, the "yes" instances are the maps where the salesperson can't (i.e., the "no" instances of TSP).

What differs between complexity classes is the amount of resources and model of computation that are required to tell the difference between a "yes" intance and a "no" instance. For NP, we use a nondeterministic Turing machine running for a polynomial number of steps and say that the machine accepts if at least one computation path accepts, and rejects otherwise. For co-NP, we do the opposite: the machine rejects if at least one computation path rejects, and accepts otherwise.

A YES/NO problem is in NP if for every instance where the answer is "YES", there is a proof that can be verified in polynomial power.

A YES/NO problem is in co-NP if for every instance where the answer is "NO", there is a proof that can be verified in polynomial power.

Of course if you take a problem in NP and just switch the answer from "YES" to "NO" and vice versa, you get a problem in co-NP, but that is rather boring. For example "is a number N composite" is in NP (just start with a non-trivial factor to show it is composite), and the opposite "is a number N prime or equal to 1" is in co-NP (just start with a non trivial factor to show that it is NOT prime or equal to 1).

What's much more interesting is problems that are both in NP and co-NP. "Is a number N composite" is indeed in co-NP but that requires some deep mathematics - whenever N is prime, there is a proof that it is prime which can be checked in polynomial time. Not easy at all.

For the Travelling Salesman problem which is easy to show in NP, nobody has the slightest clue how to prove that it would be in co-NP, and most likely it is false.