an​−4an−1​+5an−2​−2an−3​=1+2n
an​=4an−1​−5an−2​+2an−3​+(1+2n)
Characteristic equation: r3−4r2+5r−2=(r−1)2(r−2)=0, r1​=1,r2​=2
Then an(0)​=(c1​+c2​n)r1n​+c3​r2n​=c1​+c2​n+c3​2n is a solution of an​=4an−1​−5an−2​+2an−3​
We need do find particular solution of an​=4an−1​−5an−2​+2an−3​+F(n), F(n)=(1+2n)
1 and 2 are characteristic roots of multiplicity 2 and 1 respectively.
Then particular solution has form of an(p)​=n2(bt​nt+bt−1​nt−1​+...+b1​n+b0​)1n+n(dk​nk+dk−1​nk−1​+...+d1​n+d0​)2n
Suppose that an(p)​=n2b0​×1n+nd0​2n=b0​n2+d0​n2n and substitute it:
b0​n2+d0​n2n=4(b0​(n−1)2+d0​(n−1)2n−1)−5(b0​(n−2)2+d0​(n−2)2n−2)+2(b0​(n−3)2+d0​(n−3)2n−3)+1+2n=b0​(n2+2)+d0​n2n−d0​2n−2+1+2n
b0​n2+d0​n2n=b0​(n2+2)+d0​n2n−d0​2n−2+1+2n
(2b0​+1)+(2n−d0​2n−2)=0, ∀n∈N
b0​=−1/2, d0​=4
Solution of the recurrence relation is sum of an(0)​ and an(p)​ .
We have the following solution of the recurrence relation:
an​=c1​+c2​n+c3​2n−1/2n2+n2n+2 .
Answer: an​=c1​+c2​n+c3​2n−1/2n2+n2n+2.
The following source is used:
https://courses.ics.hawaii.edu/ReviewICS241/morea/counting/RecurrenceRelations2-QA.pdf