1 Introduction
There are several possible q-analogues of the Catalan numbers
$(k+1)^{-1}\binom{2k}{k}$
. Here, we consider MacMahon’s q-Catalan polynomials which are defined by

where
$[\begin {smallmatrix}{n}\\ {k}\end {smallmatrix}]_q$
denotes the q-binomial coefficient recalled in Section 2. The first few q-Catalan polynomials are

Notice that
$\mathcal {C}_k(q)$
is a polynomial in q and it reduces to the ordinary Catalan number as
$q\to 1$
. Moreover,
$\mathcal {C}_k(q)$
has a natural enumerative meaning. Indeed, MacMahon [Reference MacMahon4, Volume 2, page 214] established that

where w ranges over all ballot sequences
$a_1a_2\dots a_{2k}$
(that is, any permutation of the multiset
$\{0^k, 1^k\}$
such that in any subword
$a_1a_2\dots a_{i}$
, there are at least as many
$0$
s as there are
$1$
s) and

is the major index of w (see also the survey [Reference Fürlinger and Hofbauer1, Section 3] and [Reference Stanley7, Problem A43]).
In the present work, however, we focus on a problem of number-theoretic interest. The second author in [Reference Tauraso8, Theorem 6.1] proved that, modulo
$\Phi _n(q)$
,

where

denotes the cyclotomic polynomial of order n. Afterwards, a stronger version was proved by Liu in [Reference Liu2, Theorem 1]: modulo
$\Phi _n(q)^2$
,

where the case
$n\equiv 0\pmod {3}$
is not covered. Our main aim is to fill this gap as stated next.
Theorem 1.1. If n is a positive integer divisible by
$3$
, then

As we will explain in more detail below, this theorem holds as soon as we prove the following more manageable identity, which is of interest in its own right.
Theorem 1.2. If n is a positive integer divisible by
$3$
and q is a primitive nth root of unity, then

Notice that, according to [Reference Liu2, Lemma 3], our Theorem 1.2 mirrors

The remainder of the paper is organised as follows. In Section 2, we present a reduction of our main result Theorem 1.1 to Theorem 1.2. Section 3 contains preliminary results which we need towards the proof of Theorem 1.2. Sections 4 and 5 split up Theorem 1.2 according to the parity of n and contain the corresponding proofs. Finally, in Section 6, we consider a conversion of one particular identity coming from (1.1) into a trigonometric format and a remarkable implication in the language of character sums.
2 Reducing Theorem 1.1 to Theorem 1.2
We recall that the Gaussian q-binomial coefficients are defined by

where the q-shifted factorial is given by
$(a;q)_n=(1-a)(1-aq)\dots (1-aq^{n-1})$
for
$n\ge 1$
and
$(a;q)_0=1$
.
By [Reference Liu and Petrov3, Theorem 1.2],

where
$\genfrac {(}{)}{}{}{\,\cdot \,}{\cdot }$
denotes the Legendre symbol. In the same vein, we also recall the identity [Reference Tauraso9, Theorem 4.2],

Let
$1\leq k\leq n-1$
. Then, the q-analogue [Reference Sagan6, Theorem 2.2]

of Lucas’ classical binomial congruence combined with
$(1-q^n)\equiv 0 \pmod {\Phi _n(q)}$
, and the fact that

immediately imply that

Therefore, modulo
$\Phi _n(q)^2$
,

By substituting this congruence together with (2.1) into the definition of
$\mathcal {C}_k(q)$
, we easily see that, when n is divisible by
$3$
, Theorem 1.1 is indeed equivalent to Theorem 1.2.
3 Preparing our proof of Theorem 1.2
Henceforth, we replace n with
$3n$
so that our target in (1.1) amounts to proving

To establish this identity, we need the next two results.
Lemma 3.1. For any complex number z,

Proof. Employing partial fractions and after further rearrangement, we obtain

Continuing with additional algebraic manipulation leads to

Combining the last two calculations, we find (3.2).
Lemma 3.2. If
$\alpha $
is a primitive mth root of unity, then

Proof. We introduce the function
$f(z):=z^m-1=\prod _{k=1}^m(z-\alpha ^k)$
. Then, taking the logarithmic derivative, we obtain

which means

We set
$q=\exp ({2\pi ij}/{3n})$
with
$\gcd (j,3n)=1$
. Applying (3.3) with
$\alpha =q^3$
, and
$z=q$
and
$m=n$
,

By substituting (3.4) in the right-hand side of (3.2) with
$z=q$
, we can put the target (3.1) in a form that is more convenient for our method of proof:

Next, we proceed to study (3.5) by distinguishing two cases:
$n=2N$
and
$n=2N-1$
. This allows us to circumvent fractional powers of q.
(a) If
$n=2N$
, then
$q^{3N}=(-1)^{\,j}=-1$
because j is odd. With some algebraic simplifications, (3.5) yields

