text:
\begin{document}

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}

\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}

\theoremstyle{definition}
\newtheorem*{definition}{Definition}
\newtheorem*{remark}{Remark}
\newtheorem*{example}{Example}

\def\cA{\mathcal A}
\def\cB{\mathcal B}
\def\cC{\mathcal C}
\def\cD{\mathcal D}
\def\cE{\mathcal E}
\def\cF{\mathcal F}
\def\cG{\mathcal G}
\def\cH{\mathcal H}
\def\cI{\mathcal I}
\def\cJ{\mathcal J}
\def\cK{\mathcal K}
\def\cL{\mathcal L}
\def\cM{\mathcal M}
\def\cN{\mathcal N}
\def\cO{\mathcal O}
\def\cP{\mathcal P}
\def\cQ{\mathcal Q}
\def\cR{\mathcal R}
\def\cS{\mathcal S}
\def\cU{\mathcal U}
\def\cT{\mathcal T}
\def\cV{\mathcal V}
\def\cW{\mathcal W}
\def\cX{\mathcal X}

\def\Z{{\mathbb Z}}
\def\R{{\mathbb R}}
\def\F{{\mathbb F}}
\def\N{{\mathbb N}}
\def\C{{\mathbb C}}
\def\Q{{\mathbb Q}}
\def\P{{\mathbb P}}

\def\fc{\mathcal F}

\def\Fp{\F_p}
\def\e{\mathbf{e}}
\def\ep{\mathbf{e}_p}
\def\eps{{\varepsilon}}
\def\mand{\qquad \mbox{and} \qquad}
\def\scr{\scriptstyle}
\def\\{\cr}
\def\({\left(}
\def\){\right)}
\def\[{\left[}
\def\]{\right]}
\def\<{\langle}
\def\>{\rangle}
\def\fl#1{\left\lfloor#1\right\rfloor}
\def\rf#1{\left\lceil#1\right\rceil}
\def\le{\leqslant}
\def\ge{\geqslant}
\def\sL{\mathscr L}
\def\sM{\mathcal M}
\def\sT{\mathcal T}
\def\ds{\displaystyle}
\renewcommand{\mod}{\textrm{mod}\,}

\def\xxx{\vskip5pt\hrule\vskip5pt}

