SUBSET SUM reduction to PARTITION

This is the PARTITION problem:

Given a multiset S of positive integers, decide if it can be partitioned into two equal-sum subsets.

This is the SUBSET SUM problem:

Given a multiset S of integers and an integer T, decide if any subset of S sums to T.

The positive variant of SUBSET SUM is NP-complete.

SUBSET SUM can be reduced to PARTITION as follows:

Define S' = S + {c}, where c = 2T - sum(S). S' can be partitioned into two equal-sum subsets iff there is a subset in S summing to T.

Proof:

Partition S into A and B:

S = A + B

If there exists a subset in S summing to T, then S can be partitioned so either sum(A) = T or sum(B) = T. Suppose sum(A) = T. Let S' = A + B' where B' = B + {c}.

sum(B') = sum(S) - sum(A) + c
sum(B') = sum(S) - sum(A) + 2T - sum(S)
sum(B') = -sum(A) + 2T


By assumption, T = sum(A) therefore sum(B') = sum(A). This means S' can be partitioned into two equal-sum subsets.

If there does not exist a subset in S summing to T, then there cannot exist a c such that S' can be partitioned into two equal-sum subsets.

Suppose for contradiction c can exist.

Adding c to B creates S' = A + B'.

What value of T produces c such that sum(A) = sum(B') = sum(B) + c?

sum(A) = sum(B) + c
sum(A) = sum(B) + 2T - sum(S)
sum(A) = sum(B) + 2T - (sum(A) + sum(B))
sum(A) = sum(B) + 2T - sum(A) - sum(B)
2sum(A) = 2T
sum(A) = T


But A already sums to sum(A), contradicting the assumption that there is no subset of S summing to T.

If 2T < sum(S), then c < 0, but PARTITION only applies for positive integer multisets. Does this reduction still hold?

• We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher.
– D.W.
Jul 19, 2021 at 5:15

You should make $$c=|2T-sum(S)|$$. Show that the reduction then holds no matter what $$T$$ is.