4

A question from Herbert Wilf's generatingfunctionology book (part (d) of the question):

Question

Just for illustration: $$0010 \,\, 0100 \,\, 0001 \,\, 1000$$ Would be an example where we have 4 codewords (each of length $n=4$), where if we take any two distinct codewords above we have only one position where the bit differs. Easily this means $A(4,1) \geq 4$.

The color of a codeword is defined as $\sum _{j=1} ^{n} j\epsilon_j \mod{2n}$. For example, the 6-length codeword $101101$ would have the color: $$1*1 + 2*0 + 3*1 + 4*1 + 5*0 + 6*1 \equiv 14 \equiv 2 \mod 12$$


Working out:

For question $(c)$ I have found that $$f(z) = \sum_{j\geq 0} a_j z^j = \prod_{k=1} ^{n} (1+z^k) \tag{0}$$.

I have that (assuming $r \in \{ 0, 1, ..., 2n-1 \}$): $$\beta_r = \sum_{k\geq 0} a_{r+2nk} \tag{1}$$

And I define: $$g_r(x) = \frac{1}{x^r}\left(f(x) - \sum_{k=0} ^{r-1} a_k x_k \right) = \sum_{j\geq 0} a_{r+j} \, x^j$$

Using the fact that ('roots of unity' method; $m \in \mathbb{N}$): $$\frac{1}{m}\sum _{k=0} ^{m-1} f(e^{(2 \pi i k)/m} x) = \sum_{k\geq 0} a_{mk} (x^{m})^{k}$$

Applying it to $g_r(x)$ this time, and if we let $\omega_k = e^{(2 \pi i k)/(2n)}$ we have: $$\frac{1}{2n}\sum _{k=0} ^{2n-1} g_r(\omega_k x) = \sum_{k\geq 0} a_{r+2nk} (x^{2n})^{k} \tag{2}$$

So if we let $x=1$ from $(2)$ we have: $$\begin{align*} \beta_r &= \sum_{k\geq 0} a_{r+2nk} \\ &= \frac{1}{2n}\sum _{k=0} ^{2n-1} g_r(\omega_k) \\ &=\frac{1}{2n}\sum _{k=0} ^{2n-1} \frac{1}{(\omega_k)^r}\left(\prod_{p=1} ^{n} (1+(\omega_k)^p) - \sum_{p=0} ^{r-1} a_p (\omega_p)^k \right) \\ &=\frac{1}{2n}\sum _{k=0} ^{2n-1} \frac{1}{\omega_{kr}}\left(\prod_{p=1} ^{n} (1+\omega_{kp}) - \sum_{p=0} ^{r-1} a_p \,\omega_{pk} \right) \tag{3} \end{align*}$$

I am unsure how to proceed from here, or if this approach is even the way to go about it (considering it says to use the 'roots of unity' method). Firstly, I am unsure how to deal with $f(z) = \sum_j a_j z^j = \prod_{k=1} ^{n} (1+z^k)$, especially what to do with the product of $(1+z^k)$ in equation $(3)$.

Thus, I'd like to ask (more preferably hints) help on how to approach this question, or if the working out above is even correct.

Thank you in advance.

EDIT 2 (more working out):

With help from WolframAlpha, I find that (regardless of the values of $a_p$): $$\sum _{k=0} ^{2n-1} \omega_{-kr} \sum_{p=0} ^{r-1} a_p \,\omega_{pk} = \sum_{p=0} ^{r-1} a_p \sum _{k=0} ^{2n-1} \exp{\left(\frac{2\pi i k(p-r)}{2n}\right)} = \sum_{p=0} ^{r-1} a_p \frac{1-\exp{(2 \pi i (p-r))}}{1 - \exp{\left(-\frac{2\pi i (r-p)}{2n}\right)}} = 0$$

Since $1 \leq r-p \leq r$ and $1 \leq r \leq 2n - 1$, the denominator is never 0 but numerator equals zero since $p-r \in \mathbb{Z}$.

This makes the sum easier (but still have to deal with the product sum): $$\begin{align*} \beta_r &= \frac{1}{2n}\sum _{k=0} ^{2n-1} \frac{1}{\omega_{kr}}\left(\prod_{p=1} ^{n} (1+\omega_{kp}) \right) \\ &= \frac{1}{2n}\sum _{k=0} ^{2n-1} \exp{\left( -\frac{2\pi i kr}{2n} \right)} \prod_{p=1} ^{n} \left(1 + \exp{\left( \frac{2\pi i kp}{2n} \right)} \right) \end{align*}$$

But note at the $n$'th product (when $p=n$): $$1 + \exp{\left( \frac{2\pi i kn}{2n} \right)} = 1 + (-1)^k$$

So if $k$ is odd, the product equals $0$. So we can just sum the ones with even $k$, and since $2n - 1$ is odd then we sum when $k=0, 2, ..., 2(n-1)$. Thus:

