Sumset (source code)

= Sumset
{title2=$A+B$}
{wiki}

For <finite sets> $A,B\subseteq G$ in an <abelian group> $G$, their <sumset> is
$$
A+B=\{a+b:a\in A,\ b\in B\}\subseteq G.
$$
Each distinct value occurs only once in this <set>, even if many <ordered pairs> produce it. When $B=A$, repetitions are allowed: $a+a$ belongs to $A+A$. For the two <integer> <sets> introduced above,
$$
\begin{aligned}
A+A&=\{0,1,2,3,4,5,6\},& |A+A|&=7,\\
B+B&=\{0,1,2,4,5,8,10,11,14,20\},& |B+B|&=10.
\end{aligned}
$$
For $A$, the value $3$ comes from $(0,3),(1,2),(2,1),(3,0)$. For $B$, two <ordered pairs> give the same sum only when one reverses the other, apart from a pair being identical to itself. Thus its four pairs $(b,b)$ and six pairs with distinct members, counted without regard to order, produce ten distinct sums.

Every nonempty <finite set> of <integers> $S\subseteq\mathbb Z$ satisfies $|S+S|\geq2|S|-1$. To see this, list its members as $s_1<\cdots<s_n$. The $2n-1$ distinct sums
$$
s_1+s_1<s_1+s_2<\cdots<s_1+s_n<s_2+s_n<\cdots<s_n+s_n
$$
all belong to $S+S$. A nonconstant <arithmetic progression> attains this bound. The ordered list is essential: in the <cyclic group> $\mathbb Z/6\mathbb Z$, the <subgroup> $H=\{0,2,4\}$ instead satisfies $H+H=H$, of <cardinality> three. Addition wraps around, for example $4+4=2$ in this <group>.