Hi everyone!
Let $$$R$$$ be a ring, $$$d_0, d_1, d_2, \dots \in R$$$ and $$$e_0, e_1, e_2, \dots \in R$$$ be linear recurrence sequences, such that
In some applications, the following two sequences arise:
Today I'd like to write about the framework that allows to prove that both the sequences defined above are also linear recurrences. It would also allow to compute their characteristic polynomials in $$$O(kl \log kl)$$$, which is optimal as their degrees are $$$O(kl)$$$ in both cases.
Umbral calculus
Generally, a linear recurrence $$$f_k$$$ can be described and analyzed with the help of the linear functional $$$T : R[f] \mapsto R$$$ such that
For such functional, $$$T(P(f)) = 0$$$ when $$$P(f)$$$ is a multiple of the characteristic polynomial of $$$f_k$$$. The existence of the characteristic polynomial is the criterion of $$$f_k$$$ being a linear recurrence. So, we need to prove that there is such a polynomial for $$$f_k$$$ defined above.
Joint umbral calculus
To analyze joint properties of $$$d_k$$$ and $$$e_k$$$, we define a linear functional $$$T: R[d, e] \to R$$$ such that
Similarly to the case of a single recurrence, $$$T(f(d, e))=0$$$ whenever $$$f(d, e)$$$ is a linear combination of $$$a(d)$$$ and $$$b(e)$$$, where
are the characteristic polynomials of $$$d_i$$$ and $$$e_j$$$. In other words, $$$T(f(d, e))=0$$$ whenever $$$f(d, e)$$$ lies in the ideal $$$\langle a(d), b(e) \rangle$$$.
Composed sum
For the binomial convolution let $$$f=d+e$$$, then
To show that $$$f_k$$$ is a linear recurrence obeying to the rule
it is sufficient to show that there is a characteristics polynomial $$$c(f)$$$ such that $$$c(f) \in \langle a(d), b(e) \rangle$$$.
Assume that $$$R$$$ is an integral domain. Then the polynomial exists and can be defined explicitly as
where
The fact that $$$c(d+e) \in \langle a(d), b(e) \rangle$$$ is proven as follows:
In the sum above, there are $$$2^{kl}$$$ summands, each of them is divisible by either $$$a(d)$$$ or $$$b(e)$$$, so $$$c(d+e) \in \langle a(d), b(e)\rangle$$$.
The polynomial $$$c(f)$$$ defined above is called the composed sum of $$$a(d)$$$ and $$$b(e)$$$.
Composed product
Now the question is, how to prove that the Hadamard product $$$f_k = d_k e_k$$$ is a linear recurrence?
Using similar logic as above, one would define $$$f = de$$$ and then look for $$$c(f) \in \langle a(d), b(e) \rangle$$$. Let
This one is a bit trickier to prove. Let's start with $$$k=l=1$$$:
Rewriting it in the same way for arbitrary $$$k$$$ and $$$l$$$, we get
Then the same logic applies as to $$$c(d+e)$$$ in the binomial convolution case.
The polynomial $$$c(f) = c(de)$$$ defined above is called the composed product of $$$a(d)$$$ and $$$b(e)$$$.
Combining composed sums and products, one may now prove that for any bivariate polynomial $$$p(d, e) = d \diamond e$$$, the polynomial
also lies in the $$$\langle a(d), b(e) \rangle$$$ ideal, hence $$$c(f)$$$ for $$$f = d \diamond e$$$ is the characteristic polynomial of $$$f_k = T((d \diamond e)^k)$$$.
Computing composed products and sums
Let $$$s_i$$$ be the sum of $$$i$$$-th powers of all $$$\lambda$$$ and $$$t_j$$$ be the sum of $$$j$$$-th powers of all $$$\mu$$$, that is
The roots of the composed sum are $$$\lambda_i + \mu_j$$$ for all $$$i$$$ and $$$j$$$ and of the composed product are $$$\lambda_i \mu_j$$$, from which we can see that
So, if we're able to transform from $$$a(d)$$$ to $$$s_i$$$, then from $$$b(e)$$$ to $$$t_j$$$, compute the transforms above on them and then recover the characteristics polynomials from the result, it would solve the problem.
Next thing we should note is that the generating function of $$$s_i$$$ is
It can be further expanded as
where
is the reversed characteristic polynomial of $$$d_k$$$. Its log-derivative is indeed
Finally, to inverse this transform, we could make use of the fact that $$$\frac{A'}{A} = (\log A)'$$$, hence for
it holds that
The resulting $$$f(x)$$$ has degree $$$kl$$$, so only $$$kl$$$ terms of $$$\frac{A'}{A}$$$ and $$$\exp$$$ are needed and they may be computed in $$$O(kl \log kl)$$$.