• Support PF! Buy your school textbooks, materials and every day products Here!

Difference equations

  • Thread starter Benny
  • Start date
584
0
Hi I'm just wondering what difference/recurrence equations are about. From what I can recall from the bits and pieces I've readed, difference equations are somewhat similar or an analogue of differential equations. I've read through some things on first and second order difference equations but I don't really understand what they are about.

My book introduces difference equations as summations. They seem to be equations involving summations with different indices. I know what I've said is a little vague so here is an example question I have(not from the book I referred to).

Q. Find the general solution of the following difference equation.

[tex]y_{n + 1} - y_n = 2[/tex]

Answer: [tex]y_n = A\left( {\frac{1}{2}} \right)^n + 2[/tex]

Can someone explain to me what the equation actually means?. Any sort of explanation or references to useful websites would also be good. As I alluded to before I don't actually see the connection between difference equations and differential equations. Is it like when you have a real function f(x) and you the sequence f(n)? Any help would be appreciated.
 

Answers and Replies

AKG
Science Advisor
Homework Helper
2,559
3
I have no idea what this could mean. Assuming that solution is correct:

[tex]y_{n+1} - y_{n} = A\left (\frac 12 \right )^{n+1} + 2 - A\left (\frac 12 \right )^n - 2 = -\frac 12A\left (\frac 12 \right )^n[/tex]

so

[tex]2 = -\frac 12A\left (\frac 12 \right )^n[/tex]

[tex]A = -2^{n+2}[/tex]

[tex]y_n = -4 + 2 = -2[/tex]
 
lurflurf
Homework Helper
2,418
122
The two main ways difference and differential equations are related are
1. Analogous formula
2. differential equations can be seen as differential equations where the differences are taken to zero in a limit sense.
your equation
[tex]y_{n+1}-y_n=2[/tex]
perform indefinite summation on both sides
[tex]\sum_{n=0}^{n-1}(y_{n+1}-y_n)=\sum_{n=0}^{n-1}2[/tex]

[tex]y_{n}-y_0=2n[/tex]

[tex]y_n=y_0+2n[/tex]
where y0 is the constant to be found by initial conditions.
The equation means find the functions with the given difference.

http://mathworld.wolfram.com/RecurrenceEquation.html
 
Last edited:
Tide
Science Advisor
Homework Helper
3,076
0
What you have is an arithmetic series and your "answer" is incorrect. The correct solution is

[tex]y_n = y_1 + (n-1)\times 2[/tex]

where [itex]y_1[/itex] is an initial value. The answer you show looks like the solution of a geometric series. Did you copy the problem correctly?
 
584
0
I left out a factor 2 for the first term in the question. It should be [tex]2y_{n + 1} - y_n = 2[/tex] and the answer is the one that I included with my first post.
 
Tide
Science Advisor
Homework Helper
3,076
0
In that case, I would subtract [itex]y_n[/itex] from both sides to make it look like a difference equation and see where it leads:

[tex]2 (y_{n+1} - y_n}) = 2 - y_n[/tex]

or

[tex]y_{n+1} - y_n = \frac {2-y_n}{2}[/tex]

The right side suggests defining a new variable [itex]z_n[/itex] such that [itex]z_n = y_n - 2[/itex] or [itex]y_n = z_n + 2[/tex]. Substitute that into the equation:

[tex]z_{n+1} + 2 - z_n - 2 = -\frac {1}{2} z_n[/tex]

or

[tex]z_{n+1} - z_n = -\frac {1}{2} z_n[/tex]

Notice the additive constants are now gone! In fact, if we now just add [itex]z_n[/itex] to both side we obtain the simple relation

[tex]z_{n+1} = \frac {1}{2} z_n[/tex]

which is just a simple geometric series with the solution

[tex]z_n = \left( \frac {1}{2} \right)^{n-1} z_1[/tex]

You should be able to go from there and find the general solution for [itex]y_n[/itex] using the defintion of [itex]z_n[/itex] that we used.
 
Hurkyl
Staff Emeritus
Science Advisor
Gold Member
14,843
17
We can do other things, inspired by the methods of differential equations.

First, some notation:

[tex]Ey_n := y_{n+1}[/tex]

Δ = E - 1
or, equivalently,

[tex]\Delta y_n := y_{n+1} - y_n[/tex]


