11

Let $S={1, 2, 3, 4, ....., 2070}$ find the number of subsets of $S$ whose sum of elements in $S$ is divisible by 9

In the expression $$f(x)=(1+x)(1+x^2)......(1+x^{2070})$$

Terms of the form $x^{9k}$ will be the subsets divisible by 9. I am not able to proceed from here.

2 Answers2

11

In general, if $f$ is a polynomial, and $\zeta=e^{i2\pi/n}$ is a primitive $n^{th}$ root of unity, then $\frac1n\sum_{k=0}^{n-1}f(\zeta^k)$ is equal to the sum of the coefficients of powers of $x^{n}$. In our case, let $\zeta=e^{i2\pi/9}$. The periodic nature of the powers of $\zeta$ implies $$ f(\zeta^k)=\Big((1+\zeta)(1+\zeta^2)\cdots(1+\zeta^9)\Big)^{230}\tag 1 $$ To proceed, we use this lemma.

Lemma: If $\omega$ is a primitive $n^{th}$ root of unity, and $n$ is odd, then $$(1+\omega)(1+\omega^2)\cdots(1+\omega^n)=2.$$

Proof: It is well known that the distinct roots of the polynomial $x^n-1$ are exactly $\omega^k$, for $k=0,1,\dots,n-1$. Therefore, $x^n-1$ factors as $$ x^n-1=(x-1)(x-\omega)(x-\omega^2)\cdots(x-\omega^{n-1}) $$ Conclude by setting $x=-1$. $\square$


Back to the problem at hand, $\zeta,\zeta^2,\zeta^4,\zeta^5,\zeta^7,\zeta^8$ are all primitive $9^{th}$ roots of unity, so applying the Lemma to $(1)$ implies $$ f(\zeta^k)=2^{230},\qquad k\in \{1,2,4,5,7,8\} $$ However, for $k=3,6$, $\zeta^k$ is a primitive third root of unity, and we instead have $$ f(\zeta^3)=f(\zeta^6)=\Big((1+\zeta^3)(1+\zeta^6)(1+\zeta^9)\Big)^{690}=2^{690} $$ Finally, we obviously have $f(\zeta^0)=f(1)=2^{2070}$. Putting this all together, we get $$ \text{sum of coefficients of $x^{9k}$}=\frac19\sum_{k=0}^{9-1}f(\zeta^k)=\frac19\Big(2^{2070}+2\cdot 2^{690}+6\cdot 2^{230}\Big) $$

Mike Earnest
  • 75,930
5

Let $g(n,j)$ be the number of subsets of $\{1,\ldots,n\}$ whose sum $\equiv j \bmod 9$. Then $g(n+1,j) = g(n,j) + g(n,j-(n+1))$.

I find that $$ \pmatrix{g(9k+9,0)\cr g(9k+9, 1)\cr g(9k+9,2)\cr g(9k+9,3)\cr g(9k+9,4)\cr g(9k+9,5)\cr g(9k+9,6)\cr g(9k+9,7)\cr g(9k+9,8)\cr} = \pmatrix{ \begin {array}{ccccccccc} 60&56&56&58&56&56&58&56&56 \\ 56&60&56&56&58&56&56&58&56\\ 56 &56&60&56&56&58&56&56&58\\ 58&56&56&60&56&56&58&56& 56\\56&58&56&56&60&56&56&58&56\\ 56&56&58&56&56&60&56&56&58\\ 58&56&56&58&56&56&60&56 &56\\56&58&56&56&58&56&56&60&56 \\ 56&56&58&56&56&58&56&56&60\end {array} } \pmatrix{g(9k,0)\cr g(9k, 1)\cr g(9k,2)\cr g(9k,3)\cr g(9k,4)\cr g(9k,5)\cr g(9k,6)\cr g(9k,7)\cr g(9k,8)\cr}$$ The matrix turns out to diagonalize quite nicely, and I get $$g(9k, 0) = \frac{512^k + 2 \cdot 8^k + 6 \cdot 2^k}{9}$$ Thus as $2070 = 9 \cdot 230$, the answer is $$ \frac{512^{230} + 2 \cdot 8^{230} + 6 \cdot 2^{230}}{9}$$

Robert Israel
  • 448,999
  • I got the same answer, more or less by inspection, but I was stumped for a proof. How does that matrix diagonalise? (For the record: $g(9k,3)=g(9k,6)=(512^k+2\cdot 8^k-3\cdot 2^k)/9; g(9k,r)=(512^k-8^k)/9$ otherwise.) – TonyK Apr 30 '19 at 19:05
  • 1
    The eigenvalues are $512$, $8$ (with multiplicity $2$) and $2$ (with multiplicity $6$). An eigenvector for $512$ is $(1,1,1,1,1,1,1,1,1)^\top$. Two eigenvectors for $8$ are $(-1,0,1,-1,0,1,-1,0,1)^\top$ and $(1,-1,0,1,-1,0,1,-1,0)^\top$. – Robert Israel Apr 30 '19 at 19:52
  • 1
    You answer is equal to the number of subsets of ${1,2,\dots, 2070}$ up to $\mathbb Z/9\mathbb Z$ symmetry, where $[k]\in \mathbb Z/9\mathbb Z$ acts on the subsets by shifting each element by $230k\pmod{2070}$. I wonder if there is a correspondence between these $\mathbb Z/9\mathbb Z$ orbits and the problem in question. – Mike Earnest Apr 30 '19 at 20:02
  • @MikeEarnest Yes, you can see it by looking at https://en.wikipedia.org/wiki/P%C3%B3lya_enumeration_theorem – Lelouch Oct 02 '22 at 20:10