\newcommand{\comm}[1]{\marginpar{
\vskip-\baselineskip
\raggedright\footnotesize
\itshape\hrule\smallskip#1\par\smallskip\hrule}}

\title{\sc On primitive Dirichlet characters and the Riemann hypothesis}

\author{
{\sc William D.~Banks} \\
{Department of Mathematics} \\
{University of Missouri} \\
{Columbia, MO 65211 USA} \\
{\tt bbanks@math.missouri.edu} \\
\and
{\sc Ahmet M.~G\"ulo\u glu} \\
{Department of Mathematics} \\
{University of Missouri} \\
{Columbia, MO 65211 USA} \\
{\tt ahmet@math.missouri.edu} \\
\and
{\sc C.~Wesley Nevans} \\
{Department of Mathematics} \\
{University of Missouri} \\
{Columbia, MO 65211 USA} \\
{\tt nevans@math.missouri.edu}}

\date{}

\maketitle

\begin{abstract}
For any natural number $n$, let $\cX'_n$ be the set of primitive
Dirichlet characters modulo~$n$. We show that if the Riemann
hypothesis is true, then the inequality $|\cX'_{2n_k}|\le
C_2\,e^{-\gamma}\,\varphi(2n_k)/\log\log(2n_k)$ holds for all
$k\ge 1$, where $n_k$ is the product of the first $k$ primes,
$\gamma$ is the Euler-Mascheroni constant, $C_2$ is the twin prime
constant, and $\varphi(n)$ is the Euler function.  On the other
hand, if the Riemann hypothesis is false, then there are
infinitely many $k$ for which the same inequality holds and
infinitely many $k$ for which it fails to hold.
\end{abstract}

\section{Introduction}
\label{sec:intro}

For any natural number $n$, let $\cX_n$ be the set of Dirichlet
characters modulo~$n$, and let $\cX'_n$ be the subset of
\textit{primitive} characters in $\cX_n$.

The purpose of the present note is to establish a connection
between the \textit{classical} Riemann hypothesis and the
collection of sets $\{\cX'_n:n\in\N\}$.  Our work is motivated by
and relies on the 1983 paper of J.-L.~Nicolas~\cite{Nic} in which
a relation is established between the Riemann hypothesis and
certain values of the Euler function $\varphi(n)$; see
also~\cite{Robin}.

\begin{theorem}
\label{thm:main} For every $k\ge 1$, let $n_k$ be the product of
the first $k$ primes. Let $\gamma$ be the Euler-Mascheroni
constant and $C_2$ the twin prime constant.

\begin{itemize}

\item[$(i)$] If the Riemann hypothesis is true, then the
inequality
\begin{equation}
\label{eq:RHtrue} |\cX'_{2n_k}|\le
C_2\,e^{-\gamma}\,\frac{\varphi(2n_k)}{\log\log(2n_k)}
\end{equation}
holds for all $k\ge 1$.

\item[$(ii)$] If the Riemann hypothesis is false, then there are
infinitely many $k$ for which \eqref{eq:RHtrue} holds and
infinitely many $k$ for which it fails to hold.
\end{itemize}
\end{theorem}

We recall that
$$
\gamma=\lim_{n\to\infty}\(\,\sum_{m=1}^n\frac{1}{m}-\log
n\)=0.5772156649\cdots,
$$
and
$$
C_2=\prod_{p > 2} \frac{p(p-2)}{(p-1)^2}=0.6601618158 \cdots.
$$

To prove the theorem, we study the ratios
$$
\rho(n)=\frac{|\cX'_n|}{|\cX_n|}\qquad(n\in\N).
$$
Note that $\rho(n)$ is the \emph{proportion} of Dirichlet
characters modulo~$n$ that are primitive characters.  Since
$\rho(n)\le 1$ for all $n\in\N$, and $\rho(p)=1-1/(p-1)$ for every
prime $p$, it is clear that
$$
\limsup_{n\to\infty}\rho(n)=1.
$$
As for the minimal order, we shall prove the following:
\begin{equation}
\label{eq:liminf-n} \liminf_{\substack{n\to\infty\\n\not\equiv
2\;(\mod 4)}} \rho(n)\log\log n=C_2\,e^{-\gamma}.
\end{equation}
Note that natural numbers $n\equiv 2\pmod 4$ are excluded since
$\rho(n)=0$ for those numbers; see~\eqref{eq:rho-defn} below.

In Section~\ref{sec:two} we show that the inequalities
\begin{equation}
\label{eq:rho-ineq} \rho(2n_k)\log\log(2n_k)\le\rho(n)\log\log
n\qquad(n\not\equiv 2\;(\mod 4),~\omega(n)=k)
\end{equation}
hold for every fixed $k>1$, where $\omega(n)$ is the number of
distinct prime divisors of $n$, and we also show that
\begin{equation}
\label{eq:lim-2nk}
\lim_{k\to\infty}\rho(2n_k)\log\log(2n_k)=C_2\,e^{-\gamma}.
\end{equation}
Clearly, \eqref{eq:liminf-n} is an immediate consequence
of~\eqref{eq:rho-ineq} and~\eqref{eq:lim-2nk}.

Since $|\cX_n|=\varphi(n)$ for all $n\in\N$, the
inequality~\eqref{eq:RHtrue} is clearly equivalent to
\begin{equation}
\label{eq:RHtrueB} \rho(2n_k)\log\log(2n_k)\le C_2\,e^{-\gamma}.
\end{equation}
In Section~\ref{sec:three} we study this inequality using
techniques and results from~\cite{Nic}, and these investigations
lead to the statement of Theorem~\ref{thm:main}.

\bigskip

\noindent{\bf Acknowledgement.} The authors wish to thank Pieter
Moree for his careful reading of the manuscript and for several
useful comments.

\section{Small values of $\rho(n)$}
\label{sec:two}

The cardinality of $\cX_n$ is $\varphi(n)$, and that of $\cX'_n$
is
$$
|\cX'_n|=n\prod_{p\,\|\,n}\(1-\frac{2}{p}\)\prod_{p^2\,\mid\,n}
\(1-\frac{1}{p}\)^2
$$
(see, for example, \cite[\S\,9.1]{MontVau}); hence, it follows
that
\begin{equation}
\label{eq:rho-defn} \rho(n)=\frac{\varphi(n)}{n}\prod_{p\,\|\,n}
\frac{p(p-2)}{(p-1)^2}\qquad(n\in\N).
\end{equation}

Turning to the proof of~\eqref{eq:rho-ineq}, let $k>1$ be fixed,
and denote by $\cS$ the set of integers $n\not\equiv 2\pmod 4$
with $\omega(n)=k$. Let $p_1,p_2,\ldots$ be the sequence of
consecutive prime numbers. For each integer $j\in\{0,\ldots,k\}$,
let $\cS_j$ be the set of numbers $n\in\cS$ that have precisely
$j$ distinct prime divisors larger than~$p_k$. Since $\cS$ is the
union of the sets $\{\cS_j\}$, to prove~\eqref{eq:rho-ineq} it
suffices to show that the inequalities
\begin{equation}
\label{eq:Sjbound} \rho(2n_k)\log\log(2n_k)\le\rho(n)\log\log n
\qquad(n\in\cS_j)
\end{equation}
hold for every fixed $j\in\{0,\ldots,k\}$.

For any $n\in\cS_0$ we can write $n=2p_1^{\alpha_1}\cdots
p_k^{\alpha_k}$ with each $\alpha_j\ge 1$.
Using~\eqref{eq:rho-defn} and the fact that $2n_k=2p_1\cdots p_k$
we have
$$
\rho(2n_k)=\rho(n) \prod_{\substack{j=2\\ (\alpha_j\ge 2)}}^k
\frac{p_j(p_j-2)}{(p_j-1)^2}\le\rho(n).
$$
Since $2n_k\le n$ we also have $\log\log(2n_k)\le\log\log n$,
and~\eqref{eq:Sjbound} follows for $j=0$.

Proceeding by induction, let us suppose that~\eqref{eq:Sjbound}
has been established for some $j\in\{0,\ldots,k-1\}$. If $n'$ is
an arbitrary element of $\cS_{j+1}$, then $q\mid n'$ for some
prime $q>p_k$; note that $q\ge 5$ since $k>1$. Writing
$n'=q^\alpha m$ with $q\nmid m$, we have $\omega(m)=k-1$, hence
for at least one index $i\in\{1,\ldots,k\}$ the prime $p_i$ does
not divide $m$. Put $n=p_i^\beta m$, where $\beta=2$ if $p_i=2$
and $\beta=1$ otherwise.  Clearly, $n\in\cS_j$. Also, $n\le n'$
since $q>\max\{p_i,2^2\}$, and thus $\log\log n\le\log\log n'$. Finally,
using~\eqref{eq:rho-defn} we see that
$$
\frac{\rho(n')}{\rho(m)}=\left\{
\begin{array}{ll}
    1-1/(q-1) & \quad\hbox{if $\alpha=1$,} \\
    1-1/q & \quad\hbox{if $\alpha\ge 2$,} \\
\end{array}
\right.
$$
and
$$
\frac{\rho(n)}{\rho(m)}=\left\{
\begin{array}{ll}
    1-1/(p_i-1) & \quad\hbox{if $\beta=1$,} \\
    1/2 & \quad\hbox{if $\beta=2$.} \\
\end{array}
\right.
$$
As $q>p_i$, we have $\rho(n)\le\rho(n')$ in all cases. Putting
everything together, we see that
$$
\rho(2n_k)\log\log(2n_k)\le\rho(n)\log\log n
 \le\rho(n')\log\log n'.
$$
Since $n'\in\cS_{j+1}$ is arbitrary, we obtain~\eqref{eq:Sjbound}
with $j$ replaced by $j+1$, which completes the induction and
finishes our proof of~\eqref{eq:rho-ineq}.

Next, we turn to the proof of~\eqref{eq:lim-2nk}. Using the Prime
Number Theorem in the form
$$
\log n_k=\sum_{p\le p_k}\log p=(1+o(1))p_k\qquad(k\to\infty)
$$
together with Mertens' theorem
(see~\cite[Theorem~2.7(e)]{MontVau}), it is easy to see that
\begin{equation}
\label{eq:lim1} \lim_{k\to\infty}\left\{\log\log(2n_k)\prod_{p\le
p_k}\(1-\frac{1}{p}\)\right\}=e^{-\gamma}.
\end{equation}
Also,
\begin{equation}
\label{eq:lim2} \lim_{k\to\infty}\prod_{2<p\le
p_k}\frac{p(p-2)}{(p-1)^2}=\lim_{k\to\infty}
C_2\prod_{p>p_k}\(1+\frac{1}{p(p-2)}\)=C_2.
\end{equation}
By~\eqref{eq:rho-defn} we have
$$
\rho(2n_k)=\prod_{p\le p_k}\(1-\frac{1}{p}\)\prod_{2<p\le p_k}
\frac{p(p-2)}{(p-1)^2}\qquad(k\ge 1),
$$
and thus~\eqref{eq:lim-2nk} is an immediate consequence
of~\eqref{eq:lim1} and~\eqref{eq:lim2}.

\section{Proof of Theorem~\ref{thm:main}}
\label{sec:three}

As in~\cite[Th\'eor\`eme~3]{Nic} we put
$$
f(x)=e^\gamma\log\vartheta(x)\prod_{p\le
x}\(1-\frac{1}{p}\)\qquad(x\ge 2),
$$
where $\vartheta(x)=\sum_{p\le x}\log p$ is the Chebyshev
$\vartheta$-function. For our purposes, it is convenient to define
$$
g(x)=e^\gamma\log\(\vartheta(x)+\log 2\)\prod_{p\le x}
\(1-\frac{1}{p}\)\prod_{p>x}\(1+\frac{1}{p(p-2)}\)\qquad(x\ge 2),
$$
This definition is motivated by the fact that
$$
g(p_k)=C_2^{-1}e^\gamma\rho(2n_k)\log\log(2n_k)\qquad(k\ge 1).
$$
As mentioned earlier, the inequalities~\eqref{eq:RHtrue}
and~\eqref{eq:RHtrueB} are equivalent, and~\eqref{eq:RHtrueB} is
clearly equivalent to
$$
\log g(p_k)\le 0.
$$
Thus, to prove Theorem~\ref{thm:main} it suffices to study the
sign of $\log g(x)$.

By the trivial inequality $\log(1+t)\le t$ for all $t>-1$ and the
fact that $g(x)>f(x)$ for all $x\ge 2$, it is easy to see that
\begin{equation}
\label{eq:log g/f} 0< \log\frac{g(x)}{f(x)}\le\frac{\log
2}{\vartheta(x)\log\vartheta(x)}+\frac{1}{x-2}\qquad(x>2).
\end{equation}
Here, we have used the fact that
$$
\sum_{p>x}\frac{1}{p(p-2)}\le\sum_{n\ge\fl{x}+1}\frac{1}{n(n-2)}
=\frac{2\fl{x}-1}{2\fl{x}(\fl{x}-1)}<\frac{1}{x-2}\qquad(x>2).
$$

First, let us suppose that the Riemann hypothesis is true. In this
case, we have from~\cite[p.~383]{Nic}:
$$
\log f(x)\le -\frac{0.8}{\sqrt{x}\,\log x}\qquad(x\ge 3000).
$$
Using this bound in~\eqref{eq:log g/f} together with the
inequality $\vartheta(x)\ge 4x/5$ (which holds unconditionally for
$x\ge 121$ by~\cite[Theorems~4 and~18]{RosSch}), one sees that
$$
\log g(x)\le\frac{\log 2}{(4x/5)\log(4x/5)}+\frac{1}{x-2}-
\frac{0.8}{\sqrt{x}\,\log x}\le -\frac{0.6}{\sqrt{x}\,\log x}
$$
for all $x\ge 3000$.  This implies the desired
bound~\eqref{eq:RHtrueB} for all $k\ge 431$; for smaller values of
$k$, the bound~\eqref{eq:RHtrueB} may be verified by a direct
computation. This proves Theorem~\ref{thm:main} under the Riemann
hypothesis.

Next, suppose that the Riemann hypothesis is false, and let
$\theta$ denote the supremum of the real parts of the zeros of the
Riemann zeta function.  Then, by~\cite[Th\'eor\`eme~3c]{Nic} one
has
$$
\limsup_{x\to\infty} x^b\log f(x)>0 \qquad \text{and} \qquad
\liminf_{x\to\infty} x^b\log f(x)<0
$$
for any fixed number $b$ such that $1-\theta<b<1/2$. In view
of~\eqref{eq:log g/f} and the Chebyshev bound $\vartheta(x)\gg x$
it is clear that
$$
\log g(x)=\log f(x)+O(x^{-1});
$$
hence, we also have
$$
\limsup_{x\to\infty} x^b\log g(x)>0 \qquad \text{and} \qquad
\liminf_{x\to\infty} x^b\log g(x)<0.
$$
In particular, $\log g(p_k)$ changes sign infinitely often, which
implies Theorem~\ref{thm:main} if the Riemann hypothesis is
false.


text:
\begin{document}

\title[Average Complete Joint Weight Enumerators]{Average of Complete Joint Weight Enumerators and Self-dual Codes}

\author[Chakraborty]{Himadri Shekhar Chakraborty*}
\thanks{*Corresponding author}
\address
	{
		(1) Graduate School of Natural Science and Technology\\
		Kanazawa University\\
		Ishikawa 920-1192, Japan\\
		(2) Department of Mathematics, Shahjalal University of Science and Technology\\ Sylhet-3114, Bangladesh,
	}
\email{himadri-mat@sust.edu}

\author[Miezaki]{Tsuyoshi Miezaki}
\address
	{
		Faculty of Education, University of the Ryukyus\\ Okinawa
		903-0213, Japan\\
	}
\email{miezaki@edu.u-ryukyu.ac.jp}

\date{\today}

\begin{abstract}
	In this paper,
	we give a representation of the average of complete joint weight enumerators
	of two linear codes of length~$n$ over $\FF_q$ and $\ZZ_k$
	in terms of the compositions of $n$ and their distributions in the codes.
	We also obtain a generalization of the representation for the average of $g$-fold complete joint weight enumerators of codes over $\FF_q$ and $\ZZ_{k}$. Finally, the average of intersection numbers of a pair of Type~$\III$ (resp. Type~$\IV$) codes, and its second moment are found.
\end{abstract}

\subjclass[2010]{Primary: 11T71; Secondary: 94B05, 11F11}
\keywords{Codes, weight enumerators, equivalence.}

\maketitle

\section{Introduction}\label{SecIntroduction}

The notion of the joint weight enumerator of two $\FF_q$-linear codes was introduced in~\cite{MMC1972}. Further, the notion of the $g$-fold complete joint weight enumerator of~$g$ linear codes over $\FF_q$ was given in~\cite{SC2000}.
In recent few years,
there has been interest in studying linear codes over the finite rings $\ZZ_{k}$ of
integers modulo $k$ ($k \geq 2$).
The concept of the~$g$-fold joint weight enumerator and the~$g$-fold multi-weight enumerator of codes over $\ZZ_{k}$ was
investigated in~\cite{DHO}.
Furthermore, the average of joint weight enumerators of two binary codes was investigated in~\cite{Y1989} using the ordinary weight distributions of the codes,
and also their average intersection number was obtained.

Inspired by the relation pointed out in~\cite{MO2019}
between the complete cycle index and the complete weight enumerator,
an analogue of the relation between
the average complete joint cycle index and
the average complete joint weight enumerator of codes
was given in~\cite{CMOxxxx}.
Consecutively,
the concept of the average complete joint Jacobi polynomial of codes over $\FF_q$ and $\ZZ_{k}$ was defined in~\cite{CMxxx}, and an analogue of the main theorem in~\cite{Y1989} was given.
In this paper,
we define the average complete joint weight enumerator of two linear codes
over~$\FF_q$ or $\ZZ_k$, and give a generalization of the main theorem in~\cite{Y1989}
for it.
Moreover,
we extend the idea of the average complete joint weight enumerator
to the average of~$g$-fold complete joint weight enumerators
of linear codes over $\FF_q$ or $\ZZ_{k}$.
We take the average on all permutationally (not monomially)
equivalent linear codes over~$\FF_q$ or $\ZZ_k$.
In~\cite{Y1991},
the average of intersection numbers of a pair of
Type~$\I$ or Type~$\II$ codes over~$\FF_2$
and their second moments were given.
As a part of our study,
we give the average of intersection numbers
and its second moment of a pair of
Type~$\III$ codes over~$\FF_3$ as well as Type~$\IV$ codes over~$\FF_4$.

Throughout this paper, we assume that~$R$ denotes either the finite field $\FF_q$ of order $q$, where $q$ is a prime power or the ring $\ZZ_{k}$ of integers modulo $k$ for some integer $k\geq 2$.
Let $u = (u_1,u_2,\dots, u_n)$ and $v = (v_1,v_2,\dots,v_n)$ be the elements of $R^n$.
Then the \emph{inner product}

of~ $u,v \in R^n$ is given by
\[
	u \cdot v
	:=
	u_1v_1 + u_2v_2 + \dots + u_nv_n.
\]
If $u \cdot v = 0$,
we call $u$ and $v$ \emph{orthogonal}.
An element
$u \in R^n$ is called \emph{self-orthogonal} if
$u \cdot u = 0$.
When we consider a vector space over $\FF_4$,
it is convenient to consider another inner product given by
$u \cdot v := u_1\bar{v}_1 + u_2\bar{v}_2 + \dots + u_n\bar{v}_n$,
where $\bar{a}=a^2$ for $a \in \FF_4$.

An $\FF_q$-linear code of length~$n$ is a vector subspace of
$\FF_q^n$,
and a $\ZZ_k$-linear code of length~$n$ is an additive group of $\ZZ_{k}^n$.
Let $C$ be an $R$-linear code of length~$n$.
The elements of~$C$ are called \emph{codewords}.
The \emph{dual code} of~$C$ is defined as
\[
	C^\perp
	:=
	\{
		v\in R^{n}
		\mid
		u \cdot v = 0
		\text{ for all }
		u\in C
	\}.
\]
If $C \subseteq C^\perp$, then $C$ is called \emph{self-orthogonal},
and if $C = C^\perp$, then $C$ is called \emph{self-dual}.
Clearly, if $C$ is self-dual, every codeword $u \in C$ is self-orthogonal.

It is well known that
the length~$n$ of a self-dual code over~$\FF_q$ is even
and the dimension is $n/2$.
A self-dual code~$C$
over~$\FF_2$ or~$\FF_4$
of length $n\equiv 0 \pmod 2$
having even weight
is called \emph{Type~$\I$} or \emph{Type~$\IV$}, respectively.
A self-dual code $C$ over~$\FF_2$
of length $n\equiv 0\pmod 8$
is called \emph{Type~$\II$}
if the weight of each codeword of~$C$
is a multiple of~$4$.
Finally,
a self-dual code $C$ over~$\FF_3$
of length $n\equiv 0\pmod 4$
is called \emph{Type~$\III$}
if the weight of each codeword of~$C$
is a multiple of~$3$.

Let the elements of
$R$ be~$0=\omega_0, \omega_1, \dots, \omega_{|R|-1}$
in some fixed order.
Then the \emph{composition} of an element $u \in R^{n}$ is defined as
\[
	\comp(u)
	:=
	s(u)
	:=
	(s_0(u), s_1(u), \dots, s_{|R|-1}(u)),
\]
where $s_i(u)$ denotes the number of coordinates of $u$ that are equal to $\omega_i$. Obviously
\[
	\sum_{i=0}^{|R|-1} s_i(u) = n.
\]

In general, a \emph{composition} $s$ of $n$ is a vector $s = (s_0,s_1, \dots, s_{|R|-1})$ with non-negative integer components such that
\[
	\sum_{i=0}^{|R|-1} s_i = n.
\]

Let $C$ be an $R$-linear code of length~$n$.
We denote by $T_s^{C}$ the set of codewords of $C$ with composition $s$ and
by~$A_s^{C} := |T_s^{C}|$,
that is, the number of codewords $u \in C$
such that~$\comp(u) = s$. Then the \emph{complete weight enumerator} of $C$ is defined as:
\begin{align*}
	\C_{C}(x_0, \dots, x_{|R|-1})
	& :=
	\sum_{u \in C}
	x_0^{s_0(u)} \dots x_{|R|-1}^{s_{|R|-1}(u)}\\
	& =
	\sum_{s}
	 A_s^C x_0^{s_0} \dots x_{|R|-1}^{s_{|R|-1}},
\end{align*}
where $x_0, \dots, x_{|R|-1}$ are indeterminates and the sum extends over all compositions $s$ of $n$. Let $K := \{0,1,\dots,|R|-1\}$. Then the complete weight enumerator of $C$ can be written as:
\[
	\C_{C}(x_{i} \text{ with } i \in K)
	=
	\sum_{s} A_{s}^C \prod_{i=0}^{|R|-1} x_{i}^{s_i}.
\]

Now let $C$ and $D$ be two $R$-linear codes of length $n$.
We denote by $\eta(u,v)$ the \emph{bi-composition} of the pair
$(u,v)$ for $u,v \in R^{n}$
which is a vector with non-negative integer components
$\eta_{\alpha\beta}(u,v)$
defined as
\[
	\eta_{\alpha\beta}(u,v)
	:=
	\# \{i \mid (u_i,v_i) = (\alpha,\beta)\},
\]
where $(\alpha,\beta) \in R^2$. Clearly
\[
	\sum_{\alpha,\beta \in R}
	\eta_{\alpha\beta}(u,v)
	= n.
\]
In general, a bi-composition $\eta$ of $n$ is a vector with non-negative integer components $\eta_{\alpha\beta}$ such that
\[
	\sum_{\alpha,\beta \in R}
	\eta_{\alpha\beta}
	= n.
\]
The \emph{complete joint weight enumerator} of $C$ and $D$ is defined as
\begin{align*}
	\C\JE_{C,D}(x_{ij} \text{ with } i,j \in K)
	& :=
	\sum_{u \in C, v \in D}
	\prod_{i,j=0}^{|R|-1}
	x_{ij}^{\eta_{\omega_i\omega_j}(u,v)}\\
	& =
	\sum_{\eta}
	A_{\eta}^{C,D}
	\prod_{i,j = 0}^{|R|-1} x_{ij}^{\eta_{\omega_i\omega_j}},
\end{align*}
where $x_{ij}$ for $i,j \in K$ are the indeterminates and $A_{\eta}^{C,D}$ is the number of pair $(u,v)\in C \times D$ such that $\eta(u,v) = \eta$.

We write $\SSn$ for the symmetric group acting on the set $\{1,2,\dots,n\}$, equipped with the composition of permutations. For any $R$-linear code~$C$, the code $C^\sigma:= \{u^{\sigma} \mid u\in C\}$ for some permutation~$\sigma \in \SSn$ is called \emph{permutationally equivalent} to $C$, where $u^{\sigma} := (u_{\sigma(1)},\dots, u_{\sigma(n)})$. Then the \emph{average complete joint weight enumerator} of $R$-linear codes~$C$ and $D$ is defined as
\[
	\C\Jav_{C,D}(x_{ij} \text{ with } i,j \in K)
	:=
	\dfrac{1}{n!}\sum_{\sigma \in \SSn} \C\JE_{C^\sigma,D}(x_{ij}).
\]

This paper is organized as follows.
In Section~\ref{SecMacWilliams},
we give the average version of the MacWilliams identity
for the complete joint weight enumerators.
In Sections~\ref{SecProofMainTheorem},
we give the main result (Theorem~\ref{ThMainTheorem}) of this paper,
and in Section~\ref{Secgfold},
we obtain a generalization of Theorem~\ref{ThMainTheorem}
for the average of $g$-fold complete joint weight enumerators of codes
over~$\FF_q$ and~$\ZZ_k$ (Theorem \ref{thm:gen}).
In Section~\ref{SecAvInterNum},
the average of intersection numbers of a pair of
Type~$\III$ (resp. Type~$\IV$) codes,
and its second moment are given
(Theorem~\ref{thm:III} and Theorem~\ref{thm:IV}).

\section{MacWilliams Identity}\label{SecMacWilliams}

The MacWilliams identity
for $g$-fold complete joint weight enumerators of codes over~$\FF_q$
was established in~\cite{SC2000}.
Further, in~\cite{DHO},
the MacWilliams identity
for $g$-fold joint weight enumerators of codes over~$\ZZ_{k}$ was given.
In this section,
we study the MacWilliams type identity
for the average complete joint enumerators over~$R$.
At the beginning of this section
we recall~\cite{DHO,MMC1972}
to take some fixed character over $R$.

A \emph{character} $\chi$ of $R$ is a homomorphism from the additive group~$R$ to the multiplicative group of non-zero complex numbers.

Let $R = \FF_q$, where $q=p^f$ for some prime number $p$.
Again let $F(x)$ be a primitive irreducible polynomial of degree $f$ over $\FF_p$
and let $\lambda$ be a root of $F(x)$.
Then any element $\alpha \in \FF_q$ has a unique representation as:
\begin{equation}\label{EquAlphaRep}
	\alpha
	=
	\alpha_0
	+
	\alpha_1 \lambda
	+
	\alpha_2 \lambda^2
	+
	\dots
	+
	\alpha_{f-1} \lambda^{f-1},
\end{equation}
where $\alpha_i \in \FF_p$,
and $\chi(\alpha) := \zeta_p^{\alpha_0}$,
where $\zeta_p$ is the primitive $p$-th root~$e^{2{\pi}i/p}$ of unity,
and $\alpha_0$ is given by (\ref{EquAlphaRep}).

Again if $R = \ZZ_k$,
then for $\alpha \in \ZZ_{k}$
we defined $\chi$ as $\chi(\alpha) := \zeta_k^{\alpha}$,
where $\zeta_k$ is the primitive $k$-th root~$e^{2{\pi}i/k}$ of unity.

We have the MacWilliams identity
for the complete weight enumerator
of a code
 $C$ over $R$ as follows.

\begin{thm}[\cite{DHO, MMC1972}]
	For a code $C$ over $R$ we have
	\[
		\C_{C^\perp}(x_i \text{ with } i \in K) = \dfrac{1}{|C|} T_{R} \cdot \C_C(x_i),
	\]
	where $T_{R} = \left(\chi(\alpha\beta)\right)_{\alpha,\beta \in R}$.
\end{thm}

For a code $C$ over $R$
let $\tilde{C}$ be either $C$ or $C^\perp$. Then we define
\[
	\delta(C,\tilde{C})
	:=
	\begin{cases}
		0 & \mbox{if} \quad \tilde{C} = C, \\
		1 & \mbox{if} \quad \tilde{C} = C^\perp.
	\end{cases}
\]
For $\alpha \in R$,
we define
$\gamma(\alpha) := j$ if $\alpha = \omega_j$.
Though it is obvious for the experts,
we give a proof of the following Theorem for general readers.

\begin{thm}[MacWilliams Identity]\label{ThMacWilliams}
	Let $C$ and $D$ be two $R$-linear codes of length $n$.
	Then we have
	\[
		\C\JE_{\tilde{C},\tilde{D}}
		(x_{ij} \text{ with } i,j \in K)
		=
		\dfrac{1}{|C|^{\delta(C,\tilde{C})}|D|^{\delta(D,\tilde{D})}} T_{R}^{\delta(C,\tilde{C})}
		\otimes
		T_{R}^{\delta(D,\tilde{D})}
		\C\JE_{C,D}(x_{ij}).
	\]
\end{thm}

\begin{proof}
	It is sufficient to show
	\[
		|D|\C\JE_{{C},{D}^\perp}(x_{ij})
		=
		(I \otimes T_{R}) \C\JE_{C,D}(x_{ij}),
	\]
	where, $\tilde{C} = C$, $\tilde{D} = D^\perp$,
	and
	$I$ is the identity matrix.
	Let
	\[
	\delta_{D^\perp}(v) :=
		\begin{cases}
			1 & \mbox{if} \quad v \in D^\perp, \\
			0 & \mbox{otherwise}.
		\end{cases}
	\]
	Then we have the following identity
	\[
		\delta_{D^\perp}(v)
		=
		\dfrac{1}{|D|} \sum_{d \in D} \chi(d \cdot v).
	\]
	Now
	\begin{align*}
		|D|\C\JE_{{C},{D}^\perp}(x_{ij})
			& = |D| \sum_{c \in C} \sum_{d^\prime \in {D}^\perp} \prod_{i,j=0}^{|R|-1} x_{ij}^{\eta_{\omega_i\omega_j}(c,d^\prime)} \\
			& = |D| \sum_{c \in C} \sum_{v \in R^n} \delta_{D^\perp}(v) \prod_{i,j=0}^{|R|-1} x_{ij}^{\eta_{\omega_i\omega_j}(c,v)} \\
			& = \sum_{c \in C} \sum_{v \in R^n} \sum_{d \in D} \chi(d \cdot v) \prod_{i,j=0}^{|R|-1} x_{ij}^{\eta_{\omega_i\omega_j}(c,v)} \\
			& = \sum_{c \in C, d \in D} \sum_{v \in R^n} \chi(d \cdot v) \prod_{i,j=0}^{|R|-1} x_{ij}^{\eta_{\omega_i\omega_j}(c,v)} \\
			& =
			\sum_{c \in C, d \in D}
			\sum_{(v_1,\dots,v_n) \in R^n}
			\chi(d_1v_1 + \dots + d_nv_n)
			\prod_{1\leq i \leq n}
			x_{\gamma(c_i) \gamma(v_i)} \\
			& =
			\sum_{c \in C, d \in D}
			\prod_{1\leq i \leq n}
			\sum_{v_i \in R}
			\chi(d_iv_i)
			x_{\gamma(c_i) \gamma(v_i)} \\
			& = \sum_{c \in C, d \in D} \prod_{(\alpha,\beta) \in R^2} \left(\sum_{v \in R} \chi(\beta v) x_{\gamma(\alpha) \gamma(v)}\right)^{\eta_{\alpha\beta}(c,d)} \\
			& = \C\JE_{C,D}\left(\sum_{v \in R} \chi(\beta v) x_{\gamma(\alpha) \gamma(v)} \text{ with } (\alpha,\beta) \in R^2\right) \\
			& = (I \otimes T_{R}) \C\JE_{C,D}(x_{ij}).
	\end{align*}
	Hence, the proof is completed.
\end{proof}

Now from the above Theorem~\ref{ThMacWilliams},
we have the generalized MacWilliams identity
for the average complete joint weight enumerator
of codes $C$ and $D$ as follows:
\[
	\C\Jav_{\tilde{C},\tilde{D}}
	(x_{ij} \text{ with } i,j \in K)
	=
	\dfrac{1}{|C|^{\delta(C,\tilde{C})}|D|^{\delta(D,\tilde{D})}} T_{R}^{\delta(C,\tilde{C})}
	\otimes
	T_{R}^{\delta(D,\tilde{D})}
	\C\Jav_{C,D}(x_{ij}).
\]

\section{Main Result}\label{SecProofMainTheorem}

In this section,
we give the main result of
this paper
which is presented in the following theorem.

\begin{thm}[Main Theorem]\label{ThMainTheorem}
	Let $C$ and $D$ be two $R$-linear codes of length $n$,
	and
	$r$ and $s$ be the compositions of $n$.
	Again let $\eta$ be the bi-composition of $n$ such that
	\begin{align*}
		r & =
		\left(\sum_{\beta \in R}
		\eta_{\omega_0\beta},\dots,\sum_{\beta\in R}
		\eta_{\omega_{|R|-1}\beta}\right),\\
		s & =
		\left(\sum_{\alpha \in R}
		\eta_{\alpha\omega_0},\dots,\sum_{\alpha\in R}
		\eta_{\alpha\omega_{|R|-1}}\right).
	\end{align*}
	Then we have
	\begin{align*}
		\C\Jav_{C,D}
		(x_{ij} & \text{ with } i,j \in K) \\
		& =
		\sum_{r,s,\eta}
		A_r^C A_s^D
		\dfrac{\prod\limits_{i=0}^{|R|-1}
		\dbinom{s_i}{\eta_{\omega_0\omega_i}, \dots, \eta_{\omega_{|R|-1}\omega_i}}}
		{\dbinom{n}{r_0, \dots, r_{|R|-1}}}
		\prod_{i,j=0}^{|R|-1}
		x_{ij}^{\eta_{\omega_i\omega_j}},
	\end{align*}
	where
	\[
		\dbinom{a}{b_0, b_1, \dots, b_{m}}
		:=
		\dfrac{a!}{b_0! b_1! \dots b_m!}.
	\]
\end{thm}

\begin{proof}
Let $C$ and $D$ be two $R$-linear codes of length~$n$.
Then the complete joint weight enumerator of $C$ and $D$ is
\begin{equation}\label{EquDefCJWE}
	\C\JE_{C,D}(x_{ij} \text{ with } i,j \in K)
	:=
	\sum_{\eta} A_{\eta}^{C,D}
	\prod_{i,j = 0}^{|R|-1}
	x_{ij}^{\eta_{\omega_i\omega_j}},
\end{equation}
where $	\sum_{\alpha,\beta \in R} \eta_{\alpha\beta} = n$.
Now let us define
\[
	B_{r,s,\eta}^{C,D}
	:=
	\#\{(u,v) \in C \times D
	\mid
	\comp(u)=r, \comp(v) = s, \eta(u,v) = \eta\}.
\]
Therefore, $A_\eta^{C,D} = B_{r,s,\eta}^{C,D}$,
where
\begin{align*}
	r & = \left(\sum_{\beta \in R} \eta_{\omega_0\beta},\dots,\sum_{\beta\in R} \eta_{\omega_{|R|-1}\beta}\right),\\
	s & = \left(\sum_{\alpha \in R} \eta_{\alpha\omega_0},\dots,\sum_{\alpha\in R} \eta_{\alpha\omega_{|R|-1}}\right).
\end{align*}
Hence, we can write from~(\ref{EquDefCJWE})
\begin{equation}
	\C\JE_{C,D}(x_{ij} \text{ with } i,j \in K)
	:=
	\sum_{r,s,\eta}
	B_{r,s,\eta}^{C,D}
	\prod_{i,j = 0}^{|R|-1}
	x_{ij}^{\eta_{\omega_i\omega_j}}.
\end{equation}
Now
\begin{align*}
	\sum_{\sigma \in \SSn}
	B_{r,s,\eta}^{C^\sigma,D}
	& =
	\# \{(u,v,\sigma)
	\in
	T_r^C \times T_s^D \times \SSn
	\mid
	\eta(u^\sigma,v)
	= \eta \}\\
	& =
	\sum_{u \in T_r^C}
	\sum_{v \in T_s^D}
	\# \{\sigma \in \SSn \mid \eta(u^\sigma,v) = \eta\}.
\end{align*}
It is well known that the order of a subgroup of $\SSn$ which stabilizes $u \in T_r^C$ is $\prod_{i=0}^{|R|-1}r_{i}!$. Therefore,

\begin{align*}
	\sum_{\sigma \in \SSn} B_{r,s,\eta}^{C^\sigma,D}
	&= \sum_{u \in T_r^C}\sum_{v \in T_s^D} \prod_{i=0}^{|R|-1}r_{i}!
	\# \{u^{\prime} \in R^{n}
	\mid
	\comp(u^{\prime}) = r,\eta(u^{\prime},v) = \eta\}\\
	&= \sum_{u \in T_r^C}\sum_{v \in T_s^D} \prod_{i=0}^{|R|-1}r_{i}! \prod_{i=0}^{|R|-1}\dfrac{s_i!}{\prod_{j=0}^{|R|-1}\eta_{\omega_j\omega_i}!} \\
	&= A_r^C A_s^D \prod_{i=0}^{|R|-1}r_{i}! \prod_{i=0}^{|R|-1}\dfrac{s_i!}{\prod_{j=0}^{|R|-1}\eta_{\omega_j\omega_i}!}\\
	&= A_r^C A_s^D n!\dfrac{\prod_{i=0}^{|R|-1}\dfrac{s_i!}{\prod_{j=0}^{|R|-1}\eta_{\omega_j\omega_i}!}}{\dfrac{n!}{\prod_{i=0}^{|R|-1}r_{i}!}}\\
	&=
	A_r^C A_s^D n!
	\dfrac{\prod_{i=0}^{|R|-1}
		\dbinom{s_i}{\eta_{\omega_0\omega_i},
		\dots,
		\eta_{\omega_{|R|-1}\omega_i}}}
	{\dbinom{n}{r_0, r_1, \dots, r_{|R|-1}}}.
\end{align*}
Now we have
\begin{align*}
	\C\Jav_{C,D}&(x_{ij} \text{ with } i,j \in K)\\
	&= \dfrac{1}{n!} \sum_{\sigma\in \SSn} \C\JE_{C^\sigma,D}(x_{ij})\\
	&= \dfrac{1}{n!} \sum_{r,s,\eta} \sum_{\sigma\in \SSn} B_{r,s,\eta}^{C^\sigma,D} \prod_{i,j = 0}^{|R|-1} x_{ij}^{\eta_{\omega_i\omega_j}} \displaybreak\\
	&= \sum_{r,s,\eta} A_r^C A_s^D \dfrac{\prod_{i=0}^{|R|-1}\dbinom{s_i}{\eta_{\omega_0\omega_i}, \dots, \eta_{\omega_{|R|-1}\omega_i}}}{\dbinom{n}{r_0, r_1, \dots, r_{|R|-1}}} \prod_{i,j = 0}^{|R|-1} x_{ij}^{\eta_{\omega_i\omega_j}}.
\end{align*}
This completes the proof.
\end{proof}

\section{Average of $g$-fold Complete Joint Weight Enumerators}\label{Secgfold}

In this section, we give a generalization of the Main Theorem for the average $g$-fold complete joint weight enumerators of codes over $R$.

Let $C_1,C_2, \dots, C_g$ be $R$-linear codes of length $n$.
We denote by $\eta^g(c_1,\dots,c_g)$ the \emph{$g$-fold composition} of $g$-tuple
$$(c_1, \dots , c_g) \in C_1 \times \dots \times C_g,$$
which is a vector with non-negative integer components $\eta_a^g(c_1,\dots,c_g)$ for $a \in R^g$ and defined as:
\[
	\eta_a^g(c_1,\dots,c_g)
	:=
	\#\{i \mid (c_{1i}, \dots, c_{gi}) = a\}.
\]
We denote by a $g$-fold composition $\eta^{g}$ of $n$ a vector with non-negative integer components $\eta_a^g$ for $a \in R^g$ such that
\[
	\sum_{a \in R^g} \eta_a^g = n.
\]

We also denote by $T_{\eta^{g}}^{C_1,\dots,C_g}$ the set of codewords of $C_1 \times \dots \times C_g$ with $g$-fold composition $\eta^{g}$. The \emph{$g$-fold complete joint weight enumerator} is defined as follows:
\begin{align*}
	\C\JE_{C_1,\dots,C_g}
	(x_{\gamma(a)} \text{ with } a \in R^g)
		& :=
		\sum_{c_1 \in C_1, \dots, c_g \in C_g}
		\prod_{a \in R^g}
		x_{\gamma(a)}^{\eta_a^g(c_1,\dots, c_g)} \\
		& =
		\sum_{\eta^g} A_{\eta^g}^{C_1,\dots,C_g}
		\prod_{a \in R^g}
		x_{\gamma(a)}^{\eta_a^g},
\end{align*}
where $x_{\gamma(a)}$ for $a \in R^g$ with $\gamma(a) := (\gamma(a_1), \dots, \gamma(a_g))$ are the indeterminates and $A_{\eta^g}^{C_1,\dots,C_g}$ is the number of $g$-tuples $(c_1,\dots, c_g) \in C_1 \times \dots \times C_g$ such that $\eta^g(c_1,\dots,c_g) = \eta^g$. The \emph{average $g$-fold complete joint weight enumerators} are defined as:
\[
	\C\Jav_{C_1,C_2,\dots,C_g}
	(x_{\gamma(a)} \text{ with } a \in R^g)
	:=
	\dfrac{1}{n!}
	\sum_{\sigma \in \SSn}
	\C\JE_{C_1^\sigma,C_2,\dots,C_g}(x_{\gamma(a)}).
\]

Let $a = (a_1,\dots, a_g) \in R^g$ and $b = (b_1,\dots, b_{g-1}) \in R^{g-1}$. Then we denote
\begin{align*}
	[a;j] & := (a_1,\dots,a_{j-1},a_{j+1},\dots,a_g) \in R^{g-1},\\
	(z;b) & := (z,b_1,\dots,b_{g-1}) \in R^g \text{ for } z \in R.
\end{align*}

Now we have the following generalization of Theorem~\ref{ThMainTheorem}.

\begin{thm}\label{thm:gen}
	Let $C_1,C_2, \dots, C_g$ be the $R$-linear codes of length $n$ and $s_1,s_2, \dots, s_g$ be the composition of $n$. Again let $\eta^g$ be the $g$-fold composition of $n$ such that
	\[
		s_j = \left(\sum_{a \in R^g}\eta_{a}^g \text{ with } a_j=\omega_{i} \text{ for } i \in K\right) \quad \text{ where } j = 1, 2, \dots, g,
	\]
	and $\eta^{g-1}$ be the $(g-1)$-fold composition of $n$ such that the non-negative integer components $\eta_b^{g-1}$ for $b \in R^{g-1}$ is equal to the sum of $\eta_{a}^g$ over all $a \in R^g$ with $[a;1]=b$, that is,
	\[
		\eta_b^{g-1}
		=
		\sum_{a \in R^g} \eta_{a|_{[a;1]=b}}^g.
	\]
	Then we have
	\begin{align*}
		& \C\Jav_{C_1,\dots,C_g} (x_{\gamma(a)} \text{ with } a \in R^g) \\
		& = \sum_{s_1,\eta^{g-1},\eta^g} A_{s_1}^{C_1} A_{\eta^{g-1}}^{C_2,\dots,C_g} \dfrac{\prod\limits_{b \in R^{g-1}}\dbinom{\eta_b^{g-1}}{\eta_{(\omega_0;b)}^g, \dots, \eta_{(\omega_{|R|-1},b)}^g}}{\dbinom{n}{s_{10}, \dots, s_{1|R|-1}}} \prod_{a \in R^g} x_{\gamma(a)}^{\eta_{a}^g},
	\end{align*}
	where
	\[
		\dbinom{r}{r_0, r_1, \dots, r_{m}}
		:=
		\dfrac{r!}{r_0! r_1! \dots r_m!}.
	\]
\end{thm}

\begin{proof}
	Let $C_1,\dots, C_g$ be $R$-linear codes of length $n$. Then by the definition of $g$-fold complete joint weight enumerator of the codes $C_1,\dots,C_g$ we have,
	\begin{equation}\label{EquDefCgfoldJWE}
		\C\JE_{C_1,\dots,C_g}
		(x_{\gamma(a)} \text{ with } a \in R^g)
		:=
		\sum_{\eta^g}
		A_{\eta^g}^{C_1,\dots,C_g}
		\prod_{a \in R^g}
		x_{\gamma(a)}^{\eta_{a}^g},
	\end{equation}
	where
	\[
		\sum_{a \in R^g} \eta_{a}^g = n.
	\]
	Now let us define
	\begin{align*}
		B_{s_1,\eta^{g-1},\eta^g}^{C_1,\dots,C_g}
		:=
		\#
		\{
			(c_1,\dots,c_g) \in
			&
			C_1 \times\dots\times C_g
			\mid
			\comp(c_1)=s_1, \\
			&
			\eta^{g-1}(c_2,\dots,c_g)
			=
			\eta^{g-1},
			\eta^g(c_1,\dots,c_g)
			=
			\eta^g
		\}.
	\end{align*}
	Therefore,
	\[
		A_{\eta^g}^{C_1,\dots,C_g}
		=
		B_{s_1,\eta^{g-1},\eta^g}^{C_1,\dots,C_g}.
	\]
	Hence, we can write from~(\ref{EquDefCgfoldJWE})
	\begin{equation}
		\C\JE_{C_1,\dots,C_g}(x_{\gamma(a)} \text{ with } a \in R^g)
		:=
		\sum_{s_1,\eta^{g-1},\eta^g}
		B_{s_1,\eta^{g-1},\eta^g}^{C_1,\dots,C_g}
		\prod_{a \in R^g}
		x_{\gamma(a)}^{\eta_a^g}.
	\end{equation}
	Now
	\begin{align*}
		& \sum_{\sigma \in \SSn} B_{s_1,\eta^{g-1},\eta^g}^{C_1^\sigma,C_2,\dots,C_g} \\
		= & \# \{(c_1,\dots,c_g,\sigma) \in T_{s_1}^{C_1} \times\dots\times T_{s_g}^{C_g} \times \SSn \mid \eta^g(c_1^\sigma,c_2,\dots,c_g) = \eta^g \} \\
		= & \sum_{c_1 \in T_{s_1}^{C_1}}\sum_{(c_2,\dots,c_g) \in T_{\eta^{g-1}}^{C_2,\dots,C_g}} \# \{\sigma \in \SSn \mid \eta^g(c_1^\sigma,c_2,\dots,c_g) = \eta^g \}.
	\end{align*}
	It is well known that the order of a subgroup of $\SSn$ which stabilizes $c_1 \in T_{s_1}^{C_1}$ is $\prod_{i=0}^{|R|-1}s_{1i}!$. Therefore,

	\begin{align*}
		\mathclap{\sum_{\sigma \in \SSn}
		B_{s_1,\eta^{g-1},\eta^g}^{C_1^\sigma,C_2,\dots,C_g}} & \notag \\
		& =
		\sum_{c_1 \in T_{s_1}^{C_1}}
		\sum_{(c_2,\dots,c_g) \in T_{\eta^{g-1}}^{C_2,\dots,C_g}} \prod_{i=0}^{|R|-1}s_{1i}! \notag \\
		& \quad \quad
		\# \{c_{1}^{\prime}\in R^{n}
		\mid
		\comp(c_{1}^{\prime}) = s_1,
		\eta^g(c_1^\prime,c_2,\dots,c_g) = \eta^g\}\\
		& =
		A_{s_1}^{C_1} A_{\eta^{g-1}}^{C_2,\dots,C_g}
		\prod_{i=0}^{|R|-1}s_{1i}!
		\prod\limits_{b \in R^{g-1}}\dfrac{(\eta_b^{g-1})!}{(\eta_{(\omega_0;b)}^g)! \dots (\eta_{(\omega_{|R|-1};b)}^g)!}.
	\end{align*}
	Now it is easy to complete the proof by following similar arguments stated in the proof of Theorem~\ref{ThMainTheorem}.
\end{proof}

\section{The Average of Intersection Numbers}\label{SecAvInterNum}

The notion of
the average intersection number was introduced in~\cite{Y1989}
for binary linear codes. We take the same notion for $R$-linear codes~$C$ and~$D$ of length~$n$ and define the \emph{average intersection number} as follows:
\[
	\Delta(C,D)
	:=
	\dfrac{1}{n!}
	\sum_{\sigma \in \SSn}
	|C \cap D^\sigma|.
\]

Now we have the following result.

\begin{prop}
	Let $C,D$ be two $R$-linear code of length $n$,
	and $r$ be the composition of $n$.
	Then we have
	\[
		\Delta(C,D)
		=
		\sum_{r}
		\dfrac{A_{r}^{C} A_{r}^{D}}{\dbinom{n}{r_0,\dots,r_{|R|-1}}}.
	\]
\end{prop}

\begin{proof}
	Let $T_{r}^{C}$ and $T_{r}^{D}$
	be the set of all elements of
	$C$ and $D$, respectively, with the composition
	$r = (r_0,\dots,r_{|R|-1})$ of $n$.
	Then we can write
	\begin{align*}
		n! \Delta(C,D)
			& = \sum_{\sigma \in \SSn} |C \cap D^\sigma|\\
			& = \#\{(u,v,\sigma) \in C \times D \times \SSn \mid u = v^\sigma\}\\
			& = \sum_{r} \sum_{u \in T_r^C} \sum_{v \in T_r^D} \#\{\sigma \in \SSn \mid u = v^\sigma\}\\
			& = \sum_{r} A_r^C A_r^D \prod_{i = 0}^{|R|-1} {r_i}!.
	\end{align*}
	Hence, this completes the proof.
\end{proof}

Let $C \subseteq \FF_q^n$ for $q = 2,3,4$ be a code. Now for $m = 1,2$ we define
\[
	\Delta_{J}^{m}(C)
	:=
	\dfrac{1}{|J_n|} \sum_{D \in J_n} {|C \cap D|}^m,
\]
where $J_n$ denotes the set of self-dual codes of Type $J$,
where $J$ stands for
$\I$, $\II$, $\III$ or $\IV$.
The following results for
$J = \I$ and $\II$ are presented in~\cite{Y1991}.

\begin{thm}[\cite{Y1991}]\label{ThDeltaOne}
	Let $C$ be a binary self-dual code of length $n$. Then
	\begin{itemize}
		\item [(i)] $\Delta_{\I}(C) \approx 4$ \quad if $C$ is of Type~$\I$,
		\item [(ii)] $\Delta_{\II}(C)\approx 6$ \quad if $C$ is of Type~$\II$.
	\end{itemize}
\end{thm}

\begin{thm}[\cite{Y1991}]\label{ThDeltaTwo}
	Let $C$ be a binary self-dual code of length $n$. Then
	\begin{itemize}
		\item [(i)] $\Delta_{\I}^{2}(C) \approx 24$ \quad if $C$ is of Type~$\I$,
		\item [(ii)] $\Delta_{\II}^{2}(C)\approx 60$ \quad if $C$ is of Type~$\II$.
	\end{itemize}
\end{thm}

In this section,
we give the analogous results of the above theorems for
Type~$\III$ and Type~$\IV$ codes over $\FF_3$ and $\FF_4$ respectively.
Before presenting our findings,
we adopt the following mass formulas
which give the numbers of Type~$\III$ and Type~$\IV$ codes
over $\FF_3$ and $\FF_4$ respectively.

\begin{thm}[\cite{MOSW1978,VP1968}]
	The following hold:
	\begin{itemize}
		\item [(i)] The number of Type~$\III$ codes over $\FF_3$ of length
		$n \equiv 0 \pmod 4$ is
		\[
			2\prod_{i=1}^{n/2-1} (3^i + 1).
		\]
		\item [(ii)] The number of Type~$\IV$ codes over $\FF_4$ of length
		$n \equiv 0 \pmod 2$ is
		\[
			\prod_{i=0}^{n/2-1} (2^{2i+1}+1).
		\]
	\end{itemize}
\end{thm}

Let
$C^\prime \subseteq \FF_3^n$
be a self-orthogonal code of dimension $k$.
We denote by $N_{n,k}^{\III}$
the number of Type~$\III$ codes over $\FF_3$
of length $n$ containing $C^\prime$.
Then from~\cite{BT2019} we have
\[
	N_{n,k}^{\III} = 2\prod_{i=1}^{n/2-k-1} (3^i + 1).
\]
For $k = 1$,
we get from~\cite{PP1973}
the number of Type~$\III$ codes over $\FF_3$ of length~$n$
containing a self-orthogonal vector of $\FF_3^n$.

Now if
$C^\prime \subseteq \FF_4^n$
is a self-orthogonal code having dimension $k$,
then the number of Type~$\IV$ codes over $\FF_4$ of length $n$
containing $C^\prime$,
denoted by $N_{n,k}^{\IV}$,
is given in~\cite{CPS1979} as follows:
\[
	N_{n,k}^{\IV}
	=
	\prod_{i=0}^{n/2-k-1} (2^{2i+1}+1).
\]
In particular, for $k = 1$ we get the number from~\cite{MOSW1978}.

The following theorem is a Type~$\III$ analogue of
Theorem~\ref{ThDeltaOne} and Theorem~\ref{ThDeltaTwo}.

\begin{thm}\label{thm:III}
	Let $C$ be a Type~$\III$ code over $\FF_3$ of length $n \equiv 0 \pmod 4$.
	Then we have
	\begin{itemize}
		\item [(i)]
		$\Delta_{\III}(C)
		=
		4-\dfrac{4}{3^{n/2-1}+1} \approx 4$,
		\item [(ii)]
		$\Delta_{\III}^{2}(C)
		=
		\dfrac{40 (3^{n/2})^2}{(3^{n/2}+3)(3^{n/2}+9)} \approx 40$.
	\end{itemize}
\end{thm}

\begin{proof}
	(i) Let $C \in \III_n$. Then
	\begin{align*}
		\sum_{D \in \III_n} |C \cap D|
		& =
		\# \{(u,D) \in C \times \III_n \mid u \in D\} \\
		& =
		\sum_{u \in C}
		\#\{D\in \III_n \mid u \in D\} \\
		& =
		\left(
		\sum_{u=0}
		+
		\sum_{u \in C \setminus \{0\}}
		\right)
		\#\{D\in {\III}_n \mid u \in D\} \\
		& =
		|{\III}_n| + (|C|-1) N_{n,1}^{\III}.
	\end{align*}
	Since
	$|{\III}_n| = 2\prod_{i=1}^{n/2-1} (3^i + 1)$,
	therefore we can write
	\begin{align*}
		\Delta_{\III}(C)
		& = 1 + (|C|-1) \dfrac{N_{n,1}^{\III}}{|{\III}_n|} \\
		& = 1 + \dfrac{3^{n/2}-1}{3^{n/2-1}+1} \\
		& = \dfrac{3^{n/2-1}+3^{n/2}}{3^{n/2-1}+1} \\
		& = \dfrac{3^{n/2-1}+3.3^{n/2-1}}{3^{n/2-1}+1} \\
		& = \dfrac{4.3^{n/2-1}}{3^{n/2-1}+1} \\
		& = 4 - \dfrac{4}{3^{n/2-1}+1}.
	\end{align*}
	This completes the proof of (i).

	(ii) Similarly as (i) we can write
	\begin{align*}
		\sum_{D \in \III_n} {|C \cap D|}^2
		& =
		\# \{(u,v,D) \in C \times C \times \III_n \mid u,v \in D\} \\
		& =
		\sum_{u,v \in C}
		\#\{D\in \III_n \mid \langle u,v \rangle \subseteq D\} \\
		& =
		\left(
		\sum_{u,v=0}
		+
		\sum_{\dim\langle u,v \rangle = 1}
		+
		\sum_{\dim\langle u,v \rangle = 2}
		\right)
		\#\{D\in \III_n \mid \langle u,v \rangle \subseteq D\} \\
		& =
		|{\III}_n|
		+
		4(|C|-1) N_{n,1}^{\III}
		+
		(|C|-1)(|C|-3) N_{n,2}^{\III}.
	\end{align*}
	Since
	$|{\III}_n| = 2\prod_{i=1}^{n/2-1} (3^i + 1)$,
	therefore we can write
	\begin{align*}
	\Delta_{\III}^2(C)
		& =
		1
		+
		4(|C|-1)
		\dfrac{N_{n,1}^{\III}}{|{\III}_n|}
		+
		(|C|-1)(|C|-3)
		\dfrac{N_{n,2}^{\III}}{|{\III}_n|} \\
		& =
		1
		+
		\dfrac{4(3^{n/2}-1)}{3^{n/2-1}+1}
		+
		\dfrac{(3^{n/2}-1)(3^{n/2}-3)}{(3^{n/2-2}+1)(3^{n/2-1}+1)} \\
		& =
		1
		+
		\dfrac{12(3^{n/2}-1)}{3^{n/2}+3}
		+
		\dfrac{27(3^{n/2}-1)(3^{n/2}-3)}{(3^{n/2}+9)(3^{n/2}+3)} \\
		& =
		\dfrac{40 (3^{n/2})^2}{(3^{n/2}+3)(3^{n/2}+9)}.
	\end{align*}
	This completes the proof of (ii).
\end{proof}

We close this paper with
the following Type~$\IV$ analogue of
Theorem~\ref{ThDeltaOne} and Theorem~\ref{ThDeltaTwo}.

\begin{thm}\label{thm:IV}
	Let $C$ be a Type~$\IV$ code over $\FF_4$ of length $n \equiv 0 \pmod 2$.
	Then we have
	\begin{itemize}
		\item [(i)]  $\Delta_{\IV}(C) = 3 -\dfrac{3}{2^{2(n/2)-1}+1} \approx 3$,
		\item [(ii)]  $\Delta_{\IV}^{2}(C) = \dfrac{27(2^{2(n/2)})^2}{(2^{2(n/2)}+2)(2^{2(n/2)}+8)} \approx 27$.
	\end{itemize}
\end{thm}

\begin{proof}
	(i) Let $C \in \IV_n$. Then
	\begin{align*}
		\sum_{D \in \IV_n} |C \cap D|
		& =
		\# \{(u,D) \in C \times \IV_n \mid u \in D\} \\
		& =
		\sum_{u \in C}
		\#\{D\in \IV_n \mid u \in D\} \\
		& =
		\left(
		\sum_{u=0}
		+
		\sum_{u \in C\setminus \{0\}}
		\right)
		\#\{D\in \IV_n \mid u \in D\} \\
		& =
		|\IV_n| + (|C|-1) N_{n,1}^{\IV}.
	\end{align*}
	Since
	$|{\IV}_n| = \prod_{i=0}^{n/2-1} (2^{2i+1}+1)$,
	therefore,
	\begin{align*}
		\Delta_{\IV}(C)
		& =
		1
		+
		(|C|-1)
		\dfrac{N_{n,1}^{\IV}}{|\IV_n|} \\
		& =
		1
		+
		\dfrac{2^{2(n/2)}-1}{2^{2(n/2)-1}+1} \\
		& =
		\dfrac{2^{2(n/2)-1}+2^{2(n/2)}}{2^{2(n/2)-1}+1} \\
		& =
		\dfrac{3.2^{2(n/2)-1}}{2^{2(n/2)-1}+1} \\
		& =
		3 - \dfrac{3}{2^{2(n/2)-1}+1}.
	\end{align*}
	This completes the proof of (i).

	(ii) Similarly as (i) we can write
	\begin{align*}
		\sum_{D \in \IV_n} {|C \cap D|}^2
		& =
		\# \{(u,v,D) \in C \times C \times \IV_n \mid u,v \in D\} \\
		& =
		\sum_{u,v \in C}
		\#\{D\in \IV_n \mid \langle u,v \rangle \subseteq D\} \\
		& =
		\left(
		\sum_{u,v=0}
		+
		\sum_{\dim\langle u,v \rangle = 1}
		+
		\sum_{\dim\langle u,v \rangle = 2}
		\right)
		\#\{D\in \IV_n \mid \langle u,v \rangle \subseteq D\} \\
		& =
		|{\IV}_n|
		+
		5(|C|-1) N_{n,1}^{\IV}
		+
		(|C|-1)(|C|-4) N_{n,2}^{\IV}.
	\end{align*}
	Since
	$|{\IV}_n| = \prod_{i=0}^{n/2-1} (2^{2i+1}+1)$,
	therefore,
	\begin{align*}
		\Delta_{\IV}^{2}(C)
		& =
		1
		+
		5(|C|-1)
		\dfrac{N_{n,1}^{\IV}}{|\IV_n|}
		+
		(|C|-1)(|C|-4)
		\dfrac{N_{n,2}^{\IV}}{|\IV_n|} \\
		& =
		1
		+
		5\dfrac{2^{2(n/2)}-1}{2^{2(n/2)-1}+1}
		+
		\dfrac{(2^{2(n/2)}-1)(2^{2(n/2)}-4)}{(2^{2(n/2)-3}+1)(2^{2(n/2)-1}+1)} \\
		& =
		1
		+
		10\dfrac{2^{2(n/2)}-1}{2^{2(n/2)}+2}
		+
		16\dfrac{(2^{2(n/2)}-1)(2^{2(n/2)}-4)}{(2^{2(n/2)}+8)(2^{2(n/2)}+2)} \\

		& =
		\dfrac{27{(2^{2(n/2)})}^2}{(2^{2(n/2)}+8)(2^{2(n/2)}+2)}.
	\end{align*}
	This completes the proof of (ii).
\end{proof}

\section*{Acknowledgements}
The authors thank Manabu Oura for helpful discussions.

The authors would also like to thank the
anonymous reviewers for their beneficial comments
on an earlier version of the manuscript.
The second named author is supported by JSPS KAKENHI (18K03217).

config: arxiv


TITLE: How can I find the temperature of this system?
QUESTION [1 upvotes]: A system was given a small amount of thermal energy dE, and its number of states G grew by 25%. How can I find the system temperature?

The system contains gas particles, I know that $dE << U$
I thought about using the entropy $\sigma$ = $ln(g)$ when $g$ is the number of states
$\frac{1}{T} = K_b \frac{d\sigma}{dU}$
when $dU = dE $ and the entropy $\sigma$ is $ ln(g)$ so $d\sigma = ln(1.25g)-ln(1g) = ln(1.25)$
we get - $ T = \frac{dE}{K_b\cdot ln(1.25)}$
and the Bolztmann constant units are $J/K$ so it turns out okay units wise, but apparently its not the correct answer. Have I messed up something?

REPLY [1 votes]: Here is the correct solution
$\frac{1}{T}=K_b \cdot \frac{d\sigma}{dU}$
now we take $\sigma=ln(g)$ -> $d\sigma=\frac{dg}{g}$ and that it $25$% . substituting this into the equation yields the correct answer. It makes sense, but still I dont get why is that "more" correct then my first way?


TITLE: How prove this limit $\lim_{n\to\infty}\frac{1}{n}\sum_{i=1}^{n}\sum_{j=1}^{n}\frac{i+j}{i^2+j^2}=\frac{\pi}{2}+\ln{2}$
QUESTION [12 upvotes]: show that: this limit
$$I=\lim_{n\to\infty}\dfrac{1}{n}\sum_{i=1}^{n}\sum_{j=1}^{n}\dfrac{i+j}{i^2+j^2}=\dfrac{\pi}{2}+\ln{2}$$
My try:
$$I=\lim_{n\to\infty}\dfrac{1}{n^2}\sum_{i=1}^{n}\sum_{j=1}^{n}\dfrac{\dfrac{i}{n}+\dfrac{j}{n}}{\left(\dfrac{i}{n}\right)^2+\left(\dfrac{j}{n}\right)^2}=\int_{0}^{1}\int_{0}^{1}\dfrac{x+y}{x^2+y^2}dxdy?$$
This idea is true? and have other methods?

REPLY [6 votes]: Evaluation of the integral(after Thomas Andrews's calculation)
$$
\int_0^1 \log(1+y^2) dy= y\log(1+y^2)|_0^1 -\int_0^1 \frac{2y^2}{1+y^2} dy$$
$$=\log 2-\int_0^1 \frac{2y^2+2-2}{1+y^2} dy$$
$$=\log 2 - 2 + \frac{\pi}{2} $$
$$-\int_0^1 \log (y^2) dy = -\int_0^1 2\log y dy = 2\int_0^{\infty} e^{-x} dx = 2$$
Hence, the integral all together is
$$\log 2 + \frac{\pi}{2}$$
Application of Stolz-Cesaro:
If we can prove that the limit exists
$$
\lim_{n\rightarrow\infty}\left( \sum_{i=1}^n \frac{i+n}{i^2+n^2} +\sum_{j=1}^{n-1} \frac{n+j}{n^2+j^2}\right)  $$
then the answer is the same as the limit.
Evaluation of this limit requires integral, but this time not a 'double integral'.
$$\lim_{n\rightarrow\infty}  \sum_{i=1}^n \frac{i+n}{i^2+n^2}$$
$$=\lim_{n\rightarrow\infty} \sum_{i=1}^n \frac{ \frac{i}{n}+1}{\frac{i^2}{n^2}+1} \frac{1}{n}$$
$$=\int_0^1 \frac{x+1}{x^2+1} dx$$
$$=\frac{\pi}{4}+\frac{1}{2}\log 2.$$
The other part can be dealt similarly, it has the same value as above. Thus, all together the answer becomes
$$\frac{\pi}{2}+\log 2.$$


text:
\begin{document}

\title[Linear independence of time frequency translates]{Linear independence of time frequency translates for special configurations}

\author{Ciprian Demeter}
\address{Department of Mathematics, Indiana University, 831 East 3rd St., Bloomington IN 47405}
\email{demeterc@@indiana.edu}

\keywords{}
\thanks{The  author is supported by a Sloan Research Fellowship and by NSF Grants DMS-0742740 and 0901208}
\thanks{ AMS subject classification: Primary 26A99; Secondary 11K70, 65Q20}
\begin{abstract}

We prove that for any 4 points in the plane that belong to 2 parallel lines, there is no linear dependence between the associated time-frequency translates of any nontrivial Schwartz function.
If mild Diophantine properties are satisfied, we also prove  linear independence in the category of $L^2(\R)$ functions.
\end{abstract}
\maketitle

\section{Introduction}
The following conjecture, known as the HRT conjecture appears in \cite{HRT}. See also \cite{H} for an ample discussion on the subject.

\begin{conjecture}
\label{cc1}
Let $(t_j,\xi_j)_{j=1}^n$ be $n\ge 2$ distinct points in the plane. Then there is no nontrivial $L^2$ function  $f:\R\to \C$ satisfying a  nontrivial linear dependence
$$\sum_{j=1}^nd_if(x+t_j)e^{2\pi i\xi_jx}=0,$$
for a.e. $x\in \R$.
\end{conjecture}

The  Conjecture was proved  when  $(t_i,\xi_i)_{i=1}^n$ sit on a lattice \cite{Lin}. See also \cite{BS}, \cite{DG}, for alternative arguments. In particular, this is the case with any 3 points. The conjecture also follows trivially when all points are collinear. No other cases seem to appear in the literature.
The following weaker conjecture has also been circulated (see for example \cite{H}).

\begin{conjecture}
\label{c2}
Let $(t_j,\xi_j)_{j=1}^n$ be $n\ge 2$ distinct points in the plane. Then there is no nontrivial Schwartz function  $f:\R\to \C$ satisfying a  nontrivial linear dependence
$$\sum_{j=1}^nd_if(x+t_j)e^{2\pi i\xi_jx}=0,$$
for a.e. $x\in \R$.
\end{conjecture}

 In light of the discussion above, this conjecture also follows  for the lattice and when the points are collinear. No other result seems to have appeared in the direction of this conjecture.

 We will call an $(n,m)$ configuration, any collection of $n+m$ distinct points in the plane, such that there exist 2 distinct parallel lines such that one of them contains exactly $n$ of the points, and the other one contains exactly $m$ of the points.
Our main results are:
\begin{theorem}
\label{t:main}
Conjecture \ref{c2} holds for all $(1,3)$ and $(2,2)$ configurations.

\end{theorem}

Let $\|x\|$ denote the distance of $x$ to the nearest integer.

\begin{theorem}
\label{TT2}
Conjecture \ref{cc1} holds for  special $(1,3)$ configurations $$(0,0),(1,0), (1,\alpha), (1,\beta)$$

(a) if there exists $\gamma>1$ such that
$$\liminf_{n\to\infty}n^{\gamma}\min\{\|n\frac{\beta}{\alpha}\|,\|n\frac{\alpha}{\beta}\|\}<\infty$$

(b)  if at least one of $\alpha,\beta$ is rational

In either case, no nontrivial solution $f$ can exist satisfying  minimal decay
$$\lim_{|n|\to\infty\atop{n\in\Z}}|f(x+n)|=0,\;\;a.e.\;x$$
\end{theorem}

\begin{theorem}
\label{TT2'}
Conjecture \ref{cc1} holds  for special $(2,2)$ configurations $$(0,0),(1,0), (0,\alpha), (1,\beta)$$

(a) if
$$\liminf_{n\to\infty}n\log n\min\{\|n\frac{\beta}{\alpha}\|,\|n\frac{\alpha}{\beta}\|\}<\infty$$

(b)  if at least one of $\alpha,\beta$ is rational

In either case, no nontrivial solution $f$ can exist satisfying  minimal decay
$$\lim_{|n|\to\infty\atop{n\in\Z}}|f(x+n)|=0,\;\;a.e.\;x$$
\end{theorem}

Unlike the approaches in \cite{HRT}, \cite{Lin}, \cite{BS}, \cite{DG}, the approach here is mostly number theoretical.
An old theorem of Khinchine guarantees that (Lebesgue) almost every $x$ satisfies $$\liminf_{n\to\infty}n\log n\|nx\|<\infty,$$
and thus (via metaplectic transforms) Conjecture \ref{cc1} holds for "almost every"  $(2,2)$ configuration. Note also that Theorem \ref{TT2}(b) answers Conjecture 9.2 (b) from \cite{H}.

Theorem \ref{t:main} is proved by first reducing to special configurations. This is done via applying the area preserving affine transformations -also called {\em metaplectic transforms}- of the plane (such as translations, rotations, shears, and area one rescalings). See Section 2 in \cite{HRT} for a discussion on this.

The key feature of any special $(n,m)$ configuration of points, is the fact that any linear dependence between the corresponding time frequency translates gives rise to a recurrence along $\Z$ orbits $x+\Z$. We use Diophantine approximation to identify appropriate {\em scales}. For each fixed scale, we investigate the recurrence along finite portions of two carefully chosen distinct orbits, with length comparable to the scale.

The (2-2) case is quite simple. The two rotations by $\alpha$ and $\beta$ do not interact strongly, and hence they can be dealt with by different methods. The two orbits are selected in such a way that the trigonometric polynomials associated with $\alpha$ take conjugate values along the two orbits. This means that in absolute value, the contributions coming from these polynomials are  identical, for the two orbits. We will refer to this as the {\em conjugates trick}. The contributions coming from the polynomials associated with $\beta$ are then compared via diophantine approximation and Riemann sums, if $\beta$ is irrational, and using a {\em periodicity argument}, if $\beta$ is rational.

The (1,3) case  is significantly harder, partly because the behavior of the relevant polynomial $p(x,y)=C_0+C_1e(x)+C_2e(y)$ near its zeros is more complicated.
Our argument  relies in part on the almost periodicity for trigonometric polynomials. This in turn has behind the existence of simultaneous approximants $P\in \R$ such that $$P\max\{\|P\alpha\|,\|P\beta\|\}\lesssim 1.$$
The almost periods we get become better as $\frac\alpha\beta$ gets less Diophantine (that is better approximable by rationals).
The main idea of this approach is to compare the products of polynomials along the two orbits via estimates for their arithmetic means (see for example Proposition \ref{P1}). While the products along a fixed orbit can fluctuate a lot, and thus are very difficult to control, proving upper bounds for their averages turns out to be a less complicated proposal.
This requires a deeper understanding of the geometry of the points $(\{n\alpha\},\{n\beta\})$, as observed in the proof of Lemma \ref{l7} and Lemma \ref{l7hrstmdncvjrhufherw;'q,.c}. The key is that the more Diophantine $\frac{\alpha}{\beta}$ is, the more "regular" is the counting measure of the points $(\{n\alpha\},\{n\beta\})$, and this will serve as a compensation.

\section{Proof of Theorem \ref{t:main} for (1,3) configurations}
 Define $[x]$, $\{x\}$, $\|x\|$  to be the integer part, the  fractional part and the distance to the nearest integer of $x$. Let $\langle x\rangle$ denote the unique number in $[-1/2,1/2)$ such that $x-\langle x\rangle$ is an integer. For two quantities $A$, $B$ that vary, we will denote by $A\lesssim B$ or $A=O(B)$ the fact that $A\le C B$ for some universal constant $C$, independent of $A$ and $B$.  In general, $A\lesssim_p B$ means that the implicit constant is allowed to depend on the parameter $p$. If no parameter is specified, the implicit constants are implicitly understood to depend on the (harmless) fundamental parameters introduced in the beginning of the proof of Theorem \ref{t:main}. For a set $A\subset \R$, we will denote by $|A|$ its Lebesgue measure, and if the set is finite, $|A|$ will represent its cardinality. Finally, we define
$e(x):=e^{2\pi i x}$.

We prove a few results that will contribute to the proof of Theorem \ref{t:main}.

\begin{lemma}
\label{L4}
Let $C_0,C_1,C_2\in \C$ be some nonzero $complex$ numbers. The polynomial $p(x,y)=C_0+C_1e(x)+C_2e(y)$ has at most two  real zeros $(\gamma_1^{(j)},\gamma_2^{(j)})\in [0,1)^2$, $j\in\{1,2\}$. There exists $t=t(C_0,C_1,C_2)\in \R\setminus 0$ such that
$$|p(x,y)|\gtrsim_{C_0,C_1,C_2}\min_{j}(\| x-\gamma_1^j+t\langle y-\gamma_2^j\rangle\|+\| x-\gamma_1^j\|^2+\| y-\gamma_2^j\|^2),$$
for each $x,y\in\R$.

\end{lemma}
\begin{proof}
If $|C_0|,|C_1|,|C_2|$ can not form a triangle, then $|p(x,y)|\gtrsim_{C_0,C_1,C_2} 1$ and there is nothing to prove. If $|C_0|,|C_1|,|C_2|$ can  form a triangle, given that the side with length  $|C_0|$ is rigid, there are only two possible ways to construct the other two sides (the two triangles will be symmetric with respect to the side with length $|C_0|$). This justifies the fact that there are at most 2 zeros.

Since $p$, $\|\cdot\|$ and $\langle\cdot \rangle$ are 1 periodic, and since $\langle y\rangle =y$ and $\|y\|=|y|$ near 0, it suffices to prove that
\begin{equation}
\label{equ1}
|p(x,y)|\gtrsim_{C_0,C_1,C_2}|(x-\gamma_1^j)+t(y-\gamma_2^j)|,
\end{equation}
and
\begin{equation}
\label{equ223ds}
|p(x,y)|\gtrsim_{C_0,C_1,C_2}|x-\gamma_1^j|^2+|y-\gamma_2^j|^2,
\end{equation}
for $(x,y)$ in a sufficiently small neighborhood (on $\R$) of $(\gamma_1^j,\gamma_2^j)$.

We distinguish two cases. The {\em non-degenerate case} is when $\frac{C_1e(\gamma_1^j)}{C_2e(\gamma_2^j)}$ is not a real number. This is the same as saying that $|C_0|,|C_1|,|C_2|$  form a non-degenerate triangle. By using a Taylor expansion we get
$$\frac{p(x,y)}{2\pi i}=$$$$C_1e(\gamma_1^j)(x-\gamma_1^j+\pi i(x-\gamma_1^j)^2+O(|x-\gamma_1^j|^3))+C_2e(\gamma_2^j)((y-\gamma_2^j)+\pi i(y-\gamma_2^j)^2+O(|y-\gamma_2^j|^3)).$$Note that
$$|C_1e(\gamma_1^j)(x-\gamma_1^j)+C_2e(\gamma_2^j)(y-\gamma_2^j)|\gtrsim_{C_0,C_1,C_2}((x-\gamma_1^j)^2+(y-\gamma_2^j))^{1/2},$$
and thus $|p(x,y)|\gtrsim_{C_0,C_1,C_2}((x-\gamma_1^j)^2+(y-\gamma_2^j))^{1/2}\ge (x-\gamma_1^j)^2+(y-\gamma_2^j)^2$, for $|x-\gamma_1^j|,|y-\gamma_2^j|$ sufficiently small. Hence \eqref{equ1} also holds with, say, $t=1$.

The {\em degenerate case} is when $|C_0|,|C_1|,|C_2|$  form a degenerate triangle. In this case there is only one zero, call it $(\gamma_1,\gamma_2)$. It follows that $C_0,C_1e(\gamma_1),C_2e(\gamma_2)$ are real multiples of each other. Thus, there must exist two among these three numbers with a positive ratio. There are two cases.

First let us assume $t:=\frac{C_2e(\gamma_2)}{C_1e(\gamma_1)}>0$. Then, proceeding as before,
$$\frac{p(x,y)}{2\pi iC_1e(\gamma_1)}=(x-\gamma_1+t(y-\gamma_2)+O(|x-\gamma_1|^3+|y-\gamma_2|^3))+$$$$\pi i((x-\gamma_1)^2+t(y-\gamma_2)^2+O(|x-\gamma_1^j|^3+|y-\gamma_2|^3))$$
where the first term is the real part, while the second term is the imaginary part. Since $t>0$,
$$(x-\gamma_1)^2+t(y-\gamma_2)^2\gtrsim_t(x-\gamma_1)^2+(y-\gamma_2)^2>>(|x-\gamma_1|^3+|y-\gamma_2|^3),$$
for $|x-\gamma_1|,|y-\gamma_2|$ sufficiently small. If $|(x-\gamma_1)+t(y-\gamma_2)|\ge (x-\gamma_1)^2+(y-\gamma_2)^2,$ then the real part is dominant, and thus
$|p(x,y)|\gtrsim |(x-\gamma_1)+t(y-\gamma_2)|$. If $|(x-\gamma_1)+t(y-\gamma_2)|\le (x-\gamma_1)^2+(y-\gamma_2)^2,$ then the imaginary part is dominant, and thus $|p(x,y)|\gtrsim (x-\gamma_1)^2+(y-\gamma_2)^2$.

The second possibility is that $s:=\frac{C_1e(\gamma_1)}{C_0}>0$. The case $\frac{C_2e(\gamma_2)}{C_0}>0$ is completely symmetric, so we omit it. Note that
$$|p(x,y)|=|C_2+C_0e(-\gamma_2)e(\gamma_2-y)+C_1e(\gamma_1-\gamma_2)e(x-\gamma_1-(y-\gamma_2))|=$$
$$2\pi|C_0e(-\gamma_2)\left((\gamma_2-y)+\pi i(\gamma_2-y)^2+O(|\gamma_2-y|^3)\right)+$$$$C_1e(\gamma_1-\gamma_2)\left((x-\gamma_1-(y-\gamma_2))+\pi i(x-\gamma_1-(y-\gamma_2))^2+O(|x-\gamma_1-(y-\gamma_2)|^3)\right)|$$
Thus,
$$\frac{|p(x,y)|}{|2\pi C_0e(-\gamma_2)|}=$$
$$|\left((\gamma_2-y)+s(x-\gamma_1-(y-\gamma_2))+O_s(|\gamma_2-y|^3+|x-\gamma_1|^3)\right)+$$
$$\pi i\left((\gamma_2-y)^2+s(x-\gamma_1-(y-\gamma_2))^2+O_s(|\gamma_2-y|^3+|x-\gamma_1|^3)\right)|.$$
Using the fact that
$$(\gamma_2-y)^2+s(x-\gamma_1-(y-\gamma_2))^2\gtrsim_s (\gamma_2-y)^2+(x-\gamma_1-(y-\gamma_2))^2\ge \frac{(\gamma_2-y)^2+(x-\gamma_1)^2}{4},$$
\eqref{equ1} and \eqref{equ223ds} follow as before, this time with $t:=-\frac{1+s}{s}$.

\end{proof}

We will for the rest of the paper implicitly assume $\beta>0$.
The following result uses simultaneous diophantine approximation to construct sharp almost periods. The requirement (i) will be needed later, in order to be able to place the generators $x$ and $x+\{P_k\}$ of the two orbits, in the (potentially very small) interval $I$ where the "solution" $f$ is guaranteed to be nonzero.

\begin{lemma}
\label{L1}
Let $\alpha,\beta\in\R$ be two nonzero numbers with $\alpha/\beta$ irrational. Let also $1>s>0$ be fixed. Then there exists a constant $0<D=D(s,\alpha,\beta)<\infty$ and a sequence $N_k$ of positive integers going to infinity such that for each $k\ge 1$

(i) $\{\frac{N_k}{\beta}\}<s$,

(ii) $N_k\|N_k\frac{\alpha}{\beta}\|\le D\min_{1\le n\le N_k}n\|n\frac{\alpha}{\beta}\|$,

(iii) $N_k\|N_k\frac{\alpha}{\beta}\|\le D$

\end{lemma}
\begin{proof}
We have two cases. If (call this the {\em badly approximable regime})
$$\liminf_{N\to\infty}N\|N\frac{\alpha}{\beta}\|>0,$$
then let $\epsilon:=\min_{N\in\N}N\|N\frac{\alpha}{\beta}\|>0.$
Dirichlet's Theorem implies that we can choose a sequence $N_k'\to\infty$  such that
$N_k'\|N_k'\frac{\alpha}{\beta}\|\le 1$ for each $k$. But then
$$N_k'\|N_k'\frac{\alpha}{\beta}\|\le \frac{1}{\epsilon
}\min_{n\in\N}n\|n\frac{\alpha}{\beta}\|.$$
Finally, by pigeonholing, for each $k$ there must exist some $1\le m_k\le 1/s$ such that $N_k:=m_kN_k'$ satisfies (i). It is immediate that
$$N_k\|N_k\frac{\alpha}{\beta}\|\le \frac{1}{s^2\epsilon
}\min_{n\in\N}n\|n\frac{\alpha}{\beta}\|.$$

Assume next that we are in the {\em well approximable regime}, that is
$$\liminf_{N\to\infty}N\|N\frac{\alpha}{\beta}\|=0.$$
This is equivalent with saying the the sequence $a_k$ in the continued fraction of $\alpha/\beta$ is unbounded.
Let $(p_k,N_k')$ be the sequence of best approximants for $\frac{\alpha}{\beta}$, ordered such that $N_k'$ is increasing.
Thus
$$|\frac{\alpha}{\beta}-\frac{p_k}{N_k'}|\le\frac{1}{N_k'N_{k+1}'}.$$ Recall that $N_{k+1}'\ge a_kN_k'$, and thus $sN_{k+1}'>N_k'$ for each $k\in E$, where $E$ is infinite.  It is known (see for example Theorem 7.13 in \cite{Nie}) that for each $k$
$$N_k'\|N_k'\frac{\alpha}{\beta}\|= \min_{1\le n< N_{k+1}'}n\|n\frac{\alpha}{\beta}\|.$$Let $\pi:\N\to E$ be an increasing bijection.
Choose as before  $1\le m_k\le 1/s$ such that $N_k:=m_kN_{\pi(k)}'$ satisfies (i). Note that $N_k<N_{\pi(k)+1}'$, and thus (ii)-(iii) follow as before.

\end{proof}

The next lemma will be needed in the proof of Proposition \ref{P1}.

\begin{lemma}\label{l7}
Let $C_0,C_1,C_2\in \C$ be some nonzero $complex$ numbers. Let $\alpha,\beta$ be some nonzero real numbers. Define
$$P(x)=C_0+C_1e(\alpha x)+C_2e(\beta x).$$ Let $(N_k)$ be a sequence such that (ii) and (iii) in Lemma \ref{L1} hold. Define $\frac1{M_k}:=\frac{N_k\|N_k\frac{\alpha}{\beta}\|}{D},$
and let $P_k:=\frac{N_k}{\beta}$.
Then for each $k$ and each $\delta>0$, there exists an exceptional set $E_{k,\delta}\subset [0,1]$ such that
$$|E_{k,\delta}|<\delta$$
and
$$\frac{1}{M_kP_k}\sum_{n=0}^{[P_k]-1}\frac{1}{|P(x+n)|}\lesssim_{\delta,C_0,C_1,C_2,\alpha,\beta} \log P_k,$$
for each $x\in [0,1]\setminus E_{k,\delta}$. \end{lemma}
\begin{proof}
Let $(\gamma_1,\gamma_2)\in[0,1]^2$ be a real zero of the polynomial $p(x,y)=C_0+C_1e(x)+C_2e(y)$. Define
$$A_n(x):=\|\alpha (x+n)-\gamma_1\|^2+\|\beta (x+n)-\gamma_2\|^2$$
By Lemma \ref{L4}, it suffices to find an exceptional set with $|E_{k,\delta}|\le \frac{\delta}{2},$ such that
\begin{equation}
\label{equ:er5ahyso}
\frac{1}{P_kM_k}\sum_{n=0}^{[P_k]-1}\frac{1}{A_n(x)}\lesssim_{\delta,\alpha,\beta} \log P_k,
\end{equation}
for each $x\in [0,1]\setminus E_{k,\delta}$.
The heuristics behind the proof is that if $\alpha/\beta$ is less Diophantine, then the estimate above holds because $M_k$ is large, while if $\alpha/\beta$ is Diophantine, we win because of extra regularity of the counting measure for the points $(n\alpha,n\beta)$.

The key observation  is that each strip
$$S_a:=\{(x,y):a-\frac{1}{4M_kP_k}\le \beta x-\alpha y< a+\frac{1}{4M_kP_k}\}$$
 contains at most $O_{\beta}(1)$ points $(\{-n\alpha+\gamma_1\},\{-n\beta+\gamma_2\})$, $0\le n\le [P_k]-1$. Indeed, assume for contradiction that some $S_a$ contains  both  $(\{-n\alpha+\gamma_1\},\{-n\beta+\gamma_2\})$ and $(\{-m\alpha+\gamma_1\},\{-m\beta+\gamma_2\})$, with $[P_k]-\frac1\beta>|m-n|>\frac{2}{\beta}$. It follows that $$|\beta([-n\alpha+\gamma_1]-[-m\alpha+\gamma_1])-\alpha([-n\beta+\gamma_2]-[-m\beta+\gamma_2])| < \frac{1}{M_kP_k}.$$
Note that $L:=|[-n\beta+\gamma_2]-[-m\beta+\gamma_2]|\not=0$ and $L\le |-n\beta+m\beta|+1\le N_k$. The above implies that $\|L\frac{\alpha}{\beta}\|<\frac{1}{M_kP_k\beta}\le\frac{1}{M_kL}$, which contradicts  (ii)  in Lemma \ref{L1}.

Let $\mathcal C$ be the collection of all points $\{-n\alpha+\gamma_1\}$ with $0\le n\le [P_k]-1$. Let $E_\delta'$ be the set of $x\in [0,1)$ such that the distance from $\{\alpha x\}$ to $\mathcal C$ is less than $\frac{\delta|\alpha|}{20P_k}$. Then $|E_\delta'|<\delta/10$.

Let $E_\delta''$ consist of those $x\in [0,1)$ with  $\min(\|\alpha x\|,\|\beta x\|)\le \frac{\delta(|\alpha|+|\beta|)}{100}$. Then $|E_\delta''|\le\frac{\delta}{10}$.

Note that if $u,v\in [0,1)$ with $\|u\|>\epsilon$ for some $\epsilon>0$, then
\begin{equation}
\label{e:199056484637}
\|u-v\|\gtrsim_\epsilon |u-v|.
\end{equation}

Split $[0,1)\setminus E_\delta''$ in intervals $H\in\mathcal H$, such that for each $H$, the integer parts $[\alpha x]$ and $[\beta x]$ are both constant, when $x$ varies through $H$. Thus, the points $(\{\alpha x\},\{\beta x\})$, $x\in H$ sit on a fixed line $\beta x-\alpha y=c_H$. Note that $\mathcal H$ contains $O_{\alpha,\beta}(1)$ intervals.

Let $H\in\mathcal H$. Then, using \eqref{e:199056484637},
$$\int_{H\setminus E_{\delta'}}\frac{1}{P_kM_k}\sum_{n=0}^{[P_k]-1}\frac{1}{A_n(x)}d\lesssim_{\alpha,\beta,\delta}$$$$\int_{H\setminus E_{\delta'}}\frac{1}{P_kM_k}\sum_{n=0}^{[P_k]-1}\frac{1}{|\{\alpha x\}-\{-n\alpha+\gamma_1\}|^2+|\{\beta x\}-\{-n\beta+\gamma_2\}|^2}dx.$$
The key observation implies that there are $O_\beta(1)$ points $(\{-n\alpha+\gamma_1\},\{-n\beta+\gamma_2\})$ in each strip $St_j:=\{(x,y):c_H+\frac{j}{2M_kP_k}\le \beta x-\alpha y< c_H+\frac{j+1}{2M_kP_k}\}$, with, say,  $-10M_kP_k\le j\le 10M_kP_k$. Call $B_j$ the set of $n$ corresponding to these points.
We first evaluate for $j\notin\{-1,0\}$,
$$\int_{H}\sum_{n=0\atop{n\in B_j}}^{[P_k]-1}\frac{1}{|\{\alpha x\}-\{-n\alpha+\gamma_1\}|^2+|\{\beta x\}-\{-n\beta+\gamma_2\}|^2}dx.$$
Since $(\{\alpha x\},\{\beta x\})_{x\in H}$ belong to a line segment, and since the points in $St_j$ belong to a strip parallel to and at distance at least $|j|/2M_kP_k$ from this line segment,
a simple change of coordinates shows that the integral above is dominated by $O_{\alpha,\beta}(\int_0^1\frac{1}{x^2+\left(\frac{|j|}{M_kP_k}\right)^2}dx)=O_{\alpha,\beta}(\frac{M_kP_k}{|j|})$. Of course, only at most $P_k$ values of $j$ can contribute, and thus
$$\int_{H}\frac{1}{M_kP_k}\sum_{n=0\atop{n\in \bigcup_{j\notin\{0,1\}}B_j}}^{[P_k]-1}\frac{1}{|\{\alpha x\}-\{-n\alpha+\gamma_1\}|^2+|\{\beta x\}-\{-n\beta+\gamma_2\}|^2}d\lesssim_{\alpha,\beta}$$
$$\frac{1}{M_kP_k}\sum_{j\notin\{0,1\}\atop{St_j\not=\emptyset}}\frac{M_kP_k}{|j|}\lesssim \log P_k.$$

On the other hand, if $n\in B_0\cup B_{-1}$, then we use the fact that if $x\notin E_{\delta}'$ then
$$|\{\alpha x\}-\{-n\alpha+\gamma_1\}|^2+|\{\beta x\}-\{-n\beta+\gamma_2\}|^2\gtrsim \frac{\delta^2|\alpha|^2}{P_k^2}.$$Using this, the fact that $B_0\cup B_{-1}$ contains $O_\beta(1)$ points and the fact that $M_k\ge 1$, we get via a change of variables that
$$\int_{H \setminus E_{\delta}'}\frac{1}{M_kP_k}\sum_{n=0\atop{n\in B_0\cup B_{-1}}}^{[P_k]-1}\frac{1}{|\{\alpha x\}-\{-n\alpha+\gamma_1\}|^2+|\{\beta x\}-\{-n\beta+\gamma_2\}|^2}dx$$
is dominated by $\frac{1}{M_kP_k}O(\int_{\frac{\delta^2|\alpha|^2}{P_k^2}}^1\frac{1}{x^2}dx))=O_{\alpha,\beta}(\frac{P_k}{\delta M_kP_k})=O_{\alpha,\beta,\delta}(1).$
Thus
$$\int_{[0,1)\setminus (E_{\delta'}\cup E_\delta'')}\frac{1}{M_kP_k}\sum_{n=0}^{[P_k]-1}\frac{1}{|\{\alpha x\}-\{-n\alpha+\gamma_1\}|^2+|\{\beta x\}-\{-n\beta+\gamma_2\}|^2}dx=$$$$\sum_{H\in\mathcal H}\int_{H\setminus E_{\delta'}}\frac{1}{M_kP_k}\sum_{n=0}^{[P_k]-1}\frac{1}{|\{\alpha x\}-\{-n\alpha+\gamma_1\}|^2+|\{\beta x\}-\{-n\beta+\gamma_2\}|^2}dx$$$$\lesssim_{\alpha,\beta,\delta} \log P_k,$$
since there are $O_{\alpha,\beta}(1)$ intervals $H$. It follows  that
$$|E_\delta''':=\{x\in [0,1)\setminus (E_{\delta'}\cup E_\delta''):\frac{1}{M_kP_k}\sum_{n=0}^{[P_k]-1}\frac{1}{|P(x+n)|}\ge C_{\alpha,\beta,\delta}\log P_k\}|\le \delta/10,$$
if $C_{\alpha,\beta,\delta}$ is chosen large enough.
Finally, define $E_{k,\delta}:=E_\delta'\cup E_\delta''\cup E_\delta'''$.
\end{proof}

The next proposition captures the almost orthogonality phenomenon. The idea is to avoid estimating products along individual orbits (which seems nearly impossible), but rather to compare products along two orbits.

\begin{proposition}
\label{P1}
Let $(N_k)$ be a sequence such that (ii) and (iii) in Lemma \ref{L1} hold, and define $P_k:=\frac{N_k}{\beta}$. Let $C_0,C_1,C_2\in\C$ and $\alpha,\beta\in \R$ be nonzero and define $P(x)=C_0+C_1e(\alpha x)+C_2e(\beta x)$. Given $\delta>0$,  there exists $E_{k,\delta}\subset [0,1]$ such that $|E_{k,\delta}|\le \delta$, and there exists a  universal constant $L=L(\delta,C_0,C_1,C_2,\alpha,\beta)$ such that  for each $x,y$ satisfying $x\in [0,1)\setminus E_{k,\delta}$ and $x=y+P_k$, we have
$$|\prod_{n=0}^{[P_k]-1}P(y+n)|\le P_k^L |\prod_{n=0}^{[P_k]-1}P(x+n)|.$$
\end{proposition}
\begin{proof}
Let as before
$$\frac1{M_k}:=\frac{P_k\|P_k\frac\alpha\beta\|}{D}<1.$$
Then, we have
$$|e(\alpha x)-e(\alpha y)|=|e(P_k\alpha)-1|\le \frac{10D}{P_kM_k}\;\;\text{ and }\;\;|e(\beta x)-e(\beta y)|=|e(P_k\beta)-1|\le \frac{10D}{P_kM_k}.$$
Thus, for each $n\in \N$
$$|P(y+n)|\le |P(x+n)|+\frac{CD}{M_kP_k},$$
for some universal constant $C:=100(|C_1|+|C_2|)$.

Use the fact $a+b\le ae^{\frac{b}{a}}$ for each $a,b>0$ to get
$$|P(y+n)|\le |P(x+n)|e^{\frac{CD}{M_kP_k|P(x+n)|}},$$
and thus
$$|\prod_{n=0}^{[P_k]-1}P(y+n)|\le |\prod_{n=0}^{[P_k]-1}P(x+n)|e^{\frac{CD}{M_kP_k}\sum_{n=0}^{[P_k]-1}\frac1{|P(x+n)|}}.$$
The result now follows from Lemma \ref{l7}.
\end{proof}

\begin{proof}
(of Theorem \ref{t:main} for (1,3) configurations)

It was proved in \cite{HRT} that the linear independence of the time-frequency translates is preserved under area preserving affine transformations of the plane, both for $L^2$ and for Schwartz functions. Thus, it is easy to see that any (1,3) configuration  can be reduced to a special (1,3) configuration like $(0,0),(1,0),(1,\alpha),(1,\beta)$, for some nonzero $\alpha,\beta$, with $\alpha\not=\beta$. Indeed, apply first a rotation, then a joint rescaling of the time and frequency axes so that the distance between the line containing the 3 points and the remaining point becomes 1, followed by a translate along the frequency axis and then by a vertical shear. It is also clear that it is precisely the $(1,3)$ configurations (and they only), that can be reduced to the special configuration from above. This follows since any linear transformation of the plane maps collinear points into collinear points.

We can also assume that the 4 points do not sit on a lattice, since that case is covered by the work in \cite{Lin}. In particular, we assume $\alpha/\beta$ is irrational.

Assume now for contradiction that there is some nontrivial Schwartz $f:\R\to\C$ such that for a.e. $x$, for some fixed nonzero constants $C_i\in\C$
$$f(x+1)=f(x)(C_0+C_1e(\alpha x)+C_2e(\beta x)).$$
 We denote as before
$P(x)=C_0+C_1e(\alpha x)+C_2e(\beta x)$.

Let $(I,S,d)$ be a triple such that $d>0$, $I\subset [0,1)$ is an interval, $S\subset I$ is a set with full Lebesgue measure $|I|$,  such that
\begin{equation}
\label{e4}
\lim_{|n|\to\infty\atop_{n\in\Z}}|n|^Cf(x+n)=0, \text{ for each } x\in S \text{ and each }C>0,
\end{equation}
\begin{equation}
\label{e5}
d<|f(x)|<d^{-1},\;\text{ for each }x\in S\cup S+1,
\end{equation}
\begin{equation}
\label{e6}
f(x+1)=f(x)(C_0+C_1e(\alpha x)+C_2e(\beta x)),\;\text{ for each } x\in S+\Z.
\end{equation}

We will refer to $C_0,C_1, C_2,I,S,d,\alpha,\beta$ as {\em fundamental parameters}. Implicit constants in inequalities involving $\lesssim$ are allowed to depend on these parameters, since they can be thought of as being fixed for the rest of the argument.

Apply Lemma \ref{L1} with $s:=|I|/10$, to get  a constant $D=D(|I|,\alpha,\beta)>0$ and a sequence $N_k$ of positive integers going to infinity such that for each $k\ge 1$

(i) $\{P_k:=\frac{N_k}{\beta}\}<|I|/10$,

(ii) $N_k\|N_k\frac{\alpha}{\beta}\|\le D\min_{1\le n\le N_k}n\|n\frac{\alpha}{\beta}\|$,

(iii) $N_k\|N_k\frac{\alpha}{\beta}\|\le D$

By Proposition \ref{P1} with $\delta=\frac{|I|}{100}$, for each  $x\in [0,1)\setminus E_{k,\delta}$ and $x=y+P_k$ we have
\begin{equation}
\label{e8}
|\prod_{n=0}^{[P_k]-1}P(y+n)|\le P_k^L |\prod_{n=0}^{[P_k]-1}P(x+n)|.
\end{equation}
Note that $(S\setminus E_{k,\delta})\cap (\{P_k\}+ S)\not=\emptyset$, since the intersection of each of the 2 sets with $I$ is large. Pick any $x_k\in S\setminus E_{k,\delta}$, such that  also $x_k-\{P_k\}\in S$.
Define $x_k':=x_k-\{P_k\}$. We will now  argue that \eqref{e4} can not hold for both $x_k$ (with $n\to\infty$) and $x_k'$ (with $n\to-\infty$).
Let $y_k=x_k'-[P_k]=x_k-P_k$. Note that
$$\prod_{n=0}^{[P_k]-1}P(y_k+n)=\prod_{n=1}^{[P_k]}P(x_k'-n),$$
and thus, by \eqref{e8} we get
\begin{equation}
\label{e12}
|\prod_{n=1}^{[P_k]}P(x_k'-n)|\le P_k^L |\prod_{n=0}^{[P_k]-1}P(x_k+n)|.
\end{equation}
Recall that we have
\begin{equation}
\label{e13}
f(x_k+[P_k])=f(x_k){\prod_{n=0}^{[P_k]-1}P(x_k+n)}
\end{equation}
\begin{equation}
\label{e14}
f(x_k'-[P_k])=f(x_k'){\prod_{n=1}^{[P_k]}P(x_k'-n)}.
\end{equation}
Using \eqref{e5}  and \eqref{e12}, we get that
\begin{equation}
\label{e16}
|f(x_k+[P_k])f(x_k'-[P_k])|\gtrsim P_k^{-L},
\end{equation}
with an implicit constant depending only on the fundamental parameters (in particular, independent of $k$).
This clearly contradicts \eqref{e4}, if we let $k\to\infty$.
\end{proof}
\section{Proof of Theorem \ref{t:main} for (2,2) configurations}

The reader can easily check that the argument for $(1,3)$ configurations presented above also works here. In particular, the existence of large $P\in\R$ satisfying $$\max\{\|P\alpha\|,\|P\beta\|\}\lesssim 1/P$$ implies that one can run the almost periodicity argument.

We also present an alternative, simpler argument, which does not work in the (1,3) case. As before, by using metaplectic transformations we can reduce to the case of special (2,2) configurations.
Assume there is a continuous function  $f:\R\to \C$ such that $f$ is nonzero on some interval $I\in [0,1)$, satisfying a weaker assumption (minimal decay)
\begin{equation}
\label{eeeeeeeeeeeeeeeeeeeeee:ejhdfui34yr348r85ug}
\lim_{|n|\to\infty\atop_{n\in\Z}}f(x+n)=0
\end{equation}
for a.e. $x\in [0,1]$,
and\begin{equation}
\label{eeeeeeeeeeeeeeeeeeeeee:ejhdfui34yr348r85ug'}
f(x+1)(A+Be(\alpha x))=f(x)(C+De(\beta x)),\end{equation}
for a.e. $x$, for some fixed $A,B,C,D\in\C$, $\alpha,\beta\in\R$, none of them zero. We can also assume that $\alpha$ and $\beta$ are rationally independent, by otherwise invoking the lattice case. Note that we assume far less, namely minimal (rather than Schwartz) decay. Thus, the result we prove for special (2,2) configurations is in some sense best possible.

First, let us deal with the case when both $\alpha,\beta$ are irrational.
We can trivially assume $A$ is real. Let
$$P(x)=A+Be(\alpha x)\;\;\text{ and }\;\;Q(x)=C+De(\beta x).$$

We first observe that  $|A|\not=|B|$. Indeed, assume for contradiction that  $|A|=|B|$. Then, there exists $\omega\in[0,1)$ such that $P(\omega+n\alpha^{-1})=0$ for each $n\in \Z$. There exist infinitely many $n$ such that $x_n:=\{\omega+n\alpha^{-1}\}\in I$. Choose such an $n_0\in \N$ with the additional property that $Q(\omega+n\alpha^{-1}+m)\not=0$ when $n=n_0$, for each $m\in \Z$ (it is easy to check, using the fact that $\alpha$ and $\beta$ are rationally independent, that this holds for all $n\in \Z$ with at most one possible exception). It follows that there exists an interval $H$ around $x_{n_0}$ such that $\inf_{0\le n\le [\omega+n_0\alpha^{-1}], x\in H} |Q(x+n)|>0$.

Now, by using the recurrence \eqref{e6} along the orbits $x,x+1,\ldots,x+[\omega+n_0\alpha^{-1}]-1$ of points $x\in I\cap H$, we get that $\sup_{y\in [\omega+n_0\alpha^{-1}]+H}|f(y)|=\infty$, contradicting the continuity of $f$. Thus, we have proved that $\inf_{x\in\R}|P(x)|>0$. Similarly, it follows that   $|C|\not=|D|$, and thus $\inf_{x\in\R}|Q(x)|>0$.

This is the only place in the argument where the continuity of $f$ is exploited. Continuity seems to be vital in order to rule out the real zeros for $P$ and $Q$. Indeed, if $f$ is not continuous, the set $\{x\in [0,1]:0<|f(x)|\}$, while it has positive measure, is not guaranteed to have among its accumulation points any of the zeros of $P$ and $Q$.

The functions $\psi(x)=\ln|A+Be(x)|$ and $\phi(x)=\ln|C+De(x)|$ are now guaranteed to be continuous on $[0,1)$.
Let $S\subset I$ be a set with Lebesgue measure $|I|$ such that \eqref{eeeeeeeeeeeeeeeeeeeeee:ejhdfui34yr348r85ug} and \eqref{eeeeeeeeeeeeeeeeeeeeee:ejhdfui34yr348r85ug'} hold for each $x\in S$.
Due to  \eqref{eeeeeeeeeeeeeeeeeeeeee:ejhdfui34yr348r85ug}, it follows that for each $x,z\in S$
\begin{equation}
\label{1}
\lim_{N\to\infty}\left(\sum_{n=1}^N\phi(\beta x+\beta n)-\sum_{n=1}^N\psi(\alpha x+\alpha n)\right)= -\infty
\end{equation}
and
\begin{equation}
\label{2}
\lim_{N\to\infty}\left(\sum_{n=-N}^{-1}\phi(\beta z+\beta n)-\sum_{n=-N}^{-1}\psi(\alpha z+\alpha n)\right)\to +\infty
\end{equation}

 Let $p_k,q_k$ relatively prime, $q_k\to\infty$ such that
$$\left|\beta-\frac{p_k}{q_k}\right|\le \frac{1}{q_k^2}.$$
Note that  $n\beta$ is very regular, that is
$$|n\beta-\frac{np_k}{q_k}|\le \frac{1}{q_k},\;\;-q_k\le n\le q_k,$$
where $(np_k \mod q_k)_{n=1}^{q_k}$ cover all the residues mod $q_k$. Using this and  $|\phi'|\gtrsim 1$, we get
$$
|\sum_{n=1}^{q_k}\phi(\beta y+\beta n)-q_k\int_{0}^1 \phi|=O(1)
$$
and
$$
|\sum_{n=-q_k}^{-1}\phi(\beta y+\beta n)-q_k\int_{0}^1 \phi|=O(1)
$$
for each $y\in [0,1]$ (use Riemann sums). An immediate corollary is that for each $x,z\in S$
\begin{equation}
\label{4}
|\sum_{n=1}^{q_k}\phi(\beta x+\beta n)-\sum_{n=-q_k}^{-1}\phi(\beta z+\beta n)|=O(1)
\end{equation}

Let $B=re(\theta)$, with $r>0$. By invoking Birkhoff's pointwise ergodic theorem for the function $1_S$, there exists $x\in S$ and some $n'\in \N$ such that $z:=\{-x-\frac{2\theta}{\alpha}+n'\alpha^{-1}\}\in S$. Let $y:=-x-\frac{2\theta}{\alpha}+n'\alpha^{-1}$ and $m=y-z$.

 The point of this selection is that for each $n$,
$A+Be(\alpha y-n\alpha )$ and $A+Be(\alpha x+n\alpha)$ are complex conjugates
and thus
$$\sum_{n=-N+m}^{-1+m}\psi(\alpha z+\alpha n)=\sum_{n=1}^{N}\psi(\alpha x+\alpha n).$$

This implies that for each $N$,
\begin{equation}
\label{5}
|\sum_{n=-N}^{-1}\psi(\alpha z+\alpha n)-\sum_{n=1}^{N}\psi(\alpha x+\alpha n)|=O(1).
\end{equation}
But now it immediately follows that \eqref{1}-\eqref{5} can not simultaneously hold.

If -say- $\alpha$ is irrational, apply the conjugates trick to $P$ as above, and use the periodicity of $Q$, like in the proof of Theorem \ref{TT2'} (b) described in Section \ref{S4}.

\section{Proof of Theorem \ref{TT2}}
Let us first prove part (a) of the theorem. Part (b) is proved in the end of this section.
 The hardest case is if $\frac\alpha\beta$ is {\em Diophantine}. This means that there exists $\gamma>1$ and there exists  $\epsilon>0$ small enough to satisfy, say, $\frac{\epsilon}{\gamma+\epsilon-1}\le \frac1{10}$, such that
\begin{equation}
\label{xcniery8u3ifhtgp[r0-9}
\liminf_{n\to\infty}n^{\gamma}\|n\frac{\alpha}{\beta}\|<\infty
\end{equation}
and in addition
\begin{equation}
\label{xcniery8u3ifhtgp[r0-9ufts}
\inf_{n\in\N}n^{\gamma+\epsilon}\|n\frac{\alpha}{\beta}\|:=D_\epsilon>0.
\end{equation}
The easier case is when $\frac\alpha\beta$ is {\em Liouville}, that is if for each $\eta>1$
$$\liminf_{n\to\infty}n^{\eta}\|n\frac{\alpha}{\beta}\|<\infty.$$
\begin{lemma}\label{l7hrst}
Let $x_1,x_2,\ldots,x_N$ be $N$ not necessarily distinct real numbers.
Then for each $N\in\N$ and each $\delta>0$, there exists an exceptional set $E_{N,\delta}\subset [0,1]$ such that
$$|E_{N,\delta}|\le \delta,$$
\begin{equation}
\label{xcniery8u3ifhtgp[r0-9dvruyfg73t895ugijk}
\frac{1}{N}\sum_{n=1}^{N}\frac{1}{\|x-x_n\|}\lesssim_{\delta} \log N,
\end{equation}
\begin{equation}
\label{xcniery8u3ifhtgp[r0-9dvruyfg73t895ugijk'}
\frac{1}{N^2}\sum_{n=1}^{N}\frac{1}{\|x-x_n\|^2}\lesssim_{\delta} 1,
\end{equation}
for each $x\in [0,1]\setminus E_{N,\delta}$.
\end{lemma}
\begin{proof}
Since $y\mapsto \|y\|$ is 1 periodic, we can assume all $x_i$ are in $[0,1]$. Since $\|x-x_i\|\gtrsim \min\{|x-x_i|,|x-(1-x_i)|\}$, by doubling the number of points if necessary, we can replace $\|x-x_i\|$ with $|x-x_i|$. Define
$$U_{N,\delta}:=\bigcup_{i=1}^{N}[x_i-\frac{\delta}{10N},x_i+\frac{\delta}{10N}],$$
and note that
$$\int_{[0,1]\setminus U_{N,\delta}}\sum_{i=1}^{N}\frac{1}{|x-x_i|}d\lesssim N(\log N+\log \frac1\delta),$$
$$\int_{[0,1]\setminus U_{N,\delta}}\sum_{i=1}^{N}\frac{1}{|x-x_i|^2}d\lesssim N^2\delta^{-1}.$$
The result now follows from Cebysev's inequality.
\end{proof}

\begin{lemma}\label{l7hrstmdncvjrhufherw;'q,.c}
Let $\alpha,\beta$ be some nonzero real numbers satisfying \eqref{xcniery8u3ifhtgp[r0-9ufts} above. Define also $M:=N^{\frac{(\gamma-1)(\gamma+\epsilon)}{\gamma+\epsilon-1}}D_\epsilon^{\frac{1}{\gamma+\epsilon-1}}$.
Then for each $\xi\in\R$ and $N\in\N$
$$\frac{1}{N^\gamma}\sum_{n=0\atop{\|n\frac{\alpha}{\beta}-\xi\|\ge \frac{1}{M}}}^{N-1}\frac{1}{\|n\frac{\alpha}{\beta}-\xi\|}\lesssim_{\alpha,\beta,\gamma,\epsilon}1.$$

\end{lemma}
\begin{proof}
The crucial observation is that for each $\frac{D_\epsilon}{2^{\gamma+\epsilon}}\ge R\ge \frac{1}{M}$, the $\|\cdot\|$-ball
$$B(\xi,R):=\{x:\|x-\xi\|<R\}$$
contains at most $N(\frac RD_\epsilon)^{\frac1{\gamma+\epsilon}}$ points $n\frac{\alpha}{\beta}$, with $0\le n\le N-1$. Indeed, assume for contradiction that $N(\frac RD_\epsilon)^{\frac1{\gamma+\epsilon}}+1$ such points are contained in the ball. Then,  two of these points would correspond to some $0\le n<m\le N-1$ with $|n-m|\le (\frac{D_\epsilon}{R})^{\frac1{\gamma+\epsilon}}$. Thus,
$$(m-n)^{\gamma+\epsilon}\|(m-n)\frac{\alpha}{\beta}\|\le D_\epsilon,$$
which contradicts \eqref{xcniery8u3ifhtgp[r0-9ufts}.

In particular, for each $\frac{D_\epsilon}{2^{\gamma+\epsilon}}\ge 2^{-j}\ge \frac1M$ we have  $O(N(\frac1{2^jD_\epsilon})^{\frac1{\gamma+\epsilon}})$ points in the ball $B_j:=B(\xi,2^{-j})$.
Define for such a $j$
$$S_j:=\{0\le n\le N-1:n\frac\alpha\beta\in B_{j+1}\setminus B_j\}.$$
Then, using the fact that there are at most $N$ points outside the ball $B(\xi,\frac{D_\epsilon}{2^{\gamma+\epsilon}})$, we get
\begin{equation*}
\label{e1}
\frac{1}{N^\gamma}\sum_{n=0\atop\|n\frac{\alpha}{\beta}-\xi\|\ge \frac{1}{M}}^{N-1}\frac{1}{\|n\frac{\alpha}{\beta}-\xi\|}\le
\frac{1}{N^\gamma}\left(\sum_{\frac{D_\epsilon}{2^{\gamma+\epsilon}}\ge 2^{-j}\ge \frac{1}{M}}\sum_{n\in S_j}\frac{1}{\|n\frac{\alpha}{\beta}-\xi\|}+N\frac{2^{\gamma+\epsilon}}{D_\epsilon}\right)
\end{equation*}
$$\lesssim_{D_\epsilon,\gamma} \frac{1}{N^\gamma}\sum_{ 2^{-j}\ge \frac{1}{M}}2^jN(\frac1{2^jD_\epsilon})^{\frac1{\gamma+\epsilon}}\lesssim_{\alpha,\beta,\gamma,\epsilon} 1.$$
\end{proof}

We have the following analogue of Lemma \ref{l7}
\begin{lemma}\label{l7'}
Let $C_0,C_1,C_2\in \C$ and $\alpha,\beta$ be some nonzero numbers. Let $\gamma$ satisfy \eqref{xcniery8u3ifhtgp[r0-9ufts} if $\alpha/\beta$ is Diophantine and let $\gamma=2$ if $\alpha/\beta$ is Liouville. Define
$$P(x)=C_0+C_1e(\alpha x)+C_2e(\beta x).$$
Then for each $N\in \N$ and  $\delta>0$, there exists an exceptional set $E_{N,\delta}\subset [0,1]$ such that
$$|E_{N,\delta}|<\delta$$
and
$$\frac{1}{N^\gamma}\sum_{n=0}^{N-1}\frac{1}{|P(x+n)|}\lesssim_{\delta,C_0,C_1,C_2,\alpha,\beta,\epsilon} 1,$$
for each $x\in [0,1]\setminus E_{N,\delta}$.
\end{lemma}
\begin{proof}

Let $(\gamma_1,\gamma_2)$ be a zero of the polynomial $p(x,y)=C_0+C_1e(x)+C_2e(y)$, and let $t$ be the real number guaranteed by Lemma \ref{L4}. Define
$$A_n(x):=\|\alpha (x+n)-\gamma_1+t\langle\beta (x+n)-\gamma_2\rangle\|+\|\alpha (x+n)-\gamma_1\|^2+\|\beta (x+n)-\gamma_2\|^2$$
By Lemma \ref{L4}, it suffices to find an exceptional set with $|E_{N,\delta}|\le \frac\delta2,$ such that
\begin{equation}
\label{equ:er5ahyso'}
\frac{1}{N^\gamma}\sum_{n=0}^{N-1}\frac{1}{A_n(x)}\lesssim_{\delta,t,\alpha,\beta} 1,
\end{equation}
for each $x\in [0,1]\setminus E_{N,\delta}$.

We first analyze the case when $\alpha/\beta$ is Diophantine.
We distinguish two subcases. First, let us analyze the case $\alpha+t\beta\not=0$. In this case,
$$\|\alpha (x+n)-\gamma_1+t\langle \beta (x+n)-\gamma_2\rangle\|=\|(\alpha+t\beta)x+(\alpha+t\beta)n-\gamma_1-t\gamma_2-t[\beta (x+n)-\gamma_2]+mt\|,$$
where $m=-1$ if  $\{\beta (x+n)-\gamma_2\}>1/2$ and $m=0$ otherwise. Note that the set of points
$$S:=$$$$\{(\alpha+t\beta)n-\gamma_1-t\gamma_2-t[\beta (x+n)-\gamma_2]+mt:\;x\in[0,1],\; 0\le n\le N-1,\;m\in\{0,-1\}\}$$
has $O_\beta(N)$ elements. \eqref{xcniery8u3ifhtgp[r0-9dvruyfg73t895ugijk} implies the existence of $E_{N,\delta}$ with $|E_{N,\delta}|<\delta/2$ and
$$\frac{1}{N}\sum_{y\in S}\frac{1}{\|(\alpha+t\beta)x+y\|}\lesssim_{\delta,\alpha,\beta} \log N$$
for each $x\in [0,1]\setminus E_{N,\delta}$. Thus, \eqref{equ:er5ahyso'} follows, even with  $N\log N$ instead of $N^\gamma$ in the denominator.

Let us now analyze the subcase $\alpha+t\beta=0$. Now,
$$\|\alpha (x+n)-\gamma_1+t\langle \beta (x+n)-\gamma_2\rangle\|=\|-\gamma_1-t\gamma_2+mt+\frac{\alpha}{\beta}[\beta (x+n)-\gamma_2]\|,$$
where $m$ is as before. Let $\xi$ be either $\gamma_1+t\gamma_2$ or $\gamma_1+t\gamma_2+t$. Let $$M:=(N\beta)^{\frac{(\gamma-1)(\gamma+\epsilon)}{\gamma+\epsilon-1}}D_\epsilon^{\frac{1}{\gamma+\epsilon-1}}.$$ From Lemma \ref{l7hrstmdncvjrhufherw;'q,.c} we have that for each $x\in [0,1)$
\begin{equation}
\label{jfhury40rlvbk5yih9}
\frac{1}{N^{\gamma}}\sum_{n=0\atop{\|\frac{\alpha}{\beta}[\beta (x+n)-\gamma_2]-\xi\|\ge \frac{1}{M}}}^{N-1}\frac1{\|\frac{\alpha}{\beta}[\beta (x+n)-\gamma_2]-\xi\|}\lesssim_\beta \frac{1}{N^\gamma}\sum_{n=0\atop{\|\frac{\alpha}{\beta}n-\xi\|\ge \frac{1}{M}}}^{N\beta}\frac1{\|\frac{\alpha}{\beta}n-\xi\|}\lesssim 1.
\end{equation}

Let $S(\xi)$ be the set of those $0\le n\le N-1$ such that $\|\frac{\alpha}{\beta}n-\xi\|\le \frac{1}{M}$. It was proved in Lemma \ref{l7hrstmdncvjrhufherw;'q,.c} that $S(\xi)$ has at most $N(\frac 1{MD_\epsilon})^{\frac1{\gamma+\epsilon}}$ points. This is  $O_{\alpha,\beta}(N^{1/10})$, since $\frac{\epsilon}{\gamma+\epsilon-1}\le \frac1{10}$.
Define
$$E_{N,\delta}:=\{x\in[0,1]:\|\alpha(x+n)-\gamma_1\|\lesssim_{\alpha,\beta}  \delta N^{-\frac1{10}}\text{ for some }n\in S(\xi)\},$$ and note that $|E_{N,\delta}|\le\frac\delta2$.
 For $n\in S(\xi)$ we will use the alternative estimate
$$A_n(x)\ge \|\alpha (x+n)-\gamma_1\|^2.$$
Thus, if $x\notin E_{N,\delta}$, then  $A_n(x)\gtrsim \delta^{2}N^{-\frac15}$, and thus
\begin{equation}
\label{jfhury40rlvbk5yih9'}
\frac{1}{N^\gamma}\sum_{n=0\atop{n\in S(\xi)}}^{N-1}\frac{1}{A_n(x)}\lesssim_{\alpha,\beta}  \frac{1}{N^\gamma}\delta^{-2}N^{\frac15}N^{\frac1{10}}\lesssim_{\delta,\alpha,\beta} 1.
\end{equation}
The result now follows from \eqref{jfhury40rlvbk5yih9} and \eqref{jfhury40rlvbk5yih9'}.

Finally, assume that $\alpha/\beta$ is Liouville. Then the result follows right away from  \eqref{xcniery8u3ifhtgp[r0-9dvruyfg73t895ugijk'} and the fact that $A_n(x)\ge \|\alpha (x+n)-\gamma_1\|^2.$

\end{proof}
We now begin the final part of the argument of part (a) of Theorem \ref{TT2}.
Let now $\gamma$ satisfy \eqref{xcniery8u3ifhtgp[r0-9} and \eqref{xcniery8u3ifhtgp[r0-9ufts} if $\alpha/\beta$ is Diophantine, and let $\gamma=2$ if $\alpha/\beta$ is Liouville.

Let  $S\subset [0,1)$ be a set that satisfies \eqref{e4}-\eqref{e6}, where now  $C=0$ (thus minimal decay is assumed). Note that since $f$ is no longer assumed to be continuous, all we can guarantee about $S$ is that it has positive measure. This however is enough to guarantee -via a classical result-  that $1_S*1_{-S}(0)>0$. Since $1_S*1_{-S}$ is continuous, there must exist an interval $I$ centered at the origin and $\delta>0$, such that $1_S*1_{-S}(p)>\delta$ on $I$. This implies that for each $p\in -I$,
$$|\{x\in S:x+p\in S\}|>\delta.$$
It is automatic (by pigeonholing as before) that there exists a sequence of integers $N_k\to\infty$ and $D=D(\alpha,\beta,s)\in (0,\infty)$ such that

(i) $\{P_k:=\frac{N_k}{\beta}\}<|I|/2$,

(ii) $N_k^{\gamma}\|N_k\frac{\alpha}{\beta}\|\le D$

 Let $E_{[P_k],\delta}$ be the exceptional set guaranteed by Lemma \ref{l7'}. This set will depend on $k$, but this dependence will not be relevant.
Then the set
$S_k:=\{x\in S:x-\{P_k\}\in S\}\cap ([0,1]\setminus E_{[P_k],\delta})$ is nonempty for each $k\ge 1$. Pick some $x_k\in S_k$, and finish the argument exactly like in the proof of Theorem \ref{t:main}, by working on the orbits of $x_k$ and $x_k-\{P_k\}$. In particular, note that by the argument in Proposition \ref{P1},
$$|\prod_{n=0}^{[P_k]-1}P(x_k-P_k+n)|\lesssim |\prod_{n=0}^{[P_k]-1}P(x_k+n)|,$$
with an implicit constant depending only on the fundamental parameters.

We caution that some implicit constants will now also depend on $\gamma$, $\epsilon$ and $\delta$. This is tolerable, since these   only depend on the  fundamental parameters.

Part (b) of Theorem \ref{TT2} is much simpler. Indeed, if say, $\alpha$ is rational, then
$$\|\alpha(x+n)-\gamma_1\|\gtrsim_{\delta,\alpha} 1$$ for each $n\in\N$ and each $x$ outside some $E_\delta$ with measure $\le \delta$. Lemma \ref{L4} implies that $|p(\alpha(x+n),\beta(x+n))|\gtrsim_{\delta,\alpha} 1$ for each $x\notin E_\delta$. In particular, the estimate in Lemma \ref{l7} $$\frac{1}{N}\sum_{n=0}^{N-1}\frac{1}{|P(x+n)|}\lesssim_{\delta,C_0,C_1,C_2,\alpha,\beta} 1$$
holds trivially (this time with $\gamma=1$). The rest of the argument is the same as in the proof of Theorem \ref{t:main}. One would have to apply the inequality above for $N=N_k$ satisfying
$$\sup_kN_k\|N_k\frac{\alpha}{\beta}\|\lesssim 1.$$

\section{Proof of Theorem \ref{TT2'}}
\label{S4}
The proof of part (a) of Theorem \ref{TT2'} follows the same general pattern as the proof of Theorem \ref{TT2}, but it is significantly simpler. We briefly sketch the details for part (a). As before, given $s>0$, there exists a sequence $N_k\to\infty$ of positive integers satisfying

(i) $\{P_k:=\frac{N_k}{\beta}\}<s$,

(ii) $\sup_kN_k\log N_k\|N_k\frac{\alpha}{\beta}\|\lesssim 1$

We have the following analogue of Proposition \ref{P1}.
\begin{proposition}
\label{P1bjfjghrthuy457t585urhrgyfgety}
Let $(N_k)$ be a sequence such that (ii) above holds, and define $P_k:=\frac{N_k}{\beta}$. Let $P(x)=A+Be(\alpha x)$, $Q(x)=C+De(\beta x)$, $R(x)=\frac{P(x)}{Q(x)}$. Given $\delta>0$,  there exists $E_{k,\delta}\subset [0,1]$ such that $|E_{k,\delta}|\le \delta$ such that  for each $x,y$ satisfying $x\in [0,1)\setminus E_{k,\delta}$ and $x=y+P_k$, we have
$$|\prod_{n=0}^{[P_k]-1}R(y+n)|\lesssim_{A,B,C,D,\alpha,\beta,\delta} |\prod_{n=0}^{[P_k]-1}R(x+n)|.$$
\end{proposition}
\begin{proof}

Lemma \ref{l7} implies  that  there exists an exceptional set $E_{k,\delta}\subset [0,1]$ such that
\begin{equation}
\label{yweytcn90r8t5t[hlpl;'lh;.;h,nfgfhjghjjhhfgj}
\frac{1}{N_k}\sum_{n=0}^{N_k}\frac{1}{|P(x+n)|}+\frac{1}{N_k}\sum_{n=0}^{N_k}\frac{1}{|Q(x+n)|}\lesssim_{\delta,\alpha,\beta,A,B,C,D}\log N_k,
\end{equation}
for each $x\in [0,1]\setminus E_{k,\delta}$. If $x=y+P_k$, we have
$$|e(\alpha x)-e(\alpha y)|=|e(P_k\alpha)-1|\lesssim \frac{1}{P_k\log P_k}$$
$$|e(\beta x)-e(\beta y)|=|e(P_k\beta)-1|\lesssim \frac{1}{P_k\log P_k}.$$
Thus, for each $n\in \N$
$$|P(y+n)|\le |P(x+n)|+O(\frac{1}{P_k\log P_k}),$$
$$|Q(y+n)|\ge |Q(x+n)|-O(\frac{1}{P_k\log P_k}).$$
Use the fact $a+b\le ae^{\frac{b}{a}}$ for each $a,b>0$ to get
$$|R(y+n)|\le |R(x+n)|e^{\frac{1}{P_k\log P_k |P(x+n)|}+\frac{1}{P_k\log P_k |Q(x+n)|}}.$$
The result now follows from \eqref{yweytcn90r8t5t[hlpl;'lh;.;h,nfgfhjghjjhhfgj}.
\end{proof}
The rest of the argument for part (a) is like in the proof of Theorem \ref{TT2}.

The almost periodicity argument is ineffective for  part (b) of Theorem \ref{TT2'}, because of \eqref{yweytcn90r8t5t[hlpl;'lh;.;h,n}. Our argument combines instead  the conjugates trick from the proof Theorem \ref{t:main} for (2,2) configurations, with a periodicity argument.
Assume there is a measurable function  $f:\R\to \C$, some $d\in (0,\infty)$ and some $S\subset [0,1]$ with positive measure such that
\begin{equation}
\label{eeeeeeeeeeeeeeeeeeeeeee2}
d^{-1}<|f(x)|<d\;\;\text{for each }x\in S,
\end{equation}
\begin{equation}
\label{eeeeeeeeeeeeeeeeeeeeeee3}
\lim_{|n|\to\infty\atop_{n\in\Z}}f(x+n)=0,
\end{equation}
$$f(x+1)(A+Be(\alpha x))=f(x)(C+De(\beta x)),$$
for a.e. $x$, for some fixed $A,B,C,D\in\C$, $\alpha,\beta\in\R$, none of them zero. Let as before
$$P(x)=A+Be(\alpha x),\;\;\;Q(x)=C+De(\beta x).$$Assume also that $\beta=\frac{p}{r}$ is rational.
We can trivially assume $A$ is real and that $S+\Z$ contains no zeros of $P$ and $Q$.

Let $B=re(\theta)$, with $r>0$. By invoking Birkhoff's pointwise ergodic theorem for the function $1_S$, there exists $x\in S$ and some $n'\in \N$ large enough such that $z:=\{-x-\frac{2\theta}{\alpha}+n'\alpha^{-1}\}\in S$ and such that $m:=[-x-\frac{2\theta}{\alpha}+n'\alpha^{-1}]>0$. Let $y:=-x-\frac{2\theta}{\alpha}+n'\alpha^{-1}$. We point out that $x,z,m$ are fixed for the rest of the argument, and thus they can be thought of as a fundamental parameters. The point of this selection is that for each $n\in\Z$,
$A+Be(\alpha y-n\alpha )$ and $A+Be(\alpha x+n\alpha)$ are complex conjugates
and thus, for each $N$
$$\prod_{n=-N+m}^{m}|P(z+n)|=\prod_{n=0}^{N}|P(x+n)|.$$
It follows that
\begin{equation}
\label{eeeeeeeeeeeeeeeeeeeeeee1}
\prod_{-N+m}^{n=-1}|P(z+n)|\gtrsim_{m,A,B}\prod_{n=0}^{N}|P(x+n)|
\end{equation}
Define $T(x)=|Q(x)Q(x+1)\ldots Q(x+r-1)|$. We distinguish two cases.

If $|T(x)|\ge |T(z)|$, then since $Q$ is $r$- periodic and $\inf_{k\in \Z}|Q(z+k)|>0$, we have
\begin{equation}
\label{eeeeeeeeeeeeeeeeeeeeeee4}
\prod_{n=-N+m}^{-1}|Q(z+n)|\lesssim_{m,x,z,C,D} \prod_{n=0}^{N}|Q(x+n)|.
\end{equation}
Using the fact that for each $N> m$
$$|f(x+N+1)|=|f(x)|\frac{\prod_{n=0}^{N}|Q(x+n)|}{\prod_{n=0}^{N}|P(x+n)|}$$
$$|f(z-N+m)|=|f(z)|\frac{\prod_{-N+m}^{n=-1}|P(z+n)|}{\prod_{-N+m}^{n=-1}|Q(z+n)|},$$
it follows that \eqref{eeeeeeeeeeeeeeeeeeeeeee2}-\eqref{eeeeeeeeeeeeeeeeeeeeeee4} can not hold simultaneously (just let $N\to\infty$).

If $|T(x)|\le |T(z)|$, then since $Q$ is $r$- periodic and $\inf_{k\in \Z}|Q(z+k)|>0$, we have

$$\prod_{n=-N+m}^{-1}|Q(x+n)|\lesssim_{m,C,D,x,z} \prod_{n=0}^{N}|Q(z+n)|.$$
Note also that as before,
$$\prod_{-N+m}^{n=-1}|P(x+n)|\gtrsim_{m,A,B,x,z}\prod_{n=0}^{N}|P(z+n)|.$$
Using the fact that for each $N\ge m$
$$|f(z+N+1)|=|f(z)|\frac{\prod_{n=0}^{N}|Q(z+n)|}{\prod_{n=0}^{N}|P(z+n)|}$$
$$|f(x-N+m)|=|f(x)|\frac{\prod_{-N+m}^{n=-1}|P(x+n)|}{\prod_{-N+m}^{n=-1}|Q(x+n)|},$$
the contradiction is forced like in the previous case.

\section{Open questions}
The argument from Theorem \ref{t:main}  seems to be too weak to tackle $(1,4)$ configurations like $(0,0),(1,0), (1,\alpha), (1,\beta), (1,\gamma)$. This is because the best one can guarantee in general is the existence of arbitrarily large $P$ such that $\max\{\|P\alpha\|,\|P\beta\|,\|P\gamma\|\}\lesssim \frac{1}{\sqrt{P}}$. It is not clear whether working with 3 or more orbits would have more to say about this case.

One can wonder if continuity can be removed from the proof of Theorem \ref{t:main} for special (2,2) configurations. If yes, Conjecture \ref{cc1} would follow right away for arbitrary (2,2) configurations. If no continuity is assumed, then the following is a typical worst case scenario
\begin{equation}
\label{eeeggtjjjjslllllllffffffff}
f(x+1)(1+e(\alpha x))=f(x)(1+e(\beta x)),
\end{equation}
with $\alpha,\beta$ distinct irrationals. The almost periodicity argument is ineffective in this case. Indeed, it is easy to see that
\begin{equation}
\label{yweytcn90r8t5t[hlpl;'lh;.;h,n}
\lim_{N\to\infty}\inf_{x\in [0,1]}\frac{1}{N}\sum_{n=1}^N\frac{1}{|1-e(x+\alpha n)|}=\infty.
\end{equation}
To see this, recall that by Dirichlet's theorem, for each $N$ there exists $p_N\in\N$ and $1\le m_N\le N$ relatively prime, such that
$$|\alpha-\frac{p_N}{m_N}|\le \frac{1}{m_NN}.$$
For each $i\in\{0,1,\ldots,m_N-1\}$, roughly $N/m_N$ of the points $1\le n\le N$ satisfy
$$\|\alpha n-\frac{i}{m_N}\|\le \frac{1}{m_N}.$$
Thus, for each $x\in [0,1]$
$$\frac{1}{N}\sum_{n=1}^N\frac{1}{|1-e(x+\alpha n)|}\gtrsim \sum_{i=1}^{m_N}\frac{1}{i}\sim \log m_N.$$
Finally, note that the irrationality of $\alpha$ forces $m_N\to\infty$.

It would be very interesting to know if given $\alpha\not=\beta$ the recurrence \eqref{eeeggtjjjjslllllllffffffff} can even hold along the orbit of a single point $x_0\in [0,1]$, in such a way that $\lim_{|N|\to\infty}f(x_0+N)=0$.

\section*{Acknowledgements}
We would like to thank Christoph Thiele  for stimulating our initial interest on the HRT conjecture. Special thanks to Zubin Gautam, Nets Katz, Joseph Rosenblatt and Alexandru Zaharescu for helpful discussions on the subject.


TITLE: Prove that if a and b are elements of an Abelian group G, with o(a) = m and o(b) = n, then (ab)^{mn}
QUESTION [1 upvotes]: (a) Prove that if a and b are elements of an Abelian group G, with o(a) = m and o(b) = n,then (ab)^{mn} = e. Indicate where you use the condition that G is Abelian.
(b) With G, a, and b as in part (a), prove that o(ab) divides o(a)o(b).
(c) Give an example of an Abelian group G and elements a and b in G such that
o(ab) $\neq$  o(a)o(b). Compare part (b).
Answer
a)  $a^{m}=e$, $b^n=e$ , which follows  $a^{mn}=e$, $b^{mn}=e$. Since G is abelian,  $(ab)^{mn}=a^{mn}b^{mn}=e$.
for b i know it somthing related to gcd(m,n) and lcm(m,n)
but i dont know hot to start the prove
and i think the the solution of b is the begining of the solution of c.

REPLY [1 votes]: Well, if $o(ab) = k \nmid mn$ then $mn = pk+q$ with $0 < q < k$ so $(ab) ^{mn} = ((ab)^k)^p(ab)^q = (ab)^q \ne e$
For the counterexample you can think of $o((1,1)) = 2$ while $o((0,1)) = 2 = o((1,0))$ in $\Bbb Z_2 \times \Bbb Z_2$


TITLE: Evaluating $\int_{0}^{\pi/4}\left[4\cos^2(x)-1\right]{\sqrt{\tan x}}\,\mathrm dx$ in a less tedious way
QUESTION [4 upvotes]: Consider this integral

$$\int_{0}^{\pi/4}\left[4\cos^2(x)-1\right]\color{red}{\sqrt{\tan x}}\,\mathrm dx\tag1=1$$

An attempt:
Rewrite $(1)$ as
$$\int_{0}^{\pi/4}4\cos^2(x)\sqrt{\tan x}\,\mathrm dx-\int_{0}^{\pi/4}\sqrt{\tan x}\,\mathrm dx=I_1-I_2\tag2$$
For $I_2$ we choose $u=\sqrt{\tan x}\implies {2u\over 1+u^2}dx=dx$, then it becomes
$$\int_{0}^{1}{2u^2\mathrm du\over 1+u^4}\tag3$$
Rearrange $(3)$ in the form of
$$\int_{0}^{1}{1+{1\over u^2}\over u^2+{1\over u^2}}\mathrm du+\int_{0}^{1}{1-{1\over u^2}\over u^2+{1\over u^2}}\mathrm du\tag4$$
Apply completing the square to $(4)$
$$\int_{0}^{1}{1+{1\over u^2}\over \left(u-{1\over u}\right)^2+2}\mathrm du+\int_{0}^{1}{1-{1\over u^2}\over \left(u+{1\over u}\right)^2-2}\mathrm du=I_3+I_4\tag5$$
For $I_3$ setting $v_1=u-{1\over u}$ and for $I_4$ setting $v_2=u+{1\over u}$ then
$$\left.{1\over \sqrt{2}}\tan^{-1}\left({v_1\over \sqrt{2}}\right)\right|_{0}^{\infty}-{1\over \sqrt{8}}
\left.\ln{\left({v_2+\sqrt{2}\over v_2-\sqrt{2}}\right)}\right|_{2}^{\infty}={\pi\over \sqrt{8}}+{1\over \sqrt{8}}\ln{(3+2\sqrt{2})}\tag6$$
We can rewrite $I_1$ as
$$I_1=2\int_{0}^{\pi/4}\sqrt{\tan x}\,\mathrm dx+2\int_{0}^{\pi/4}\cos(2x)\sqrt{\tan x}\,\mathrm dx\tag7$$
$$I_1=2\cdot(6)+2\int_{0}^{\pi/4}\cos(2x)\sqrt{\tan x}\,\mathrm dx\tag8$$
$(8)$ we can apply integration by part, I am sure it would be lengthy.
How else can we tackle $(1)$ in another less lengthy way?

REPLY [3 votes]: $\displaystyle J=\int_{0}^{\pi/4}\left[4\cos^2(x)-1\right]{\sqrt{\tan x}}\,\mathrm dx$
Perform the change of variable $y=\dfrac{\pi}{2}-x$,
$\displaystyle J=\int_{\tfrac{\pi}{4}}^{\tfrac{\pi}{2}}\dfrac{4(\sin x)^2-1}{\sqrt{\tan x}}dx$
Perform the change of variable $y=\sqrt{\tan x}$,
$\begin{align} J&=\int_{1}^{\infty} \dfrac{\tfrac{4}{1+\frac{1}{x^4}}-1}{x}\times \dfrac{2x}{1+x^4}dx\\
&=2\int_{1}^{\infty} \dfrac{3x^4-1}{(1+x^4)^2}dx\\
&=2\left[\dfrac{-x}{1+x^4}\right]_{1}^{\infty}\\
&=2\times \left(0+\dfrac{1}{2}\right)\\
&=\boxed{1}
\end{align}$