Ubiquity of simplices in subsets of vector spaces over finite fields

Abstract: We prove that a sufficiently large subset of the $d$-dimensional vector space over a finite field with $q$ elements, $ {\Bbb F}_q^d$, contains a copy of every $k$-simplex. Fourier analytic methods, Kloosterman sums, and bootstrapping play an important role.

\section{Introduction}

\vskip.125in
Many problems in combinatorial geometry ask, in one form or another,
whether a certain structure must be present in a set of sufficiently
large size. Perhaps the most celebrated result of this type is
Szemeredi's theorem (\cite{SO75}) which says that if a subset of the
integers has positive density, then it contains an arbitrary large
arithmetic progression. The conclusion has recently been extended to
the subsets of prime numbers by Green and Tao (\cite{GT07}). In
Euclidean space, a result due to Katznelson and Weiss (\cite{FKB90})
says that a subset of Euclidean space of positive Lebesgue upper
density contains every sufficiently large distance. A subsequent
result by Bourgain (\cite{BK86}), says that a subset of $\Bbb R^k$ of
positive Lebesgue upper density contains an isometric copy of all
large dilates of a set of $k$ points spanning a $(k-1)$-dimensional
hyperplane. Ergodic theory has been used to show that positive upper
density implies that the set contains a copy of a sufficiently large
dilate of every convex polygon with finitely many sides. See, for
example, a recent survey by Bryna Kra (\cite{K06}).

Let $\Bbb F_q^d$ be a $d$-dimensional vector space over a finite
field $\Bbb F_q$ of odd characteristic.  A plausible analogy to Bourgain's result (\cite
{BK86}) in this context would be to consider whether a subset of
positive density contains a isometric copy of a set of $k$ points
spanning a $(k-1)$-dimensional hyperplane. It turns out however, that
the positive density condition is much too strong in the context of vector spaces over finite fields and the same
conclusion follows from a much weaker assumption on the size of the
underlying set.

\begin{definition}
Let a $k$-simplex be a set of $k+1$ points in general position, which
means that
no $n + 1$ of these points, $n \leq k$, lie in a $(n - 1)$-dimensional
sub-space of ${\Bbb F}_q^d$.
\end{definition}

\begin{definition} We say that a linear transformation $T$ on ${\Bbb
F}_q^d$ is an isometry if
$$ ||Tx||=||x||,$$ where
$$ ||x||=x_1^2+x_2^2+\dots+x_d^2,$$ an element of ${\Bbb F}_q$.
\end{definition}

The question we ask in this paper is how large does $E \subset {\Bbb
F}_q^d$ need to be in order to be sure that it contains a copy of
every $k$-simplex.
Our main result is the following.
\begin{theorem} \label{main} Let $E \subset {\Bbb F}_q^d$, $d>{k+1 \choose 2}$, such that
$|E| \ge C q^{\tfrac{k}{k+1}d}q^{\tfrac{k}{2}}$ with a
sufficiently large constant $C>0$.  Then $E$ contains an isometric
copy of every $k$-simplex.
\end{theorem}

Note that we obtain non-trivial results only when $k<<\sqrt{d}$.
Nevertheless, in that range we are able to dip considerably below the
positive density condition on the underlying set $E$.

The method of proof relies on the fact that orthogonal
transformations on ${\Bbb F}_q^d$ are isometries.
A "distance representation" of a simplex is then used to reduce
Theorem \ref{main} to an appropriate weighted incidence theorem for
spheres and points.  Weil's estimate (\cite{We48}) for classical
Kloosterman sums is used to control the size of the Fourier transform
of spheres of non-zero radius. The key idea in the proof is to show
at each step of an inductive argument that a collection of distances
among vertices of a given simplex can not only be realized, but
actually occur a "statistically correct" number of times.
\vskip.125in

\section{Preliminaries and Definitions}
Let $\Bbb F _q^d$ be the $d$-dimensional vector space over the finite
field ${\Bbb F}_q$. The Fourier transform of a function
$$f: \Bbb F_q^d \rightarrow \Bbb C$$ is given by
\begin{equation*}
\widehat{f}(m) := q^{-d} \sum_{x \in \Bbb F_q^d} f(x) \chi(-x \cdot m),
\end{equation*}
where $\chi$ is an additive character on $\Bbb F_q$.

The orthogonality property of the Fourier Transform says that
$$ q^{-d}\sum_{x \in \Bbb F_q^d} \chi(-x \cdot m)=1$$ for $m=(0,
\dots, 0)$ and $0$
otherwise yields many standard properties of the Fourier Transform.

We summarize some of the properties of the Fourier Transform as follows.

\begin{lemma}[The Fourier Transform]
Let
$$f,g:\Bbb F_q^d \rightarrow \Bbb C.$$

\begin{align*}
& \hat f (0, \dots, 0) =q^{-d} \sum_{x \in \Bbb F_q^d} f(x),
\\
& (\text{Plancherel})\ q^{-d} \sum_{x \in \Bbb F_q^d} f(x) \overline{g
(x)} =\sum_{m \in \Bbb F_q^d} \hat{f}(m) \overline{\hat{g}(m)},
\\
& (\text{Inversion})\ \ \  f(x) =\sum_{m \in \Bbb F_q^d} \hat{f}(m)
\chi(x \cdot m).
\end{align*}
\end{lemma}

\subsection{Notation} Throughout the paper $X \lesssim Y$ means that
there exists $C>0$ such that $X\leq CY$, $X \gtrsim Y$ means $Y
\lesssim X$, and $X \approx Y$ if both $X\lesssim Y$ and
$X\gtrsim Y$.  Along the same lines, $X \ll Y $ means that $\tfrac{X}
{Y}\rightarrow 0$, as $q \to \infty$ $X \gg Y$ means $Y\ll X$, and $X
\sim Y$ if $\tfrac{X}{Y}\rightarrow 1$ as $q \rightarrow \infty$.
\vskip.125in

\section{Proof of the main result}
Even though a finite field with $q$ elements, ${\Bbb F}_q$, is not a
metric space, we define the "distance" between two points $x$ and $y$
in ${\Bbb F}_q^d$ by the formula
$$ ||x-y||={(x_1-y_1)}^2+{(x_2-y_2)}^2+\dots+{(x_d-y_d)}^2.$$
The same notion of "distance" was used by Bourgain, Katz and Tao(\cite
{BKT04}), and Iosevich and Rudnev(\cite{IR07}) in their study of the
Erd\H os distance problem in vector spaces over finite fields. As we
noted above, a geometric justification of this notion of distance is
that an orthogonal transformation on ${\Bbb F}_q^d$, a matrix $O$
such that $O^t \cdot O=I$, preserves this notion of a "distance".
Represent a $k$-simplex in a subset $E \subset \Bbb F_q^d$ on $k+1$
points recursively by setting
$$ {\cal T}_{l_k}=\{(x_0,\dots,x_{k-1},x_k) \in {\cal T}_{l_{k-1}}
\times E: ||x_0-x_k||=t_{1,k}, ||x_1-x_k||=t_{2,k},\dots,||x_{k-1}-x_k||=t_{k,k}\},$$
for $l_k=l_{k-1}\cup_\{t_{1,k},\dots t_{k,k}\},t_{i,j}\in \mathbb F_q^*$ where
$$ {\cal T}_{l_1}=\{(x_0,x_1) \in E^2: ||x_0-x_1||=t_{1,1}\}.$$
This representation does not, in general, always embody a simplex as $
{\cal T}_{l_k}^k$ is not guaranteed to be in general position.
However, as we show below, "legitimate" $k$-simplices are equivalent
up to an orthogonal transformation.

\begin{theorem} \label{simplexlemma} Let $E \subset {\Bbb F}_q^d$, $d>
{k+1 \choose 2}$, such that
$|E| \ge Cq^{\tfrac{k}{k+1}d}q^{\tfrac{k}{2}}$, with a
sufficiently large constant $C$.  Then for every side length set $l_k$, $l_k\in (\Bbb F_q^*)^{k+1 \choose 2}$ we have that $|{\cal T}_{l_k}|>0$.  Furthermore,
$$ |{\cal T}_{l_k}| \sim |E|^{k+1}q^{-{k+1 \choose 2}}.$$
\end{theorem}

Using this theorem we recover the main result of the paper using the
following linear algebraic observation.

\begin{lemma}\label{uptocrap} Let $P$ be a simplex with vertices
$V_0, V_1, \dots, V_k$, $V_j \in {\Bbb F}_q^d$. Let $P'$ be another
simplex with vertices $V'_0, V'_1, \dots, V'_k$. Suppose that
\begin{equation} \label{equalnorm} ||V_i-V_j||=||V'_i-V'_j|| \end{equation}
for all $i,j$.
Then there exists an orthogonal, affine transformation $O$ on ${\Bbb F}_q^d$ such
that $O(P)=P'$.
\end{lemma}

\vskip.125in

\subsection{Proof of Theorem \ref{simplexlemma}-the main result
reformulated in terms of "distances"}

The proof proceeds by induction. The first step is the case $k=2$.
For a set $E$ we define the characteristic or indicator function to
be $E(x)$.  Now define the sphere of radius $t_{1,1} \in \Bbb F_q^*$
to be
$$S_{t_{1,1}}=\{x \in {\Bbb F}_q^d: ||x||=t_{1,1}\},$$ then
\begin{align*}
|{\cal T}_{l_1}|&=|\{(x_0,x_1) \in E \times E: ||x_0-x_1||=t_{1,1}\}|
\\
&=\sum_{x_0,x_1} E(x_0)E(x_1)S_{t_{1,1}}(x_0-x_1).
\end{align*}

In order to obtain information from this quantity the behavior of
incidences of spheres and points in $E$ will be critical.  The
following classical fact, whose proof will be given in a subsequent
section, states that the sphere has optimal Fourier decay away
from the origin.

\begin{lemma} \label{sphere} Let $S_{t}$, $t \in \Bbb F_q^*
$ be defined as above. If $m \not=(0, \dots, 0)$ then
$$ |\widehat{S}_{t}(m)| \lesssim q^{-\frac{d+1}{2}}, $$ and
$$ \widehat{S}_{t}(0, \dots, 0)=q^{-d} |S_{t}| \approx q^{-1}.$$ \end{lemma}
Applying Fourier inversion to the sphere,
\begin{align*}
|{\cal T}_{l_1}|=&q^{2d}\sum_{x_0,x_1} E(x_0)E(x_1)\sum_m \widehat{S}_{t_{1,1}}(m)\chi(m\cdot(x_0-x_1))
\\
&=q^{2d} \sum_m {|\widehat{E}(m)|}^2 \widehat{S}_{t_{1,1}}(m)
\\
&={|E|}^2 \cdot q^{-d} \cdot |S_{t_{1,1}}|+q^{2d} \sum_{m \not=(0,
\dots, 0)} {|\widehat{E}(m)|}^2 \widehat{S}_{t_{1,1}}(m)
\\
&=M+R.\,
\end{align*}
By Lemma \ref{sphere},
$$ M \approx \frac{{|E|}^2}{q},$$ and using Lemma \ref{sphere} once
again,
\begin{align*}
|R| &\lesssim q^{2d} \cdot q^{-\frac{d+1}{2}} \cdot \sum_m {|\widehat
{E}(m)|}^2
\\
&=q^{\frac{d-1}{2}} \cdot |E|,
\end{align*}
which is smaller than $M$ if $|E| \ge Cq^{\frac{d+1}{2}}$ with a
sufficiently large constant $C$ and thus
${\cal T}_{l_1}$ is non-empty. Moreover, if $|E| \gg q^{\frac{d+1}
{2}}$, we get the "statistically expected" number of distances,
$$|{\cal T}_{l_1}| \sim \frac{{|E|}^2}{q}.$$

