# If two sets have the same sum and xor are they necessarily the same?

Let $A = \{A_1, A_2, A_3, \cdots, A_n\}$ and $B = \{B_1, B_2, B_3,\cdots, B_n\}$. where $A_i\in \mathbb{Z}$ and $B_i\in \mathbb{Z}$.

Say,

$$S_{1} = A_1 + A_2 + A_3 + \cdots + A_n = \sum_{i=1}^{n}{A_{i}} \\ S_{2} = B_1 + B_2 + B_3 + \cdots + B_n = \sum_{i=1}^{n}{B_{i}}$$

And,

$$X_1 = A_1 \oplus A_2 \oplus A_3 \oplus \cdots \oplus A_n = \bigoplus_{i=1}^{n}{A_{i}} \\ X_2 = B_1 \oplus B_2 \oplus B_3 \oplus \cdots \oplus B_n = \bigoplus_{i=1}^{n}{B_{i}}$$

If $S_{1} = S_{2}$ and $X_{1}=X_{2}$, does this imply that $A$ and $B$ contain the same set of integers?

-
Are you using $I$ to stand for the integers? and A1, etc., to stand for $A_1$, etc.? – Gerry Myerson Jul 15 '12 at 12:40
@GerryMyerson yes – Eight Jul 15 '12 at 12:46

No. Counterexample: \begin{align*} A &= \{ 1, 6, 8, 48 \} \\ B &= \{ 3, 4, 24, 32 \} \end{align*} More generally, any sets of integers of the form $$A = \{ 2^{a_k}, 2^{b_k} + 2^{c_k} \}_{k = 1,2,\ldots} \qquad\qquad B = \{ 2^{a_k} + 2^{b_k}, 2^{c_k} \}_{k = 1,2,\ldots}$$ where the sequences $a_k, b_k, c_k$ never repeat and also don't have any elements in common, will be a counterexample. This can be generalised to any sequence of non-overlapping binary vectors, in which there are more vectors with Hamming weight 2 or greater than Hamming weight 1, interpreted as integers in binary notation.
No. For example, $\{ 0, 3 \}$ and $\{1 , 2\}$ both have sum and xor $3$.