Lagrangians for dissipative nonlinear oscillators: the method of Jacobi Last Multiplier

Abstract: We present a method devised by Jacobi to derive Lagrangians of any second-order differential equation: it consists in finding a Jacobi Last Multiplier. We illustrate the easiness and the power of Jacobi's method by applying it to several equations and also a class of equations studied by Musielak with his own method [Musielak ZE, Standard and non-standard Lagrangians for dissipative dynamical systems with variable coefficients. J. Phys. A: Math. Theor. 41 (2008) 055205 (17pp)], and in particular to a Liènard type nonlinear oscillator, and a second-order Riccati equation.

\section{Introduction}
It should be well-known that the knowledge of a Jacobi Last
Multiplier always yields a Lagrangian of any second-order ordinary
differential equation \cite{JacobiVD}, \cite{Whittaker}. Yet many
distinguished scientists seem to be unaware of this classical
result. In this paper we present again the method of the Jacobi
Last Multiplier in order to compare the easiness and the power of
Jacobi's method with that proposed by Museliak et al
\cite{musetal08} for the same purpose. We have already presented
the properties of the Jacobi Last Multiplier  in \cite{jlm05}.
Some of  our papers \cite{ennity}-\cite{nuctam_1lag} and the
references within may give an idea of the many fields of
applications yielded by Jacobi Last Multiplier.

In \cite{musetal08} the authors searched for a Lagrangian of the
following second-order ordinary differential equation
\begin {equation}
\ddot x+b(x)\dot x^2+c(x)x=0 \label{eq1}
\end{equation}
with $b(x),c(x)$  arbitrary functions of the dependent variable
$x=x(t)$. After some lengthy calculations they found one
Lagrangian. In \cite{nuctam_1lag}  we show that (\ref{eq1}) is a
subcase of a more general class of equations studied by Jacobi
\cite{Jacobi 45}, i.e.
\begin{equation}
\ddot x+\frac{1}{2}\frac{\partial \varphi}{\partial x}\dot
x^2+\frac{\partial \varphi}{\partial t}\dot x+B=0\label{Jeq}
\end{equation}
with $\varphi, B$ arbitrary functions of $t$ and $x$. We applied
Jacobi's method to equation (\ref{eq1}) and showed that many (an
infinite number of) Lagrangians can be easily derived.

In the present paper we show how to obtain many (an infinite
number of) Lagrangians for the class of equations
\begin {equation}
\ddot x+f(x)\dot x+g(x)=0 \label{2}
\end{equation}
with $f(x)$ and $g(x)$ arbitrary functions of the dependent
variable $x(t)$.   With the help of the Jacobi Last Multiplier
standard and nonstandard Lagrangians can be derived without much
effort. In \cite{musetal08_2} the author applied  his lengthy
method to (\ref{2}) in order to obtain at least one Lagrangian.