Assuming the $(k-1)$st case, we count the number of $k$-simplices
in $E$ as an extension of the $(k-1)$-simplices in $E$.
$$|{\cal T}_{l_{k}}|= \sum_{x_0,\dots,x_k} {\cal T}_{l_{k-1}}(x_0,\dots,x_{k-1})E(x_k)S_{t_{1,k}}(x_0-x_k)\dots S_{t_{k,k}}(x_{k-1}-x_k).$$
By Fourier inversion, the expression equals
$$ \sum_{x_0,\dots,x_k} \sum_{m_0,\dots,m_{k-1}} \prod_{i=1}^{k}\chi
((x_{i-1}-x_k) \cdot m_{i-1})\widehat{S}_{t_{i,k}}(m_{i-1}) {\cal T}_{l_{k-1}}(x_0,\dots,x_{k-1})E(x_k)$$
$$=q^{(k+1)d} \sum_{m_0,\dots,m_{k-1}} \widehat{{\cal T}}_{l_{k-1}}
(-m_0,\dots,-m_{k-1}) \widehat{E}(m_0+\dots+m_{k-1})  \widehat{S}_
{t_{1,k}}(m_0)\dots\widehat{S}_{t_{k,k}}(m_{k-1}),$$ where the
Fourier transform of ${\cal T}_{l_{k-1}}$ is actually the
Fourier transform on ${\Bbb F}_q^d \times\dots\times {\Bbb F}_q^d$,
$k$ times.