So, you have the equation 2Ey - y = 2. We'd like to rewrite it as Tide suggested. The "easy" way is to recognize you can subtract y from both sides, but if you didn't notice that, you could use E = 1 + Δ to get:

2 (1 + Δ) y - y = 2
2y + 2Δy - y = 2
2Δy + y = 2
Δy + (1/2) y = 1


First, the "plug and chug" method: this will be uninspired, but it does give you a solution to any difference equation with summations and products. You can safely skip down to the next section if you like.

In an ordinary differential equation we look for an integrating factor μ... we can do the same here. Notice that:

Δ(μy) = Eμ Δy + Δμ y

So, what we want is (Δμ) / Eμ = (1/2). Using Δ = E - 1, we can rearrange this to form:

Eμ = 2μ

By picking an initial value for [itex]\mu_0[/itex], in the general case we can write μ as a product. Here, however, we can find the closed form solution:

[tex]\mu_n = 2^n[/tex]

So now, we have:

Δy + (1/2) y = 1
Δy + (Δμ)/(Eμ) y = 1
Eμ Δy + Δμ y = Eμ
Δ(μy) = Eμ

And now, we can take an antidifference (i.e. a sum). Notice that:

[tex]
\sum_{k = 0}^{n-1} \Delta z_k = z_n - z_0
[/tex]

We can apply this here to get:

[tex]
\begin{equation*}
\begin{split}
\mu_n y_n - \mu_0 y_0 &= \sum_{k = 0}^{n-1} E \mu_k \\
2^n y_n - y_0 &= \sum_{k = 0}^{n - 1} 2^{k+1} \\
&= 2^{n+1} - 2 \\
y_n &= 2^{-n} y_0 + 2 - 2^{1-n} \\
&= A 2^{-n} + 2
\end{split}
\end{equation*}
[/tex]

Where the last step was just collecting the coefficients.

#################################################
#################################################

Just like with differential equations, we recognize special forms that come up frequently. Recall that we are trying to solve:

Δy + (1/2) y = 1

The homogenous part is Δh + (1/2) h = 0. This has constant coefficients, so we can immediately posit the solution [itex]h_n = r^n[/itex]. Plugging this in gives:

[tex](r - 1) r^n + (1/2) r^n = 0[/tex]

Which is easily solved to give r = (1/2). So, the homogenous solution is [itex]h_n = A (1/2)^n[/itex].

Now to find a particular solution of the original equation. Since the R.H.S. is also a constant, we can immediately posit a constant solution for y. (If the R.H.S. was a polynomial of degree n, we could posit a polynomial of degree n as a solution for y) This is easily seen to be y = 2.

So, the general solution is:

[tex]y_n = A (1/2)^n + 2[/tex]
 
584
0
Thanks for the help guys but I still don't really understand well enough the main thing which characterises difference equations. I just read my book again and it says that first order recurrence relations for which n = 1 are exemplified by [tex]u_{n + 1} = au_n + k[/tex] with u_0 specified. The solution of the homogeneous relation (where k = 0) is immediate, [tex]u_n = Ca^n [/tex].

I don't understand why the solution would be so 'obvious.' Can someone please show me how the given expression for u_n can be verified to be a solution of the homogeneous relation? Perhaps it will make it easier for me to understand it. Any help would be good.
 
Tide
Science Advisor
Homework Helper
3,076
0
If [itex]u_n = C a^n[/itex] then [itex]u_{n+1} = C a^{n+1}[/itex] and substituting into [itex]u_{n+1} = a u_n[/itex] gives

[tex]C a^{n+1} = a \times C a^n[/tex]

which is clearly true for any value of a. Therefore, [itex]C a^n[/itex] is the general solution.

To obtain the solution of the homogeneous equation from scratch simply step down with the index like this:

[tex]u_{n+1} = a u_n = a \times a u_{n-1} = a \times a \times a u_{n-2} ...[/tex]

and so on until you get to the first index on the right side. You should see the pattern that develops.
 
584
0
Thanks again for your help Tide.
 

Related Threads for: Difference equations

Replies
6
Views
384
  • Last Post
Replies
5
Views
31K
  • Last Post
Replies
1
Views
736
  • Last Post
Replies
0
Views
865
Replies
2
Views
1K
  • Last Post
Replies
4
Views
1K
  • Last Post
Replies
5
Views
5K
Top