0

My Initial Question :

I understand how to solve a recurrence relation like such:

$t(n) = t(n-1) + t(n-2)$.

I would turn it into:

$t(n) - t(n-1) - t(n-2) = 0$, then $r^2 - r - 1 = 0$, then you solve for roots and such.

But what do I do if the recurrence relation looks like this?

$t(n) = t(n-1) + t(n-2) + 4$.

Can I follow the same pattern and do:

$t(n) - t(n-1) - t(n-2) = 4$, then $r^2 - r - 1 = 4$, then $r^2 - r - 5 = 0$ and continue on?

I was able to solve my problem using the following method:

I decremented n by 1 turning:

$t(n)=t(n−1)+t(n−2)+4$

into

$t(n-1)=t(n−2)+t(n−3)+4$

I then subtracted the second equation from the first to get:

$t(n)= 2t(n−1)-t(n-3)$

After which I was able to carry on fine.

Gharrot
  • 11

1 Answers1

2

The short answer is no.

A slightly less short answer is that you will have the solution to the recurrence is going to be the homogeneous solution plus the particular solution. The homogeneous solution will be found as normal for the related recurrence where there was no "extra" stuff added at the end, in this case $t(n)=t(n-1)+t(n-2)$. The particular solution will be of the same "form" as the nonhomogeneous part (with some slight complications to avoid overlapping with the homogeneous solution). In this case since it was $t(n)=t(n-1)+t(n-2)\color{red}{+4}$ (and since $1$ is not a root of the characteristic polynomial) the particular solution will be a constant.

So, $t(n)=t(n-1)+t(n-2)+4$ will have a closed form looking like $t(n)=c_1\lambda_1^n+ c_2\lambda_2^n + d$ where $\lambda_1,\lambda_2$ are the roots of the polynomial $\chi(x)=x^2-x-1$, $c_1$ and $c_2$ are constants which are determined by the initial conditions, and $d$ is a constant which can be solved for. (in this case it will be $-4$)

A longer answer can be found in any textbook under the heading "Solving a nonhomogeneous linear recurrence." See for example wikipedia or generatingfunctionology.

JMoravitz
  • 80,908