$$\begin{align*} \beta_r &= \frac{1}{2n}\sum _{k=0} ^{n-1} \exp{\left( -\frac{2\pi i (2k)r}{2n} \right)} \prod_{p=1} ^{n} \left(1 + \exp{\left( \frac{2\pi i (2k)p}{2n} \right)} \right) \\ &= \frac{1}{2n}\sum _{k=0} ^{n-1} \exp{\left( -\frac{2\pi i kr}{n} \right)} \prod_{p=1} ^{n} \left(1 + \exp{\left( \frac{2\pi i kp}{n} \right)} \right) \tag{4} \end{align*}$$


EDIT 3: (more working out)

Right now I'm working through simplifying the product $\prod_{p=1} ^{n} \left(1 + \exp{\left( \frac{2\pi i kp}{n} \right)}\right)$ to reach to the desired answer.

  • If $n$ is even, note that the $n$'th roots of unity $\{e^{2\pi i t/n}\}_{t=1}^{n} = \{e^{2\pi i t/n}\}_{t=1}^{n/2} \cup \{e^{-2\pi i t/n}\}_{t=1}^{n/2}$ since roots of $1-x^n$ come in conjugate pairs.
  • If $n$ is odd, then similarly $\{e^{2\pi i t/n}\}_{t=1}^{n} = \{1\} \cup \{e^{2\pi i t/n}\}_{t=1}^{n-1} = \{1\} \cup \{e^{2\pi i t/n}\}_{t=1}^{(n-1)/2} \cup \{e^{-2\pi i t/n}\}_{t=1}^{(n-1)/2}$.

For the time being, I will work on the case when $n$ is odd since the answer desires $n = 2^\alpha n''$ and if $n$ is odd then $n = n''$ with $\alpha = 0$ (makes this case the easier one compared to when $n$ is even).

Thus, assume $n$ is odd with $n\geq 1$ and $k=0,1,...,n-1$:

$$\begin{align*} \prod_{p=1} ^{n} \left(1 + \exp{\left( \frac{2\pi i kp}{n} \right)}\right) &= 2 \prod_{p=1} ^{n-1} \left(1 + \exp{\left( \frac{2\pi i kp}{n} \right)}\right) \\ &= 2 \prod_{p=1} ^{\frac{n-1}{2}} \left(1 + \exp{\left( \frac{2\pi i kp}{n} \right)}\right) \left(1 + \exp{\left( -\frac{2\pi i kp}{n} \right)}\right) \\ &= 2 \prod_{p=1} ^{\frac{n-1}{2}} \left(2 + \exp{\left( \frac{2\pi i kp}{n}\right)} + \exp{ \left( - \frac{2\pi i kp}{n}\right)} \right) \\ &= 2^{\frac{n+1}{2}}\prod_{p=1} ^{\frac{n-1}{2}} \left(1 + \cos{\left( \frac{2\pi kp}{n}\right)} \right) \\ &= 2^{\frac{n+1}{2}}\prod_{p=1} ^{\frac{n-1}{2}} \left(2 \cos^2{\left( \frac{\pi kp}{n}\right)} \right) \tag{A1} \\ &= 2^{n} \left( \prod_{p=1} ^{\frac{n-1}{2}} \cos{\left( \frac{\pi kp}{n}\right)} \right)^2 \end{align*}$$

Where in $(A1)$ I used the trig identity $\cos^2(x) = \frac{1+\cos(2x)}{2}$. Now, according to the answer, I am hoping there will be a $gcd(k,n)$ in it somewhere.

1 Answers1

4

The simple part would be to note that

$$\alpha_j = [z^j] \prod_{p=1}^n (1+z^p).$$

We then get by roots-of-unity that

$$\beta_r = \left. \frac{1}{2n} \sum_{q=0}^{2n-1} z^{2n-r} \prod_{p=1}^n (1+z^p) \right|_{z=\exp(q\pi i/n)} \\ = \frac{2^{n-1}}{n} + \frac{1}{2n} \sum_{q=1}^{2n-1} e^{(2n-r)q\pi i/n} \prod_{p=1}^n (1+e^{pq\pi i/n}).$$

Next filter the cases where the product is zero which happens if $pq\pi i/n$ is an odd multiple of $\pi i$ for some $p.$ Clearly when $\gcd(q,n) = d$ we can pair this with $p=n/d$ to get a multiple of $n$, namely $q/d \times n,$ so that we are after those $q$ where $q/\gcd(q,n)$ is odd. This means that the exponent $v_2(q)$ of two in the prime factorization of $q$ is at most $v_2(n).$ The complement is multiples of $2^{v_2(n)+1}$ so that we find using the summation variable from the text

$$\frac{2^{n-1}}{n} + \frac{1}{2n} \sum_{j=1}^{\lfloor (2n-1)/2^{v_2(n)+1} \rfloor} e^{(2n-r)j2^{v_2(n)+1}\pi i/n} \prod_{p=1}^n (1+e^{pj2^{v_2(n)+1}\pi i/n}).$$

