TITLE: difference of recursive equations
QUESTION [5 upvotes]: Lets have two recursive equations:
\begin{align}
f(0) &= 2  \\
f(n+1) &= 3 \cdot f(n) +  8 \cdot n \\ \\
g(0) &= -2 \\
g(n+1) &= 3 \cdot  g(n) + 12
\end{align}
We want a explicit equation for f(x) - g (x).
I firstly tried to do in manually for first $n$ numbers
\begin{array}{|c|c|c|c|}
\hline
n & f(n) & g(n) & f(n) - g(n) \\ \hline
0 & 2 & -2 &    4 \\ \hline
1 & 6  & 6 &    0 \\ \hline
2 & 26  & 30 &  -4 \\ \hline
3 & 94 & 102 &  -8 \\ \hline
4 & 306  & 318 & -12 \\ \hline
\end{array}
We can deduce that $f(n) - g(n) = 4 - 4n$
But now we have to prove it.
Lets extend recursive equation $f(n)$:
$$f(n) = 3^n \cdot f(0) + 8 \cdot (3^{n+1} \cdot 0 + \dots + 3^{0}(n-1))$$
for $g$ we get $$g(n) = 3^n \cdot g(0) + 12 \cdot (3^{n-1} + \dots + 3^0)$$
We can simply check this by induction but I will skip it, so the question won't be so long.
Now lets  put it together:
$$
f(n) - g(n) = 2 \cdot 3^n + 8 * 3^{n-1} \cdot 0 + ... + 3^0 \cdot (n-1) + 2 \cdot 3^n - 4 \cdot 3 \cdot ( 3^{n-1}+ ... + 3^0)= \\
= 4 \cdot 3^n  + 8 \cdot (3^{n-1} \cdot 0 + ... + 3^0(n-1)) - 4 \cdot (3^n + 3^{n-1} + ... + 3^1) = \\
= 8 \cdot (3^{n-1} \cdot 0 + ... + 3^0(n-1)) - 4 \cdot (3^{n-1} + ... + 3^1 + 3^0) + 4 \cdot 3^0 = \\
= 8 \cdot (3^{n-1} \cdot 0 + ... + 3^0(n-1)) - 4 \cdot (3^{n-1} + ... + 3^1 + 3^0) + 4
$$
As we can see, we already got the $4$, so to get $-4n + 4$, the rest of the equation must equal $-4n$. But this is where I don't know how to continue.
How to prove that:
$$8 \cdot (3^{n-1} \cdot 0 + \dots + 3^0(n-1)) - 4 \cdot (3^{n-1} + \dots + 3^1 + 3^0) = -4n$$
All I could do is this:
\begin{align}
&8 \cdot (3^{n-1} \cdot 0 + \dots + 3^0(n-1)) - 4 \cdot (3^{n-1} + \dots + 3^1 + 3^0) = \\
&= 4 \cdot (\frac{0}{2}3^{n-1} + \dots + \frac{1}{2} \cdot (n-1) - 4 * (\frac{2}{2}3^{n-1} + \dots + \frac{2}{2}3^0) = \\
&= 4 \cdot (3^{n-1} \cdot (\frac{0- 2}{2}) + \dots + 3^0 \cdot \frac{(n-1)-1}{2}) = \\
&= 4 \cdot (-\frac{2}{2}3^{n-1} + \dots + \frac{n-2}{2}) 
\end{align}
And I made sum function out of it:
$\sum^{n-1}_{i=0}{\frac{i - 2}{2}\cdot 3^{n-1-i}}$
What to do next? Did I go the wrong direction anywhere?
Thank you for your fast responses.

REPLY [2 votes]: There is no need for induction, use a straight proof.
The equation is
$$f(n+1)-g(n+1)=3(f(n)-g(n))+8n-12$$ with $$f(0)-g(0)=4$$ and it does verify the solution
$$f(n)-g(n)=4-4n$$ as is shown by substitution,
$$4-4(n+1)=3(4-4n)+8n-12,$$ equivalent to $$-4n=-4n.$$
Furthermore, $$4=4-4\cdot 0.$$