(b) If
$n=2N-1$
, then we determine that (3.5) is equivalent to

In the next two sections, we furnish the proofs for these two cases.
4 Proof of the case
$n=2N$
The condition
$\gcd (j,6N)=1$
forces
$j=\pm 1 \pmod {6}$
. We set
$\omega :=q^{N}$
so that we have
$1-\omega +\omega ^2=0$
and
$\omega ^3=-1$
. Therefore, it suffices to show the following result.
Lemma 4.1. We have

Proof. We find it convenient to express our claim in terms of the quantities

(i) By partial fraction decomposition,

Hence, taking
$x=q^k$
results in

(ii) Again by partial fraction decomposition,

Thus, the choice
$x=q^{2k-1}$
gives

where

It is easy to check that
$B_2={N}/2$
and
$B_1+B_3=N$
directly from

Consequently,

Moreover, we recognise that

(iii) Introducing the values

and using a partial fraction decomposition of
$1/{(1-x^3)}$
,

Taking advantage of (3.4) yields

The last two evaluations lead to

Finally, by using items (i), (ii) and (iii), we reduce (4.1) to

which holds because of the symmetry
$A_{\ell }+A_{7-\ell }=N-1$
for
$\ell =1, 2$
and
$3$
.
5 Proof of the case
$n=2N-1$
Let
$\omega :=-q^{2(2N-1)}=e^{{\pi i}/3}$
so that
$\omega ^2=q^{2N-1}$
,
$1-\omega +\omega ^2=0$
and
$\omega ^3=-1$
.
Lemma 5.1. We have

Proof. We adopt the notation
$A_i$
from the previous section.
(i) By the partial fraction decomposition (4.2),

(ii) By the partial fraction decomposition (4.3),

(iii) We have

and invoking (3.4) yields

The last two results imply that

Now, by items (i), (ii) and (iii), we are able to restate (5.1) in terms of
$A_i$
. So, the problem reduces to exhibiting a proof for the relation

Since

we have

Therefore, we arrive at the following equivalent form of (5.2):

Since
$1+(\omega q^k)^3=1-q^{3k}$
and
$1+(\omega ^2q^k)^3=1+q^{3k}$
, further algebraic manipulation converts (5.3) into

However, we note that

Letting
$z=q^k$
and
$\omega =-\omega ^{-2}=- q^{-(2N-1)}$
, our summand can be written as

Hence, the claim now becomes

which in turn translates to

Indeed, equality follows here since both sides of the last equation are equal to
$\sum _{k=1}^{2N-2}{1}/{(1-q^{-k})}$
. In fact, this is reminiscent of the set-theoretic identity

The proof is complete.
6 Conclusion
For the trigonometric functions enthusiast, the particular equation in (5.4) can be converted to one that involves only these circular functions. To this end, we use the identities

and we rewrite
$\pi /6=\pi /2-(2N-1)x$
followed by replacing
$\tan $
with
$\cot $
via
$\tan (\pi /2-t)=\cot (t)$
. Here,
$x=\pi /(6N-3)$
and the outcome is

Hence, (5.4) reduces to verifying the trigonometric identity

For the more number-theoretic minded reader, we present below a consequence of the identity in (5.4). We appreciate Terence Tao for allowing us to include his derivation in this paper. For the remainder of this section, specialise to the case where
$2N-1$
is coprime to
$3$
.
Introduce the cube root of unity
$\epsilon : = \omega ^2= e^{2\pi i/3} = q^{2N-1}$
, where
$q=e^{{2\pi i}/{(6N-3)}}$
. Expand the numerator in (5.4):

From the easily verified ‘discrete sawtooth Fourier series’ identity, for any k not divisible by
$2N-1$
,

(proven by multiplying out the denominator, cancelling terms and applying the geometric series formula), we can write the preceding identity to be proven as

Since
$\gcd (2N-1,3)=1$
, we can write
$q = \epsilon ^{2N-1} \zeta $
for some primitive
$(2N-1)$
th root
$\zeta $
of unity. We then reduce to

From Galois theory, we can see that the net coefficient of
$\zeta ^a$
would have to be independent of a for each primitive residue class a mod
$2N-1$
. We summarise this discussion in the next declaration.
Corollary 6.1. Let
$N>1$
be a natural number such that
$2N-1$
is not divisible by
$3$
, let
$\chi : \mathbb {Z} \to \mathbb {C}$
be a nonprincipal Dirichlet character of period
$2N-1$
and let
$\epsilon := e^{2\pi i/3}$
. Then, we have the character sum identity

We conclude with a problem proposed by Terence Tao.