1. ## Difference equation

How do I calculate:
$\displaystyle y_{n+1}-y_{n}=\sin(n)$
$\displaystyle n>=0, y_0=0$

2. Originally Posted by a4swe
How do I calculate:
$\displaystyle y_{n+1}-y_{n}=\sin(n)$
$\displaystyle n>=0, y_0=0$
Looks to me like:
$\displaystyle y_0 = 0$
$\displaystyle y_1 = y_0 + sin(1) = sin(1)$
$\displaystyle y_2 = y_1 + sin(2) = sin(1) + sin(2)$

etc.

So
$\displaystyle y_{n} = \sum_{i = 0}^n sin(i)$

-Dan

3. Yes, I would agree to that.
But what then?

4. You could start by building your iterations.

$\displaystyle y_{n+1}-y_{n}=sin(n)\Rightarrow{y_{1}+y_{0}=sin(0)}\Righta rrow{y_{1}=0}$

$\displaystyle y_{2}-y_{1}=sin(1)\Rightarrow{y_{2}=sin(1)}$

$\displaystyle y_{3}-y_{2}=sin(2)\Rightarrow{y_{3}-sin(1)=sin(2)}$

$\displaystyle y_{4}-y_{3}=sin(3)\Rightarrow{y_{4}-(sin(2)+sin(1))=sin(3)}$

And so on and so on.

5. I want to have a formula for ANY n, that method won't help me.
I know there is one, and getting to that is my problem.

$\displaystyle \frac{\sin(\frac{n}{2})*\sin(\frac{n-1}{2})}{\sin(\frac{1}{2})}$
Is what I want it to be.

6. Originally Posted by a4swe
I want to have a formula for ANY n, that method won't help me.
I know there is one, and getting to that is my problem.

$\displaystyle \frac{\sin(\frac{n}{2})*\sin(\frac{n-1}{2})}{\sin(\frac{1}{2})}$
Is what I want it to be.
(Hmmm...It seems I was off by a term in my earlier post. Galactus has it right.)

Have you tried an induction proof?

For n = 1: $\displaystyle \frac{\sin(\frac{1}{2})*\sin(\frac{1-1}{2})}{\sin(\frac{1}{2})} = 0$
Since $\displaystyle y_1 = 0$ this is good. (The formula also works for $\displaystyle y_0 = 0$.)

So it works for some n. Let's see if it works for n + 1.
Now, $\displaystyle y_{n+1} = \sum_{i = 0}^{n+1} sin(i) =(?) \frac{\sin(\frac{n+1}{2})*\sin(\frac{n}{2})}{\sin( \frac{1}{2})}$

By hypothesis $\displaystyle y_{n+1} = y_n + sin(n)$ so
$\displaystyle \frac{\sin(\frac{n+1}{2})*\sin(\frac{n}{2})}{\sin( \frac{1}{2})} = \frac{\sin(\frac{n}{2})*\sin(\frac{n-1}{2})}{\sin(\frac{1}{2})} + sin(n)$
should be true.

$\displaystyle \sin(\frac{n+1}{2})*\sin(\frac{n}{2}) = \sin(\frac{n}{2})*\sin(\frac{n-1}{2}) + sin(\frac{1}{2})sin(n)$

On the LHS:
$\displaystyle \sin(\frac{n+1}{2})*\sin(\frac{n}{2}) = sin(\frac{n}{2} + \frac{1}{2}) * sin(\frac{n}{2})$

= $\displaystyle \left [ sin(\frac{n}{2}) cos(\frac{1}{2}) + sin(\frac{1}{2}) cos(\frac{n}{2}) \right ] sin(\frac{n}{2})$

= $\displaystyle sin^2(\frac{n}{2}) cos(\frac{1}{2}) + sin(\frac{1}{2}) sin(\frac{n}{2}) cos(\frac{n}{2})$

= $\displaystyle sin^2(\frac{n}{2}) cos(\frac{1}{2}) + \frac{1}{2} sin(\frac{1}{2}) sin(n)$

Similarly we may show that the RHS becomes
$\displaystyle \sin(\frac{n}{2})*\sin(\frac{n-1}{2}) + sin(\frac{1}{2})sin(n) =$ $\displaystyle sin^2(\frac{n}{2}) cos(\frac{1}{2}) - \frac{1}{2} sin(\frac{1}{2}) sin(n) + sin(\frac{1}{2})sin(n)$

Which again gives:
$\displaystyle sin^2(\frac{n}{2}) cos(\frac{1}{2}) + \frac{1}{2} sin(\frac{1}{2}) sin(n)$

So the two sides are equal.

So the theorem is true for n and n + 1 etc.

-Dan

7. Ahhh, yes!
Thank you tops.