Solving a Recurrence Equation: What Did I Do Wrong?

  • Thread starter yoran
  • Start date
  • Tags
    Recurrence
In summary: Thanks again!In summary, the conversation is about solving a recurrence equation with the given answer being y[k]=c_1sin(\frac{\pi}{2}k) + c_2cos(\frac{\pi}{2}k) + \frac{sin(k)+sin(k-2)}{2(1+cos(2))}. The conversation goes on to discuss finding a particular solution for the non-homogeneous equation and making substitutions to find the correct answer.
  • #1
yoran
118
0
Hi, I'm trying to solve this recurrence equation.

Homework Statement


Solve [tex]y[k+2]+y[k]=sin(k)[/tex].
The answer is already given, it's
[tex]y[k]=c_1sin(\frac{\pi}{2}k) + c_2cos(\frac{\pi}{2}k) + \frac{sin(k)+sin(k-2)}{2(1+cos(2))}[/tex]

Homework Equations




The Attempt at a Solution


First I solve the homogeneous equation.
[tex]y[k+2]+y[k]=0[/tex].
The characteristic function is
[tex]r^2+1=0[/tex]
This has two complex roots [tex]r=i[/tex] and [tex]r=-i[/tex].
Thus the general solution is
[tex]y[k]=c_1(i)^k+c_2(-i)^k[/tex]
If you change the notation for the complex numbers, then it gives
[tex]y[k]=c_1(cos(\frac{\pi}{2}k)+isin(\frac{\pi}{2}k)) + c_2(cos(\frac{-\pi}{2}k)+isin(\frac{-\pi}{2}k))[/tex]
After grouping together it gives
[tex](c_1+c_2)cos(\frac{\pi}{2}k) + (c_1-c_2)isin(\frac{\pi}{2}k)[/tex]
Apparently, the answer is without complex numbers so I guess they only keep the real part. Then it must be so that
[tex]c_1-c_2=0\Leftrightarrow c_1=c_2[/tex]
Then I get as solution
[tex]y[k]=2c_1cos(\frac{\pi}{2}k)[/tex]
which is not the same solution as the general solution in the answer. What did I do wrong?

I also tried to find a particular solution for the non-homogeneous equation. I tried as a solution
[tex]y[k]=\alpha sin(k)[/tex]
with [tex]\alpha[/tex] the parameter to determine. I don't this is the right solution. Can anyone help me with this problem?

Thanks,

Yoran
 
Physics news on Phys.org
  • #2
They don't "only keep the real part". Plug the solution back into the homogeneous equation; the sine part falls out without imposing any constraint on c1 and c2.
 
  • #3
Hi,

Thanks for your quick reply. I tried to do what you told me but when I plug it into the homogeneous equation, everything cancels out! I get 0=0. This is what I did:
We have that
[tex]y[k]=(c_1+c_2)cos(\frac{\pi}{2}k)+(c_1-c_2)isin(\frac{\pi}{2}k)[/tex]
I plug it into
[tex]y[k+2]+y[k]=0[/tex]
I get
[tex](c_1+c_2)cos(\frac{\pi}{2}(k+2))+(c_1-c_2)isin(\frac{\pi}{2}(k+2))+(c_1+c_2)cos(\frac{\pi}{2}k)+(c_1-c_2)isin(\frac{\pi}{2}k)=0[/tex]
Because
[tex]cos(\theta + \pi)=-cos(\theta)[/tex] and
[tex]sin(\theta + \pi)=-sin(\theta)[/tex]
I get that
[tex]-(c_1+c_2)cos(\frac{\pi}{2}k)-(c_1-c_2)isin(\frac{\pi}{2}k)+(c_1+c_2)cos(\frac{\pi}{2}k)+(c_1-c_2)isin(\frac{\pi}{2}k)=0[/tex]
which makes
[tex]0=0[/tex]
How come?
 
  • #4
Actually, you are correct. That was a silly suggestion of me, because 0=0 simply confirms your solution satisfies the equation from which you derived the solution. I will edit this post if I come up with something.

Edit: Wow I had been reading it wrong for a good 45 minutes, sorry! Consider complex coefficients and make the substitution d1=c1+c2 and d2=i(c1-c2).

Can you find the particular solution from here?
 
Last edited:
  • #5
Hi,

