# Thread: Difference Equation - Non Homogeneous need help

1. ## Difference Equation - Non Homogeneous need help

Hi

Can someone help me with this and provide a step by step response?

Suppose I have the following difference equation:

$u_{n}= -u_{n-1}+6u_{n-2} +7$ with
$u_{0} =1, u_{1} =2$

I have solved the characteristic eqn to be $\lambda = 2,-3$

But how do I go about solving the particular solution?

2. ## Re: Difference Equation - Non Homogeneous need help

Originally Posted by zzizi
Hi

Can someone help me with this and provide a step by step response?

Suppose I have the following difference equation:

$u_{n}= -u_{n-1}+6u_{n-2} +7$ with
$u_{0} =1, u_{1} =2$

I have solved the characteristic eqn to be $\lambda = 2,-3$

But how do I go about solving the particular solution?

Hi zzizi!

Wiki explains it better than I can:
Recurrence relation - Wikipedia, the free encyclopedia

The equation in the above example was [[homogeneous differential equation|homogeneous]], in that there was no constant term. If one starts with the non-homogeneous recurrence
$b_{n}=Ab_{n-1}+Bb_{n-2}+K$

with constant term ''K'', this can be converted into homogeneous form as follows: The [[steady state]] is found by setting $b_n = b_{n-1} =b_{n-2} = b^*$ to obtain
$b^{*} = \frac{K}{1-A-B}$

Then the non-homogeneous recurrence can be rewritten in homogeneous form as
$[b_n - b^{*}]=A[b_{n-1}-b^{*}]+B[b_{n-2}-b^{*}]$

which can be solved as above.

3. ## Re: Difference Equation - Non Homogeneous need help

I would use the technique of symbolic differencing to obtain a homogeneous linear recurrence:

$u_{n}=-u_{n-1}+6u_{n-2}+7$

$u_{n+1}=-u_{n}+6u_{n-1}+7$

Subtracting the former from the latter, we obtain:

$u_{n+1}=7u_{n-1}-6u_{n-2}$

The characteristic roots are $r=-3,\,1,\,2$ hence the closed form is:

$u_n=k_1(-3)^n+k_2+k_32^n$

We may use initial conditions to determine the parameters $k_i$:

$u_0=k_1+k_2+k_3=1$

$u_1=-3k_1+k_2+2k_3=2$

$3_2=9k_1+k_2+4k_3=11$

Solving this system, we find:

$k_1=\frac{7}{20},\,k_2=-\frac{7}{4},\,k_3=\frac{12}{5}$ and so we have:

$u_n=\frac{7(-3)^n+3\cdot2^{n+4}-35}{20}$

4. ## Re: Difference Equation - Non Homogeneous need help

Originally Posted by ILikeSerena
Hi zzizi!

Wiki explains it better than I can:
Recurrence relation - Wikipedia, the free encyclopedia

The equation in the above example was [[homogeneous differential equation|homogeneous]], in that there was no constant term. If one starts with the non-homogeneous recurrence
$b_{n}=Ab_{n-1}+Bb_{n-2}+K$

So I was incorrect to think it was non-homogeneous?
I wasn't aware that it could be solved this way, so I will have to perhaps look into it further.

5. ## Re: Difference Equation - Non Homogeneous need help

Originally Posted by MarkFL2
I would use the technique of symbolic differencing to obtain a homogeneous linear recurrence:

$u_{n}=-u_{n-1}+6u_{n-2}+7$

$u_{n+1}=-u_{n}+6u_{n-1}+7$

Subtracting the former from the latter, we obtain:

$u_{n+1}=7u_{n-1}-6u_{n-2}$

The characteristic roots are $r=-3,\,1,\,2$ hence the closed form is:

$u_n=k_1(-3)^n+k_2+k_32^n$

We may use initial conditions to determine the parameters $k_i$:

$u_0=k_1+k_2+k_3=1$

$u_1=-3k_1+k_2+2k_3=2$

$3_2=9k_1+k_2+4k_3=11$

Solving this system, we find:

$k_1=\frac{7}{20},\,k_2=-\frac{7}{4},\,k_3=\frac{12}{5}$ and so we have:

$u_n=\frac{7(-3)^n+3\cdot2^{n+4}-35}{20}$
Thank you very much for this solution.

How would I go about checking it? I tried to find u(3) from the original recursion and the closed form but they didn't correlate.

6. ## Re: Difference Equation - Non Homogeneous need help

From the inhomogeneous recurrence you gave:

$u_2=-2+6+7=11$

$u_3=-11+12+7=8$

Using the closed form I gave:

$u_3=\frac{7(-3)^3+3(2)^7-35}{20}=\frac{160}{20}=8$

7. ## Re: Difference Equation - Non Homogeneous need help