Now observe that

$$\lfloor (2n-1)/2^{v_2(n)+1} \rfloor = \lfloor n/2^{v_2(n)} - 1/2^{v_2(n)+1} \rfloor = n''-1$$

so we have

$$\frac{2^{n-1}}{n} + \frac{1}{2n} \sum_{j=1}^{n''-1} e^{(2n-r)j2^{a+1}\pi i/n} \prod_{p=1}^n (1+e^{pj2^{a+1}\pi i/n}) \\ = \frac{2^{n-1}}{n} + \frac{1}{2n} \sum_{j=1}^{n''-1} e^{(2n-r)2j\pi i/n''} \prod_{p=1}^n (1+e^{p2j\pi i/n''}) \\ = \frac{1}{2n} \sum_{j=1}^{n''} e^{(2n-r)2j\pi i/n''} \prod_{p=1}^n (1+e^{p2j\pi i/n''}).$$

We also have $(e^{2j\pi i/n''})^{2n}=1$ for all values of $j$ so this becomes (we split the range of $p$ into $2^a$ consecutive blocks of length $n''$)

$$\frac{1}{2n} \sum_{j=1}^{n''} e^{-rj 2\pi i/n''} \prod_{p=1}^{n''} (1+e^{p j 2\pi i/n''})^{2^a}.$$

The first $p$ for $\exp(j 2\pi i/n'')^p$ to hit one is $n''/\gcd(j, n'')$ (the factors present in $j$ are given by $\gcd(j, n'')$) hence we have

$$\prod_{p=1}^{n''} (1+e^{pj 2\pi i/n''}) = \prod_{p=1}^{n''/\gcd(j, n'')} (1+e^{pj 2\pi i/n''})^{\gcd(j,n'')}$$

It thus remains to evaluate

$$\prod_{p=1}^{n''/\gcd(j, n'')} (1+e^{pj 2\pi i/n''}).$$

Here we are just dealing with a permutation of the roots of unity $\zeta$ of order $n''/\gcd(j, n'')$, call it $m.$ Note however that

$$\prod_{p=1}^m (1+\zeta^p) = (-1)^m [x^0] \prod_{p=1}^m (x-1-\zeta^p) = (-1)^m [x^0] ((x-1)^m - 1).$$

In the present case we have by construction that $m$ is odd, so we find

$$- [x^0] ((-1)^m - 1) = 2.$$

Unrolling the last three substitutions now yields

$$\bbox[5px,border:2px solid #00A000]{\Large \frac{1}{2n} \sum_{j=1}^{n''} e^{-2\pi i rj/n''} 2^{2^a \gcd(j, n'')}.}$$

The reverse direction of the initial classification also holds. We showed that given $q$ where $v_2(q)\le v_2(n)$ there exists $p$ such that $pq$ is an odd multiple of $n$, namely $p=n/d$. On the other hand if there exists $p$ given $q$ such that $pq$ is an odd multiple of $n$ then clearly $v_2(q) \le v_2(n).$

Marko Riedel
  • 64,728
  • Thanks for the help again! I would like to ask a thing that I'm having trouble understanding.

    About the bit where $\left. \prod_{p=1}^{n''/\gcd(j, n'')} (1+z^p) \right|_{z=\exp(j 2\pi i/n'')}$, I am unsure how this is actually a permutation of the roots of unity of $n''/\gcd(j, n'')$. Is there an explanation or reason for this?

    – user246678 Jan 09 '18 at 05:18
  • 1
    'On dividing by $\gcd(j,n'')$ we have that the numerator and the denominator of $(j/\gcd(j,n'')/(n''/\gcd(j,n''))$ are coprime and hence we have a primitive root of order $n''/\gcd(j,n'').$ The fact that the powers of this root then generate all the others is a standard result that you may quote e.g. from Wikipedia, resting on the fact that the group of the $n$th roots of unity is cyclic. – Marko Riedel Jan 09 '18 at 06:09
  • The framing of this result is deserved. I read somewhere that this manipulation is 'standard' in number theory, can you please maybe clarify what is the 'standard' intuition here? I am interested in learning how to spot what to do first when facing equalities like $\prod_{j=1}^n (1+e^{2\pi i \frac{kj}{n''}})= 2^{gcd(j,n'')2^a}$ – NotaChoice Feb 23 '25 at 03:39
  • Also please, is there a particular reason why do you keep 'trailing' the evaluation of $z=..$ and not simply put the value inside the formula? I don't get it – NotaChoice Feb 23 '25 at 03:40
  • Thank you for commenting. I changed some of the formatting. – Marko Riedel Feb 24 '25 at 03:11
  • Thank you for the answer! .. The $j$ in my comment should be a $k$ but I can't edit it. – NotaChoice Feb 26 '25 at 01:48