[Math] Prove that the “even” subset sum problem is NP-complete

algorithmsnp-complete

I need to prove that the even subset sum problem is NP-complete.

"Given a finite set of natural numbers and an even number $n$, decide whether a
subset of the given set exists such that the numbers in that subset sum up to $n$.”

I know that in order to do this I first need to prove that it is in NP, and then need to prove that it is also NP-Hard.

I think I can figure out the first part, but I have no idea how I go about proving that it is NP-Hard. Since it is already proven that the normal subset sum problem is NP-complete, it seems logical to reduce from this one:

“Given a finite set of natural numbers and a number n, decide whether a subset
of the given set exists such that the numbers in that subset sum up to $n$.”

After this, I'm completely stuck. It would be nice if someone could explain the rest of the process to me.

Best Answer

Here's the reduction I thought of first; there may be others equally simple.

We suppose we have a magic machine $M$ which can solve instances of subset-sum, but only when the target sum is even. We want to use this to solve all instances of subset-sum. Suppose the given instance has a set of numbers $N$ and asks us to find a subset $S\subset N$ whose sum is $n$. If $n$ is even we can hand the problem to the machine and use the solution directly; the only interesting case is what to do when $n$ is odd. Then let $o$ be some odd number larger than $\sum N$. We can take $o=1+\sum N$ if that is odd, and otherwise $o = 2+\sum N$. Clearly we can calculate $o$ in polynomial time.

Then hand the machine $N\cup\{o\}$ and ask it to find a subset that adds up to the target sum $o+n$, which it will do, because $o+n$ is even. It will give us back a set $S\subset N\cup\{o\}$ such that $\sum S = o+n$.

We can be sure that $o\in S$ because otherwise $S\subset N$ and so $\sum S\le \sum N \lt o \lt o+n$ which we know is not the case. Then $S\setminus\{o\}$ is the subset we want because it is a subset of $N$, and $\sum(S\setminus\{o\}) = \sum S - o = n+o-o = n$.

Related Question