1

For brevity, let $s(D) = \sum_{d\in D} d$ denote the sum of the elements in $D$.

Given a set $A = \{a_1, \dots, a_n\}$ of positive integers, and a target value $K$, the subset sum problem is to determine if there exists a subset $A' \subseteq A$ such that $s(A') = K$.

Given a set $B = \{b_1, \dots, b_m\}$ of positive integers, the partition problem is to determine if there exists a subset $B' \subseteq B$ such that $s(B') = s(B \setminus B')$.

Theorem. Subset sum $\propto$ partition.

The proof found in most references, and the one given in the relevant CS SE question, performs the reduction from subset to partition by letting $S = s(A)$ and taking $B = A \cup \{S + K, 2S - K\}$ in the reduction.

I came up with the following alternative approach.


Proof. Given an instance of subset sum, take $S = s(A)$ and construct an instance of the partition problem with $B = A \cup \{S, 2K\}$.

Suppose that $B$ admits a partition $B' \subseteq B$. Because $2K + S > s(A)$, we must have either $2K \in B'$ and $S \in B \setminus B'$ or vice-versa. Assume (without loss of generality) that the former is the case.

Now, let $A' = A \cap (B \setminus B')$ denote the elements of $A$ that are not in $B'$. We know that $$\begin{align} &&s(B') &= s(B \setminus B') \\ \iff\quad&& 2K + s(A\setminus A') &= S + s(A') \\ \iff\quad&& 2K + s(A\setminus A') + s(A') &= S + s(A') + s(A') \\ \iff\quad&& 2K + S &= S + 2s(A') \\ \iff\quad&& K &= s(A') \\ \end{align}$$

Conversely, if $A$ admits a subset having $s(A') = K$, then it is easy to see that $B' = \{2K\}\cup (A\setminus A')$ is a valid partition for $B$.


Is this proof correct?

Max
  • 125
  • 4

1 Answers1

1

Yes, but perhaps more cumbersome than necessary, and less readable than it could be. Here's an alternative approach:

Let $S = \{e_1, ..., e_n\} , W \in \mathbb{N}$ be the instance for subset sum and let $$U = S \cup \left\{ \sum S , 2W \right\}$$ be the instance for partition.

Since, as you noted, $\sum S + 2W > \sum S$, we can assume that if $A$ and $B$ partitions $U$ in equal sums, $\sum S \in A$ and $2W \notin A$.

Now, $$ \sum A = \sum B = \sum U /2 = \frac{\sum S + \sum S + 2W}{2} = \sum S + W.$$

But since $\sum S \in A$, it follows that $\sum A - \sum S = W$, which is precisely the set we are looking for in subset sum.

You also need to prove that a yes instance for subset sum translates to a yes instance for partition, but that is straightforward.

Ainsley H.
  • 17,823
  • 3
  • 43
  • 68