$$f(0)=a$$ $$f(1)=b$$
$$f(n) = 2f(n-1) -f(n-2) + 1$$ How can I begin repeated substitution with this? I'm confused because there are two $f$ terms not sure how to sub for both of them.
$$f(0)=a$$ $$f(1)=b$$
$$f(n) = 2f(n-1) -f(n-2) + 1$$ How can I begin repeated substitution with this? I'm confused because there are two $f$ terms not sure how to sub for both of them.
After some computations $$f(2) = 2f(1)-f(0)+1 = 2b-a+1,$$ $$f(3) = 2f(2)-f(1)+1 = 4b-2a+2-b+1 = 3b-2a+3,$$ $$f(4) = 2f(3)-f(2)+1 = 6b-4a+6-2b+a-1+1 = 4b-3a+6,$$ you can conjecture that $$f(n) = nb-(n-1)a+ \frac{n(n-1)}{2}$$ and prove this by induction.