This paper is organized in the following way. In  section 2, we
illustrate the Jacobi Last Multiplier and its properties
\cite{Jacobi 42}-\cite{JacobiVD}, its connection to Lie symmetries
\cite{Lie1874}, \cite{Lie 12}, and its link to the Lagrangian of
any second-order differential equations \cite{JacobiVD},
\cite{Whittaker}. We also exemplify Jacobi's method with an
equation \cite{MatLak74} of the class of equations (\ref{eq1}),
i.e.:
\begin {equation}
\ddot x=x\frac{ - a + \lambda \dot x^2}{\lambda x^2 + 1}
\label{careq}
\end{equation}
and a nonautonomous equation \cite{NorMar} of the more general
class of equations (\ref{Jeq}), i.e.:
\begin {equation}
\ddot x=-\frac{\dot x^2}{x}+\frac{\dot x}{t}\label{NMeq}.
\end{equation}
Both examples  were  not included in \cite{nuctam_1lag}. In
section 3, we apply Jacobi's method to the class of equations
(\ref{2}), and show some particular examples such as a Li\`enard
type nonlinear oscillator, and a second-order Riccati equation. In
section 4, we conclude with some final remarks.

 In this paper we employ ad hoc interactive programs
\cite{man2} written
in REDUCE language to calculate the Lie symmetry algebra of the equations we study.\\

\section{The method by Jacobi}
The method of the Jacobi Last Multiplier \cite{Jacobi 44
a}-\cite{JacobiVD}) provides a means to determine all the
solutions of the partial differential equation
\begin {equation}
\mathcal{A}f = \sum_{i = 1} ^n a_i(x_1,\dots,x_n)\frac {\partial
f} {\partial x_i} = 0 \label {2.1}
\end {equation}
or its equivalent associated Lagrange's system
\begin {equation}
\frac {\mbox{\rm d} x_1} {a_1} = \frac {\mbox{\rm d} x_2} {a_2} = \ldots = \frac {\mbox{\rm d}
x_n} {a_n}.\label {2.2}
\end {equation}
In fact, if one knows the Jacobi Last Multiplier and all but one
of the solutions, then the last solution can be obtained by a
quadrature. The Jacobi Last Multiplier $M$ is given by
\begin {equation}
\frac {\partial (f,\omega_1,\omega_2,\ldots,\omega_{n- 1})}
{\partial (x_1,x_2,\ldots,x_n)}
 = M\mathcal{A}f, \label {2.3}
\end {equation}
where
\begin {equation}
\frac {\partial (f,\omega_1,\omega_2,\ldots,\omega_{n- 1})}
{\partial (x_1,x_2,\ldots,x_n)} = \mbox {\rm det}\left [
\begin {array} {ccc}
\displaystyle {\frac {\partial f} {\partial x_1}} &\cdots &\displaystyle {\frac {\partial f} {\partial x_n}}\\
\displaystyle {\frac {\partial\omega_1} {\partial x_1}} & &\displaystyle {\frac {\partial\omega_1} {\partial x_n}}\\
\vdots & &\vdots\\
\displaystyle {\frac {\partial\omega_{n- 1}} {\partial x_1}}
&\cdots &\displaystyle {\frac {\partial\omega_{n- 1}} {\partial
x_n}}
\end {array}\right] = 0 \label {2.4}
\end {equation}
and $\omega_1,\ldots,\omega_{n- 1} $ are $n- 1 $  solutions of
(\ref {2.1}) or, equivalently, first integrals of (\ref {2.2})
independent of each other. This means that  $M$ is a function of
the variables $(x_1,\ldots,x_n)$ and  depends on the chosen $n-1$
solutions, in the sense that it varies as they vary. The essential
properties of the Jacobi Last Multiplier are:
\begin{description}
\item{ (a)} If one selects a different set of $n-1$ independent
solutions $\eta_1,\ldots,\eta_{n-1}$ of equation (\ref {2.1}),
then the corresponding last multiplier $N$ is linked to $M$ by the
relationship:
$$
N=M\frac{\partial(\eta_1,\ldots,\eta_{n-1})}{\partial(\omega_1,
\ldots,\omega_{n-1})}.
$$
\item{ (b)} Given a non-singular transformation of variables
$$
\tau:\quad(x_1,x_2,\ldots,x_n)\longrightarrow(x'_1,x'_2,\ldots,x'_n),
$$
\noindent then the last multiplier $M'$ of  $\mathcal{A'}F=0$ is
given by:
$$
M'=M\frac{\partial(x_1,x_2,\ldots,x_n)}{\partial(x'_1,x'_2,\ldots,x'_n)},
$$
where $M$ obviously comes from the $n-1$ solutions of
$\mathcal{A}F=0$ which correspond to those chosen for
$\mathcal{A'}F=0$ through the inverse transformation $\tau^{-1}$.
\item{ (c) } One can prove that each multiplier $M$ is a solution
of the following
 linear partial differential equation: \begin {equation}
\sum_{i = 1} ^n \frac {\partial (Ma_i)} {\partial x_i} = 0; \label
{2.5} \end {equation} \noindent viceversa every solution $M$ of
this equation is a Jacobi Last Multiplier.
\item{ (d) } If one
knows two Jacobi Last Multipliers $M_1$ and $M_2$ of equation
(\ref {2.1}), then their ratio is a solution $\omega$ of (\ref
{2.1}), or, equivalently,  a first integral of (\ref {2.2}).
Naturally the ratio may be quite trivial, namely a constant.
Viceversa the product of a multiplier $M_1$ times any solution
$\omega$ yields another last multiplier
$M_2=M_1\omega$.\end{description}
  Since the existence of a solution/first integral
is consequent upon the existence of symmetry, an alternate
formulation in terms of symmetries was provided by Lie \cite {Lie
12}. A clear treatment of the formulation in terms of
solutions/first integrals  and symmetries
 is given by Bianchi \cite {Bianchi 18}. If we know
$n- 1 $ symmetries of (\ref {2.1})/(\ref {2.2}), say
\begin {equation}
\Gamma_i =
\sum_{j=1}^{n}\xi_{ij}(x_1,\dots,x_n)\partial_{x_j},\quad i = 1,n-
1, \label {2.6}
\end {equation}
Jacobi's last multiplier is given by $M =\Delta ^ {- 1} $,
provided that $\Delta\not = 0 $, where
\begin {equation}
\Delta = \mbox {\rm det}\left [
\begin {array} {ccc}
a_1 &\cdots & a_n\\
\xi_{1,1} & &\xi_{1,n}\\
\vdots & &\vdots\\
\xi_{n- 1,1}&\cdots &\xi_{n- 1,n}
\end {array}\right]. \label {2.8}
\end {equation}
There is an obvious corollary to the results of Jacobi mentioned
above. In the case that there exists a constant multiplier, the
determinant is a first integral.  This result is potentially very
useful in the search for first integrals of systems of ordinary
differential equations.  In particular, if each component of the
vector field of the equation of motion is missing the variable
associated with that component, i.e., $\partial a_i/\partial x_i =
0 $, the last multiplier is a constant, and any other Jacobi Last
Multiplier is a first integral.

Another property of the Jacobi Last Multiplier is  its (almost
forgotten) relationship with the Lagrangian, $L=L(t,x,\dot x)$,
for any second-order equation
\begin{equation}
\ddot x=F(t,x,\dot x) \label{geno2}
\end{equation}
is \cite{JacobiVD}, \cite{Whittaker}
\begin{equation}
M=\frac{\partial^2 L}{\partial \dot x^2} \label{relMLo2}
\end{equation}
where $M=M(t,x,\dot x)$ satisfies the following equation
\begin{equation} \frac{{\rm d}}{{\rm d} t}(\log M)+\frac{\partial F}{\partial
\dot x} =0.\label{Meq}
\end{equation}
Then equation (\ref{geno2}) becomes the Euler-Lagrangian equation:
\begin{equation}
-\frac{{\rm d}}{{\rm d} t}\left(\frac{\partial L}{\partial \dot
x}\right)+\frac{\partial L}{\partial x}=0. \label{ELo2}
\end{equation}
The proof is given by taking the derivative of (\ref{ELo2}) by
$\dot x$ and showing that this yields (\ref{Meq}).
 If one knows a Jacobi Last Multiplier, then $L$ can be
easily obtained by a double integration, i.e.:
\begin{equation}
L=\int\left (\int M\, {\rm d} \dot x\right)\, {\rm d} \dot
x+f_1(t,x)\dot x+f_2(t,x), \label{lagrint}
\end{equation}
where $f_1$ and $f_2$ are functions of $t$ and $x$ which have to
satisfy a single partial differential equation related to
(\ref{geno2}) \cite{laggal}. As it was shown in \cite{laggal},
$f_1, f_2$ are related to the gauge function $G=G(t,x)$. In fact,
we may assume
\begin{eqnarray}
f_1&=&  \frac{\partial G}{\partial x}\nonumber\\
f_2&=& \frac{\partial G}{\partial t} +f_3(t,x) \label{gf1f2o2}
\end{eqnarray}
where $f_3$ has to satisfy the mentioned partial differential
equation and $G$ is obviously arbitrary. \\
In \cite{Jacobi 45} Jacobi himself found his ``new multiplier''
for the  class of second-order ordinary differential
equations\footnote{This is not Jacobi's original notation.}
studied by Euler \cite{Euler} [Sect. I,  Ch. VI, \S\S 915 ff.]
(\ref{Jeq}). Indeed Jacobi derived that the multiplier of equation
(\ref{Jeq}) is given by:
\begin{equation}
M=e^{\varphi(t,x)}, \label{JM}
\end{equation}
as it is obvious from (\ref{Meq}). Consequently in our previous
paper \cite{nuctam_1lag}  we  derived a Lagrangian of the class of
equations (\ref{Jeq}) by means of (\ref{relMLo2}), i.e.
\begin {equation}
L=\frac{1}{2} e^{\varphi(t,x)}\dot x^2+f_3(t,x)+\frac{{\rm
d}}{{\rm d}t}G(t,x) \label{LagJ}
\end{equation}
with $f_3$ a function of $t$ and $x$ satisfying the following
equation:
\begin {equation}
  \frac{\partial f_3}{\partial x}
+e^{\varphi(t,x)} B(t,x)=0.
\end{equation}
Equation (\ref{careq}) is a particular example of the equation
considered by Jacobi. In fact from (\ref{JM}) and (\ref{LagJ}) we
derive:
\begin {equation}
 M=\frac{1}{\lambda x^2 + 1},
 \end{equation}
  and consequently
  \begin {equation}  L=\frac{\dot x^2}{2(\lambda x^2 + 1)}
 -\frac{a x^2}{2(\lambda x^2 + 1)}+\frac{{\rm
d}}{{\rm d}t}G(t,x).\label{Lcareq}
\end{equation}
This Lagrangian is known \cite{MatLak74}. Equation (\ref{careq})
does not possess any Lie point symmetries apart translation in
$t$. Therefore Noether's theorem applied to the autonomous
Lagrangian $L$ in (\ref{Lcareq}) yields the following first
integral:
\begin {equation}
I=\frac{a x^2 + \dot x^2}{2(\lambda x^2 + 1)}.
\end{equation}
Jacobi proved that in the case of a second-order differential
equation if one knows a first integral and a last multiplier then
the equation can be integrated by quadrature (a new Principle of
Mechanics, indeed) \cite{Jacobi 42}, \cite{Jacobi 44 a}.

Equation (\ref{NMeq}) is obtained by the symmetry reduction
transformation $x=u', t=u$ of the third-order equation:
\begin {equation}
u'''=-\frac{u'u''}{u},
\end{equation}
where $u(T)$ is a function of $T$. Equation (\ref{NMeq}) admits an
eight-dimensional Lie point symmetry algebra and therefore is
linearizable.
 In \cite{laggal} it was shown that if one knows several
(at least two) Lie symmetries of the second-order differential
equation (\ref{geno2}), i.e.
\begin {equation}
\Gamma_j =V_j(t,x)\partial_t+G_j(t,x)\partial_x, \quad j = 1,r,
 \label {gensym}
\end {equation}
 then many Jacobi Last Multipliers could be
derived by means of (\ref{2.8}), i.e.
\begin {equation}
{\displaystyle{\frac{1}{M_{nm}}}}=\Delta_{nm} = \mbox {\rm
det}\left [
\begin {array} {ccc}
1 &\dot x & F(t,x,\dot x)\\[0.2cm]
V_n &G_n &{\displaystyle{\frac{\mbox{\rm d} G_n}{\mbox{\rm d} t} -\dot x\frac{\mbox{\rm d} V_n}{\mbox{\rm d} t}}} \\[0.2cm]
V_m &G_m &{\displaystyle{\frac{\mbox{\rm d} G_m}{\mbox{\rm d} t} -\dot x\frac{\mbox{\rm d} V_m}{\mbox{\rm d} t}}}\\
\end {array}\right],\label {Mnm}
\end {equation}
with $(n,m=1,r)$, and therefore many Lagrangians  can be obtained
by means of (\ref{lagrint}). In particular, fourteen different
Lagrangians can be obtained if the equation admits an
eight-dimensional Lie point symmetry algebra. We do not look for
the fourteen Lagrangians of equation (\ref{NMeq}). Instead we use
equation (\ref{JM}) to find a Jacobi Last Multiplier and
consequently a Lagrangian. In fact from (\ref{JM}) and
(\ref{LagJ}) we derive:
\begin {equation}
 JLM=\frac{x^2}{t},
 \end{equation}
  and consequently
  \begin {equation}
   Lag=\frac{\dot x^2 x^2}{2 t}
 +\frac{{\rm
d}}{{\rm d}t}G(t,x).\label{LNMeq}
\end{equation}
If one applies Noether's theorem to $Lag$ then the following five
first integrals of equation (\ref{NMeq}) can be derived:
\begin{eqnarray}
FI_1&=& x^2 (x^2 - 2 x \dot x y + \dot x^2 t^2) \nonumber\\
 FI_2&=&\frac{x^2 \dot x ( - x + \dot x t)}
{2 t} \nonumber\\
FI_3&=&\frac{x^2 \dot x^2}{2 t^2}\label{NMI} \\
 FI_4&=& x (x - \dot x t)\nonumber\\
 FI_5&=&\frac{x \dot x}{t}\nonumber
\end{eqnarray}
We underline that the first integrals $FI_1$ and $FI_4$ could not
be derived if the gauge function $G(t,x)$ was assumed to be equal
to zero.

\section{Equations with space-dependent coefficients}

The class of equations (\ref{2})  has an obvious Jacobi Last
Multiplier and therefore Lagrangian if the following relationship
holds between $f(x)$ and $g(x)$:
\begin {equation}
\frac{{\rm d}}{{\rm
d}x}\left(\frac{g(x)}{f(x)}\right)=\alpha(1-\alpha)f(x) \label{3}
\end{equation} where $\alpha$ is any constant $\neq 1$. In fact if
(\ref{3}) holds then equation (\ref{2}) can be written as
\begin {equation}
\dot u+\alpha f(x) u=0 \label{ueq}
\end{equation} i.e.
\begin {equation}
f(x)=-\frac{1}{\alpha}\frac{{\rm d}}{{\rm d}t}(\log u),\quad\quad
{\rm with}\quad u=\dot x+\frac{g(x)}{\alpha f(x)},
\end{equation}
and thus a Jacobi Last Multiplier for equation (\ref{2}) is
\begin {equation}
M=\exp\left(\int f(x) dt\right) = \exp\left(-\frac{1}{\alpha} \int
d(\log u)\right)=u^{-1/\alpha} \label{Ms}\end{equation}
 and the corresponding Lagrangian is
\begin {equation}
L=u^{2-1/\alpha}+\frac{{\rm d}}{{\rm d}t}G(t,x)=\left(\dot
x+\frac{g(x)}{\alpha f(x)}\right)^{2-1/\alpha}+\frac{{\rm d}}{{\rm
d}t}G(t,x), \label{Ls}
\end{equation}
with $G(t,x)$ an arbitrary gauge function.\\
We note that this Lagrangian is autonomous and therefore it admits
at least the Noether point symmetry of translation in $t$, and
consequently the following first integral
\begin {equation}
In=\left(\dot x + \frac{g(x)}{\alpha f(x)}\right)^{1-1/
\alpha}\frac{\alpha f(x)\dot x - f(x)\dot x -
 g(x)}{\alpha^2 f(x)^2}\label{I2}
\end{equation}
We would like to remark that because of property (d) of the Jacobi
Last Multiplier, then we can obtain another Jacobi Last Multiplier
$\overline M=In M$ and consequently another Lagrangian of equation
(\ref{2}). We  will not pursue it here any further but one can
envision a deluge of Lagrangians obtained by  simply taking any
function of the first integral $In$ in (\ref{I2}) and multiplying
it for either $M$ in (\ref{Ms}) or $\overline M$, and so on ad
libitum.

\subsection{Examples}

It is very easy to obtain a Jacobi Last Multiplier and therefore a
Lagrangian for the  following Li\`enard type nonlinear oscillator:
 \begin {equation}
 \ddot x+kx\dot x+\frac{k^2}{9}x^3+\lambda x=0. \label{1}
 \end{equation}
In fact we know that $M=\exp(\int kx dt)$. Then if  one can put
the equation in the form
\begin {equation}
\dot u_1+\alpha k x u_1=0,\label{1u1eq}\end{equation}  with
$\alpha$ a constant to be determined, i.e.
\begin {equation}
kx=-\frac{1}{\alpha}\frac{{\rm d}}{{\rm d}t}(\log u_1)
\end{equation}
then
\begin {equation}
M=u_1^{-1/\alpha}. \end{equation} In the case of equation
(\ref{1}) we have
\begin {equation}
\dot u_1+\frac{1}{3}k x u_1=0, \quad \quad   {\rm with}\quad
u_1=\dot x +\frac{k}{3}x^2+\frac{3}{k}\lambda, \quad ({\rm
i.e.,}\quad \alpha=1/3).\end{equation}
 Therefore $M_1=u_1^{-3}$ and consequently\footnote{We  do not take
  into consideration any nonessential
multiplicative constant.}:
\begin {equation}
L_1=\frac{1}{u_1}+\frac{{\rm d}}{{\rm d}t}G(t,x)=\frac{1}{\dot x
+\frac{k}{3}x^2+\frac{3}{k}\lambda}+\frac{{\rm d}}{{\rm
d}t}G(t,x).
\end{equation}
Actually, we can derive another Lagrangian because substituting
$f(x)=kx, g(x)=\frac{k^2}{9}x^3+\lambda x $ into equation
(\ref{3}) yields two different $\alpha$, i.e.:
\begin {equation}
\frac{{\rm d}}{{\rm
d}t}\left(\frac{g}{f}\right)-\alpha(1-\alpha)f=0\quad
\Longrightarrow \quad 9\alpha^2 - 9\alpha + 2=0\quad
\Longrightarrow \quad \alpha_{1,2}=\frac{1}{3}, \frac{2}{3}
\end{equation}
The case $\alpha=\frac{1}{3}$ has been considered above. If we
substitute  $\alpha=\frac{2}{3}$ into equation (\ref{ueq}) then we
obtain $M_2=u^{-3/2}$ and consequently
\begin {equation}
L_2=\sqrt{u}+\frac{{\rm d}}{{\rm d}t}G(t,x)=\sqrt{\dot x
+\frac{k}{6}x^2+\frac{3}{2 k}\lambda}+\frac{{\rm d}}{{\rm
d}t}G(t,x).
\end{equation}
Equation (\ref{1}) admits an eight-dimensional Lie symmetry
algebra and therefore is linearizable. Moreover one can determine
at least twelve more Lagrangians \cite{CP07jlmmech}. We note that
$L_1$ admits one Noether point symmetry while $L_2$ admits three
Noether point symmetries.

A particular case of (\ref{1}) is the second-order Riccati
equation:
 \begin {equation}
 \ddot x+3x\dot x+x^3=0, \label{riceq}
 \end{equation}
 a member of the Riccati-chain \cite{Ames}. Equation (\ref{riceq}) is linearizable to a third-order linear equation
by the transformation $x=\dot V(t)/V(t)$, namely (\ref{riceq})
transforms into $\ddot V=0$. It also well-known that equation
(\ref{riceq}) is linearizable by means of a point transformation
because it admits an eight-dimensional Lie symmetry algebra
generated by the following operators:
\begin{eqnarray}
\Gamma_1&=&t^3(t x-2)\partial_t-t(x t-2) (x^2 t^2+2-2 x t)\partial_x\nonumber\\
\Gamma_2&=&x t^3\partial_t-(x t-1) (x^2 t^2+4-2 x t)\partial_x\nonumber\\
\Gamma_3&=&x t^2\partial_t-x (x^2 t^2+2-2 x t)\partial_x\nonumber\\
\Gamma_4&=&x t\partial_t-x^2 (x t-1)\partial_x\nonumber\\
\Gamma_5&=&x\partial_t-x^3\partial_x\\
\Gamma_6&=&\partial_t\nonumber\\
\Gamma_7&=&t\partial_t-x\partial_x\nonumber\\
\Gamma_8&=&t^2\partial_t-2(x t-1)\partial_x\nonumber
\end{eqnarray}
In order to find the linearizing transformation we have to look
for a two-dimensional abelian intransitive subalgebra \cite{Lie
12}, and, following Lie's classification of two-dimensional
algebras in the real plane \cite{Lie 12}, we have to transform it
into the canonical form
$$\partial_{\tilde x},\;\;\;\;\;\tilde t\partial_{\tilde x}$$ with
$\tilde t$ and $\tilde x$ the new independent
 and dependent variables, respectively. We found that one such subalgebra
  is that generated by $\Gamma_1$
and $\Gamma_9\equiv\Gamma_2-\Gamma_8$.
 Then, it is easy to derive that
 $$ \tilde t=  \frac{tx-1}{x(t x-2)},\;\;\;\;\;\tilde x=-\frac{x}{2t(t x-2)}$$
and equation (\ref{riceq}) becomes
\begin{equation}
{{\rm d}^2 \tilde x \over {\rm d}\tilde t^2}=0
\end{equation}
We can derive fourteen different Lagrangians by using (\ref{Mnm})
and (\ref{lagrint}). Two of these Lagrangians admit five Noether
symmetries, i.e.:
\begin {equation}
L_{56}=-\frac{1}{2(\dot x+x^2)}+\frac{{\rm d}}{{\rm d}t}G(t,x)
\label{rL56}
\end{equation}
and
\begin {equation}
L_{19}=-\frac{1}{2 t^4 (x^2 t^2+\dot x t^2-2 x t+2)}+\frac{{\rm
d}}{{\rm d}t}G(t,x).
\end{equation}
which are derived from
\begin {equation}
 JLM_{56}=-\frac{1}{(\dot x +x^2)^3},
\end{equation}
and
\begin {equation}
 JLM_{19}=-\frac{1}{(t^2 x^2+t^2\dot x-2t x+2)^3},
\end{equation}
 respectively.
 We remark that  $JLM_{56}$  can be also obtained from (\ref{ueq}). In
fact equation (\ref{riceq}) can be written as
\begin {equation}
\dot u+ 3 x \alpha  u=0, \quad \quad u=\dot x+x^2,\quad
\alpha=\frac{1}{3}.
\end{equation}
If one applies Noether's theorem to $L_{56}$ then the following
five first integrals of equation (\ref{riceq}) can be derived:
\begin{eqnarray}
I_1&=&\frac{(x^2  t^2 - 2  x  t + \dot  x  t^2 + 2)^2}{4  (x^2 +\dot  x)^2} \nonumber\\
I_2&=&\frac{(x^2  t^2 - 2  x  t + \dot  x  t^2 + 2)  (x^2  t - x +\dot  x  t)}
{2  (x^2 + \dot  x)^2} \nonumber\\
I_3&=&\frac{x^2 + 2  \dot  x}{2  (x^2 + \dot  x)^2}\\
 I_4&=&\frac{(x^2  t - x + \dot  x  t)^2}{(x^2 + \dot  x)^2}\nonumber\\
 I_5&=&\frac{x^2  t - x +\dot  x  t}{x^2 + \dot  x}\nonumber \label{ricI}
\end{eqnarray}
while Noether's theorem applied to $L_{19}$ yields:
\begin{eqnarray}
In_1&=&\frac{x^2  t - x + \dot  x  t}{x^2  t^2 - 2  x  t + \dot  x
t^2 +
2}\nonumber\\
In_2&=&\frac{(x^3  t - 2  x^2 - 2  \dot  x)  x  t + (\dot  x  t^2
+ 4) \dot  x
    + (2  \dot  x  t^2 + 3)  x^2}{(x^2  t^2 - 2  x  t + \dot  x  t^2 + 2)^2}\nonumber \\
In_3&=&\frac{(x^2  t - x + \dot  x  t)  (x^2 + \dot  x)}{(x^2  t^2
- 2 x  t
+ \dot  x  t^2 + 2)^2} \\
In_4&=&\frac{(x^2 + \dot  x)^2}{(x^2  t^2 - 2  x  t + \dot  x  t^2
+
2)^2}\nonumber \\
In_5&=&\frac{x^2 + 2  \dot  x}{2  (x^2  t^2 - 2  x  t + \dot  x
t^2 + 2)^2}\nonumber\label{ricIn}
\end{eqnarray}
We remark the importance of the gauge function $G(t,x)$. None of
the first integrals above, apart $I_3$ and $In_5$, could be
derived if the gauge function was assumed to be equal to zero.

\section{Final remarks}

The Lagrangian which admits the maximum number of Noether point
symmetries is that obtained by means of the Jacobi Last Multiplier
which comes from the determinant (\ref{Mnm}) with the two solution
symmetries, namely the two-dimensional abelian intransitive
subalgebra which yields the linearizing transformation. We may
infer that this is the physical Lagrangian. Also the Lagrangian
obtained by using the Jacobi Last Multiplier (\ref{Ms}) possesses
the maximum number of Noether point symmetries as shown in the
case of equation (\ref{3}). This may explain why Lagrangian
(\ref{Ls}) possesses  nice physical properties as shown in
\cite{Caretal05}.

In the present paper, we do not claim to have been exhaustive in
our presentation of the application of the Jacobi Last Multiplier
 for finding Lagrangians of any second-order differential
equation. Indeed we would like to encourage other authors to apply
Jacobi's method to their preferred equation.

\section*{Acknowledgements} This work was initiated while K.M.T.
was enjoying the hospitality of Professor M.C. Nucci and the
facilities of the Dipartimento di Matematica e Informatica,
Universit\`a di Perugia. K.M.T. gratefully acknowledges the
support of the Italian Istituto Nazionale Di Alta Matematica ``F.
Severi'' (INDAM), Gruppo Nazionale per la Fisica Matematica
(GNFM), Programma Professori Visitatori.

Mathematical Physics (math-ph); Exactly Solvable and Integrable Systems (nlin.SI)


Shifts of the prime divisor function of Alladi and Erdős

Abstract: We introduce a variation on the prime divisor function $B(n)$ of Alladi and Erdős, a close relative of the sum of proper divisors function $s(n)$. After proving some basic properties regarding these functions, we study the dynamics of its iterates and discover behaviour that is reminiscent of aliquot sequences. We prove that no unbounded sequences occur, analogous to the Catalan-Dickson conjecture, and give evidence towards the analogue of the Erdős-Granville-Pomerance-Spiro conjecture on the pre-image of $s(n)$.

\section{Introduction}

Let $n$ be a positive integer with prime factorization $n=p_1^{r_1}\dots p_k^{r_k}$. Consider the sum of prime divisors function $B(n) = \sum_{i=1}^kr_ip_i$ and the sum of distinct prime divisors function $\beta(n) = \sum_{i=1}^k p_i$. They can be viewed as variants of the sum of proper divisors function $s(n)=\sum_{d||n}d$, discussed since Pythagoras. The arithmetic properties of $B(n)$, for example, were studied by Alladi and Erd\"os \cite{AE}, and $\beta(n)$ studied by Hall \cite{H} since the 1970s.\footnote{In \cite{AE}, the authors denote $B(n),\beta(n)$ by $A(n), A^*(n)$. In this paper we follow the former convention, consistent with more recent literature.} These are large additive functions in the sense that they have the same average order as the largest prime factor of $n$, which is expected by the well-known result of Hardy and Ramanujan that $\Omega(n)$ and $\omega(n)$ have the same average order $\log\log n$.

In this paper, we introduce perturbations of $\beta(n)$ and $B(n)$, by shifting the values at certain fixed points. Clearly $B(n)=\beta(n)=n$ if $n$ is prime. Then define for a fixed positive integer $n$, the functions
\be
B_a(n) =
\begin{cases}
n+a		& n \text{ prime}\\
B(n)		& n \text{ otherwise}
\end{cases}
\ee
and similarly $\beta_a(n)$. They are no longer additive, and behave in similar and different ways in comparison to the original functions, as we discuss in Section \ref{shifts}.

Our main interest will lie in their iterates, denoting $B^2_a(n)= B_a(B_a(n))$, and similarly for $\beta_a(n)$. The aliquot sequence $n, s(n), s(s(n)),\dots$ stops at either primes, or cycles of length two (amicable pairs) or longer (sociable numbers). Iterating $B_a(n)$ and $\beta_a(n)$, we encounter similar phenomena, detailed in Section \ref{iterates}. Surprisingly, for fixed $a$ only a handful of cycles are observed; it is in varying $a$ we find many different cycles.

This suggests a version of the Catalan-Dickson conjecture, which states that there does not exist unbounded aliquot sequences (or, alternatively, the Guy-Selfridge counter-conjecture \cite{GS} which gives certain candidate counterexamples). It is obvious that $B_0^k(n)$ and $\beta_0^k(n)$ all eventually reach a fixed point, but for general $a$ there may be exceptional cases in which the sequences escape to infinity. In support of this, the Green-Tao theorem guarantees that there exists integers $n$ and $a$ such that
\be
n<B_a(n) < \dots < B_a^k(n), \text{ and }\ n<\beta_a(n) < \dots < \beta_a^k(n).
\ee
that for any $k>0$ (Corollary \ref{GT}). Nonetheless, we show in Theorem \ref{finite}, that in fact no unbounded sequences occur.
\begin{thm}
There exists finitely many cycles for each $a$, and all integers iterate to cycles.
\end{thm}

We conclude with evidence towards a variant of a conjecture of Erd\H{o}s, Granville, Pomerance, and Spiro \cite{EGPS}, which states that the pre-image of any set of asymptotic density zero under $s(n)$ is again of asymptotic density zero. Namely, we prove as Theorem \ref{EGPS}, using previous work of Pollack, Pomerance, and Thompson \cite{PPT} on divisor-sum fibres:

\begin{thm}
Let $\epsilon=\epsilon(x)$ be a fixed function tending to 0 as $x\to\infty$, and let $\mathscr A$ be a set of at most $x^{\frac12+\epsilon(x)}$ positive integers. Then
\be
\#\{n\leq x : B(n)\in\mathscr A\} = o_\epsilon(x)
\ee
as $x\to\infty$, uniformly in the choice of $\mathscr A$.
\end{thm}

\subsubsection*{Acknowledgments}  The authors would like to thank Jeff Lagarias for suggesting the proof of Theorem \ref{finite}.

\section{Shifts}
\label{shifts}

In this section, we prove some basic results of $B_a(n)$ and $\beta_a(n)$. First, from the fact that $B(n^k)=kn$ it follows that if $n$ is composite then $B_a(n^k)=kn$. Also, $B_a(n)$ is close to additive in the sense that $B_a(mn)=B_a(n)+B_a(m)$ if and only if $m,n$ are not prime.

The following result shows that $B_a(n)$ is in certain ways similar to $B_0(n)$, independently of $a$.

\begin{prop}
\label{order}
(a) The average order $B_a(n)$ is $\dfrac{\pi^2 n}{6\log n}$. In other words,
\be
\sum_{n\leq x} B_a(n) \sim \frac{\pi^2 x^2}{12\log x}.
\ee
(b) The average order of $B_a(n) - \beta_a(n)$ is $\log\log n$. In other words,
\be
\sum_{n\leq x}(B_a(n) - \beta_a(n)) = x \log\log x + O(x).
\ee
(c) For any fixed integer $N$, the set $\#|B_a(n) - \beta_a(n) = N|$ has positive natural density. In other words,
\be
\lim_{n\to\infty} \frac{n}{B_a(n) - \beta_a(n)} > 0.
\ee
\end{prop}

\begin{proof}
These follow simply from the fact that
\be
\sum_{n\leq x} B_a(n) = \sum_{n\leq x} B(n) + a \sum_{p\leq x} 1
\ee
and similarly for $\beta_a(n)$, then applying the corollaries to \cite[Theorem 1.1]{AE}. The additional sum over $p$ is $a\pi(x)$, which gives a smaller error $ax/\log x$. For the last two claims, we also note that $B_a(n) - \beta_a(n)=B(n) - \beta(n).$
\end{proof}

Let $f(n)$ be an arithmetic function taking positive integer values. Then for any fixed $N\geq 0$, the local density of $f(n)$ is defined to be
\be
d_N = \lim_{x\to \infty} \frac{1}{x}\#|n\leq x : f(n) = N|.
\ee
Then we may deduce the following result from \cite[\S3]{Iv}:

\begin{cor}
There exists $d_N$ such that
\be
\#\{n\leq x : B_a(n)-\beta_a(n) = N\} = d_N x + O(x^\frac12\log x)
\ee
and
\be
\#\{n\leq x : B_a(n)-\beta_a(n) \geq N\} \ll \frac{x}{N}.
\ee
uniformly in $N>0$.
\end{cor}

The next theorem shows a departure from the unshifted case. In fact, we find a qualitative difference depending on whether $a$ is 0, even, or odd. Recall that in the case of $a=0$, we have that $B_0(n)$ and $\beta_a(n)$ are additive, and therefore uniformly distributed for all $q$ by Delange's theorem (c.f. \cite{G}).

\begin{thm}
\label{dist}
(a) Let $q=2$. Then $B_a(n)$ is uniformly distributed \textnormal{mod} $q$ if $a$ is even. That is, there is a constant $c_0>0$ such that
\be
\sum_{n=1}^\infty (-1)^{B_a(n)} = O(x\exp(c_0(\log x)^\frac23).
\ee
If $a$ is odd, we have instead $O(x)$, as $x\to\infty$.

(b) Let $q,h$ be fixed integers with $q>2$. Then for any $a$ such that $q|ha$,  $B_a(n)$ is uniformly distributed mod $q$.
\end{thm}

\begin{proof}
First consider $q=2$. Notice that $(-1)^{B_a(p)}= (-1)^{B(p)}(-1)^a$, so the even case follows directly from \cite[Theorem 3.1]{AE}, so it suffices to consider the case with $a$ odd. We have the Dirichlet series
\be
\sum_{n=1}^\infty\frac{(-1)^{B_a(n)}}{n^s} = \sum_{n=1}^\infty\frac{(-1)^{B(n)}}{n^s} - 2\sum_{p} \frac{1}{p^s}
= \frac{2^s+1}{2^s-1}\frac{\zeta(2s)}{\zeta(s)} - 2P(s)
\ee
where $P(s)=\sum_{p} p^{-s}$ denotes the so-called prime zeta function, which is essentially $\log\zeta(s)$ as $s\to1^+$.

The claim for $q>2$ follows from a recent result of Goldfeld: by assumption the character $\exp(2\pi i \frac{hB_a(n)}{q}) = \exp(2\pi i \frac{hB(n)}{q})$ is completely multiplicative, and thus we may apply \cite[Theorem 1.2]{G} to get
\be
\sum_{\substack{n\leq x\\ B(n) \equiv h\textnormal{ mod } q}}1 = \frac{x}{q} + O\left(\frac{x}{(\log x)^\frac12}\right)
\ee
as $x\to\infty$, which gives the result.
\end{proof}

From the above we observe that the lack of additivity leads to obstructions to uniform distribution, which in turn leads to a departure from certain proofs related to iterates of $B_a(n)$ and $\beta_a(n)$, which we will discuss next. Nonetheless, we can conclude:

\begin{cor}
If $a$ is even, then
\be
\sum_{n=1}^\infty\frac{(-1)^{B_a(n)}}{n}=0.
\ee
\end{cor}

\section{Iterates}
\label{iterates}

Now we turn to the dynamics of iterates of $B_a(n)$ and $\beta_a(n)$. While most of the results below concern $B_a(n)$, many of them can be carried over to $\beta_a(n)$ without difficulty, which we leave to the interested reader. Throughout we will also raise several problems regarding the sequences $B^k_a(n)$, which can also be posed for $\beta^k_a(n)$, suggested by the numerical computations.

\subsection{Cycles}
\label{cycles}

We call $n$ a periodic point if $B_a^{k+l}(n)=B_a^k(n)$ for some $l$, and eventually periodic if $B_a^k(n)$ is periodic for some $k$. Define a cycle to be the orbit of a periodic point $n$. We will sometimes refer to the fixed points $B_a(n)=n$ as trivial cycles.

\begin{lem}
For any $a$ nonzero, $B_a(n) = n$ if and only if $n=4$.
\end{lem}

\begin{proof}
Primes are not fixed points by definition. So the only possible fixed points are those of $B(n)$ for $n$ composite, which is $n=4$, as $B(n)<n$ for any composite $n>4$.
\end{proof}

\subsubsection{The first case}

Recall that the stopping time for $n$, denoted $\sigma(n)$ is defined to be $\inf\{k: B^k_a(n)<n\}$. We will also define the total stopping time for $n$, denoted $\sigma_\infty(n)$ to be the number of iterates required for $B^k_a(n)$ to enter a cycle.

\begin{prop}
$B_1^k(n)$ is eventually periodic for all $n$, with cycles $(4)$ and $(5,6)$.
\end{prop}

\begin{proof}
This is easy to check the orbits for small $n$, say $n\leq 6$, so we may assume that $n>6$. We first claim that $B^k_1(n)$ has stopping time $\sigma(n)=2$ if $n$ is prime, otherwise $\sigma(n)=1$. It suffices to check for $n=p$. Set $p+1=2m$. Then
\be
B^2_1(p)=B_1(p+1)=2 + B_1(m)\leq 2+m < p.
\ee
It follows from the claim that $B^k_1(n) < n$ for all $k>1$, thus $B^{2k}_1(n)$ is strictly decreasing until it reaches the cycle $(5,6)$.
\end{proof}

\begin{rem}
The proof above fails for $a>1$, since $p+a$ may be prime if $a$ is even, while the final inequality $2+m<p$ is no longer guaranteed if $a$ is odd.
\end{rem}

\subsubsection{Amicable pairs}
Do all primes above 3 occur in some amicable pair, i.e., 2-cycle for some $a$? We can answer this in the affirmative.

\begin{prop}
\label{amicable}
Every $p>3$ occurs in a $2$-cycle $(p,B_a(p))$ for some integer $a$.
\end{prop}
\begin{proof}
We have to produce an $a$ such that $B_a(p+a)=p$. This forces $p+a$ to be composite, so it suffices to ask if $B_0(p+a)=p$ for some $a$. Let $n$ be a composite solution to $B_0(n)=p$. Then setting $a=n-p$, we have that $B_a: p \mapsto n \mapsto p$ as desired.

It remains to show that $B_0(n)=p$ always has a composite solution. Let $q$ be the largest prime less than $p$. If $p-q$ is prime, then choose $n=q(p-q)$. If not, then let $a$ be a prime dividing $p-q$, and write $p-q=ab$. Then choose $n=qa^b$.
\end{proof}

\begin{rem}
Observe that if $a$ was chosen to be the largest prime dividing $p-q$, then the construction will in fact produce the smallest composite solution $n$.
\end{rem}

\subsubsection{Finite cycles}
How many kinds of cycles appear for fixed $a$? Up to $a\leq 200$, we found at most 4 distinct nontrivial cycles, at $a=39$, we have:
\[
(43, 82),(13,52,17,56),(7,46,25,10),(5, 44, 15, 8, 6)
\]
Note that from the above, we see that different $k$-cycles can occur for a fixed $k$ and $a$.

It is natural to consider a variant of the Catalan-Dickson conjecture for $s(n)$: Does the sequence $B^k_a(n)$ ever escape to infinity as $k\to\infty$? Heuristically, the sequence $B_a(n)/n$ has average order $\pi^2/6\log n < 1$ by Proposition \ref{order}(a),\footnote{In contrast to $s(n)/n$ which is slightly greater than 1 on average.} which suggests that an unbounded sequence should not exist. We show that this is indeed true:

\begin{thm}
\label{finite}
There exists finitely many cycles for each $a$, and all integers iterate to cycles.
\end{thm}

\begin{proof}
It suffices to show that for any shift $a$ that there is a bound $C(a)$ such that all orbits of iterating $B_a$ from any starting point $n$ enter the range $[1, C(a)]$. Without loss of generality take $n$ be a prime $p$. We will show that for $p$ large enough, the next iterate of $p$ which goes downhill will go to a number less than $p$.

Let $s$ be the smallest prime that does not divide $a$, which is less than $2a$ by Bertrand's postulate. Then $a$ mod $s$  is nonzero, hence relatively prime to it. On the other hand, at least one of $p+a,p+2a,\dots, p+sa$ is divisible by $s$, and therefore composite. Denote it by $p+ka$.

We claim that for composite $n$, $B_a(n) \le 2 + \frac{n}{2}$. Assuming this, then whenever $p$ is such that
\be
B_a(p+ka)\le 2+ \frac{p+ sa}{2}< p
 \ee
then we will go downhill.  Now since $s < 2p$, we may choose $C(a)=2a^2 + 10 < p.$

It remains to prove the claim. Since $n$ is composite, it suffices to prove it for $a=0$. Let $n = p^kq$ where $p$ is the smallest prime factor of $n$, with $(p,q)=1, q>1$. (If $q=1$ then $B(p^k) = kp$ and we are done.) By additivity, we have then:
\begin{align}
B(n)  &= kp + B(q) \\
& \le kp + q \\
& \le 2 + (\frac{p^k}{2}-1)q + q = 2 + \frac{n}{2}.
\end{align}
The last inequality follows since $2 + (\frac{p^k}{2}-1)q \ge p^k$, and $q >1$.
\end{proof}

The following table lists the distinct nontrivial cycles found for small $a$ and checking $n$ up to $10^6$.
\begin{table}[ht!]
  \centering
  \caption{Nontrivial cycles for $n\leq 10^6$.}
  \label{tab:table1}
  \begin{tabular}{c| l | c| l}
    \toprule
    $a$ & cycles & $a$& cycles \\
    \midrule
    1 & $(5,6)$				&11&$(5,15,8,6)$\\
    2 & $(5,7,9,6)$			&12&$(5, 17, 29, 41, 53, 65, 18, 8, 6)$\\
    3 & $(5,8,6),(7,10)$		&13&$(5,16,8,6)$\\
    4 & $(5,9,6)$				&14&$(5, 19, 33, 14, 9, 6), (7, 21, 10)$ \\
    5 & $(7,12)$				&15&$(5,20,9,6),(19,34)$\\
    6 & $(7,13,19,25,10)$		&16&$(7, 23, 39, 16, 8, 6, 5, 21, 10)$\\
    7 & $(5,12,7,14,9,6)$		&17&$(7, 24, 9, 6, 5, 22, 13, 30, 10),(11,28)$\\
    8 & $(5,13,21,10,7,15,8,6)$	&18&$(5, 23, 41, 59, 77, 18, 8, 6),(7, 25, 10)$ \\
    9 & $(5,15,9,6),(13,22)$	&19&$(5, 24, 9, 6)$ \\
    10 & $(5,15,8,6)$			&20&$(5, 25, 10, 7, 27, 9, 6)$\\
    \bottomrule
  \end{tabular}
\end{table}

\subsubsection{Cycle length}
What are the lengths of cycles, and how do they depend on $a$ and $n$? What are the stopping times $\sigma(n)$ and $\sigma_\infty(n)$? We have not studied this question in detail, but numerical experiments suggest that both times are small, relative to $s(n)$, for example.

\subsubsection{Sign patterns}
Any $k$-cycle $(n,B_a(n),\dots,B^k_a(n))$ can be ordered so that $n$ is the least term in the sequence, making $n$ prime and $B^k_a(n)$ composite. We adopt the following notation: we will assign $\{+,-\}$ to denote in a cycle whether a number is prime or composite. For example, the cycle $(5,7,9,6)$ in $a=2$ has sign pattern $(+,+,-,-)$.

We can now pose the following question: what are the possible sign patterns allowed in a $k$-cycle? All non-trivial cycles of length $k>2$ must have sign pattern of the form $(+,\dots,-)$. Do all combinations occur in between? For example, with $k=3$ we find both combinations $(+,+,-)$ and $(+,-,-)$ to occur.

\subsection{Ascending chains}

Looking in the other direction, a number $n$ is called abundant if the sum of proper divisors $s(n)>n$, and it was shown in an unpublished work of Lenstra, and later improved by Erd\H{os} \cite{E}, that for every $K$ there is an $n$ for which
\be
\label{abundantchain}
n<s(n) < \dots < s^K(n).
\ee
Our $B_a(n)$ are simpler in the sense that $B_a(n)>n$ if and only if $n$ is prime and $a>1$, but on the other hand the analog of Lenstra's result requires the Green-Tao theorem \cite[Theorem 1.1]{GT}, which implies that there are arbitrarily long arithmetic progressions of primes, since such a progression yields primes $B_a^k(p) = p+ka$. Nonetheless we can immediately conclude:

\begin{cor}
\label{GT}
For any $k>0$, there exists integers $n$ and $a$ such that
\be
n<B_a(n) < \dots < B_a^k(n), \text{ and }\ n<\beta_a(n) < \dots < \beta_a^k(n).
\ee
\end{cor}

\begin{rem}
Note that there is a natural extension of $B_a(n)$ to $\ensuremath{{\bf Z}}_{\geq0}$ by setting $B(1)=1$ and $B(0)=0$, and to negative integers by setting $B(-n)=B(n)$, similarly for $\beta_a(n)$. Thus iterating our functions can be viewed as studying dynamics on $\ensuremath{{\bf Z}}$ itself. We may also extend to ${\bf Q}$ by defining $B(\frac{x}{y}):=B(x)-B(y)$ for reduced fractions, though upon iterating once we return to $\ensuremath{{\bf Z}}$, and from there $\ensuremath{{\bf Z}}_{\geq0}$. One possible way of producing more interesting extensions is by setting $B(-n) = -B(n)$, and $B(\frac{x}{y})=B(x)/B(y).$
\end{rem}

\subsection{Prime-divisor fibres}
A question related to cycles is: For a fixed $p$, what is the set of solutions $\#\{n : B_a(n)=p\}$? The solution sets are the same for every $a$, except possibly the pre-image $\{p-a\}$, which will be counted if it is prime. From the proof of Theorem \ref{amicable} we have already found the smallest composite solution.

In fact, the solutions to $B_a(n) = m$ for a fixed $m$ are given precisely by the prime partitions $\kappa(m)$ of $m$, as was already observed in \cite[Theoren 2.7]{J}, and there is at least one composite solution for all $n\ge 5$. From this fact we can immediately deduce from \cite[VIII.26]{FS} the following asymptotic:

\begin{prop}
We have
\be
\log(\#\{n : B_a(n)=m\}) \sim 2\pi\sqrt{\frac{m}{3\log m}}.
\ee
as $m\to\infty$.
\end{prop}

\begin{rem}
Indeed, one even has a recursive definition for $\kappa(n)$ in terms of $\beta(n)$,
\be
\kappa(n)=\frac{1}{n}\big(\beta(n)+\sum_{i=1}^{n-1}\kappa(n-i)\beta(i)\big).
\ee
with the initial condition $\kappa(1)=0$. In other words, the number solutions of $B(n)=m$ are determined by the values of $\beta(i)$ for $i\leq m$.
\end{rem}

More generally, this can be phrased in terms of prime-divisor sum fibres, with reference to \cite{PPT}: Let $\mathscr{A}\subset {\bf N}$ be a set of asymptotic density zero (for example, the set of prime numbers). What is the preimage $B^{-1}_a(p)$ for a fixed $a,p$? Erd\H{o}s, Granville, Pomerance, and Spiro (EGPS) conjecture that the fibre $s^{-1}(\mathscr{A})$ also has asymptotic density zero. The following theorem shows that evidence towards the analogous conjecture also holds for $B(n) = B_0(n)$.

\begin{thm}
\label{EGPS}
Let $\epsilon=\epsilon(x)$ be a fixed function tending to 0 as $x\to\infty$, and let $\mathscr A$ be a set of at most $x^{\frac12+\epsilon(x)}$ positive integers. Then
\be
\#\{n\leq x : B(n)\in\mathscr A\} = o_\epsilon(x)
\ee
as $x\to\infty$, uniformly in the choice of $\mathscr A$.
\end{thm}

\begin{proof}
Let $a\in\mathscr A$, and $n$ a non-exceptional preimage of $a$ in the sense of \cite[\S2]{PPT}. Write $n=de$ where $d$ is the largest divisor of $n$ not exceeding $\sqrt{x}$. Then following the proof of \cite[Theorem 1.2]{PPT}, we observe firstly that from $B(n)\leq s(n)$ that
\be
B(n) \ll x^{\frac12-10\epsilon(x)}\log x.
\ee
Secondly, $B(de) = B(d) + B(e)$ let $g=\gcd(B(d),B(e))$, then
\be
\frac{a}{g} \equiv  \frac{B(e)}{g} \pmod{B(d)/g},
\ee
so that given $d$ we see that $B(e)$ lies in a uniquely determined residue class mod $B(d)/g$. Hence the number of choices of $B(e)$ given $d$ is
\be
\ll 1+x^{\frac12-10\epsilon(x)}\log x\frac{g}{B(d)}\le  1+x^{\frac12-10\epsilon(x)}\frac{\log x}{\log d}
\ee
where the second inequality follows from $B(d) \ge \log d $.

Now we sum over possible values of $g$ and $d$. We can write each $d$ as $gh$ where $h\leq x^{1/2-10\epsilon(x)}/g$. Thinking of $g$ as fixed and summing on $d = gh$ gives a bound of $\ll (\log x)^2x^{1/2-10\epsilon(x)}$. Whereas summing over the $\tau(a)$ divisors $g$ of $a$ bounds the number of possibilities for $n$ by
\be
\ll \tau(a)(\log x)^2x^{1/2-10\epsilon(x)}<x^{1/\log\log x}x^{1/2-10\epsilon(x)}\leq x^{1/2-9\epsilon(x)},
\ee
bounding the number of $n$ that arise in this way as desired.
\end{proof}

\begin{rem}
Since $B_a(n)\leq s(n)$ is no longer true for $a>1$, it remains to ask whether the above holds for general $a$, and if moreover the EGPS conjecture should also hold. \end{rem}

Number Theory (math.NT); Combinatorics (math.CO)


Connections Between Finite Difference and Finite Element Approximations

Abstract: We present useful connections between the finite difference and the finite element methods for a model boundary value problem. We start from the observation that, in the finite element context, the interpolant of the solution in one dimension coincides with the finite element approximation of the solution. This result can be viewed as an extension of the Green function formula for the solution at the continuous level. We write the finite difference and the finite element systems such that the two corresponding linear systems have the same stiffness matrices and compare the right hand side load vectors for the two methods. Using evaluation of the Green function, a formula for the inverse of the stiffness matrix is extended to the case of non-uniformly distributed mesh points. We provide an error analysis based on the connection between the two methods, and estimate the energy norm of the difference of the two solutions. Interesting extensions to the 2D case are provided.

\section{Introduction}

When studying  basic numerical methods for solving boundary value problems (BVP) many resources start with a Finite Difference (FD) approach followed by a separate Finite Element (FE) approach. In this paper, we adopt a new point of view that emphasizes on the connections between the FE and FD methods by solving a standard two point boundary value problem discretized on the same nodes through both  FD and the FE methods. We present the connections that help simplify certain proofs for FD error approximation, and also, that lead to a better understanding of the advantages of each of these two methods.

Consider the two-point boundary value problem
\begin{equation}\label{2pBVP}
-u''(x) =f(x), \ x \in (0, 1), \ u(0)=u(1)=0.
\end{equation}

It is known that, if $u \in C^2([0, 1])$ is the unique solution of \eqref{2pBVP}, then
\begin{equation}\label{GF}
u(x) =\int_0^1 G(x,s) f(s)\, ds, \ \text{for all} \ x \in(0,1),
\end{equation}
where,
\begin{equation}\label{Gfunc}
 G(x,s) =  \left\{
 \begin{array}{rcl}
     s(1-x)  & \mbox{if } \  0\leq s\leq x,\\
      x(1-s)  & \mbox{if } \ x<s\leq 1.\\
\end{array}
\right.
\end{equation}

 For the discretization of  \eqref{2pBVP}, we divide the interval $[0,1]$ into $n$  subintervals,  using the nodes $0=x_0<x_1<\cdots < x_n=1$ and denote \\ $h_j:=x_j - x_{j-1}, j=1, 2, \cdots, n$.
 First, consider the finite difference approximation of  $u''(x_j)$  that uses  the quadratic polynomial interpolation  of the solution $u$ at three nodes: $x_{j-1}, x_j$, and $x_{j+1}$:
 \begin{equation}\label{FD1}
 u^{''}(x_j) \approx \frac{2 u(x_{j-1}) }{h_j(h_j +h_{j+1})} + \frac {-2 u(x_j)}{h_j\, h_{j+1}}  + \frac{2 u(x_{j+1})}{h_{j+1}(h_j +h_{j+1})}.
\end{equation}
For the  uniform distribution of the nodes  $x_j=h j$,  $j=0,1, \ldots, n$,  where $h=\frac{1}{n}$,  the approximation \eqref{FD1} becomes the second order  standard centered difference approximation
\[
 u^{''}(x_j) \approx \frac{u(x_{j-1}) -2 u(x_j) + u(x_{j+1})}{h^2}.
\]

For the general case of non-uniform distributed nodes,  we  let $f_j:=f(x_j)$, and for $u_j\approx u(x_j)$, we solve the system

 \begin{equation}\label{FDs1}
  \left\{
 \begin{array}{rcl}
     u_0 & =0&\\ \\
 \displaystyle  \frac{-2 u_{j-1} }{h_j(h_j +h_{j+1})} + \frac {2 u_j}{h_j\, h_{j+1}}  + \frac{-2 u_{j+1}}{h_{j+1}(h_j +h_{j+1})} & =f_j& \ j=\overline{1,n-1}.\\  \\
     u_n & =0.&
\end{array}
\right.
\end{equation}
By multiplying the generic equation in \eqref{FDs1} with $\displaystyle \frac{h_j +h_{j+1}}{2}$,   we get
 \begin{equation}\label{FDs2}
  \frac{-1}{h_j}\,  u_{j-1} + \left (\frac {1}{h_j} + \frac{1}{h_{j+1}} \right )  u_j + \frac{-1} {h_{j+1}} u_{j+1} = \frac{h_j +h_{j+1}}{2}\,  f_j.
\end{equation}

Denote ${u}^{FD} := [ u_1, u_2, \cdots, u_{n-1}]^T$, and  $\tilde{f}:=[ f_1, f_2, \cdots, f_{n-1}]^T$. Let  $W$  be the $(n-1)\times(n-1)$ diagonal matrix with entries: $\{\frac{h_1 +h_{2}}{2}, \cdots, \frac{h_{n-1}+h_{n}}{2} \}$ and let  $S$  be the stiffness
tridiagonal $(n-1)\times(n-1)$ matrix
\begin{equation} \label{S}
S=\left [\begin{matrix}
 \frac{1}{h_1}+ \frac{1}{h_2},& -\frac{1}{h_2} &   & & & \\
-\frac{1}{h_2} &  \frac{1}{h_2}+ \frac{1}{h_3} & -\frac{1}{h_3}  &  & &  \\
  \   & \ddots & \ddots  & \ddots  & &  \\
    & & & & & \\
  &  & & -\frac{1}{h_{n-2}}  &  \frac{1}{h_{n-2}}+ \frac{1}{h_{n-1}} &   -\frac{1}{h_{n}} \\
 & &  & & -\frac{1}{h_{n-1}}  &  \frac{1}{h_{n-1}}+ \frac{1}{h_n}  \\
\end{matrix} \right].
\end{equation}

Then, using \eqref{FDs2}  and the fact that $u_0=u_n=0$, the system \eqref{FDs1} is equivalent to
 \begin{equation}\label{FDs3}
 S\, {u}^{FD} = W\, \tilde{f}.
\end{equation}

For a better comparison of the finite difference  solution $ {u}^{FD}$ to the finite element  approximation $ {u}^{FE}$, we prefer to write the linear system in the form \eqref{FDs3}.

Secondly, for the FE discretization, we  will use the standard notation
\[
a(u, v) = \int_0^1 u'(x) v'(x) \, dx, \ \text{and} \ (f, v) = \int_0^1  f(x) v(x) \, dx.
 \]
Then, the variational formulation of \eqref{2pBVP} is : Find $u \in V:= H^1_0(0,1)$ such that
 \begin{equation}\label{VF}
a(u, v) = (f, v), \ \text{for all} \ v \in V.
\end{equation}

 Also, we consider the mesh nodes  on $[0,1]$ as being the same as those used for the finite difference discretization:   $0=x_0<x_1<\cdots < x_n=1$,  and define  the corresponding   discrete space  $V_h$  as  the subspace of $ V = H^1_0(0,1)$, given by
 \[
 V_h = \{ v_h \in V \mid v_h \text{ is linear on each } [x_j, x_{j + 1}]\},
 \]
  i.e., $V_h$ is the space of all {\it piecewise linear continuous functions} with respect to the given nodes that are zero at $x=0$ and $x=1$.  We consider the nodal basis $\{ \varphi_j\}_{j = 1}^{n-1} \subset V_h$ such that $\varphi_i(x_j ) = \delta_{ij}$.
 Thus, the discrete  variational formulation of \eqref{2pBVP} is: Find $u_h \in V:= H^1_0(0,1)$ such that
 \begin{equation}\label{dVF}
a(u_h, v_h) = (f, v_h), \ \text{for all} \ v_h \in V_h.
\end{equation}
We look for  $u_h=u_h^{FE}$ with  the nodal basis expansion
 \[
 u_h := \sum_{i=1}^{n-1} u_i \varphi_i, \ \text{where} \ \ u_i=u_h(x_i).
 \]
If we consider the test functions $v_h=\varphi_j, j=1,2,\cdots,n-1$ in \eqref{dVF}, we  obtain   the system
\begin{equation}\label{eq:FEsol}
S\, u^{FE} = \tildeu{f},
\end{equation}
for finding the coefficient vector  $u^{FE}=[u_1, \cdots, u_{n-1}]^T$, where \\ $\tildeu{f}:=[(f, \varphi_1), \cdots (f, \varphi_{n-1})]^T$ and  $S$ is the $(n-1)\times (n-1)$ {\it tridiagonal} matrix with entries $S_{ij}=a(\varphi_i', \varphi_j')$.
It is an easy exercise to verify that $S$ defined for the finite element discretization, coincides with the matrix defined in \eqref{S} for the finite difference discretization.

We note that  for any $\alpha \in \mathbb{R}^{n-1}, \alpha \neq 0$
\[
\alpha^T S \, \alpha = a(v_h, v_h) =  \int_0^1 (v'_h(x))^2 \, dx>0,
\]
where $v_h = \sum_{i=1}^{n-1} \alpha_i \varphi_i$. Consequently, the stifnees matrix $S$ is invertible.

We can also define the $(n-1)\times(n-1)$ Green matrix
\[
\tilde{G} =\left [G(x_i,x_j) \right ]_{i,j=\overline{1,n-1}}.
\]

The purpose of the paper is to show how the  two types of discretization are connected.
Using  that  the Green function \eqref{Gfunc} can be viewed  as a scaled  finite element  function, we will prove that  the common stiffness matrix $S$ satisfies  $ S^{-1}=\tilde{G}$ in the general non-uniform case. While the identity is well known for the uniform distributed nodes, see Section 12.2.2 in \cite{QSS}, by the best knowledge of the authors, the identity seems to  be not available  for the non-uniform case or in the finite element context. We  will also show that  the right hand side vector of  \eqref{FDs3}, that defines the finite difference solution,  is obtained by the Composite Trapezoid Rule (CTR) approximation of  the entries  of the dual vector  $\tildeu{f}$.  As a consequence, we can  compare the $u^{FD}$  and $u^{FE}$  and  estimate  the energy norm of the  error $u^{FD} -u^{FE}$.

The rest of the paper is organized as follows: In Section \ref{sec:FDvsFE}, we  present the similarity between the  finite element and the finite difference  linear systems   for  the model problem \eqref{2pBVP}. In Section \ref{sec:error}, we use the formulas for the FD and the FE solutions in order to compare the two discretizations and  do an error analysis.  Two interesting extensions to the 2D case are presented in Section \ref{sec:2D}.

\section{The connections between the finite element and the finite difference of the 1D model problem}\label{sec:FDvsFE}
In this section we investigate the systems for the FE and FD discretizations of \eqref{2pBVP} by relating the matrices and the load vectors for the two systems. The following lemma gives a formula for the general  component of the dual vector $\tildeu{f}$ and the evaluation of the solution $u$  at the neighboring nodes viewed as degrees of freedom for the finite element approximation.
In addition, the formula connects with the FD discretization via the formula  \eqref{FDs2}.
\subsection{A formula for the finite element  solution}
\begin{lemma}\label{fvarphi}
Let $u$ be the solution of \eqref{2pBVP}, and $\{\varphi_j\}_{j=1,2,\cdots, n-1}$ be the nodal basis for $V_h$. Then, for $j=1,2,\cdots,n-1$, we have

\begin{equation}\label{lemma1fphij}
(f,\varphi_j)=\displaystyle -\frac{1}{h_j} u(x_{j-1})+\left(\frac{1}{h_j}+\frac{1}{h_{j+1}}\right) u(x_j)-\frac{1}{h_{j+1}} u(x_{j+1})
\end{equation}

\end{lemma}

\begin{proof}
From the variational formulation \eqref{dVF}, we have $(f,\varphi_j)=a(u,\varphi_j)=\displaystyle \int_0^1u'(x)\varphi'_j(x) dx=\frac{1}{h_j}\int_{x_{j-1}}^{x_j} u'(x) dx+\frac{-1}{h_{j+1}}\int_{x_{j}}^{x_{j+1}} u'(x) dx=-\frac{1}{h_j} u(x_{j-1})+\left(\frac{1}{h_j}+\frac{1}{h_{j+1}}\right) u(x_j)-\frac{1}{h_{j+1}} u(x_{j+1})$.
\end{proof}

Next, for any $s\in (0,1)$, we define the function
\begin{equation}
 \phi_s(x) =  \left\{
 \begin{array}{ccl}
    \displaystyle  \frac{x}{s}  & \mbox{if } \  0\leq x\leq s,\\ \\
    \displaystyle   \frac{1-x}{1-s}  & \mbox{if } \ s<x\leq 1.\\
\end{array}
\right.
\end{equation}

Note that, if $s=x_j$, $j=1,2,\cdots,n-1$, then $\phi_{x_j}$ is a piecewise linear function that belongs to $V_h$.

\begin{corollary} (Green's Formula)
For any $s\in (0,1)$, we have

\begin{equation}\label{fBigphij}
(f,\phi_s)=\displaystyle \frac{1}{s(1-s)} u(s)
\end{equation}

\end{corollary}
\begin{proof} In the Lemma \eqref{fvarphi}, take $n=2$, $x_0=0$, $x_2=1$, $x_1=s$, $h_1=s$, $h_2=1-s$.
\end{proof}

Note that the equation  \eqref{fBigphij} is in fact the Green's formula \eqref{dVF}. This is because

\begin{equation}\label{GBigphis}
G(x,s)=s(1-s) \phi_s(x)=G(s,x), \ \text{for all}  \ x, s \in (0, 1).
\end{equation}

This formula shows that the Green's Function can be interpreted as a scaled finite element function.

\begin{corollary}\label{uFF} Let $\displaystyle u_h := \sum_{i=1}^{n-1} u_i \varphi_i$  be the finite element solution of  \eqref{dVF}, and let ${u}^{FE} := [ u_1, u_2, \cdots, u_{n-1}]^T$. Then $u_h$ coincides with the linear interpolant of $u$ on the nodes $x_0,x_1, \ldots, x_n$.

In other words, $u_j=u(x_j)$, $j=1,2,\cdots,n-1$.

\end{corollary}
\begin{proof} Since the stiffness matrix $S$ for the system \eqref{dVF} is given by \eqref{S}, from the equation \eqref{lemma1fphij}  we have that $\tilde{u}=[u(x_1), u(x_2), \ldots, u(x_{n-1})]^T$ solves $S\tilde{u}=\tildeu{f}$. On the other hand, from \eqref{eq:FEsol} we have that
$S\, u^{FE}=\tildeu{f}$. Using  that the matrix $S$ is invertible, we conclude that $u^{FE}=\tilde{u}$.
\end{proof}

\begin{corollary} If $S$ is the stiffness matrix defined in \eqref{S}, then
\begin{equation}\label{SinverseG}
S^{-1}=\tilde{G},
\end{equation}
consequently, $u^{FE}=S^{-1}\tildeu{f}= \tilde{G} \tildeu{f}$.
\end{corollary}

\begin{proof}
Apply \eqref{fBigphij} for $s=x_j$, $j=1,2,\cdots,n-1$ to get
\begin{equation}\label{uxPhij}
u(x_j)=x_j(1-x_j)\int_0^1\phi_{x_j}(x)f(x) dx.
\end{equation}
Obviously, by the definition of $\phi_{x_j}$ we have $\phi_{x_j}\in V_h$. Hence, $\phi_{x_j}$ coincides with its interpolant on the nodes $x_0,x_1, \ldots, x_n$. Thus,
\begin{equation}\label{Phivarphi}
\phi_x(x)=\sum_{i=1}^{n-1} \phi_{x_j}(x_i) \varphi_i(x).
\end{equation}

For the equations \eqref{uxPhij} and \eqref{Phivarphi}, we get

\begin{equation}\label{eq:FESf}
u(x_j)=x_j(1-x_j)\sum_{i=1}^{n-1} \phi_{x_j}(x_i) \int_0^1f(x)\varphi_i(x) dx.
\end{equation}

 Since $x_j(1-x_j)\phi_{x_j}(x_i)=G(x_j,x_i)$, we obtain $\displaystyle u(x_j)=\sum_{i=1}^{n-1} G(x_j,x_i)(f,\varphi_i)$, $j=1,2,\cdots,n-1$, which combined with the fact that the finite element solution coincides with the interpolant as given by Corollary \ref{uFF}, leads to $u^{FE}=\tilde{G}\tildeu{f}$. Since $u^{FE}=S^{-1}\tildeu{f}$ for any $\tildeu{f} \in \mathbb{R}^{n-1}$, we conclude that the formula \eqref{SinverseG} holds.
\end{proof}
In order to obtain the formula \eqref{eq:FESf}, it is essential that $\phi_{x_j}\in V_h$, and that  $\phi_{x_j}$ can be expanded in the basis $\{ \varphi_i\}$.

\subsection{A formula for the finite difference solution}

Let us consider the finite difference discretization \eqref{FDs1} that is equivalent to \eqref{FDs2} and  builds the system \eqref{FDs3}.

For a continuous function $\theta : [0,1]\to \mathbb{R}$ such that $\theta(0)=\theta(1)=0$, the composite trapezoid rule (CTR) on the nodes $x_0,x_1, \ldots, x_n$ is
\begin{equation}\label{CTR}
\int_0^1\theta(x)dx \approx T_n(\theta):=\sum_{i=1}^{n-1} \theta(x_i) \frac{h_i+h_{i+1}}{2}.
\end{equation}
Note that if $\displaystyle I(\theta)=\sum_{i=1}^{n-1} \theta(x_i)\, \varphi_i$ is the interpolant of $\theta$, and by using  that $\int_0^1 \varphi_i(x)dx=\displaystyle \frac{h_i+h_{i+1}}{2}$, then the CTR formula  becomes
\[
T_n(\theta)=\int_0^1I(\theta)(x)dx.
\]
We observe that  the diagonal entries of  $W$ in equation \eqref{FDs3} are  exactly  the weights of the quadrature formula \eqref{CTR}.

Next, we will show that, componentwise, the finite difference solution $u_j$  is the CTR approximation of the solution $u(x_i)$ given by the Green's formula:
\begin{equation}\label{Guj}
u(x_j)=\int_0^1 G(x_j,x)f(x)dx.
\end{equation}

For each $j=1,2,\cdots,n-1$, we define
\[
\theta_j(x)=G(x_j,x)f(x), \ x \in [0,1], \ \text{and}
\]
\[
\begin{aligned}
w_j & :=T_n(\theta_j)=\displaystyle \sum_{i=1}^{n-1}\frac{h_i+h_{i+1}}{2}\theta_j(x_i)
=\displaystyle \sum_{i=1}^{n-1} G(x_j,x_i)\frac{h_i+h_{i+1}}{2}f(x_i) \\
& =(\tilde{G}W\tilde{f})_j.
\end{aligned}
\]
Consequently, we have
\begin{equation}\label{eq:w}
w= \tilde{G}W\tilde{f}.
\end{equation}
\begin{prop}\label{WT}
The finite difference solution $u^{FD}$ of \eqref{FDs3} coincides with the vector $w=[w_1, w_2, \ldots, w_{n-1}]^T$.
\end{prop}
\begin{proof}
From  the formula  \eqref{SinverseG}, we have  that $u^{FD}=\tilde{G} W\tilde{f}$ which compared to  \eqref{eq:w}, leads to $u^{FD}=w$.
\end{proof}

\begin{remark} We can prove the Proposition \ref{WT} without using finite element arguments needed to prove  \eqref{SinverseG}. We can just verify that the vector $w$ satisfies the system $Sw=W\tilde{f}$ by essentially using  that $\phi_{x_j}$  is linear on the intervals $[0, x_j]$ and $[x_j, 1]$.
\end{remark}
\subsection{Comparison}
 By rewriting the FD system, we have that the  FD and the FE linear systems have the same stiffness matrices.  The corresponding solutions are given by
\[
u^{FE}=S^{-1}\tildeu{f}, \ \text{and} \  u^{FD}=S^{-1}W\tilde{f},\ \text{where}
\]
\[
(\tildeu{f})_j=(f,\varphi_j)=\int_0^1 f(x)\varphi_j(x)\, dx,  \ \text{and} \ (W\tilde{f})_j=\frac{h_j+h_{j+1}}{2}f(x_j) .
\]
The right hand sides of  the two systems are componentwise related by
\begin{equation}\label{fTn}
(f,\varphi_j)=T_n(f\varphi_j).
\end{equation}

\section{Error Estimates} \label{sec:error}
 As a consequence of the previous section, we provide error estimates for $u -u_h^{FD}$  in both the discrete infinity norm and the energy norm, and estimate the energy norm of the difference $u_h^{FE} -u_h^{FD}$.

\subsection{The infinity norm estimate for the FD solution}
From Lemma \ref{WT}, we can estimate the error $$
\displaystyle  \max_{j=\overline{1,n-1}} |u(x_j)-u_j^{FD}| $$  in the general non-uniform case.

For the uniform case, it is well known (see e.g.  \cite{QSS}), that  if $ f\in {\mathcal{C}}^2([0,1])$, then
\begin{equation}\label{maxerrc}
\displaystyle \max_{1\leq j\leq n} |u(x_j)-u_j^{FD}|\leq \frac{h^2}{96}\|f''\|_{\infty},
\end{equation}
where for a continuous function $\theta$ on $[a,b]$, we define $\displaystyle \|\theta\|_{\infty, [a, b]}:=\max_{x\in[a,b]}|\theta(x)|$ and
$\|\theta\|_{\infty}:=\|\theta\|_{\infty, [0, 1]}$.

For  extending \eqref{maxerrc} to the general nonuniform case,  we will use the known  formula for the CTR error as follows:
For a function $\theta:[a,b]\to \mathbb{R}$, \\ $\theta \in {\mathcal{C}}^2([a,b])$, and the nodes $a\leq x_0 <x-1<\ldots <x_n=b$, we have
\begin{equation}\label{CTRE}
\displaystyle \left|\int_a^b\theta(x)dx - T_{n,[a,b]}\right|\leq\frac{b-a}{12} h^2\|\theta''\|_{\infty,[a,b]},
\end{equation}
where $\displaystyle T_{n,[a,b]}(\theta)=\sum_{i=1}^n (x_i-x_{i-1})\frac{\theta(x_i)+\theta(x_{i-1})}{2}$ and $h=\displaystyle \max_{i=\overline{1,n}}(x_i-x_{i-1})$.

\begin{theorem} Let $f\in  {\mathcal{C}}^2[0,1])$, and  let  $u$ be the solution of the boundary value problem \eqref{2pBVP}, and $u^{FD}=[u_1,u_2,\ldots, u_{n-1}]^T$ be the finite difference solution of \eqref{FDs3}. If $h_j=x_j-x_{j-1}$ for $j=1,2,\ldots, n$ and $\displaystyle h:=\max_{j=\overline{1,n}} |h_j|$, then, we have
\begin{equation}\label{EDEinf}
\displaystyle \max_{1\leq j \leq n-1}|u(x_j)-u_j|\leq \frac{h^2}{48}(4\|f'\|_{\infty}+\|f''\|_{\infty}).
\end{equation}
\end{theorem}
\begin{proof}
From the proof of Corollary \ref{SinverseG} and the equation \eqref{uxPhij}, we have
\[
u(x_j)=x_j(1-x_j)\int_0^1 \phi_{x_j}(x) f(x)dx.
\]
From  Proposition  \ref{WT}, equations \eqref{CTR} and \eqref{fTn}, we also have that

\begin{equation}\label{uFDf}
\begin{aligned}
u_j&=(\tilde{G}W\tilde{f})_j= \displaystyle \sum_{i=1}^{n-1} G(x_j,x_i)\frac{h_i+h_{i+1}}{2}f(x_i) \\
&= \displaystyle x_j(1-x_j)  \sum_{i=1}^{n-1} \phi_{x_j}(x_i)\frac{h_i+h_{i+1}}{2} = \displaystyle x_j(1-x_j) T_n(\phi_{x_j}f).
\end{aligned}
\end{equation}
Consequently, the error  $E_j=u(x_j)-u_j$  satisfies
\begin{equation}
\begin{aligned}
E_j&= \displaystyle x_j(1-x_j)\left( \int_0^1\phi_{x_j}(x)f(x)dx- T_n(\phi_{x_j}f)\right)=\\
&=x_j(1-x_j)\left(\int_0^{x_j} \phi_{x_j}(x)f(x)dx - T_{n, [0, x_j]}(\phi_{x_j}f)\right) +\\
& + x_j(1-x_j)\left(\int_{x_j}^1 \phi_{x_j}(x)f(x)dx- T_{n, [ x_j,1]}(\phi_{x_j}f)\right).
\end{aligned}
\end{equation}

By noting that $\phi_xf$ is ${\mathcal{C}}^2$ on $[0,x_j]$ and $[x_j,1]$, applying the estimate \eqref{CTRE} on the intervals $[0,x_j]$ and $[x_j,1]$  for $\theta(x)=\phi_{x_j}(x)f(x)$, and using
\[
\displaystyle \max_{x\in [0,x_j]}|\theta''(x)|\leq \frac{2}{x_j}\|f'\|_{\infty}+\|f''\|_{\infty}, \ \text{and}
\]
\[
\displaystyle \max_{x \in [x_j,1]}|\theta''(x)|\leq \frac{2}{1-x_j}\|f'\|_{\infty}+\|f''\|_{\infty},
\]
we obtain
\begin{equation*}
\begin{aligned}
\displaystyle |E_j| & \leq  x_j(1-x_j) \frac{h^2}{12}x_j\left(\frac{2}{x_j}\|f'\|_{\infty,[0,x_j]}
 +\|f''\|_{\infty}\right)+ \\
&+x_j(1-x_j) \frac{h^2}{12}(1-x_j)\left(\frac{2}{1-x_j}\|f'\|_{\infty,[x_j,1]}+\|f''\|_{\infty}\right).
\end{aligned}
\end{equation*}
Since  $x_j(1-x_j) \leq \frac{1}{4}$, the above estimate  leads to \eqref{EDEinf}.
\end{proof}
\begin{remark} It is known that \eqref{FD1} is only first order accurate if $h_j\neq h_{j+1}$,  see  e.g., Section 1.3 in \cite{LeVeque07}. The estimate \eqref{EDEinf} shows that  the FD method based on \eqref{FDs1} or \eqref{FDs2}  is globally $O(h^2)$.
We also emphasize that our  proof is done using the formula of the solution \eqref{uFDf}, and it is not based on \\  $\delta$-functional arguments as usually done for proving \eqref{maxerrc}, see e.g., \cite{QSS}.
\end{remark}

 Based on the CTR approximation, the formula \eqref{uFDf} allows for further error analysis in  the energy norm.

\subsection{Energy Norm  Errors}

For $v\in V=H_0^1(0, 1)$, define the energy norm
 \begin{equation}
|v|=|v|_a=\left(\int_0^1 (v'(x))^2dx\right)^{\frac{1}{2}}=(a(v,v))^{\frac{1}{2}}.
\end{equation}

If the vector $u^{FD}=[u_1, \ldots, u_{n-1}]^T$ is the solution of the finite difference system \eqref{FDs3}, then we define the corresponding function in $V_h$ as

$u_h^{FD}:=\displaystyle \sum_{i=1}^{n-1} u_i\varphi_i$. From the previous sections, we know that $u^{FD}$ satisfies the equation $Su^{FD}=\tilde{G}(W\tilde{f})$, where $W\tilde{f}$ is defined by \eqref{S} and \eqref{FDs3}, and $\displaystyle \frac{h_i+h_{i+1}}{2}f(x_i)=T_n(f\varphi_j)$. Thus, since the finite element stiffness matrix is still $S$, we have that
\[
a(u_h^{FD}, \varphi_j)=T_n(f\varphi_j), \ \ \text{for all} \ j=1,2,\ldots, n-1.
\]
Using the linearity of $a(u_h^{FD},\cdot)$ and $T_n(f,\cdot)$, we have that
\begin{equation}\label{uhFD}
a(u_h^{FD},v_h)=T_n(fv_h),  \ \text{for all} \ v_h \in V_h.
\end{equation}

On the other hand, we have
\begin{equation}\label{uhFE}
a(u_h^{FE}, v_h)=(f,v_h)=\int_0^1fv_h \ dx,  \ \text{for all} \ v_h\in V_h.
\end{equation}

From the equations \eqref{uhFD} and \eqref{uhFE}, we obtain
\[
a(u_h^{FE}-u_h^{FD}, v_h)=F_h(v_h):=\int_0^1fv_h \ dx-T_n(fv_h).
\]
Consequently,
\begin{equation}\label{Fh}
|u_h^{FE}-u_h^{FD}|=\sup_{v_h \in V_h} \frac{F_h(v_h)}{|v_h|}:=\|F_h\|_{V_h^*}
\end{equation}
where the supremum is taken over all non-zero vectors.
\begin{theorem}\label{th:FED}
Assume that $f\in{\mathcal{C}}^2([0,1])$, and that $u_h^{FE}$ and $u_h^{FD}$ are the finite element and the finite difference corresponding solutions of the boundary value problem \eqref{2pBVP} on the nodes $x_0=0<x_1<\ldots<x_n=1$.

 Let $\displaystyle h=\max_{i=\overline{1,n}} (x_i-x_{i-1})=\displaystyle \max_{i=\overline{1,n}}(h_i)$. Then,
\begin{equation}\label{udiff}
|u_h^{FE}-u_h^{FD}|\leq h^2\left( \frac{\|f''\|_{\infty}}{12}+\frac{\|f'\|_{\infty}}{6}\right).
\end{equation}
\end{theorem}
\begin{proof}
According to the equation \eqref{Fh}, we just have to find an upper bound for $\|F_h\|_{V_h^{\star}}$. Let $\theta_{i}(x):=f(x)v_h(x)$, for $x\in [x_{i-1},x_i]$, $i=1,2,\ldots, n$. Using the trapezoid rule error formula for $\theta_i$, we  have that
\begin{equation}\label{Fvh}
F_h(v_h)=-\frac{1}{12}\sum_{i=1}^n h_i^3 \theta_i ''(\xi_i),  \ \xi_i \in [x_{i-1},x_i].
\end{equation}
To simplify the notation, we assume that $\displaystyle v_h=\sum_{i=1}^{n-1} \alpha_i \varphi_i$. Then, on the interval $(x_{i-1},x_i)$, $v'_h= \frac{\alpha_i - \alpha_{i-1}}{h_i}$, and  from the equation \eqref{Fvh}, we have
\[
F_h(v_h)=\displaystyle -\frac{1}{12}\left(\sum_{i=1}^n  h_i^3 f''(\xi_i)v_h(\xi_i)+2\sum_{i=1}^n h_i^3\,  \frac{\alpha_i-\alpha_{i-1}}{h_i}f'(\xi_i) \right).
\]
We have  $h_i\leq h$ and $|v_h(x)| \leq \|v_h\|_{\infty}\leq |v_h|$, for all $v_h \in V_h$. Thus,
\begin{equation}\label{Fh2}
|F_h(v_h)| \leq \frac{1}{12}h^2|v_h|\sum_{i=1}^n h_i |f''(\xi_i)|+\frac{1}{6} h^2 \|f'\|_{\infty}\sum_{i=1}^n|\alpha_i - \alpha_{i-1}|.
\end{equation}
Using the discrete  mean value theorem, (see e.g., Theorem 9.1  in  \cite{QSS}), for some $\xi \in (0, 1)$, we have
\[
\sum_{i=1}^n h_i |f''(\xi_i)|=|f''(\xi)| \sum_{i=1}^n h_i\leq \|f''\|_{\infty}.
\]
For the second sum in \eqref{Fh2}, the  Cauchy-Schwarz inequality gives
\[
\begin{aligned}
 \sum_{i=1}^n|\alpha_i-\alpha_{i-1}|&  =\sum_{i=1}^n h_i^{\frac{1}{2}} \frac{|\alpha_i-\alpha_{i-1}|}{h_i^{\frac{1}{2}}}
  \leq \left(\sum_{i=1}^n h_i\right)^{1/2}\left(\sum_{i=1}^n  \frac{|\alpha_i-\alpha_{i-1}|^2}{h_i}\right)^{1/2}\\ &=\left(\sum_{i=1}^n \int_{x_{i-1}}^{x_i} (v'_h)^2 dx\right )^{1/2}=|v_h|.
 \end{aligned}
 \]
Combining the last two estimates with  \eqref{Fh2}, gives
\[
|F_h(v_h)|\leq \frac{1}{12} h^2 |v_h|  \|f''\|_{\infty}+\frac{1}{6}h^2\|f'\|_{\infty} |v_h|.
\]
Hence,
\[
\|F_h\|_{V_h^*} \leq h^2\left( \frac{\|f''\|_{\infty}}{12}+\frac{\|f'\|_{\infty}}{6}\right),
\]
which, together with \eqref{Fh}  proves the statement of the theorem.
\end{proof}
\begin{corollary}
Under the same assumptions as in the Theorem \ref{th:FED}, we have
\begin{equation}\label{ChFD}
|u-u_h^{FD} |\leq Ch(\|f''\|_\infty + \|f\|_{L^2(0, 1)}),
\end{equation}
 where $C$ is a constant independent of $h$ or $f$.
\end{corollary}
\begin{proof} It is known that the following estimate for the finite element error in the energy norm holds

\begin{equation}\label{ChFE}
|u-u_h^{FE} |\leq Ch \|f\|_{L^2(0, 1)}.
\end{equation}
 where $C$ is a constant independent of $h$ or $f$, see e.g. \cite{braess, brenner-scott,  ern-guermond}.

Now, the inequality \eqref{ChFD} follows  using \eqref{ChFE}, \eqref{udiff}, and  the triangle inequality
\[
|u-u_h^{FD}| \leq |u-u_h^{FE}|  + |u_h^{FE}-u_h^{FD}|.
\]

\end{proof}

\section{Interesting extensions to the 2D case}\label{sec:2D}

Let $\Omega\subset\mathbb{R}^2$ be a polygonal domain, and $f \in L^2(\Omega)$ or $f$ is a continuous functional on $H^1_0(\Omega)$. Consider the model problem: Find $u$  such that

\begin{equation}\label{2DBVP}
 \left\{
 \begin{array}{rccl}
     -\Delta u = & f  & \text{in } \ \Omega,\\
      u =& 0 & \text{on} \  \partial \Omega.
\end{array}
\right.
\end{equation}

The corresponding variational or weak formulation of \eqref{2DBVP} is:

Find $u \in H^1_0(\Omega)$ such that
\begin{equation}\label{2Dvf}
a(u,v) = (f,v) ,\ \text{for all} \ v \in  H^1_0(\Omega),
\end{equation}
where, for any $u,v\in  H^1_0(\Omega)$, and for  $f \in L^2(\Omega)$,
\[
a(u,v): =\int_\Omega \nabla u\cdot \nabla v \, dx, \ \text{and}\  (f,v):=\int_\Omega f(x) v(x) \, dx.
\]
The existence and uniqueness of the solution of \eqref{2Dvf} is well know, see e.g., \cite{braess, brenner-scott,  ern-guermond, demko-oden}.
For the discretization of \eqref{2DBVP}, we let ${\mathcal{T}}_h$ be a triangulation of $\Omega$ and consider $V_h$ a conforming finite element space with a nodal basis $\{\varphi_1, \cdots, \varphi_n\}$ associated with the mesh ${\mathcal{T}}_h$.
If $\varphi_j$ is a generic basis function with support $D_j \subset \Omega$, we assume
\begin{equation*}
\displaystyle D_j= \bigcup_{i=1}^{n_j} T_i, \ \text{with}  \ T_i\ \text{being a triangle in} \ {\mathcal{T}}_h.
\end{equation*}
The formula \eqref{lemma1fphij} is a formula of significant importance because it shows the strong connection between the FE and the FD discretizations  in 1D.
A corresponding formula for the 2D case can be obtained by applying the Green's formula for the function $f\varphi_j = -\Delta u \varphi_j$ to get

\begin{equation}\label{2DF}
\begin{aligned}
(f,\varphi_j) &  = \int_\Omega  -\Delta u \varphi_j \, dx = \int_\Omega \nabla u\cdot \nabla \varphi_j\, dx =\\
                  & = -\sum_{T_i\subset D_j}\int_{T_i} (\Delta \varphi_j)\, u\, dx +\sum_{T_i\subset D_j} \int_{\partial T_i} (\nabla u\cdot {\bf n}) \, u \, ds.
\end{aligned}
\end{equation}
where ${\bf{n}}$ is the outer normal vector to the integration domain's boundary.
Similary to the 1D case,  the components $(f,\varphi_j)$ of the dual vector $f$ relative to   the basis $\{\varphi_1, \cdots, \varphi_n\}$  can be written as linear combinations of degrees of freedom acting on $u$. However, in this case, the degrees of freedom have to involve integrations on triangles and on the edges of ${\mathcal{T}}_h$.  We can redefine an  interpolant using the new degrees of freedom in order to have the FE solution agree with the interpolant.
However,  the main challenge  in this case is to match the number of degrees of freedom with the number $n$ of basis functions when considering the system given by \eqref{2DF}. Except for very simple meshes, this seems to be difficult to achieve.

Next, we consider  two special 2D cases, leaving the challenge to extend this idea to the  more general  cases of meshes in 2D or 3D for  future work.

\subsection{The Green function  for the 1D BVP as a 2D discretization function fo the 2D BVP}

Consider the problem \eqref{2DBVP} on the unit square $\Omega=(0, 1) \times (0, 1)$, and define the mesh ${\mathcal{T}}_1=T_1\cup T_2$,
where $T_1, T_2$ are the two triangles determined by the positive slope diagonal $\Gamma$  of $\Omega$. We define $V_h=V_1= span\{G\}$, where $G=G(x,y)$ is the function defined in \eqref{Gfunc}.

We have  $G\in H^1_0(\Omega)$, and if $u$ is the solution of
\eqref{2DBVP}, then
\begin{equation}\label{2DG}
\begin{aligned}
(f,G) &  = \int_\Omega  -\Delta u\, G\, dxdy = \int_\Omega \nabla u\cdot \nabla G\, dxdy =\\
                  & = \int_{T_1} -\Delta G \, u\, dxdy  \int_{\partial T_1} (\nabla G\cdot {\bf n}_{T_1})\, u \, ds +\\
                  & + \int_{T_2} -\Delta G \, u\, dxdy  \int_{\partial T_2} (\nabla G\cdot {\bf n}_{T_2})\, u \, ds.
\end{aligned}
\end{equation}
Using that $\Delta G= 0 \ \ \text{on} \ \Omega \backslash \Gamma$ and on $\Gamma= \{(x,y) \in\Omega |\  x=y\}$, and that
\[
\nabla G _{|_{T_1}} \cdot {\bf n}_{T_1}+ \nabla G _{|_{T_2}} \cdot {\bf n}_{T_2}=\sqrt{2},
\]
from \eqref{2DG}, we obtain a  formula for $\int_\Gamma u\, ds $.
\begin{theorem}
Let $u$ be the solution of \eqref{2pBVP}. Then,
\begin{equation}\label{2DGF}
\int_\Gamma u\, ds = \frac{1}{\sqrt{2}}  \int_\Omega  f G\, dx dy =  \frac{1}{\sqrt{2}}  \int_\Omega \nabla u \cdot \nabla G \, dx dy.
\end{equation}
\end{theorem}
\begin{remark} The simple calculations leading to formula \eqref{2DGF} have  the following  consequences:
\begin{enumerate}
\item [i)] The function $G=G(x,y)$ is the unique solution of
\begin{equation}\label{2Ddelta}
  -\Delta u = \sqrt{2} \, \delta_\Gamma \ \text{on} \  \Omega =(0, 1)\times (0, 1),
\end{equation}
where
\[
 \delta_\Gamma (\varphi) = \int_\Gamma \varphi\, ds, \ \text{for all} \ \varphi \in C_0^\infty (\Omega).
\]
\item [ii)] The function $G=G(x,y)$ is the Riesz representation of \\ the functional $ \sqrt{2} \, \delta_\Gamma :H^1_0(\Omega)\to \mathbb{R}$.

\item [iii)] Part ii) can  be viewed  as an extension of  the 1D problem on $(0,1)$, where,  for each $s \in (0, 1)$, the function
\[
x \to s(1-s) \Phi_s(x) = G(s,x)
\]
is the Riesz representation of  $\delta_s :H^1_0(\Omega)\to \mathbb{R}$,
\[
\delta_s(\varphi) = \varphi(s), \ \text{for any} \ \varphi \in C_0^\infty (\Omega).
\]
\item [iv)]  The function  $G=G(x,y)$  can be viewed also as the finite element  discretization  of \eqref{2pBVP}, using $C^0-P^2$ discretization on the space $V_1$.

\item [v)] In light of the FD versus FE connections presented here, any 2D quadrature approximation of the 2D integral
$\displaystyle \frac{1}{\sqrt{2}}  \int_\Omega  f G$ can be viewed as a ``finite difference'' approximation of  $\displaystyle \int_\Gamma u\ ds$, where
$u$ is  the solution of \eqref{2pBVP}.
\end{enumerate}
\end{remark}

\subsection{ A bubble  function for the 2D discretization on a special domain}
Consider that $\Omega$ is the domain defined by one equilateral triangle $T$ with vertices $z_1, z_2, z_3$. We define the bubble function
\[
B= \lambda_1 \lambda_2 \lambda_3,
\]
where $ \lambda_1, \lambda_2$ and  $\lambda_3$ are the  linear functions on $T$ with the property that
$\lambda_i(z_j)=\delta_{ij},\  i, j=1,2,3$. We denote the area of the triangle $T$ by $|T|$.

It is easy to check that $B\in H_0^1(\Omega)$ and
\begin{equation}\label{B}
-\Delta B= \frac{1}{\sqrt{3}\, |T|}.
\end{equation}
Then, for any function $\varphi \in H_0^1(\Omega)$, we have
\begin{equation}\label{B2}
 \frac{1}{\sqrt{3}\, |T|} \int_\Omega \varphi = \int_\Omega  (-\Delta B)  \varphi = \int_\Omega \nabla B\cdot \nabla \varphi .
\end{equation}
In particular, if $u\in H_0^1(\Omega)$ is the solution of \eqref{2DBVP} for a given $f$, we have
\begin{equation}\label{B3}
 \frac{1}{\sqrt{3}\, |T|} \int_\Omega u  = \int_\Omega \nabla B\cdot \nabla u =  \int_\Omega f\, B = (f, B).
\end{equation}

\begin{theorem}
Let $\Omega$ be an equilateral triangle, and let $u$ be the solution of \eqref{2pBVP}, then
\begin{equation}\label{2DBF}
\int_\Omega u = \sqrt{3}|\Omega|  \int_\Omega  f B.
\end{equation}
\end{theorem}

\begin{remark} As in the previous case, we point out the following consequences:
\begin{enumerate}
\item [i)] The function $\sqrt{3}\, |\Omega|\, B$ is the unique solution of
\[
 \left\{
 \begin{array}{rccl}
     -\Delta u = & 1  & \text{in } \ \Omega,\\
      u =& 0 & \text{on} \  \partial \Omega.
\end{array}
\right.
\]
\item [ii)]  From \eqref{B2},  the function $\sqrt{3}\, B$ is the Riesz representation of the functional $ F :H^1_0(\Omega)\to \mathbb{R}$,
\[
F(\varphi)= \frac{1}{ |\Omega|}  \int_\Omega \varphi.
\]

\item [iii)]  The function   $\sqrt{3}\, |\Omega|\, B$  can be viewed also as the  finite element  discretization  of \eqref{2pBVP}, using $C^0-P^3$ discretization on the space  \\ $V_0:= span\{B\}$.
 \item [iv)] Any 2D quadrature approximation of
$\sqrt{3} \int_\Omega  f B\, dx dy$ can be viewed as a ``finite difference'' approximation of  $\frac{1}{|\Omega|} \int_\Omega u$, where $u$ is  the solution of \eqref{2pBVP}.

\end{enumerate}
\end{remark}
We note that the assumption that $\Omega$ be an equilateral triangle is needed in order to have that the Laplacian operator acting on the bubble function is  a constant function.
\section{Conclusion}\label{sec:conclusion}

We considered the finite difference and the  finite element methods for a model  boundary value problem.
We  emphasized the connections between the two methods by rewriting the FD system  such that the matrix of the system coincides with the stiffness matrix of the FE discretization.  In this reformulation, the right hand side vector for the FD system can be also viewed
as a dual vector obtained componentwise from the composite trapezoid rule approximation of the FE dual vector.
Using the connection between the Green function  and the $C^0-P^1$  finite element basis  functions, we  found that the inverse of the stiffness matrix $S$ is exactly the matrix obtained by evaluating the  Green function at the interior grid nodes $\{(x_i, x_j)\}  \subset (0, 1)  \times (0, 1)$.  Consequently, we found simplified proofs for the standard FD error analysis, and  provided an energy estimate
 for the difference between the FE and FD solutions.
 We presented  interesting possible  extensions to the 2D case based on the fact that
  the components of the FE  dual vector associated with the given data $f$  acting on  conforming finite element basis functions, can be written as linear combinations of various degrees of freedom acting on the solution $u$.  The challenges of extending these ideas to the more general cases of discrete spaces and meshes in 2D or 3D, remain to be addressed  in our future work.

\vspace{0.4in}

\paragraph*{\bf Acknowledgment.}
 The   authors are grateful for an Oden Institute fellowship which allowed them to visit UT Austin in the Fall of 2019.

\bibliographystyle{plain}

Numerical Analysis (math.NA); Analysis of PDEs (math.AP)