TOPICS
Search

Subset Sum


A subset sum of a finite set A of numbers is the sum of the elements of a subset of A. The set of all attainable subset sums is

 Sigma(A)={sum_(a in B)a:B subset= A},
(1)

where the empty subset contributes 0.

For A={1,2,3}, the eight subsets give the sums

sum_(a in emptyset)a=0
(2)
1=1
(3)
2=2
(4)
3=3
(5)
1+2=3
(6)
1+3=4
(7)
2+3=5
(8)
1+2+3=6,
(9)

so the sum appearing most often is 3, which occurs twice, and Sigma(A)={0,1,2,3,4,5,6} has seven elements. More generally, for A={1,...,n}, every integer from 0 through n(n+1)/2 is attainable, so

 |Sigma(A)|=1+(n(n+1))/2.
(10)

For n=1, 2, ..., the numbers of distinct subset sums are 2, 4, 7, 11, 16, 22, 29, 37, 46, 56, ... (OEIS A000124).

When A consists of nonnegative integers, the coefficient of x^s in product_(a in A)(1+x^a) counts the subsets with sum s. Thus, Sigma(A) is the set of exponents with nonzero coefficients. The definition also applies to subsets of finite abelian groups, where bounds on |Sigma(A)| are studied in additive combinatorics (Griffiths 2009).

The term "subset sum" is also used as a short name for the subset sum problem, which asks questions about attainable sums.


See also

Subset Sum Problem

Explore with Wolfram|Alpha

References

Griffiths, S. "Asymptotically Tight Bounds on Subset Sums." Acta Arith. 138, 53-72, 2009. https://doi.org/10.4064/aa138-1-3.Sloane, N. J. A. Sequence A000124 in "The On-Line Encyclopedia of Integer Sequences."

Cite this as:

Weisstein, Eric W. "Subset Sum." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/SubsetSum.html

Subject classifications