TITLE: Number theory and set theory problem
QUESTION [5 upvotes]: Let $A$ be a finite set. For $0\leq i\leq 2$, let $a_i$ be the number of subsets $B$ of $A$ such that 
  $$|B|\equiv i \pmod{3}.$$
  Prove that $$|a_i - a_j| \leq 1,$$ for all $0\leq i,j\leq 2$.

Firstly I assumed that $|A|=n$. Then $a_0 = {^nC_0} + {^nC_3} + {^nC_6} +\cdots$  and $a_1 = {^nC_1}+ {^nC_4}+{^nC_7}+\cdots$  and $a_2$ in a similar manner but I am unable to show the main part.
Could anyone give a hint!!

REPLY [5 votes]: Here's a simple induction proof. The claim clearly holds if $|A|=0$, so suppose $|A|>0$. Pick an element $a\in A$ and let $A':=A-\{a\}$. Let $a_i$ and $a_i'$ be the number of subsets of $A$ and $A'$, respectively, of cardinality congruent to $i$ mod $3$. As every subset of $A$ is either a subset of $A'$ or the union of a subset of $A'$ with $\{a\}$ (exclusive or), we find that
$$a_0=a_0'+a_2'\qquad a_1=a_1'+a_0'\qquad a_2=a_2'+a_1'.$$
so
$$a_0-a_1=a_2'-a_1'\qquad a_1-a_2=a_0'-a_2'\qquad a_2-a_0=a_1'-a_0',$$
and by induction we are done.