Yeah of course... just give different names as they are just parameters... Thanks a lot.
I tried the substitution [tex]\alpha sin(k)[/tex] because there is [tex]sin(k)[/tex] on the right side of the equation. However, I can't find the right answer. This is what I have done:
Try
[tex]y[k]=\alpha sin(k)[/tex]
Plug it into the equation:
[tex]\alpha sin(k+2) + \alpha sin(k) = sin(k)[/tex]
Then we get
[tex]\alpha = \frac{sin (k)}{2sin(k+1)cos(1)}[/tex]
by using the identity
[tex]sin(\theta) + sin(\alpha) = 2sin(\frac{\theta + \alpha}{2})cos(\frac{\theta - \alpha}{2})[/tex]
The answer for [tex]\alpha[/tex] is obviously not the right answer.
Did I make the wrong substitution?
 
  • #6
Anyone?
 
  • #7
yoran said:
Try
[tex]y[k]=\alpha sin(k)[/tex]

Hi yoran! :smile:

Try [tex]y[k]=\alpha\,sin(k\,-\,1)[/tex] . :smile:
 
  • #8
Ok, I tried
[tex]y[k]=\alpha \sin(k-1)[/tex].
Then I get that
[tex]\alpha = \frac{1}{2\cos 1}[/tex]
So given the solution for the homogeneous equation and this solution, I have that
[tex]y[k]=c_1\sin{\frac{\pi}{2}k} + c_2\cos{\frac{\pi}{2}k} + \frac{1}{2\cos{1}}\sin{k-1}[/tex]
But the answer should be
[tex]y[k]=c_1\sin{\frac{\pi}{2}k} + c_2\cos{\frac{\pi}{2}k} + \frac{\sin{k}+\sin(k-2)}{2(1+\cos{2})}[/tex]
Where does it go wrong in my solution?
 
  • #9
Hi yoran! :smile:
yoran said:
…I have that
[tex]y[k]=c_1\sin{\frac{\pi}{2}k} + c_2\cos{\frac{\pi}{2}k} + \frac{1}{2\cos{1}}\sin{k-1}[/tex]
But the answer should be
[tex]y[k]=c_1\sin{\frac{\pi}{2}k} + c_2\cos{\frac{\pi}{2}k} + \frac{\sin{k}+\sin(k-2)}{2(1+\cos{2})}[/tex]
Where does it go wrong in my solution?

:rofl: But they're the same! :rofl:​

Standard trig equation: 1 + cos(2) = 2cos²(1).

So [tex]\frac{\sin{k}+\sin(k-2)}{2(1+\cos{2})}[/tex] = … ? :smile:
 
  • #10
Hehe, of course... Thanks a lot!
[tex]\frac{\sin{k}+\sin(k-2)}{2(1+\cos{2})}=\frac{2\sin(k-1)\cos(1)}{4\cos^2(1)}=\frac{\sin(k-1)}{2\cos 1}[/tex]
 

1. What is a recurrence equation?

A recurrence equation is an equation that expresses a sequence of values in terms of one or more previous terms. It is commonly used in mathematics and computer science to model and analyze iterative processes.

2. How do I solve a recurrence equation?

The most common method for solving a recurrence equation is by using a technique called "substitution". This involves replacing the recurrence relation with a closed form expression, which can then be solved using algebraic techniques.

3. What is the difference between a linear and a non-linear recurrence equation?

A linear recurrence equation is one in which the value of the next term in the sequence is a linear combination of the previous terms. A non-linear recurrence equation, on the other hand, involves terms that are not proportional to the previous terms.

4. Can a recurrence equation have multiple solutions?

Yes, a recurrence equation can have multiple solutions. This is because there are often different ways to express a sequence of values using a recurrence relation. It is important to carefully consider the initial conditions and boundary conditions when solving a recurrence equation to ensure the correct solution is obtained.

5. What are some real-world applications of recurrence equations?

Recurrence equations are used in various fields such as economics, physics, and computer science. Some examples include modeling population growth, analyzing the efficiency of algorithms, and predicting stock prices.

Similar threads

  • Calculus and Beyond Homework Help
Replies
8
Views
117
  • Calculus and Beyond Homework Help
Replies
1
Views
383
  • Calculus and Beyond Homework Help
Replies
1
Views
253
Replies
12
Views
270
  • Calculus and Beyond Homework Help
Replies
2
Views
857
  • Calculus and Beyond Homework Help
Replies
1
Views
178
  • Calculus and Beyond Homework Help
Replies
5
Views
193
  • Calculus and Beyond Homework Help
Replies
3
Views
444
  • Calculus and Beyond Homework Help
Replies
1
Views
786
  • Calculus and Beyond Homework Help
Replies
8
Views
757
Back
Top