13

This is the question I've run into: Show that given a set of positive n integers, there exists a non-empty subset whose sum is divisible by n

I'm having trouble understanding how they came to the conclusion

enter image description here

the part that I'm having trouble understanding is how subtracting the two subsets results in a sum that's divisible by n given that the two subsets have the same remainder

2 Answers2

11

Via modular arithmetic this is very easy, and something you can check (if you're familiar with this). Otherwise, one can show the following result via the division algorithm (i.e. just straight division with quotient and remainder):

If $a$ and $b$ have the same remainder when divided by $n$, then $a-b$ is divisible by $n$.

The proof is as follows. Let $r$ be the common remainder of $a$ and $b$ when divided by $n$. The division algorithm gives integers $q,p$ such that $a=qn+r$ and $b=pn+r$. Thus, we get $$a-b=(qn+r)-(pn+r)=(qn-pn)+(r-r)=(q-p)n$$ so $n$ divides $a-b$.

Note that the above result is more general, and can be applied to your situation by having $a=S_j$ and $b=S_i$. It doesn't really matter that the $S_i$ and $S_j$ are sums of integers when applying the statement I just proved; as far as we care they are just some integers $a$ and $b$.

Dave
  • 13,568
  • But this is $a-b$ not $a+b$ – kelalaka Jan 03 '19 at 16:41
  • @kelalaka yes, and this is what we want for this question. We want $a-b$. – Dave Jan 03 '19 at 17:43
  • I'm confused. The OP requested sum is divisible but all the answers are $a-b$. I'm trying to prove $a+b$. – kelalaka Jan 03 '19 at 17:47
  • 1
    @kelalaka I think you should read the proof in the question more carefully. Each of the $S_i$'s are sums of the elements in the set, so $S_j-S_i$ is also a sum of elements in the set when $i\neq j$. Then in my answer I denote $a=S_j$ and $b=S_i$, so $a-b$ is a sum of elements in the given set. – Dave Jan 03 '19 at 17:52
  • @Dave can you elaborate on how $S_j-S_i$ is also a sum of elements in the set? For example if the set contains 2, 3, 4, $S_j = 6$ and $S_i = 5$ then $S_j-S_i = 1$ but that wouldn't necessarily be a sum of elements in the same set right? Maybe I misunderstood or missed something, so please correct me if I'm wrong. – Jack Oct 30 '19 at 23:02
  • @jackz314 if you look at the pic in OP's question it should be clear: the $S_j$'s are specifically the sum of the elements $a_1+\cdots+a_j$, so when we have $j>i$ we get $S_j-S_i=a_{i+1}+\cdots+a_j$, a sum of elements of the set. – Dave Oct 30 '19 at 23:26
  • 3
    @Dave oh I can't believe I missed that part, thank you. – Jack Oct 30 '19 at 23:50
4

Let $p<q$, if $S_p = \sum_{i=1}^p s_i \equiv r \pmod{n}$

and $S_q = \sum_{i=1}^q s_i \equiv r \pmod{n}$

then we have $S_q-S_p=\sum_{i=p+1}^q s_i \equiv r-r \equiv 0 \pmod{n}$

where we have use the property that if $a \equiv b \pmod{n}$ and $c \equiv d \pmod{n}$, then we have $a-c \equiv b-d \pmod{n}$

If you are not familiar with modulo arithmetic, view it as if $a = nk+r$ and $c = nt+r$, then $a-c = n(k-t)$.

Siong Thye Goh
  • 149,520
  • 20
  • 88
  • 149
  • thanks for taking time to write this answer too! you can probably tell my math skills aren't that great so the bottom one made more sense to me for now with a bit more explanation without the modular arithmetic route :| – testinggnitset ser May 06 '18 at 03:37