Before we present a proof of our main result, in this section we present, as a motivation and for benefit of the reader, an application of the method of invariants on a very basic example of linear first-order difference equation with constant coefficients explaining a frequently confusing detail. We also give a general hint how to use the method of invariants for the case of difference equations of any order.
Linear first-order difference equation with constant coefficients
Here we consider difference equation (1) when the sequences \((a_{n})_{n\in {\mathbb{N}}_{0}}\) and \((b_{n})_{n\in {\mathbb{N}}_{0}}\) are constant, that is, the linear first-order difference equation with constant coefficients
$$\begin{aligned} x_{n}=ax_{n-1}+b, \quad n\in {\mathbb{N}}_{0}, \end{aligned}$$
(5)
where \(a, b, x_{-1}\in {\mathbb{C}}\), \(a\ne 0\).
Besides the three standard methods for solving difference equation (1) which correspond to the three methods for solving the linear first-order differential equation (see, e.g., [16]), the special choice of sequences \((a_{n})_{n\in {\mathbb{N}}_{0}}\) and \((b_{n})_{n \in {\mathbb{N}}_{0}}\) enables finding general solution to the equation also in some other ways. One of the ways is by use of an invariant. General solution to difference equation (5) in the nontrivial case when \(a\ne 1\) (formula (16)) was found for the first time by Lagrange in [5] (see also [53]).
Now we demonstrate how the method of invariants can be used for solving equation (5) in very detail, which will help to understand the method better. The method is essentially known, but usually scientist are not aware that they use an invariant and do not pay attention to some details.
Let
$$\begin{aligned} I_{1}(x_{n-1},x_{n}):=x_{n}-ax_{n-1} \end{aligned}$$
(6)
for \(n\in {\mathbb{N}}_{0}\).
Since the following obviously holds
$$\begin{aligned} I_{1}(x_{n-1},x_{n})=b, \quad n\in { \mathbb{N}}_{0}, \end{aligned}$$
(7)
(6) is an invariant for equation (5).
An obvious consequence of relation (7) is
$$\begin{aligned} I_{1}(x_{n},x_{n+1})=I_{1}(x_{n-1},x_{n}) \end{aligned}$$
(8)
for \(n\in {\mathbb{N}}_{0}\).
Now note that (8) can be written in the following form:
$$\begin{aligned} x_{n}-(a+1)x_{n-1}+ax_{n-2}=0, \quad n\in { \mathbb{N}}, \end{aligned}$$
(9)
which is a homogeneous linear second-order difference equation with constant coefficients, so solvable.
Since in the case \(a=1\) equation (5) is easily solved, from now on we will assume that \(a\ne 1\).
The characteristic polynomial associated with equation (9) is
$$ p_{2}(\lambda )=\lambda ^{2}-(a+1)\lambda +a, $$
from which it follows that
$$ \lambda _{1}=1 \quad\text{and} \quad \lambda _{2}=a $$
are the characteristic zeros.
Hence, general solution to equation (9) is
$$\begin{aligned} x_{n}=c_{1}+c_{2}a^{n}, \quad n\ge -1, \end{aligned}$$
(10)
where \(c_{1}\) and \(c_{2}\) are arbitrary constants.
To find \(c_{1}\) and \(c_{2}\), it is necessary to solve the linear system
$$\begin{aligned} &c_{1}+\frac{c_{2}}{a}=x_{-1}, \end{aligned}$$
(11)
$$\begin{aligned} &c_{1}+c_{2}=x_{0}, \end{aligned}$$
(12)
from which it follows that
$$\begin{aligned} c_{1}=\frac{ax_{-1}-x_{0}}{a-1} \quad \text{and}\quad c_{2}=a \frac{x _{0}-x_{-1}}{a-1}. \end{aligned}$$
(13)
Using (13) in (10), we have
$$\begin{aligned} x_{n}=\frac{ax_{-1}-x_{0}+(x_{0}-x_{-1})a^{n+1}}{a-1}, \end{aligned}$$
(14)
which is general solution to equation (9) in terms of parameter a and the initial values \(x_{-1}\) and \(x_{0}\).
Now note that from (5) we have
$$\begin{aligned} x_{0}=ax_{-1}+b. \end{aligned}$$
(15)
By using (15) in (14), we obtain
$$\begin{aligned} x_{n}=\frac{((a-1)x_{-1}+b)a^{n+1}-b}{a-1}, \quad n\in {\mathbb{N}} _{0}. \end{aligned}$$
(16)
The above procedure, although very simple, has many steps. So, at first sight, it is not quite clear what formula (16) represents, although it is expected that it is general solution to difference equation (5), which is easily verified by a simple inductive argument.
The confusion is found in the fact that a relation of the form (8) is a consequence of any relation of the form (7). However, from (8), in general, we cannot conclude that relation of the form (7) holds. Namely, from (8) we have
$$\begin{aligned} I_{1}(x_{n-1},x_{n})=I_{1}(x_{-1},x_{0}) \end{aligned}$$
(17)
for \(n\in {\mathbb{N}}_{0}\).
However, the catch is that in this case \(I_{1}(x_{-1},x_{0})\) is not only equal to b, but the value of \(x_{0}\) is not arbitrary (it is specified, see relation (15)).
So, the above procedure is not one-directional, but, in fact, all the steps are equivalent. More precisely, the initial value problem consisting of equation (5) and initial value \(x_{-1}\) is equivalent to the initial value problem consisting of equation (9) and initial values \(x_{-1}\) and the one given in (15).
Remark 1
The above detailed analysis shows that during applications of the method of invariants for difference equations and systems, it should be tried to transfer a problem to equivalent one, if possible, or, at least, as long as it is possible. Nevertheless, it is suggested that the final formulas are always checked by the method of induction for the case (if a difference equation is complicated, its general solution can be very complicated as it was the case in several recent papers of ours [20, 40, 41, 43, 44]; we have also found several papers with wrong formulas for general solutions to difference equations; see, for example, our comment in [54]).
Remark 2
Obvious consequence of relation (7) appearing in (8) is usually used for the corresponding invariants for difference equations of any order. Namely, if (2) holds, then the following relation
$$\begin{aligned} I(x_{n},x_{n+1},\ldots ,x_{n+l-1})=I(x_{n-1},x_{n}, \ldots ,x_{n+l-2}) \end{aligned}$$
(18)
also holds on the domain of the corresponding difference equation, where l is a fixed natural number.
Of course, if we know invariants for a difference equation or for a system of difference equations, then compositions of the invariants with any other function are also invariants, but the catch is to choose the operative ones, that is, the ones from which we can conclude something on solutions of the difference equation, which in our case refers to finding a closed-form formula for general solution to the difference equation or system.
Remark 3
The above argument can be used to any linear difference equation of the following form
$$\begin{aligned} x_{n}=a_{k}x_{n-1}+\cdots +a_{1}x_{n-k}+b, \quad n\in {\mathbb{N}}_{0}, \end{aligned}$$
(19)
where coefficients \(a_{j}\), \(j=\overline{1,k}\), and b are complex numbers such that \(a_{1}\ne 0\), that is, to nonhomogeneous linear difference equations with constant coefficients whose nonhomogeneous part is constant.
Namely, let
$$\begin{aligned} I_{2}(x_{n-k},x_{n-k+1},\ldots ,x_{n})=x_{n}-a_{k}x_{n-1}- \cdots -a _{1}x_{n-k} \end{aligned}$$
(20)
for \(n\in {\mathbb{N}}_{0}\).
Since it obviously holds
$$\begin{aligned} I_{2}(x_{n-k},x_{n-k+1},\ldots ,x_{n})=b, \quad n\in {\mathbb{N}}_{0}, \end{aligned}$$
(21)
(20) is an invariant for equation (19).
An obvious consequence of relation (21) is
$$\begin{aligned} I_{2}(x_{n-k},x_{n-k+1},\ldots ,x_{n})=I_{2}(x_{n-k+1},x_{n-k+2}, \ldots ,x_{n+1}) \end{aligned}$$
(22)
for \(n\in {\mathbb{N}}_{0}\), which can be written in the following form:
$$\begin{aligned} x_{n+1}-(a_{k}+1)x_{n}-(a_{k-1}-a_{k})x_{n-1}- \cdots -(a_{1}-a_{2})x _{n-k+1}+a_{1}x_{n}=0 \end{aligned}$$
(23)
for \(n\in {\mathbb{N}}_{0}\).
Now note that difference equation (23) is homogeneous linear with constant coefficients, but of order \(k+1\), which is solvable, at least theoretically (equations of order five and more need not be practically solvable due to the Abel–Ruffini theorem which says that polynomials of order five or more need not be solvable by radicals [55]).
Remark 4
Let us also note that there is a custom to show solvability of linear second-order difference equation with constant coefficients prior to showing the solvability of equation (5). It is also interesting to note that de Moivre essentially knew to solve equation (9) already at the beginning of the eighteenth century, but the solvability of equation (5) was discovered several decades later by Lagrange.