# How do I solve this recurrence relation with the given condition?

Equation: $a_n = a_{n-1}-n$ for the given condition: $a_0 = 4$

So that means I know that $a_1 = 3$, $a_2 = 1$, $a_3 = -2$, $a_4 = -6$, and $a_5 = -11$.

I've tried for over 1.5 hours now trying to solve this. Here's what I've had.

$a_1 = 4 - 1$

$a_2 = 4 - 3(n-1)$

$a_3 = 4 - 3(n-1) - 0$

$a_4 = 4 - 3(n-1) - 1$

$a_5 = 4 - 3(n-1) - 3$

I'm not sure what I'm doing now. I'm supposed to find a pattern that repeats and forms an equation that works for all the values when plugged in back into the original equation by replacing $a_{n-1}$.

By pattern, here's what I mean. This is a problem that I already solved. I had the following equation: $a_n = -a_{n-1}$ for $a_0 = 5$. Here was the pattern I found for the values $a_1 = -5$, $a_2 = 5$, $a_3 = -5$, $a_4 = 5$ and so on. Here's the pattern:

$a_1 = -(5)$

$a_2 = -(-(5))$

$a_3 = -(-(-(5)))$

So the pattern is $a_n = -5(-1)^n$ because when you plug in the value of n, it works for all of them for the equation $a_n = -(-5(-1)^n)$.

Likewise, this problem $a_n = a_{n-1}+3$ for $a_0 = 1$ had the solution $a_n = 3(n-1)+1$ and plugging into the original $a_n = 3(n-1)+1+3$ results in $a_n = 3n+1$ which is true for its values {1, 4, 7, 10,...}.

Notice that:

$$a_1 = a_0 - 1 \\ a_2 = a_1 - 2 \\ a_3 = a_2 - 3 \\ a_4 = a_3 - 4 \\ \vdots \\ a_n = a_{n-1} - n$$

Adding them up, $a_n = a_0 - (1+2+3+\dots+n) = a_0 - n(n+1)/2$.

Finally, as $a_0 = 4$, you have that $a_n = 4 - n(n+1)/2$.

Let's check whether it works: $a_5 = 4 - 5 \cdot 6 / 2 = 4 - 5 \cdot 3 = 4 - 15 = -11$.

You can also prove this formula using finite induction.

We are given $a_0 = 4$ and $a_n=a_{n−1}−n$.

The recurrence can be written $a_n-a_{n−1}=−n$.

Addind this up for $n$ from $1$ to $m$, $\sum_{n=1}^m (a_n-a_{n−1})=\sum_{n=1}^m(−n)$ or $a_m-a_0 =-\frac{m(m+1)}{2}$ or $a_m =4-\frac{m(m+1)}{2}$.

Let $a_m=b_m+a+bm+cm^2$

$4=a_0=b_0+a\iff b_0=4-a$

$-n=a_n-a_{n-1}=b_n-b_{n-1}+b+c(2n-1)$

Choose $b-c=0,2c=-1$ to find $b_n=b_{n-1}=\cdots=b_0=4-a$

$\implies a_m=4-a+a-\dfrac12\cdot m-\dfrac12\cdot m^2$