Originally Posted by zzizi
So I was incorrect to think it was non-homogeneous?
I wasn't aware that it could be solved this way, so I will have to perhaps look into it further.
You were right. It is non-homogeneous.

Originally Posted by zzizi
$u_{n}= -u_{n-1}+6u_{n-2} +7$ with
$u_{0} =1, u_{1} =2$

I have solved the characteristic eqn to be $\lambda = 2,-3$
If you compare that to
$b_{n}=Ab_{n-1}+Bb_{n-2}+K$

you'll see that you have:
$b_n = u_n$
$A = -1$
$B = 6$
$K = 7$
$b^{*} = \frac{K}{1-A-B} = \frac{7}{1-(-1)-6} = - \frac 7 4$

As a result, your solution takes the form:
$u_n = C (-3)^n + D 2^n + b^{*}$

If you fill in your boundary conditions, you get 2 equations with 2 unknowns (C and D), which can be solved with substitution.

8. ## Re: Difference Equation - Non Homogeneous need help

Originally Posted by MarkFL2
From the inhomogeneous recurrence you gave:

$u_2=-2+6+7=11$

$u_3=-11+12+7=8$

Using the closed form I gave:

$u_3=\frac{7(-3)^3+3(2)^7-35}{20}=\frac{160}{20}=8$

Umm ... I guess I miscounted

9. ## Re: Difference Equation - Non Homogeneous need help

Originally Posted by ILikeSerena
You were right. It is non-homogeneous.

If you compare that to
$b_{n}=Ab_{n-1}+Bb_{n-2}+K$

you'll see that you have:
$b_n = u_n$
$A = -1$
$B = 6$
$K = 7$
$b^{*} = \frac{K}{1-A-B} = \frac{7}{1-(-1)-6} = - \frac 7 4$

As a result, your solution takes the form:
$u_n = C (-3)^n + D 2^n + b^{*}$

If you fill in your boundary conditions, you get 2 equations with 2 unknowns (C and D), which can be solved with substitution.
Thank you very much for your explanation! Much appreciated.

10. ## Re: Difference Equation - Non Homogeneous need help

I have a query;

Is there another way, by substituting values to find the particular solution?

11. ## Re: Difference Equation - Non Homogeneous need help

Originally Posted by ILikeSerena
You were right. It is non-homogeneous.

If you compare that to
$b_{n}=Ab_{n-1}+Bb_{n-2}+K$

you'll see that you have:
$b_n = u_n$
$A = -1$
$B = 6$
$K = 7$
$b^{*} = \frac{K}{1-A-B} = \frac{7}{1-(-1)-6} = - \frac 7 4$

As a result, your solution takes the form:
$u_n = C (-3)^n + D 2^n + b^{*}$

If you fill in your boundary conditions, you get 2 equations with 2 unknowns (C and D), which can be solved with substitution.

What if I end up with zero for the b* value? I used this method to solve my difference equation but I got zero for the constant. If this happens would the whole solution be complete or do I try another method?

12. ## Re: Difference Equation - Non Homogeneous need help

Originally Posted by zzizi
What if I end up with zero for the b* value? I used this method to solve my difference equation but I got zero for the constant. If this happens would the whole solution be complete or do I try another method?
The only way that b* can be zero is if the constant K is zero.
In that case the difference equation is a homogeneous difference equation instead of an in-homogeneous one.

But this is not applicable to your current problem statement.....
Am I misunderstanding you?

13. ## Re: Difference Equation - Non Homogeneous need help

Originally Posted by ILikeSerena
The only way that b* can be zero is if the constant K is zero.
In that case the difference equation is a homogeneous difference equation instead of an in-homogeneous one.

But this is not applicable to your current problem statement.....
Am I misunderstanding you?
You are quite right. I wanted to understand the concept because I have another problem for my homework that I am working which is like this:

$u_{n}= -3u_{n-1}+4u_{n-2}+9$

When I applied the formula I got this:

$b^{*} = \frac{K}{1-A-B} = \frac{9}{1-(-3)-4} = 0$

SO would this be considered a homogeneous D.Eqn?

14. ## Re: Difference Equation - Non Homogeneous need help

Originally Posted by zzizi
You are quite right. I wanted to understand the concept because I have another problem for my homework that I am working which is like this:

$u_{n}= -3u_{n-1}+4u_{n-2}+9$

When I applied the formula I got this:

$b^{*} = \frac{K}{1-A-B} = \frac{9}{1-(-3)-4} = 0$

I just wondered what I should do in this situation
I'm afraid you miscalculated b*.

$b^* = \frac 9 0 = \infty$

Either way, it means this method does not work.

Next method in line is the symbolic differentiation method MarkFL2 described.
That one works for this problem.

Thank you.