This passage is used to introduce how to calculate general term formula by linear recursive formula. Let’s know some basic information before we start.
- Linear: Each term is a linear term of . For example it doesn’t exist: , .
- Homogeneous: There is no extra at end. Warning: constant function ( is always the constant) also be included.
- Constant Coefficients: All coefficients of is constant.
- Order : The current item depends on at most the first k items before it.
Then you can use these tags to check which kind of recursive formula fit this article.
Linear Homogeneous Recurrence with Constant Coefficients
This is the most easy one. This kind of recurrence can be express by below formula:
For this kind of recurrence, we can use a general method called characteristic equation to solve it. The Core idea of characteristic equation is: An exponential sequence only changes by a constant factor when shifted.
So we can let , give you a example:
Then we have:
This is characteristic equation, then we can calculate by it. And we should have some little categorical discussion on it.
Different Root
Define the solution set is , then the recurrence can be expressed by
Then if problem give we the first element, we can calculate the coefficients by them.
As the example I give, the root of is , so we can write the general terms as
Then if we have any two element of this sequence we can calculate , but in this problem, question setter give u only . What to do? hold on. The setter give us a special condition: satisfy .
The second term is a negative number less than , so as increase, the absolute value of it will increase and it’s positive and negative alternately. But the first term is decrease as increase. So it , we always exist .
So the answer is obvious. , the general term of is
Repeat Root
If the characteristic equation is
We can express general term as
OK, I know it is hard to understand such a ugly expression, so let’s see a example.
Let , then we can have below characteristic equation
Ok know we have repeat root. Base on formula above, we have below general term.
Then We can use the first two terms to solve for A and B
So the final general term of this sequence is
You can verify it using enumeration.
Linear non-Homogeneous Recurrence with Constant Coefficients
But we know, in lot of stuation, the recurrence always non-homogeneous. So should we give up? No! This part let we know how to solve general term in linear non-homogeneous recurrence with constant coefficients.
Also we start with a little example.
We should find a sequence which also satisfy this recurrence. In this case, we can find a sequence . The core idea is to minus the non-homogeneous part of origin recurrence.
So now we have two sequence: , if we let the recurrence of minus , we will take a sequence , and this sequence is a linear homogeneous recurrence with constant coefficients.
Then use common sense or the method I introduce last part, we can know , substitute and we will get general term of
Then we can use the start value of to calculate value of , it’s .
Summarize
This article introduce some common and easy situation when we are translating recurrence to general term. In most of situation, Matrix Fast Exponentiation also OKay. But math can optmize to