Solving a Recurrence Equation: What Did I Do Wrong?

  • Thread starter Thread starter yoran
  • Start date Start date
  • Tags Tags
    Recurrence
yoran
Messages
116
Reaction score
0
Hi, I'm trying to solve this recurrence equation.

Homework Statement


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

Homework Equations




The Attempt at a Solution


First I solve the homogeneous equation.
y[k+2]+y[k]=0.
The characteristic function is
r^2+1=0
This has two complex roots r=i and r=-i.
Thus the general solution is
y[k]=c_1(i)^k+c_2(-i)^k
If you change the notation for the complex numbers, then it gives
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))
After grouping together it gives
(c_1+c_2)cos(\frac{\pi}{2}k) + (c_1-c_2)isin(\frac{\pi}{2}k)
Apparently, the answer is without complex numbers so I guess they only keep the real part. Then it must be so that
c_1-c_2=0\Leftrightarrow c_1=c_2
Then I get as solution
y[k]=2c_1cos(\frac{\pi}{2}k)
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
y[k]=\alpha sin(k)
with \alpha 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
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.
 
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
y[k]=(c_1+c_2)cos(\frac{\pi}{2}k)+(c_1-c_2)isin(\frac{\pi}{2}k)
I plug it into
y[k+2]+y[k]=0
I get
(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
Because
cos(\theta + \pi)=-cos(\theta) and
sin(\theta + \pi)=-sin(\theta)
I get that
-(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
which makes
0=0
How come?
 
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:
Hi,

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

Hi yoran! :smile:

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

:smile: But they're the same! :smile:

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

So \frac{\sin{k}+\sin(k-2)}{2(1+\cos{2})} = … ? :smile:
 
  • #10
Hehe, of course... Thanks a lot!
\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}
 
Back
Top