Extracting the zero term and breaking the remaining sum into pieces
on which we may apply Lemma \ref{sphere}, this expression equals
$$q^{(k+1)d} \cdot q^{-(k+1)d} \cdot |{\cal T}_{l_{k-1}}| \cdot |E|
\cdot |S_{t_{1,k}}| \cdot q^{-d}\cdot\dots \cdot |S_{t_{k,k}}|
\cdot q^{-d}$$
$$+q^{(k+1)d} \sum_{\substack{\mathcal{I} \cup \mathcal{I}'= \{ 0, \dots ,k-1 \} \\ m_i=0\ (i\in \mathcal{I})\\ m_i\neq 0\ (i \notin \mathcal{I})}}
\widehat{{\cal T}}_{l_{k-1}}(-m_0,\dots,-m_{k-1}) \widehat{E}(m_0+\dots+m_{k-1})\widehat{S}_{t_{1,k}}(m_0)\dots\widehat{S}_{t_{k,k}}(m_{k-1})$$
$$=M+R,$$ where the sum defining $R$ runs over all the partitions of $\{0,\dots,k-1\}$ with the case $\mathcal{I}'=\emptyset$
extracted and used as the main term $M$ above.

By Lemma \ref{sphere} and the induction hypothesis,
$$ M \sim {|E|}^{k+1}q^{-{k+1 \choose 2}}.$$

By Lemma \ref{sphere} we have that
$$|R|\lesssim q^{(k+1)d}\sum_{\substack{\mathcal{I} \cup \mathcal{I}'= \{ 0, \dots ,k-1 \} \\ m_i=0\ (i\in \mathcal{I})\\ m_i\neq 0\ (i \notin \mathcal{I})}}
q^{-|\mathcal{I}'|(d+1)/2-|\mathcal{I}|}
|\widehat{{\cal T}}_{l_{k-1}}(-m_0,\dots,-m_{k-1})| |\widehat{E}(m_0+\dots+m_{k-1})|.$$

Then for each term in the sum corresponding to a partition $\mathcal{I} \cup \mathcal{I}'$ we apply Cauchy-Schwarz,
$$\sum_{\substack{m_i=0\ (i\in \mathcal{I})\\ m_i\neq 0\ (i \notin \mathcal{I})}}
|\widehat{{\cal T}}_{l_{k-1}}(-m_0,\dots,-m_{k-1})| |\widehat{E}(m_0+\dots+m_{k-1})|
\lesssim A^{1/2}B^{1/2}.$$
Applying Plancherel and the induction hypothesis,
$$A\leq\sum_{m_0,\dots,m_{k-1}} |\widehat{{\cal T}}_{l_{k-1}}(-m_0,
\dots,-m_{k-1})|^2 =q^{-kd}|{\cal T}_{l_{k-1}}|\sim q^{-kd}q^{-{k \choose 2}} {|E|}^{k}.$$
Now
$$B=\sum_{m_i(i\in \mathcal{I}')}
\left| \widehat{E}\left(\sum_{i\in \mathcal{I}'}m_i \right)\right|^2=q^{|\mathcal{I}'|d}q^{-2d}|E|.$$
This implies that
$$|R|\lesssim q^{\tfrac{kd}{2}}q^{-\tfrac{k(k-1)}{4}} {|E|}^{\tfrac{k+1}{2}}\sum_{\mathcal{I} \cup \mathcal{I}'= \{ 0, \dots ,k-1 \}}
q^{-|\mathcal{I}'|(d+1)/2-|\mathcal{I}|} q^{|\mathcal{I}'|d}.$$

The largest term in the sum occurs when $\mathcal{I}=\emptyset$. We
conclude that
$$|R| \lesssim q^{\tfrac{kd}{2}} q^{-\tfrac{k(k+1)}{4}} {|E|}^
{\tfrac{k+1}{2}}.$$

The term $R$ is smaller than, say,  $\frac{M}{2}$ if
$$q^{\tfrac{kd}{2}} q^{-\tfrac{k(k+1)}{4}} {|E|}^{\tfrac{k+1}{2}}
\leq C {|E|}^{k+1}q^{-{k+1 \choose 2}},$$ with a sufficiently large
constant $C$, which happens if
$$ |E| \ge C'q^{\tfrac{k}{k+1}d}q^{\tfrac{k}{2}},$$ with a
sufficiently large constant $C'$ depending on the constants implicit
in the estimates above. This completes the proof.

\vskip.125in

\section{Proof of Lemma \ref{uptocrap}}

To prove Lemma \ref{uptocrap}, let $\pi_r(x)$ denote the $r$th coordinate of
$x$. There is no harm in assuming that $V_0=(0, \dots, 0)$. We may also
assume that $V_1, \dots, V_k$ are contained in ${\Bbb F}_q^k$. The condition
(\ref{equalnorm}) implies that
\begin{equation} \label{dotproduct} \sum_{r=1}^k \pi_r(V_i) \pi_r(V_j)=
\sum_{r=1}^k \pi_r(W_i) \pi_r(W_j). \end{equation}

Let $T$ be the linear transformation uniquely determined by the condition
$$ T(V_i)=V'_i.$$

In order to prove that $T$ is orthogonal, it suffices to show that
$$ ||Tx||=||x||$$ for any $x \not=(0, \dots, 0)$.

Since $V_j$s form a basis, by assumption, we have
$$ x=\sum_i t_i V_i, $$ so it suffices to show that
$$ ||x||=\sum_r \sum_{i,j} t_i t_j \pi_r(V_i) \pi_r(V_j)$$
$$=\sum_r \sum_{i,j} t_i t_j \pi_r(V'_i) \pi_r(V'_j)=||Tx||,$$ which follows
immediately from (\ref{dotproduct}).

Observe that we used the fact that orthogonality of $T$, the condition that
$T^t \cdot T=I$ is equivalent to the condition that $||Tx||=||x||$. To see
this observe that to show that $T^t \cdot T=I$ it suffices to show that
$T^tTx=x$ for all non-zero $x$. This, in turn, is equivalent to the
statement that
$$ <T^tTx,x>=||x||,$$ where
$$ <x,y>=\sum_{i=1}^k x_iy_i.$$

Now,
$$ <T^tTx,x>=<Tx, Tx>$$ by definition of the transpose, so the stated
equivalence is established. This completes the proof of Lemma
\ref{uptocrap}.

\vskip.125in

\section{Estimation of the Fourier transform of the sphere: proof of Lemma \ref{sphere}}
The proof of Lemma \ref{sphere} is fairly standard, but we outline
the argument for reader's convenience.  For any $m\in{\mathbb
F}^d_q$, we have
\begin{equation} \label{sphereparade}
\begin{array}{llllll} \widehat{S}_t(m)&=&
q^{-d} \sum_{x \in {\mathbb F}^d_q} q^{-1} \sum_{j \in {\mathbb F}_q} \chi(
j(\|x\|-t)) \chi( -  x \cdot m)\\ \hfill \\&=&q^{-1}\delta(m) +
q^{-d-1} \sum_{j \in {\mathbb F}^{*}_q} \chi(-jt) \sum_{x}
\chi( j\|x\|) \chi(- x \cdot m)\\ \hfill
\\&=&q^{-1}\delta(m)+   Q^d q^{-\frac{d+2}{2}} \sum_{j \in {\mathbb
F}^{*}_q}
\chi\left(\frac{\|m\|}{4j}+jt\right)\eta^d(-j),\end{array}\end{equation}
where the notation $\delta(m)=1$ if $m=(0\ldots,0)$ and $\delta(m)=0$
otherwise.
In the last line we have completed the square, changed $j$ to
$-j$, and used $d$ times the Gauss sum equality
\begin{equation}
\sum_{c\in {\mathbb F}_q} \chi(jc^2) = \eta(j)\sum_{c\in{\mathbb
F}_q}\eta(c)\chi(c)=\eta(j)\sum_{c\in{\mathbb F}_q^*}\eta(c)\chi(c) =
Q\sqrt{q}\,\eta(j),
\label{gauss}\end{equation} where the constant $Q$ equals $\pm1$ or $\pm i$, depending on
$q$, and $\eta$ is the quadratic multiplicative character (or the
Legendre symbol) of ${\mathbb F}_q^*$.
The conclusion now follows from the following classical estimate due to
A. Weil (\cite{We48}).
\begin{theorem} \label{kloosterman} Let
$$ K(a)=\sum_{s \not=0} \chi(as+s^{-1}) \psi(s), $$ where, once
again, $\psi$ is a multiplicative character on ${\Bbb F}_q^{*}$. Then
$$ |K(a)| \leq 2 \sqrt{q}$$ if $a \not=0$.
\end{theorem}
\vskip.125in
\newpage

Classical Analysis and ODEs (math.CA); Combinatorics (math.CO)


Unweighted linear congruences with distinct coordinates and the Varshamov--Tenengolts codes

Abstract: In this paper, we first give explicit formulas for the number of solutions of unweighted linear congruences with distinct coordinates. Our main tools are properties of Ramanujan sums and of the discrete Fourier transform of arithmetic functions. Then, as an application, we derive an explicit formula for the number of codewords in the Varshamov--Tenengolts code $VT_b(n)$ with Hamming weight $k$, that is, with exactly $k$ $1$'s. The Varshamov--Tenengolts codes are an important class of codes that are capable of correcting asymmetric errors on a $Z$-channel. As another application, we derive Ginzburg's formula for the number of codewords in $VT_b(n)$, that is, $|VT_b(n)|$. We even go further and discuss connections to several other combinatorial problems, some of which have appeared in seemingly unrelated contexts. This provides a general framework and gives new insight into all these problems which might lead to further work.

\section{Introduction}\label{Sec_1}

A \textit{$Z$-channel} (also called a \textit{binary asymmetric channel}) is a channel with binary input and binary output where a transmitted $0$ is always received correctly but a transmitted $1$ may be received as either $1$ or $0$. These channels have many applications, for example, some data storage systems and optical communication systems can be modelled using these channels. In 1965, Varshamov and Tenengolts \cite{VATE} introduced an important class of codes, known as the Varshamov--Tenengolts codes or VT-codes, that are capable of correcting asymmetric errors on a $Z$-channel (see also \cite{STYO, VAR}). Levenshtein \cite{LEV1, LEV2}, by giving an elegant decoding algorithm, showed that these codes could also be used for correcting a single deletion or insertion. Using the Varshamov--Tenengolts codes, Gevorkyan and Kabatiansky \cite{GEKA} constructed a class of binary codes of a specific length correcting single localized errors whose cardinality attains the ordinary Hamming bound.

\begin{definition}
Let $n$ be a positive integer and $0\leq b\leq n$ be a fixed integer. The Varshamov--Tenengolts code $VT_b(n)$ is the set of all binary vectors $\langle y_1,\ldots,y_n \rangle$ such that
$$
\sum_{i=1}^{n}iy_i \equiv b \pmod{n+1}.
$$
\end{definition}
For example, $VT_0(5)=\lbrace 00000, 10001, 01010, 11100, 00111, 11011 \rbrace$, where we have shown vectors as strings. So, $|VT_0(5)|=6$. The \textit{Hamming weight} of a string over an alphabet is defined as the number of non-zero symbols in the string. Equivalently, the Hamming weight of a string is the Hamming distance between that string and the all-zero string of the same length. For example, the Hamming weight of $01010$ is $2$, and the number of codewords in $VT_0(5)$ with Hamming weight $2$ is $2$.

Varshamov in his fundamental paper ``On an arithmetic function with an application in the theory of coding" (\cite{VAR2}) proved that the maximum number of codewords in the Varshamov--Tenengolts code $VT_b(n)$ is achieved when $b=0$, that is, $|VT_0(n)| \geq |VT_b(n)|$ for all $b$. Several natural questions arise: What is the number of codewords in the Varshamov--Tenengolts code $VT_b(n)$, that is, $|VT_b(n)|$? Given a positive integer $k$, what is the number of codewords in $VT_b(n)$ with Hamming weight $k$, that is, with exactly $k$ $1$'s? Ginzburg \cite{GIN} in 1967 considered the first question and proved an explicit formula for $|VT_b(n)|$. In this paper, we deal with both questions and obtain explicit formulas for them via a novel approach, namely, \textit{connecting the Varshamov--Tenengolts codes to linear congruences with distinct coordinates}. We even go further and show that the number of solutions of these congruences is related to several other combinatorial problems, some of which have appeared in seemingly unrelated contexts. (For example, as we will discuss in Section~\ref{Sec_4}, Razen, Seberry, and Wehrhahn \cite{RSW} considered two special cases of a function considered in this paper and gave an application in coding theory in finding the complete weight enumerator of a code generated by a circulant matrix.) This provides a general framework and gives new insight into all these problems which might lead to further work. Let us now describe these congruences.

Throughout the paper, we use $(a_1,\ldots,a_k)$ to denote the greatest common divisor (gcd) of the integers $a_1,\ldots,a_k$, and write $\langle a_1,\ldots,a_k\rangle$ for an ordered $k$-tuple of integers. Let $a_1,\ldots,a_k,b,n\in \mathbb{Z}$, $n\geq 1$. A linear congruence in $k$ unknowns $x_1,\ldots,x_k$ is of the form
\begin{align} \label{cong form}
a_1x_1+\cdots +a_kx_k\equiv b \pmod{n}.
\end{align}

By a solution of (\ref{cong form}), we mean an $\mathbf{x}=\langle x_1,\ldots,x_k \rangle \in \mathbb{Z}_n^k$ that satisfies (\ref{cong form}). The following result, proved by D. N. Lehmer \cite{LEH2}, gives the number of solutions of the above linear congruence:

\begin{proposition}\label{Prop: lin cong}
Let $a_1,\ldots,a_k,b,n\in \mathbb{Z}$, $n\geq 1$. The linear congruence $a_1x_1+\cdots +a_kx_k\equiv b \pmod{n}$ has a solution $\langle x_1,\ldots,x_k \rangle \in \mathbb{Z}_{n}^k$ if and only if $\ell \mid b$, where
$\ell=(a_1, \ldots, a_k, n)$. Furthermore, if this condition is satisfied, then there are $\ell n^{k-1}$ solutions.
\end{proposition}

Counting the number of solutions of the above congruence with some restrictions on the solutions is also a problem of great interest. As an important example, one can mention the restrictions $(x_i,n)=t_i$ ($1\leq i\leq k$), where $t_1,\ldots,t_k$ are given positive divisors of $n$. The number of solutions of the linear congruences with the above restrictions, which we called {\it restricted linear congruences} in \cite{BKSTT}, was first considered by Rademacher \cite{Rad1925} in 1925 and Brauer \cite{Bra1926} in 1926, in the special case of $a_i=t_i=1$ $(1\leq i \leq k)$. Since then, this problem has been studied, in several other special cases, in many papers (very recently, we studied it in its `most general case' in \cite{BKSTT}) and has found very interesting applications in number theory, combinatorics, geometry, physics, computer science, and cryptography; see \cite{BKS2, BKSTT, BKSTT2, JAWILL} for a detailed discussion about this problem and a comprehensive list of references.

Another restriction of potential interest is imposing the condition that all $x_i$ are {\it distinct} modulo $n$. Unlike the first problem, there seems to be very little published on the second problem. Recently, Grynkiewicz et al. \cite{GPP}, using tools from additive combinatorics and group theory, proved necessary and sufficient conditions under which the linear congruence $a_1x_1+\cdots +a_kx_k\equiv b \pmod{n}$, where $a_1,\ldots,a_k,b,n$ ($n\geq 1$) are arbitrary integers, has a solution $\langle x_1,\ldots,x_k \rangle \in \mathbb{Z}_{n}^k$ with all $x_i$ distinct modulo $n$; see also \cite{ADP, GPP} for connections to zero-sum theory. So, it would be an interesting problem to give an explicit formula for the number of such solutions. Quite surprisingly, this problem was first considered, in a special case, by Sch\"{o}nemann \cite{SCH} almost two centuries ago(!) but his result seems to have been forgotten. Sch\"{o}nemann \cite{SCH} proved an explicit formula for the number of such solutions when $b=0$, $n=p$ a prime, and $\sum_{i=1}^k a_i \equiv 0 \pmod{p}$ but $\sum_{i \in I} a_i \not\equiv 0 \pmod{p}$ for all $I\varsubsetneq \lbrace 1, \ldots, k\rbrace$. Very recently, the authors \cite{BKS6} generalized Sch\"{o}nemann's theorem using Proposition~\ref{Prop: lin cong} and a result on graph enumeration recently obtained by Ardila et al. \cite{ACH}. Specifically, we obtained an explicit formula for the number of solutions of the linear congruence $a_1x_1+\cdots +a_kx_k\equiv b \pmod{n}$, with all $x_i$ distinct modulo $n$, when $(\sum_{i \in I} a_i, n)=1$ for all $I\varsubsetneq \lbrace 1, \ldots, k\rbrace$, where $a_1,\ldots,a_k,b,n$ $(n\geq 1)$ are arbitrary integers. Clearly, this result does not resolve the problem in its full generality; for example, it does not cover the important case of $a_i=1$ ($1\leq i\leq k$) and this is what we consider in this paper with an entirely different approach. Specifically, we give an explicit formula for the number $N_n(k,b)$ of such solutions when $a_i=1$ ($1\leq i\leq k$), and do the same when in addition all $x_i$ are \textit{positive} modulo $n$.

Our main tools in this paper are properties of Ramanujan sums and of the discrete Fourier transform of arithmetic functions which are reviewed in the next section. In Section~\ref{Sec_3}, we derive the explicit formulas, and discuss applications to the Varshamov--Tenengolts codes. In Section~\ref{Sec_4}, we discuss connections to several other combinatorial contexts.

\section{Ramanujan sums and discrete Fourier transform} \label{Sec_2}

Let $e(x)=\exp(2\pi ix)$ be the complex exponential with period 1. For integers $m$ and $n$ with $n \geq 1$ the quantity
\begin{align}\label{def1}
c_n(m) = \mathlarger{\sum}_{\substack{j=1 \\ (j,n)=1}}^{n}
e\!\left(\frac{jm}{n}\right)
\end{align}
is called a {\it Ramanujan sum}. It is the sum of the $m$-th powers of the primitive $n$-th roots of unity, and is also denoted by $c(m,n)$ in the literature. From (\ref{def1}), it is clear that $c_n(-m) = c_n(m)$. Clearly, $c_n(0)=\varphi (n)$, where $\varphi (n)$ is {\it Euler's totient function}. Also, $c_n(1)=\mu (n)$, where $\mu (n)$ is the {\it M\"{o}bius function}. The following theorem, attributed to Kluyver~\cite{KLU}, gives an explicit formula for $c_n(m)$:

\begin{theorem} \label{thm:Ram Mob}
For integers $m$ and $n$, with $n \geq 1$,
\begin{align}\label{for:Ram Mob}
c_n(m) = \mathlarger{\sum}_{d\, \mid\, (m,n)} \mu
\!\left(\frac{n}{d}\right)d.
\end{align}
\end{theorem}

By applying the M\"{o}bius inversion formula, Theorem~\ref{thm:Ram Mob} yields the following property: For $m,n\geq 1$,
\begin{align} \label{Orth1 for cons}
\sum_{d\, \mid\, n} c_{d}(m)&=
  \begin{cases}
    n, & \text{if $n\mid m$},\\
    0, & \text{if $n\nmid m$}.
  \end{cases}
\end{align}

The {\it von Sterneck number} (\cite{von}) is defined by

\begin{align}\label{def3}
\Phi(m,n)=\frac{\varphi (n)}{\varphi \left(\frac{n}{\left(m,n\right)}\right)}\mu \!\left(\frac{n}{\left(m,n\right)} \right).
\end{align}

A crucial fact in studying Ramanujan sums and their applications is that they coincide with the von Sterneck number. This result is attributed to Kluyver~\cite{KLU}:

\begin{theorem} \label{thm:von rama}
For integers $m$ and $n$, with $n \geq 1$, we have
\begin{align}\label{von rama for}
\Phi(m,n)=c_n(m).
\end{align}
\end{theorem}

A function $f:\mathbb{Z} \to \mathbb{C}$ is called {\it periodic} with period $n$ (also called {\it $n$-periodic} or {\it periodic} modulo $n$) if $f(m + n) = f(m)$, for every $m\in \mathbb{Z}$. In this case $f$ is determined by the finite vector $(f(1),\ldots,f(n))$. From (\ref{def1}) it is clear that $c_n(m)$ is a periodic function of $m$ with period $n$.

We define the {\it discrete Fourier transform} (DFT) of an $n$-periodic function $f$ as the function
$\widehat{f}={\cal F}(f)$, given by
\begin{align}\label{FFT1}
\widehat{f}(b)=\mathlarger{\sum}_{j=1}^{n}f(j)e\! \left(\frac{-bj}{n}\right)\quad (b\in \mathbb{Z}).
\end{align}

The standard representation of $f$ is obtained from the Fourier representation $\widehat{f}$ by
\begin{align}\label{FFT2}
f(b)=\frac1{n} \mathlarger{\sum}_{j=1}^{n}\widehat{f}(j)e\!\left(\frac{bj}{n}\right) \quad (b\in \mathbb{Z}),
\end{align}
which is the {\it inverse discrete Fourier transform} (IDFT); see, e.g., \cite[p.\ 109]{MOVA}.

\section{Solutions with distinct coordinates}\label{Sec_3}

In this section, we obtain an explicit formula for the number of solutions $\langle x_1,\ldots,x_k \rangle \in \mathbb{Z}_{n}^k$ of the linear congruence $x_1+\cdots +x_k\equiv b \pmod{n}$, with all $x_i$ distinct modulo $n$. First, we need some preliminary results.

\begin{lemma}\label{lem: cyclo 1}
Let $n$ be a positive integer and $m$ be a non-negative integer. We have

$$
\mathlarger{\prod}_{j=1}^{n}\left(1-ze^{2\pi ijm/n}\right)=(1-z^{\frac{n}{d}})^d,
$$
where $d=(m,n)$.
\end{lemma}

\begin{proof}
It is well-known that (see, e.g., \cite[p. 167]{STAN})

$$
1-z^n=\mathlarger{\prod}_{j=1}^{n}\left(1-ze^{2\pi ij/n}\right).
$$
Now, letting $d=(m,n)$, we obtain

\begin{align*}
\mathlarger{\prod}_{j=1}^{n}\left(1-ze^{2\pi ijm/n}\right) &= \mathlarger{\prod}_{j=1}^{n} \left(1-ze^{2\pi ij\frac{m/d}{n/d}}\right)\\
&= \left(\mathlarger{\prod}_{j=1}^{n/d}\left(1-ze^{2\pi ij\frac{m/d}{n/d}}\right)\right)^d\\
&{\stackrel{(\frac{m}{d},\frac{n}{d})=1}{=}} \left(\mathlarger{\prod}_{j=1}^{n/d}\left(1-ze^{\frac{2\pi ij}{n/d}}\right)\right)^d=(1-z^{\frac{n}{d}})^d.
\end{align*}
\end{proof}

Similarly, we can prove that:

\begin{lemma}\label{lem: cyclo 2}
Let $n$ be a positive integer and $m$ be a non-negative integer. We have

$$
\mathlarger{\prod}_{j=1}^{n}\left(z-e^{2\pi ijm/n}\right)=(z^{\frac{n}{d}}-1)^d,
$$
where $d=(m,n)$.
\end{lemma}

Now, we simply get:

\begin{corollary}\label{cor: cyclo 1}
Let $n$ be a positive integer and $m$, $k$ be non-negative integers. The coefficient of $z^k$ in

$$
\mathlarger{\prod}_{j=1}^{n}\left(1+ze^{2\pi ijm/n}\right),
$$
is $(-1)^{k+\frac{kd}{n}}\binom{d}{\frac{kd}{n}}$, where $d=(m,n)$. Note that the binomial coefficient $\binom{d}{\frac{kd}{n}}$ equals zero if $\frac{kd}{n}$ is not an integer.
\end{corollary}

Now, we are ready to obtain an explicit formula for the number of solutions of the linear congruence.

\begin{theorem} \label{main thm dist ai=1}
Let $n$ be a positive integer and $b \in \mathbb{Z}_n$. The number $N_n(k,b)$ of solutions $\langle x_1,\ldots,x_k \rangle \in \mathbb{Z}_{n}^k$ of the linear congruence $x_1+\cdots +x_k\equiv b \pmod{n}$, with all $x_i$ distinct modulo $n$, is
\begin{align} \label{main thm dist ai=1: for}
N_n(k,b)=\frac{(-1)^k k!}{n}\mathlarger{\sum}_{d\, \mid \, (n,\;k)}(-1)^{\frac{k}{d}}c_{d}(b)\binom{\frac{n}{d}}{\frac{k}{d}}.
\end{align}
\end{theorem}

\begin{proof}
It is well-known that (see, e.g., \cite[pp. 3-4]{GUP}) the number of partitions of $b$ into exactly $k$ \textit{distinct} parts each taken from the given set $A$, is the coefficient of $q^bz^k$ in

$$
\mathlarger{\prod}_{j \in A}\left(1+zq^j\right).
$$
Now, take $A=\mathbb{Z}_n$ and $q=e^{2\pi im/n}$, where $m$ is a non-negative integer. Then, the number $P_n(k,b)$ of partitions of $b$ into exactly $k$ \textit{distinct} parts each taken from $\mathbb{Z}_n$ (that is, the number of solutions of the above linear congruence, with all $x_i$ distinct modulo $n$, if order does not matter), is the coefficient of $e^{2\pi ibm/n}z^k$ in

$$
\mathlarger{\prod}_{j=1}^{n}\left(1+ze^{2\pi ijm/n}\right).
$$
This in turn implies that

$$
\mathlarger{\sum}_{b=1}^{n}P_n(k,b)e^{2\pi ibm/n} = \text{the coefficient of $z^k$ in $\mathlarger{\prod}_{j=1}^{n}\left(1+ze^{2\pi ijm/n}\right)$}.
$$
Let $e(x)=\exp(2\pi ix)$. Note that $N_n(k,b)=k!P_n(k,b)$. Now, using Corollary~\ref{cor: cyclo 1}, we get

$$
\mathlarger{\sum}_{b=1}^{n}N_n(k,b)e\left(\frac{bm}{n}\right) = (-1)^{k+\frac{kd}{n}}k!\binom{d}{\frac{kd}{n}},
$$
where $d=(m,n)$. Now, by (\ref{FFT1}) and (\ref{FFT2}), we obtain
\begin{align*}
N_n(k,b) &= \frac{(-1)^{k}k!}{n}\mathlarger{\sum}_{m=1}^{n}(-1)^{\frac{kd}{n}}e\left(\frac{-bm}{n}\right)\binom{d}{\frac{kd}{n}}\\
&= \frac{(-1)^{k}k!}{n}\mathlarger{\sum}_{d\, \mid \, n}\mathlarger{\sum}_{\substack{m=1 \\ (m,\;n)=d}}^{n}(-1)^{\frac{kd}{n}}e\left(\frac{-bm}{n}\right)\binom{d}{\frac{kd}{n}}\\
&{\stackrel{m'=m/d}{=}} \;\; \frac{(-1)^{k}k!}{n}\mathlarger{\sum}_{d\, \mid \, n}\mathlarger{\sum}_{\substack{m'=1 \\ (m',\;n/d)=1}}^{n/d}(-1)^{\frac{kd}{n}}e\left(\frac{-bm'}{n/d}\right)\binom{d}{\frac{kd}{n}}\\
&= \frac{(-1)^{k}k!}{n}\mathlarger{\sum}_{d\, \mid \, n}(-1)^{\frac{kd}{n}}c_{n/d}(-b)\binom{d}{\frac{kd}{n}}\\
&= \frac{(-1)^{k}k!}{n}\mathlarger{\sum}_{d\, \mid \, n}(-1)^{\frac{kd}{n}}c_{n/d}(b)\binom{d}{\frac{kd}{n}}\\
&= \frac{(-1)^{k}k!}{n}\mathlarger{\sum}_{d\, \mid \, n}(-1)^{\frac{k}{d}}c_{d}(b)\binom{\frac{n}{d}}{\frac{k}{d}}\\
&= \frac{(-1)^{k}k!}{n}\mathlarger{\sum}_{d\, \mid \, (n,\;k)}(-1)^{\frac{k}{d}}c_{d}(b)\binom{\frac{n}{d}}{\frac{k}{d}}.
\end{align*}
\end{proof}

\begin{corollary} \label{special cases: b=0,1}
If $n$ or $k$ is odd then from (\ref{main thm dist ai=1: for}) we obtain the following important special cases of the function $P_n(k,b)=\frac{1}{k!}N_n(k,b)$:
\begin{align} \label{special case: b=0}
P_n(k,0)= \frac{1}{n}\mathlarger{\sum}_{d\, \mid \, (n,\;k)}\varphi(d)\binom{\frac{n}{d}}{\frac{k}{d}},
\end{align}
\begin{align} \label{special case: b=1}
P_n(k,1)= \frac{1}{n}\mathlarger{\sum}_{d\, \mid \, (n,\;k)}\mu(d)\binom{\frac{n}{d}}{\frac{k}{d}}.
\end{align}
\end{corollary}

\begin{corollary}
If $(n,k)=1$ then (\ref{main thm dist ai=1: for}) is independent of $b$ and simplifies as
$$N_n(k)=\frac{k!}{n}\binom{n}{k}.$$
(Of course, this can also be proved directly.) If in addition we have $n=2k+1$ then
$$
P_n(k)=\frac{1}{k!}N_n(k)=\frac{1}{2k+1}\binom{2k+1}{k}=\frac{1}{k+1}\binom{2k}{k},
$$
which is the Catalan number.
\end{corollary}

\begin{rema}
Using (\ref{Orth1 for cons}), it is easy to see that (\ref{main thm dist ai=1: for}) also works when $k=0$.
\end{rema}

Now, we introduce the important function $T_n(b)$ which is the sum of $P_n(k,b)$ over $k$. There are several interpretations for the function $T_n(b)$, for example, $T_n(b)$ can be interpreted as the number of subsets of the set $\lbrace 1, 2, \ldots, n \rbrace$ which sum to $b$ modulo $n$.

\begin{corollary}\label{nice function}
Let $T_n(b):=\sum_{k=0}^{n}\frac{1}{k!}N_n(k,b)=\sum_{k=0}^{n}P_n(k,b)$. Then we have
\begin{align} \label{nice function: for}
T_n(b)=\frac{1}{n}\mathlarger{\sum}_{\substack{d\, \mid \, n \\ d \; \textnormal{odd}}}c_{d}(b)2^{\frac{n}{d}}.
\end{align}
\end{corollary}

\begin{proof} We have
\begin{align*}
T_n(b)&= \mathlarger{\sum}_{k=0}^{n} \frac{(-1)^{k}}{n}\mathlarger{\sum}_{d\, \mid \, (n,\;k)}(-1)^{\frac{k}{d}}\binom{\frac{n}{d}}{\frac{k}{d}}c_{d}(b)\\
&= \frac{1}{n}\mathlarger{\sum}_{d\, \mid \, n}c_{d}(b)\mathlarger{\sum}_{\substack{k=0 \\ d\, \mid \,k}}^{n}(-1)^{k+\frac{k}{d}}\binom{\frac{n}{d}}{\frac{k}{d}}\\
&= \frac{1}{n}\mathlarger{\sum}_{\substack{d\, \mid \, n \\ d \; \textnormal{odd}}}c_{d}(b)\mathlarger{\sum}_{\substack{k=0 \\ d\, \mid \,k}}^{n}(-1)^{k+\frac{k}{d}}\binom{\frac{n}{d}}{\frac{k}{d}}
+\frac{1}{n}\mathlarger{\sum}_{\substack{d\, \mid \, n \\ d \; \textnormal{even}}}c_{d}(b)\mathlarger{\sum}_{\substack{k=0 \\ d\, \mid \,k}}^{n}(-1)^{k+\frac{k}{d}}\binom{\frac{n}{d}}{\frac{k}{d}}
\\
&=\frac{1}{n}\mathlarger{\sum}_{\substack{d\, \mid \, n \\ d \; \textnormal{odd}}}c_{d}(b)2^{\frac{n}{d}}.
\end{align*}
Note that in the last equality we have used the fact that if $d \mid n$ and $d$ is even then
$$
\mathlarger{\sum}_{\substack{k=0 \\ d\, \mid \,k}}^{n}(-1)^{k+\frac{k}{d}}\binom{\frac{n}{d}}{\frac{k}{d}}
= \mathlarger{\sum}_{\substack{k=0 \\ d\, \mid \,k}}^{n}(-1)^{\frac{k}{d}}\binom{\frac{n}{d}}{\frac{k}{d}}= 0.
$$
\end{proof}

What is the number of subsets of the set $\lbrace 1, 2, \ldots, n-1 \rbrace$ which sum to $b$ modulo $n$? Using Corollary~\ref{nice function}, we can obtain an explicit formula for the number of such subsets (see also \cite{MAZ}).

\begin{corollary}\label{nice function 2}
The number $T'_n(b)$ of subsets of the set $\lbrace 1, 2, \ldots, n-1 \rbrace$ which sum to $b$ modulo $n$ is
\begin{align} \label{nice function 2: for}
T'_n(b)=\frac{1}{2}T_n(b)=\frac{1}{2n}\mathlarger{\sum}_{\substack{d\, \mid \, n \\ d \; \textnormal{odd}}}c_{d}(b)2^{\frac{n}{d}}.
\end{align}
\end{corollary}

\begin{proof}
Let $A$ be a subset of the set $\lbrace 1, 2, \ldots, n-1 \rbrace$ which sum to $b$ modulo $n$. Then $A$ and $A\cup \lbrace n \rbrace$ are both subsets of the set $\lbrace 1, 2, \ldots, n \rbrace$ and both sum to $b$ modulo $n$. Therefore, $T'_n(b)=\frac{1}{2}T_n(b)$.
\end{proof}

Ginzburg \cite{GIN} in 1967 proved an explicit formula for the number of codewords in the $q$-ary Varshamov--Tenengolts codes, where $q$ is an arbitrary positive integer. This result was later rediscovered by Stanley and Yoder \cite{STYO} in 1973, and in the binary case (that is, when $q=2$) by Sloane \cite{SLO} in 2002. Now, we give a short proof for the binary case which we derive as a consequence of our results.

\begin{corollary}\label{VT exa tot}
The number $|VT_b(n)|$ of codewords in the Varshamov--Tenengolts code $VT_b(n)$ is
\begin{align} \label{VT exa tot: for}
|VT_b(n)|=\frac{1}{2(n+1)}\mathlarger{\sum}_{\substack{d\, \mid \, n+1 \\ d \; \textnormal{odd}}}c_{d}(b)2^{\frac{n+1}{d}}.
\end{align}
\end{corollary}

\begin{proof}
Let $\langle y_1,\ldots,y_n \rangle$ be a codeword in $VT_b(n)$. Note that $\sum_{i=1}^{n}iy_i$ is just the sum of some elements of the set $\lbrace 1, 2, \ldots, n \rbrace$. Therefore, finding the number of codewords in $VT_b(n)$ boils down to finding the number of subsets of the set $\lbrace 1, 2, \ldots, n \rbrace$ which sum to $b$ modulo $n+1$. The result now follows by a direct application of Corollary~\ref{nice function 2}.
\end{proof}

In some applications (for example, in coding theory) we also need to consider the case that all $x_i$ are \textit{positive} and \textit{distinct} modulo $n$. Now, we obtain an explicit formula for the number of such solutions.

\begin{theorem} \label{main thm dist pos ai=1}
Let $n$ be a positive integer and $b \in \mathbb{Z}_n$. The number $N_n^{>0}(k,b)$ of solutions $\langle x_1,\ldots,x_k \rangle \in \mathbb{Z}_{n}^k$ of the linear congruence $x_1+\cdots +x_k\equiv b \pmod{n}$, with all $x_i$ positive and distinct modulo $n$, is
\begin{align} \label{main thm dist pos ai=1: for}
N_n^{>0}(k,b)=\frac{(-1)^k k!}{n}\mathlarger{\sum}_{d\, \mid \, n}(-1)^{\lfloor\frac{k}{d}\rfloor}c_{d}(b)\binom{\frac{n}{d}-1}{\lfloor\frac{k}{d}\rfloor}.
\end{align}
\end{theorem}

\begin{proof}
Clearly, $N_n^{>0}(k,b)=N_n(k,b)-N_n^{0}(k,b)$, where $N_n^{0}(k,b)$ denotes the number of solutions $\langle x_1,\ldots,x_k \rangle \in \mathbb{Z}_{n}^k$ with all $x_i$ distinct modulo $n$ and one of $x_i$ is zero modulo $n$. Also, clearly, $N_n^{0}(k,b)=kN_n^{>0}(k-1,b)$. Thus,
\begin{align}\label{relation bet N and N>0}
N_n(k,b)=N_n^{>0}(k,b)+kN_n^{>0}(k-1,b).
\end{align}
Now, we use Theorem~\ref{main thm dist ai=1}. We have
\begin{align*}
N_n(k,b)&= \frac{(-1)^k k!}{n}\mathlarger{\sum}_{d\, \mid \, (n,\;k)}(-1)^{\frac{k}{d}}c_{d}(b)\binom{\frac{n}{d}}{\frac{k}{d}}\\
&= \frac{(-1)^k k!}{n}\mathlarger{\sum}_{d\, \mid \, (n,\;k)}(-1)^{\frac{k}{d}}c_{d}(b)\left(\binom{\frac{n}{d}-1}{\frac{k}{d}}+\binom{\frac{n}{d}-1}{\frac{k}{d}-1}\right)\\
&= \frac{(-1)^k k!}{n}\mathlarger{\sum}_{d\, \mid \, n}c_{d}(b)\left((-1)^{\frac{k}{d}}\binom{\frac{n}{d}-1}{\frac{k}{d}}-(-1)^{\frac{k}{d}-1}\binom{\frac{n}{d}-1}{\frac{k}{d}-1}\right)\\
&= \frac{(-1)^k k!}{n}\mathlarger{\sum}_{d\, \mid \, n}c_{d}(b)\left((-1)^{\lfloor\frac{k}{d}\rfloor}\binom{\frac{n}{d}-1}{\lfloor\frac{k}{d}\rfloor}-(-1)^{\lfloor\frac{k-1}{d}\rfloor}\binom{\frac{n}{d}-1}{\lfloor\frac{k-1}{d}\rfloor}\right)\\
&= \frac{(-1)^k k!}{n}\mathlarger{\sum}_{d\, \mid \, n}(-1)^{\lfloor\frac{k}{d}\rfloor}c_{d}(b)\binom{\frac{n}{d}-1}{\lfloor\frac{k}{d}\rfloor}\\
&+k\frac{(-1)^{k-1} (k-1)!}{n}\mathlarger{\sum}_{d\, \mid \, n}(-1)^{\lfloor\frac{k-1}{d}\rfloor}c_{d}(b)\binom{\frac{n}{d}-1}{\lfloor\frac{k-1}{d}\rfloor}.
\end{align*}
Note that in the fourth equality above we have used the fact that $\lfloor\frac{k}{d}\rfloor=\lfloor\frac{k-1}{d}\rfloor+1$ if $d \mid k$, and $\lfloor\frac{k}{d}\rfloor=\lfloor\frac{k-1}{d}\rfloor$ if $d\nmid k$. Now, recalling (\ref{relation bet N and N>0}) we obtain the desired result.
\end{proof}

We believe that Theorem~\ref{main thm dist pos ai=1} is also a strong tool and might lead to interesting applications. Denote by $VT_b^{1,k}(n)$ the set of codewords in the Varshamov--Tenengolts code $VT_b(n)$ with Hamming weight $k$. Theorem~\ref{main thm dist pos ai=1} immediately gives an explicit formula for the number of such codewords. This result is useful in the study of a class of binary codes that are immune to single repetitions \cite{DOAN}.

\begin{corollary}\label{VT exa k1s}
The number $|VT_b^{1,k}(n)|$ of codewords in the Varshamov--Tenengolts code $VT_b(n)$ with Hamming weight $k$ is
\begin{align} \label{VT exa k1s: for}
|VT_b^{1,k}(n)|=\frac{(-1)^k}{n+1}\mathlarger{\sum}_{d\, \mid \, n+1}(-1)^{\lfloor\frac{k}{d}\rfloor}c_{d}(b)\binom{\frac{n+1}{d}-1}{\lfloor\frac{k}{d}\rfloor}.
\end{align}
\end{corollary}

\begin{proof}
Let $\langle y_1,\ldots,y_n \rangle$ be a codeword in $VT_b(n)$ with Hamming weight $k$, that is, with exactly $k$ $1$'s. Denote by $x_j$ the position of the $j$th one. Note that $1\leq j \leq k$ and $1 \leq x_1 < x_2 < \cdots < x_k \leq n$. Now, we have
$$
\sum_{i=1}^{n}iy_i \equiv b \pmod{n+1} \Longleftrightarrow x_1+\cdots +x_k\equiv b \pmod{n+1}.
$$
Therefore, finding the number of codewords in $VT_b(n)$ with Hamming weight $k$ boils down to finding the number of solutions $\langle x_1,\ldots,x_k \rangle \in \mathbb{Z}_{n+1}^k$ of the linear congruence $x_1+\cdots +x_k\equiv b \pmod{n+1}$, with all $x_j$ positive and distinct modulo $n+1$, and with disregarding the order of the coordinates. The result now follows by a direct application of Theorem~\ref{main thm dist pos ai=1}.
\end{proof}

\begin{rema}
There is an earlier interesting result of Dolecek and Anantharam \cite{DOAN} which gives the formula (\ref{VT exa k1s: for}) in a special case where the Hamming weight is dependent on the modulus, but here we give a more general treatment where the Hamming weight is \textit{arbitrary}. Of course, the expression (3.7) in their paper is exactly the same as our formula (\ref{main thm dist ai=1: for}), so it is an interesting problem to prove a 1-1 correspondence between these two results.
\end{rema}

\section{More connections}\label{Sec_4}

Interestingly, some special cases of the functions $P_n(k,b)$, $N_n(k,b)$, $T_n(b)$, and $T'_n(b)$ that we studied in this paper have appeared in a wide range of combinatorial problems, sometimes in seemingly unrelated contexts. Here we briefly mention some of these connections. It would be interesting to prove 1-1 correspondences between these interpretations.

\bigskip

\textbf{Ordered partitions acted upon by cyclic permutations.} Consider the set of all ordered partitions of a positive integer $n$ into $k$ parts acted upon by the cyclic permutation $(1 2 \ldots k)$. Razen, Seberry, and Wehrhahn \cite{RSW} obtained explicit formulas for the cardinality of the resulting family of orbits and for the number of orbits in this family having exactly $k$ elements. These formulas coincide with the expressions for $P_n(k,0)$ and $P_n(k,1)$, respectively, when $n$ or $k$ is odd (see Corollary~\ref{special cases: b=0,1}). Razen et al. \cite{RSW} also discussed an application in coding theory in finding the complete weight enumerator of a code generated by a circulant matrix.

\bigskip

\textbf{Permutations with given cycle structure and descent set.} Gessel and Reutenauer \cite{GERE} counted permutations in the symmetric group $S_n$ with a given cycle structure and descent set. One of their results gives an explicit formula for the number of $n$-cycles with descent set $\lbrace k \rbrace$, which coincides with the expression for $P_n(k,1)$ when $n$ or $k$ is odd.

\bigskip

\textbf{Fixed-density necklaces and Lyndon words.} If $n$ or $k$ is odd then the expressions for $P_n(k,0)$ and $P_n(k,1)$ give, respectively, the number of fixed-density binary necklaces and fixed-density binary Lyndon words of length $n$ and density $k$, as described by Gilbert and Riordan \cite{GIRI}, and Ruskey and Sawada \cite{RUSA}.

\bigskip

\textbf{Necklace polynomial.} The function $T_n(b)$ is closely related to the polynomial

$$
M(q, n)= \frac{1}{n}\sum_{d\, \mid \, n}\mu(d)q^{\frac{n}{d}},
$$
which is called the \textit{necklace polynomial} of degree $n$ (it is easy to see that $M(q, n)$ is integer-valued for all $q \in \mathbb{Z}$). In fact, if $n$ is odd then $M(2, n)=T_n(1)$. The necklace polynomials turn up in various contexts in combinatorics and algebra.

\bigskip

\textbf{Quasi-necklace polynomial.} The function $T'_n(b)$ is also closely related to the polynomial

$$
M'(q, n)= \frac{1}{2n}\sum_{d\, \mid \, n}\mu(d)q^{\frac{n}{d}},
$$
that we call the \textit{quasi-necklace polynomial} of degree $n$. In fact, if $n$ is odd then $M'(2, n)=T'_n(1)$. The quasi-necklace polynomials also turn up in various contexts in combinatorics. For example, they appear as:

\begin{itemize}

   \item the number of transitive unimodal cyclic permutations obtained by Weiss and Rogers \cite{WERO} (motivated by problems related to the structure of the set of periodic orbits of one-dimensional dynamical systems) using methods related to the work of Milnor and Thurston \cite{MITH}. See also \cite{THIB} which gives a generating function for the number of unimodal permutations with a given cycle structure;

   \item the number of periodic patterns of the tent map \cite{AREL}.

\end{itemize}

\section*{Acknowledgements}
The authors would like to thank the anonymous referees for a careful reading of the paper and helpful suggestions. During the preparation of this work the first author was supported by a Fellowship from the University of Victoria (UVic Fellowship).


Approximate solutions of one dimensional systems with fractional derivative

Abstract: The fractional calculus is useful to model non-local phenomena. We construct a method to evaluate the fractional Caputo derivative by means of a simple explicit quadratic segmentary interpolation. This method yields to numerical resolution of ordinary fractional differential equations. Due to the non-locality of the fractional derivative, we may establish an equivalence between fractional oscillators and ordinary oscillators with a dissipative term.

\section{Introduction}

The study of fractional derivatives for its application in classical and quantum physics has lately received a lot of attention \cite{KST,HER,UCH}. Needless to say that one of the simplest and most studied of those systems is the one dimensional harmonic oscillator. Thus, it would be a good  point of departure in the study of systems with fractional derivative, a task which has been carried out in \cite{MAI}. Damped oscillator with fractional derivative has been also the objective of some studies, see \cite{OO}. Some extensions of the theory to other classical systems have been proposed, see for instance \cite{OO1} and references therein, or in \cite{CEY}.

In many of these papers, it was noted an analogy between a fractional oscillator and a classical oscillator with a damping term. This could be an idea to be exploited in order to model quantum systems with dissipation, in which the second derivative of the wave function in the Schr\"odinger equation be replaced by a fractional derivative, see \cite{OO2}.

The present work has been inspired by the article by Narahari et. al. \cite{AHEC}, where in addition to the study of the one dimensional harmonic oscillator with fractional derivative, they give a comparison with an equivalent dissipative oscillator described on the phase plane and analyze the stability of the solution.

Along the present manuscript, we show that it may be possible the determination of a time interval in which the solution of a fractional one dimensional oscillator may be approximated by the solution of a one dimensional ordinary equation with a dissipative term. The idea could be described by using a very simple example. Let us consider the Caputo derivative $D^\alpha_0$, defined in \eqref{1} below, and the fractional differential equation $D^\alpha_0\,x(t)=0$, with $1<\alpha\le 2$ and initial conditions $x(0)=0$ and $\dot x(0)=-1$. The solution is $x(t)=-t$. Then, let us consider the equation $\ddot z(t)=-p\dot z(t)$, $p>0$. The goal is the determination of a value of $p$ such that the solution of this equation with initial conditions $z(0)=0$ and $\dot z(0)=-1$, i.e., the same initial conditions imposed to the fractional equation, be approximated by the solution of the fractional equation over a finite time interval. This is clear, since the solution of the equation on $z(t)$ is

$$
z(t)=\frac 1p (-1+e^{-pt})\,.
$$

Therefore, on a time interval $0<t<\tau$, with $\tau=1/p$, we have $z(t)=-t+o(t^2)$. In this sense of having similar approximate solutions on a finite interval, we say that the fractional and the dissipative equations are {\it equivalent}.  Here, we want to extend this idea.

Observe that in our notion of equivalence, we have discarded the asymptotic regime. This is essentially due to two reasons: i.) for large values of time, the fractional oscillator does not show oscillations; ii.) the behaviour of the oscillator from a strictly physical point of view, whether linear or non-linear but particularly the latter, has interest for finite times only. Its asymptotic behaviour is not measurable and has a mathematical interest only, and it is not the object of our study.

The present paper is organized as follows: On Section 2, we construct a method to obtain approximate solutions of fractional differential equations, with fractional Caputo derivative to be defined there, based on segmentary interpolation. This kind of interpolation has been used successfully to obtain approximate solutions of ordinary differential equations \cite{GL}. On Section 3, we apply this method to the fractional linear oscillator and to some other simple examples and make estimations on its precision. We compare results with those obtained replacing the fractional oscillator by the ordinary oscillator with a dissipative term.  We present a similar analysis by replacing the equation of the oscillator by the van der Pol equation on Section 4. We close this paper with some concluding remarks.

\section{Caputo fractional derivative and its evaluation by segmentary interpolation}

Let $\alpha$ be a real positive number and denote by $n=\lceil \alpha \rceil$ the smaller integer bigger than $\alpha$. Let us define the Caputo fractional derivative, $D^\alpha_a$, of a $n$ times differentiable function of real variable, $x(t)$, as \cite{DIE}

\begin{equation}\label{1}
D^\alpha_a \,x(t) = \frac 1{\Gamma(n-\alpha)} \int_a^t \frac{x^{(n)}(s)}{(t-s)^{\alpha-n+1}} \,ds\,,
\end{equation}
where $x^{(n)}(s)$ means the $n$-th derivative of the function $x(s)$. Our objective, as mentioned at the header of the present section, is an evaluation of \eqref{1} using segmentary interpolation. Here, we consider that $0<\alpha<1$, so that the only choice for $n$ is $n=1$, and this will be the case for some of our applications. Segmentary interpolation is a standard tool of wide use in the approximation of solutions of differential equations \cite{HNW}. Let us sketch the method here for completeness, using an approach that has been used in previous articles by our group \cite{GL,FLS}.

Let $[a,b]$ be a compact interval in the real axis $\mathbb R$. At regular intervals, we select $n$ nodes, $a= t_0<t_1<\dots<t_n=b$, with $t_k-t_{k-1}=h$, for all $k=1,2,\dots,n$, so that $kn=b-a$. Let $x(t):[a,b] \longmapsto\mathbb C$ be a continuous function and use the notation $x_k:=x(t_k)$ and $I_k:=[t_{k-1},t_k]$\,, for all $k=1,2,\dots,n$.

Then, a quadratic segmentary interpolator $S(t)$ for the function $x(t)$, is a continuous function $S(t):[a,b]\longmapsto \mathbb C$, with first continuous derivative, such that

1.- On each interval of the form $I_k=[t_{k-1},t_k]$, $k=1,2,\dots,n$, we have that $S(t)\equiv P_k(t)$, where $P_k(t)$ is a polynomial of order two, depending on the given interval.

2.- The function $S(t)$ interpolates $x(t)$, in the sense that for any of the nodes $\{t_k\}$, one has that

\begin{equation}\label{2}
P_k(t_{k-1})=x_{k-1}\,,\qquad P_k(t_k)=x_k\,, \qquad k=1,2,\dots,n\,.
\end{equation}

The condition on the continuity of the derivative $S'(t)$ implies that

\begin{equation}\label{3}
P'_k(t_k) =P'_{k+1}(t_k)\,, \qquad k=1,2,\dots,n-1\,.
\end{equation}

Thus, the construction of the segmentary interpolator $S(t)$ relies in the construction of the interpolating polynomials $P_k(t)$. We propose the following form for the interpolating polynomials: For each of the intervals $I_k$, let us define,

\begin{equation}\label{4}
P_k(t) =p_k(t)+a_k(t-t_{k-1})(t-t_k)\,,
\end{equation}
with

\begin{equation}\label{5}
p_k(t) =\frac{t-t_{k-1}}{h}\,x_k-\frac{t-t_k}{h}\,x_{k-1}\,,
\end{equation}
and the complex coefficients $a_k$ are given by

\begin{equation}\label{6}
a_k= \sum_{j=0}^n c_{k,j}\,x_j\,.
\end{equation}

We still need to determine the values of the $c_{k,j}$, which are

\begin{equation}\label{7}
c_{j,k} = \left\{ \begin{array}{ll} \frac{(-1)^k}{h^2}\,\eta_1\,,  & {\rm if}\; j=0\,, \\[2ex]
\frac{(-1)^{k+1}}{h^2}\,(2\eta_1+\eta_2)\,, &  {\rm if}\; j=1\,, \\[2ex]
\frac{(-1)^{k+j}}{h^2}\,(\eta_{j-1}+2\eta_j+\eta_{j+1}) \,, & {\rm if}\; 1<j<n-1\,, \\[2ex]
\frac{(-1)^{k+n-1}}{h^2}\,(2\eta_{n-2}+\eta_{n-1}) \,, & {\rm if}\; j=n-1\,, \\[2ex]
\frac{(-1)^{k+n}}{h^2}\, \eta_{n-1} \,, & {\rm if}\; j=n \,,
\end{array}  \right.
\end{equation}
where $\eta_j=j/n$ if $j\le k-1$ and $\eta_j=j/n-1$ if $j>k-1$.

Taking into account that $S(t)$ is an approximation of $x(t)$, on each of the nodes $t_k$ the Caputo fractional derivative \eqref{1} is approximated by

\begin{equation}\label{8}
D^\alpha_{a} x(t_k) \approx \frac{1}{\Gamma(1-\alpha)} \sum_{j=1}^k \int_{t_{j-1}}^{t_j} \frac{P'_j(s)}{(t_k-s)^\alpha}\,ds\,,\qquad k=1,\dots,n\,.
\end{equation}

Then, on each of the intervals $I_k$, we have that $P'_k(t)=\alpha_k\,t+\beta_k$, with

\begin{equation}\label{9}
\alpha_k=2a_k\,,\qquad \beta_k= \frac{x_k-x_{k-1}}{h} - a_k(2t_{k-1}+h)\,,
\end{equation}
and, consequently, equation \eqref{8}, takes the following form:

\begin{equation}\label{10}
D^\alpha_{a} x(t_k) \approx \frac{1}{\Gamma(1-\alpha)} \sum_{j=1}^k  \widetilde c_{k,j}\,\alpha_j + \widetilde d_{k,j}\,\beta_j\,.
\end{equation}

The new coefficients $\widetilde c_{k,j}$ and $\widetilde d_{k,j}$ are given by

\begin{equation}\label{11}
\widetilde c_{k,j} = \int_{t_{j-1}}^{t_j} \frac{s\,ds}{(t_k-s)^\alpha}\,,\qquad  \widetilde d_{k,j} = \int_{t_{j-1}}^{t_j} \frac{ds}{(t_k-s)^\alpha}\,,
\end{equation}
which obviously depend solely of the partition.

It is customary to choose $a=x_0=0$, which obviously does not restrict generality. Since the integrals in \eqref{11} are easily solvable and we know expressions for $\alpha_j$ and $\beta_j$, we can write the right hand side in \eqref{10} as

\begin{equation}\label{12}
D^\alpha_{a} x(t_k) \approx \frac{1}{(-1+\alpha)(-2+\alpha)\,\Gamma(1-\alpha)} \, \sum_{j=1}^k \gamma_{k,j}\,\alpha_j\,,
\end{equation}
where,

\begin{eqnarray}\label{13}
\gamma_{k,j} = [h(-j+k)]^{-\alpha} \,[h(1-j+k)]^{-\alpha} \, \Big\{ h(-1+j-k) \,[h(-j+k)]^\alpha \nonumber\\[2ex] \times
[-2h(-2+j+k) +h (-3+2j)\alpha-2(-2+\alpha)t_{j-1}] \nonumber\\[2ex] -h(j-k)\,[h(1-j+k)]^\alpha \, [-2h(-1+j+k)+h(-1+2j)\alpha-2(-2+\alpha) t_{j-1}] \Big\}\,.
\end{eqnarray}

This is a quite simple and workable receipt to obtain, once $x(t)$ is given, the values of its Caputo fractional derivative at the nodes $t_k$, so that we have an estimation of this fractional derivative.

It is interesting to remark that, due to the linear dependence on $\{x_n\}$ of the coefficients $\alpha_j=2a_j$ given in \eqref{6}, then, the derivative $D^\alpha_{a} x(t_k)$ in \eqref{12} can be explicitly determined from $x(t)$.

\subsection{A type of differential equations with fractional derivative}

Let $x(t):[a,b]\longmapsto \mathbb R^m$ be a differentiable real function of the real variable $t$ and $f(t,x):[a,b]\times\mathbb R^m\longmapsto \mathbb R^m$. In addition, we assume that $x(t^*)=x^*$, where $t^*$ is one of the nodes $\{t_k\}$, $a\le t^*\le b$, and $0<\alpha<1$. Then, let us consider the following fractional differential equation:

\begin{equation}\label{14}
D^\alpha_a x(t) = f(t,x(t))\,.
\end{equation}

The objective is to obtain an approximation for the solution of equation \eqref{14} under the condition $x(t^*)=x^*$. We already know how to obtain the identity \eqref{14} in the nodes $t_k$. Take these nodes with the exception of $t^*$. Then, \eqref{14} provides of an algebraic system of equations where the indeterminates are $\{x_{j,k}\}_{j=1,k=0}^{m,n}$ with $x_{j,k}:=x_j(t_k)$ and $x_{j,k}\ne x^*_j=x_j(t^*)$. This algebraic system may or may not be linear depending on the form of $f(t,x(t))$ and is of order $(mn)\times(mn)$. A numerical solution of this system could be obtained by whatever method, which gives a segmentary solution $S(t)$, which is given once one has obtained the coefficients $a_k$ defined in \eqref{6}.

In the particular case in which $f(t,x(t))$ contains an eigenvalue $\lambda$ and $f$ be linear with respect to $(\lambda,x)$ this algebraic system is linear and homogeneous. The eigenvalue is determined in the usual way.

As the reader may easily understand, this method is more general than the usual way to obtain a solution knowing an initial value, since now $t^*$ could be any node. In particular, the restriction to the solution that replaces the initial value condition could be imposed at $t^*$, and this represents a great advantage when compared with the shooting method worked out in \cite{DIE1,DB}.

\section{The fractional linear oscillator}

A simple example of an equation of the type \eqref{14} is the linear oscillator with the fractional derivative, which is defined as

\begin{equation}\label{15}
D_0^\alpha\,x(t) =-\omega^2\,x(t)\,.
\end{equation}

As in the standard harmonic oscillator the constant $\omega^2=k/m$, where $m$ is the oscillator mass and $k$ a constant, $\alpha$ being the order of derivation that in the present case we assume to be $1<\alpha \le 2$. Using the definition \eqref{1}, taking into account that for some differentiable function $f(t)$ (in our case $f(t)=x(t)$ or $f(t)=\dot x(t)$, where the dot means first derivative), we have that

\begin{equation}\label{16}
\lim_{\alpha\to 0^+} \frac1{\Gamma(\alpha+1)}\, t^\alpha\,f(0)=f(0)\,,
\end{equation}
and that $n$ is either 2 or 3, we may integrate by parts \eqref{15} using \eqref{1}, which gives the following integral version of \eqref{2}:

\begin{equation}\label{17}
x(t) = x(0)+\dot x(0) -\frac{\omega^2}{\Gamma(-\alpha)}\int_0^t (t-s)^{-\alpha-1}\,x(s)\,ds\,.
\end{equation}

The general solution has the form

\begin{equation}\label{18}
x(t) = c_1\,  E_{\alpha,1}(-\omega^2 t^{\alpha}) + c_2\,t\, E_{\alpha,2} (-\omega^2 t^{\alpha})\,,
\end{equation}
where $E_{\alpha,\beta}(z)$ is the so called Mittag-Leffler function

\begin{equation}\label{19}
E_{\alpha,\beta}(z) = \sum_{k=0}^\infty \frac{z^k}{\Gamma(\alpha k+\beta)}\,.
\end{equation}

Thus, in order to obtain a particular solution, we have to impose some initial conditions. For instance, if we choose $x(0)=1$ and $\dot x(0)=0$, the solution to \eqref{17} with these initial conditions is given by

\begin{equation}\label{20}
x(t)= E_{\alpha,1} (-\omega^2 t^{\alpha})\,.
\end{equation}

Let us find a particular numerical solution to the fractional linear oscillator, using the method introduced in Section 2.1. We have to choose a particular value for $\omega$ and the simplest possibility is $\omega=1$. This is developed in the forthcoming subsection.

\subsection{Some numerical estimations.}

First of all, it is not the objective here to give explicit expressions for the approximate solutions for the studied examples. It is not difficult to plot these solutions for different values of $n$.

Let us start with equation \eqref{15} with $\omega=1$ on the interval $0\le t\le 1$, with $0<\alpha<1$ and initial condition $x(0)=1$. As seen above, this equation has exact solution given by $x_{\rm exact}(t)=E_{\alpha,1}(-t^\alpha)$ \cite{DIE}. The objective is now an estimation on the precision of the proposed method. As customary, this precision is measured by using the following parameter:

\begin{equation}\label{21}
e_n(\alpha)= \int_0^1 [x_{\rm exact}(t)-x_n(t)]^2\,dt\,,
\end{equation}

Here, $n$ is the number of sub-intervals $I_n$ in which we partite $[0,1]$, the number of nodes being $n+1$. The dependence of this parameter on $\alpha$ shows that the smaller is the value of $\alpha$, or equivalently the closer is $\alpha$ to zero, the lower is the precision and, therefore, the slower is the convergence to the exact value. However, we do not observe significative variations on the precision when we increase the value of $n$, i.e., as we make the sub-intervals smaller and smaller.

\vskip1cm

\centerline{$
\begin{array}
[c]{cccc}
n & e_{n}(0.1) & e_{n}(0.5) & e_{n}(0.9)\\[2ex]
5 & 7.4\text{ }10^{-3} & 1.7\text{ }10^{-3} & 2.0\text{ }10^{-4}\\
10 & 3.0\text{ }10^{-3} & 4.9\text{ }10^{-4} & 2.8\text{ }10^{-5}\\
20 & 1.1\text{ }10^{-3} & 1.4\text{ }10^{-4} & 5.9\text{ }10^{-6}\\
40 & 3.0\text{ }10^{-4} & 3.7\text{ }10^{-5} & 1.3\text{ }10^{-6}
\end{array}
$}

\medskip
\centerline{Table 1.- Values of the precision in terms of $n$ and $\alpha$.}

\vskip1cm

This can be seen in Table 1, where we have chosen values of $n$ ranging from 5 to 40. The values of $\alpha$ studied are 0.1, 0.5 and 0.9.

Let us study the precision of the method with another example different from the fractional oscillator, yet an equation of the form \eqref{14}. Here, we have chosen,

\begin{equation}\label{22}
D^{1/2}_0 x(t) =\sin x(t)\,,
\end{equation}
on the interval $[0,1]$, with the initial condition $x(1)=5/2$, which was already studied in \cite{DIE1}, where the integration was performed by means of the iterative shot method. Contrarily to the previous example, here we do not know an exact solution. The way out is to define the precision as

\begin{equation}\label{23}
e_n= \int_0^1 [D^{1/2}_0 x_n(t) -\sin x_n(t)]^2\, dx\,,
\end{equation}
where $n$ is again the number of intervals and $x_n(t)$ is the interpolating function for the studied case. After integration and using the boundary condition, we obtain $x(0)$. Along with \eqref{23}, we introduce another parameter that measures the convergence and that we denote as $e_r\%$. It represents the relative variation between the value of $y(0)$, obtained for a given value of $n$, and the value given for the precedent value of $n$ as listed on Table 2.

 Table 2 is just a sample of numerous numerical examples we have performed. This sample is significative, as it manifest an obvious convergence and shows that the result obtained for a small number of nodes is satisfactory.

\vskip1cm

\centerline{$
\begin{array}
[c]{cccc}
n & y(0) & e_{r}\% & e_{n}\\[2ex]
5 & 1.74895 & -- & 1.8\text{ }10^{-2}\\
10 & 1.73812 & 0.5 & 7.4\text{ }10^{-3}\\
20 & 1.73326 & 0.3 & 2.6\text{ }10^{-3}\\
30 & 1.73166 & 0.09 & 1.1\text{ }10^{-3}\\
40 & 1.73085 & 0.05 & 5.6\text{ }10^{-4}
\end{array}
$}

\medskip
\centerline{Table 2: Values of $y(0)$, $e_r\%$ and $e_n$ for a given value of $n$}

\vskip1cm

Finally, we have performed another reliability test, which was the use of the value of $y(0)$ obtained numerically as initial value and evaluate the value of $y(1)$. In all cases, we have recovered the value $y(1)=5/2$.

\subsection{Damped oscillator with entire derivative.}

As is well known, the damped oscillator with entire derivative is given by

\begin{equation}\label{24}
m \ddot y(t)+ p\dot y(t)+k y(y)=0\,,
\end{equation}
where $m$, $p$ and $k$ are constants. Here, we assume that $p>0$.

For $p=0$, the limit for $\alpha\longmapsto 2^-$ in \eqref{15} should give the solution $y(t)$ for \eqref{24}, which we denote here as $\lim_{\alpha\to 2^-}x(t)=y(t)$. The solution $x(t)$ is damped oscillatory on the transitory regime only \cite{AHEC,DIE,KST}. Based on these notions, we propose the following Ansatz:

{\it For each given $1<\alpha\le 2$, there exists $p>0$  such that the solution $x(t)$ of \eqref{15} with $\alpha$ is a good approximation of the solution $y(t)$ of \eqref{24} with $p$, in the transitory regime}.

Using this Ansatz, let us obtain an approximate solution $y(t)$ for \eqref{24} such that this and its corresponding solution $x(t)$ for \eqref{15} fulfil the conditions $y(0)=x(0)$ and $\dot y(0)=\dot x(0)$. This is:

\begin{equation}\label{25}
y(t) = \exp\left( -\frac pm\,t \right)\, (c_-\exp(-\Delta t) +c_+ \exp(\Delta t))\,,
\end{equation}
where,

\begin{equation}\label{26}
\Delta= \sqrt{(p/m)^2-4\omega^2}\,,\quad \lambda_\pm =\frac{-p\pm\Delta}{2}\,,\quad c_\pm =\pm \frac{\lambda_\mp}{\Delta}\,,
\end{equation}
where $\omega^2$ was given in \eqref{15}.

Then, the point is the determination of the value of $p$ being given the value of $\alpha$, or equivalently the determination of a function $p=p(\alpha)$, in application to our Ansatz. This is an optimal control problem. We have to find the optimal solution, which minimizes  the following functional:

\begin{equation}\label{27}
E(\alpha):= \frac 1T \int_0^T [x(t)-y(t)]^2\,dt\,,
\end{equation}
where $T$ is some time scale in which the amplitude of the oscillations are reduced by a factor of $1/T$. On the interval $[0,T]$, the transitory regime, we compare the solutions of the fractional derivative $x(t)$ and of the damped oscillator $y(t)$.  The functional $E(\alpha)$ measures the deviation between $x(t)$ and $y(t)$. Then, go back to \eqref{20} and note that the function $E_{\alpha,1} (-\omega^2 t^{\alpha})$ is not asymptotically oscillating as $t\longmapsto 0$. This permits us to choose a value of $T$, although not small, not very high either. Numerical experiments have shown that the choice $T=20$ is appropriate.

Let us give some numerical results. On Table 3, we give the dependence between values of $\alpha$, $p(\alpha)$ and $E(\alpha)$ for the values $k=m=1$ and $n=50$.

\vskip1cm

\centerline{$
\begin{array}
[c]{ccc}
\alpha & p & E\\[2ex]
1.10 & 1.140 & 6.4\,10^{-3}\\
1.30 & 0.891 & 5.7\,10^{-3}\\
1.50 & 0.668 & 4.7\,10^{-3}\\
1.70 & 0.433 & 3.3\,10^{-3}\\
1.90 & 0.152 & 1.1\, 10{-3}\\
1.95 & 0.754 & 4.3\, 10^{-4}\\
2 & 0 & 0
\end{array}
$}

\medskip
\centerline{Table 3: Comparison between the values of $\alpha$, $p$ and $E$,}

\centerline{for $T=20$, $k=m=1$ and $n=50$.}

\vskip1cm

An explicit expression of the function $p(\alpha)$ may be obtained by the least-square method and this gives $p(\alpha)= 1.49409 +0.056127 \,\alpha - 0.401446\,\alpha^2$. This is depicted on Figure 2.

On Figure 1, we represent the usual behaviour in the transitory regime for $x(t)$ and $y(t)$, when we choose $\alpha=1.7$ and $n=50$.

It is interesting to remark that numerical experiments show that $p(\alpha)$ does not depend on any choice of initial values.

\subsection{Non-linear oscillator}

Following the discussion on the damped oscillator, we present a similar problem given by the following non-linear oscillator:

\begin{equation}\label{28}
D_0^\alpha\,x(t) =y(t)\,, \qquad D_0^\alpha\,y(t) =-\sin x(t)\,,
\end{equation}
with $0<\alpha\le 1$. Let us choose the initial values given by $x(0)=1$ and $y(0)=0$. Clearly, for small oscillations equation \eqref{28} becomes equation \eqref{15} with the replacement $\alpha \rightarrow 2\alpha$. Again, this is a non-linear problem having no analytic solution for $\alpha$ non-integer. Then, we proceed by analogy with the damped oscillator. In this case, we consider the following system involving entire derivatives only:

\begin{equation}\label{29}
\dot z(t)=w(t)\,,\qquad \dot w(t)=-p w(t)-\sin z(t)\,,\qquad p>0\,.
\end{equation}

On the transitory regime, we compare the solutions of systems \eqref{28} and \eqref{29} under the conditions $z(0)=x(0)=1$ and $w(0)=y(0)=0$. To do this, we need the previous determination of $p(\alpha)$, which we assume that minimizes the following quadratic dispersion:

\begin{equation}\label{30}
E(\alpha)=\frac 1T \int_0^T  \{ [x_n(t)-z(t)]^2 +[y_n(t)-w(t)]^2 \}\,dt\,.
\end{equation}

Obviously, this expression generalizes \eqref{27}. Again, we adjust the value of $T$ by numerical experiments, which show that $T=20$ is, again, a convenient choice. On Table 4, we give some values for the dependence between $\alpha$, $p(\alpha)$ and $E(\alpha)$ after the choice $T=20$ and $n=50$.

\vskip1cm

\centerline{$
\begin{array}
[c]{ccc}
\alpha & p & E\\[2ex]
0.50 & 1.203 & 5.5\,10^{-3}\\
0.70 & 0.757 & 3.9\,10^{-3}\\
0.90 & 0.294 & 2.1\,10^{-3}\\
0.95 & 0.148 & 1.4\,10^{-3}\\
1.00 & 0 & 0
\end{array}
$}

\medskip
\centerline{Table 4: Comparison between the values of $\alpha$, $p$ and $E$,}

\centerline{for the values $T=20$ and $n=50$.}

\vskip1cm

The above examples manifest an analogous behaviour between a fractional  linear oscillator and a damped or even non-linear oscillator on some time interval. The solutions between the fractional and the integer equation are very similar on some time scale. This could be a rather general situation, so that in many practical cases and inside a time interval, we conjecture that a fractional operator might be replaced by the frictional additional term on the classical oscillator. The behaviour of the solutions is similar to that shown in Figure 1.

\begin{figure}
\centering
\includegraphics[width=0.4\textwidth]{OLNL}
\caption{\small
{ The continuous line represents the solution, $x(t)$ of the fractional equation \eqref{15}, which is given by \eqref{25}. The dashed line gives the solution, $y(t)$, of the equation with ordinary derivative \eqref{25}.}
}
\label{}
\end{figure}

\begin{figure}
\centering
\includegraphics[width=0.4\textwidth]{PALF}
\caption{\small
Function $p(\alpha)$.
}
\label{}
\end{figure}

\section{On the fractional van der Pol equation}

The van der Pol equation is a second order non-linear ordinary differential equation \cite{VDP,FAR}. It has the following form:

\begin{equation}\label{31}
\ddot x(t) - \mu(1-x^2(t))\,\dot x(t) + x(t)=0\,,
\end{equation}
where $\mu\ge 0$ is a constant. When $\mu=0$, \eqref{31} is the equation of the ordinary harmonic oscillator. The van der Pol equation may be written in terms of a first order system as

\begin{equation}\label{32}
 \dot x(t):= z(t)\,,\qquad  \dot z(t)=-\mu (x^2(t)-1) z(t) -x(t)\,, \qquad \mu\ge 0\,.
\end{equation}

This equation has a unique limit cycle for $\mu\ne 0$, after the Li\'enard theorem \cite{STR}. This suggested us the interest of considering the possible existence of a limit cycle for the fractional system analogous to \eqref{32} given by

\begin{equation}\label{33}
D_0^\alpha\, x(t)=z(t)\,,\qquad D_0^\alpha \,z(t)= -\mu z(t) (x^2(t)-1)-x(t)\,,\qquad 0<\alpha\le 1.
\end{equation}

One fractional van der Pol equation of the type

\begin{equation}\label{34}
D_0^{\alpha+1}\, x(t) +\mu (x^2(t)-1)  D_0^\alpha \,x(t) +x(t)=0\,,
\end{equation}
has been studied in \cite{GUO}, where a relation between the parameters $\alpha$ and $\mu$ was given as a sufficient condition for the existence of a limit cycle, using the balance harmonic method \cite{DEU}.

We have studied the system \eqref{33} through numerical as well as analytic methods. We have performed a big amount of numerical experiments, which have shown the existence of a value of the parameter $\mu$, here called $\mu_c$, where the subindex $c$ stands for {\it critical}, which depends on $\alpha$ and $\mu_c(\alpha)>0$, such that

\begin{itemize}

\item{For values of $\mu$ with $0<\mu<\mu_c$, there is a fixed point $(x^*,z^*)=(0,0)$, which remains stable at the limit $t\longmapsto\infty$, $\lim_{t\to\infty}(x(t),z(t))=(0,0)$. Therefore, there is no stable limit cycle. In addition, there is no evidence of the existence of an unstable limit cycle.}

\item{For values $\mu>\mu_c$, the fixed point $(x^*,z^*)=(0,0)$ is unstable. We found a unique stable limit cycle. In this case a Hopf bifurcation emerges with $\mu_c$ as critical parameter.}

\item{As shown in Figure 3, $\mu_c(\alpha)$ decreases with $\alpha$ and $\lim_{\alpha \to1}\mu_c(\alpha)=0$.}

\end{itemize}

The point here is to show  the existence of the critical value for the parameter $\mu$ for a given value of $0<\alpha<1$, $\mu_c(\alpha)$. This existence has been manifested by the numerical estimations above. Nevertheless, this existence may be also shown analytically. To this end, we use the following result \cite{AEE}:

Let us consider the following system, where $D_0^\alpha$ represents the Caputo fractional derivative:

\begin{equation}\label{35}
D^\alpha_0 \, x(t)=f(x,z)\,,\qquad D^\alpha_0\,z(t)= g(x,z)\,,\qquad 0<\alpha<1\,.
\end{equation}

A solution $(x^*(t),z^*(t))$ is in equilibrium if $f(x^*(t),z^*(t))=g(x^*(t),z^*(t))=0$. It is asymptotically stable if the eigenvalues, $\lambda$, of the Jacobian matrix

\begin{equation}\label{36}
J(x,z):= \left(\begin{array}{cc} \partial f/\partial x & \partial f/\partial z \\[2ex] \partial g/\partial x & \partial g/\partial z  \end{array} \right)\,,
\end{equation}
when evaluated at the equilibrium point satisfies

\begin{equation}\label{37}
|\arg(\lambda)|>\alpha\,\frac \pi 2\,.
\end{equation}

A comparison between \eqref{33} and \eqref{35} gives the precise form of $f(x,z)$ and $g(x,z)$ for our particular case. This gives the precise form of \eqref{36} as

\begin{equation}\label{38}
J(x,z):= \left(\begin{array}{cc} 0 & 1 \\[2ex] -1-2\mu\,z(t)x(t) & -\mu(x^2(t)-1)  \end{array} \right)\,.
\end{equation}

Taking into account that the fixed point is located at $(x^*,z^*)=(0,0)$, we have that

\begin{equation}\label{39}
J(0,0)=\left(\begin{array}{cc} 0 & 1\\[2ex] -1 & \mu  \end{array} \right)\,,
\end{equation}
which has the following eigenvalues:

\begin{equation}\label{40}
\lambda_\pm= \frac 12 (\mu\pm \sqrt{\mu^2-4})\,.
\end{equation}

Obviously, if $\mu \ge 2$, then $\arg(\lambda_\pm)=0$. On the other hand, if $\mu<2$, one has that,

\begin{equation}\label{41}
\arg(\lambda_\pm)= \arctan \left(\pm\sqrt{\left( \frac 2\mu\right)^2-1} \right)\,.
\end{equation}

From \eqref{37}, the critical value, $\mu_c$, of $\mu$ should obey the following relation:

\begin{equation}\label{42}
\arctan \left(\pm\sqrt{\left( \frac 2\mu_c\right)^2-1} \right) = \alpha\,\frac \pi 2\,,
\end{equation}
which gives

\begin{equation}\label{43}
\mu_c= \frac{2}{\displaystyle \sqrt{1+\tan^2\left( \frac{\alpha\pi}{2}\right)}}\,.
\end{equation}

\begin{figure}
\centering
\includegraphics[width=0.4\textwidth]{MUC}
\caption{\small
Function $\mu_c(\alpha)$.
}
\label{}
\end{figure}

This is to say, if we fix $\alpha$ and start from $\mu\approx 0$, as we increase $\mu$, we go from a situation with a asymptotically stable fixed point to an unstable point. This happens when $\mu>\mu_c$. The transition from the stability to the unstability drives to the emergency of a limit cycle. We may qualitatively interpret the limit cycle loss as follows: let us consider $\mu\approx 0$ in \eqref{33}, which may then be approximated  by

\begin{equation}\label{44}
D_0^\alpha \,x(t) = z(t)\,,\qquad D_0^\alpha \,z(t)=-x(t)\,.
\end{equation}

This is the same than equation \eqref{28} with the paraxial approximation $\sin y(x)\approx y(x)$. Note that \eqref{44} does not show a limit cycle and, further, the trivial solution $(0,0)$ is an attractor. The second equation in \eqref{33} contains the term $-\mu\,z(x)(y^2(x)-1)$, which in the case of $\mu>\mu_c$ is not negligible. This fact outbalances the dissipation and this is precisely which makes it possible the existence of a limit cycle.

On Figure 4 and on the phase plane, the continuous and slashed curves represent the solution with entire and fractional derivative, respectively. Both trajectories are determined with same initial values and same parameter $\mu$. In all cases, the fractional limit circle is enclosed by the trajectory of the limit cycle with entire derivative.

On Figure 3, we show the relation $\mu_c=\mu_c(\alpha)$.  In the region above the curve, there exists a stable cycle limit and, furthermore, the fixed point $(0,0)$ is unstable. Below the curve the limit cycle does not exist and the fixed point is asymptotically stable. There is an obvious difference with the results obtained in \cite{GUO}, which is due to the fact that the fractional equations \eqref{33} and \eqref{34} are {\it not} equivalent.

\subsection{Equivalence between the fractional van der Pol equation and the same equation with entire derivative and dissipation.}

On the previous section, we have compared the approximate solutions of a dissipative oscillator with entire derivative with those of the linear oscillator with fractional derivative. Now, we want to carry out a similar analysis with the fractional van der Pol equation and a van der Pol equation with entire derivative and a dissipative term of the form $\beta z(t)$, $\beta>0$.   This system has the form,

\begin{equation}\label{45}
x'(t)=z(t)\,,\qquad z'(t)=-z(t)(\beta+\mu(x^2(t)-1))-z(t)\,, \qquad \mu\,,\beta>0\,.
\end{equation}

Here, the fixed point is $(x^*,z^*)=(0,0)$. To check its stability, we consider again equation \eqref{37}, which in the present case gives at the fixed point the following expression

\begin{equation}\label{46}
J(0,0)= \left(\begin{array}{cc} 0 & 1 \\[2ex] -1 & \mu-\beta \end{array}\right)\,,
\end{equation}
which has the eigenvalues

\begin{equation}\label{47}
\lambda_\pm = \frac{(\mu-\beta) \pm \sqrt{(\mu-\beta)^2-4}}2\,.
\end{equation}

Therefore, the fixed point is stable if Re$(\lambda_\pm)<0$ and unstable if Re$(\lambda_\pm)>0$, or equivalently, if $\mu-\beta<0$ and $\mu-\beta>0$, respectively. Then, for each $\mu$, there exists a $\beta_c=\mu$, where the Hopf bifurcation of the fixed point appears and, consequently, the destruction of the limit cycle.

In any case, according to the Li\'enard theorem \cite{STR,FAR}, we may show that there exists a unique stable limit cycle if $\mu-\beta<0$. In consequence, the van der Pol equations with entire derivative and dissipation and fractional have qualitatively the same properties.

We have checked numerically a qualitative equivalence, in the sense of having approximately the same solution, through a substantial number of numerical experiments, between equations \eqref{44} (with fractional derivative) and \eqref{45} (with entire derivative). Thus by trial and error, we have determined a value of $\beta$ giving the same cycle in both cases. For instance, if we give the values $\alpha=0.9$ and $\mu=0.1$, we obtained $\beta\cong 0.315$. In an analogous manner, we trial with values for which $\mu<\mu_c$ and obtained similar conclusions.

On Figure 5, we represent limit cycles for the fractional and dissipative entire van der Pol equations.

\begin{figure}
\centering
\includegraphics[width=0.4\textwidth]{CLEF}
\caption{\small
Comparison between the entire (continuous curve) and the fractional (slashed curve) van der Pol solutions, with the same value of $\mu$.
}
\label{}
\end{figure}

\begin{figure}
\centering
\includegraphics[width=0.4\textwidth]{CERF}
\caption{\small
Comparison between the damped (continuous curve) and the fractional (slashed curve) van der Pol solutions.
}
\label{}
\end{figure}

\section{Concluding remarks}

We have applied a quadratic spline method  in order to obtain functions that approximate the result of applying a fractional derivative to a given function.  This is suitable to obtain solutions to some differential equations with initial values or mixed conditions of potential interest in Physics or Engineering.  We have tested our method with the fractional linear oscillator, where exact solutions are known and checked its degree of precision. Results of numerous numerical experiments show that for values of $\alpha$ in the range $0<\alpha<1$, the higher is $\alpha$, the better is the precision of our method.  Here, $\alpha$ is the order of the fractional derivation, $D^\alpha$. However, there are not substantial differences when we increase the number of nodes on the interval under our consideration. Similar results have been obtained for non-linear oscillators.

Based on previous studies on the approximation of solutions of the fractional linear oscillator by solutions of a damped oscillator, we have used our method to confirm these results. We have shown that there exists a time interval for which the solutions of both equations are similar with a high degree of accuracy, under the condition that a relation is given between the coefficient $p$ of the dissipative term of the damped oscillator and the order of the fractional derivation, $\alpha$.

A similar study compares a fractional and a damped van der Pol equations, written as a system of two equations on phase space, with similar results.  In addition, we have considered the behaviour of limit cycles and fixed points in terms of $\alpha$ and a parameter $\mu$ characteristic of the van der Pol equation. Using analytic as well as numerical arguments, we show the existence of a critical value for the parameter $\mu$, $\mu_c$, such that if $\mu<\mu_c$ the origin of phase space is stable and if $\mu>\mu_c$ is unestable.  This limit value $\mu_c$ depends on $\alpha$ and we give the exact relation.

\section*{Acknowledgements}

This research has been financed by  the Projects No. ING 19/i 402 and ING 80020180100064  of the Universidad Nacional de Rosario, the Spanish MINECO (Project  No. MTM2014-57129) and the Junta de Castilla y Le\'on (Project Nos. BU229P18 and VA137G18).