Recurrence relation: $a_n = 3a_{n-1} + 2n, a_0 = 1$

Solve the following recurrence relation by generating its direct formula: $$a_n = 3a_{n-1} + 2n, a_0 = 1$$ Use the direct formula to find the $10th$ term of the recurrence relation.

My attempt:

$3(10-1) + 2(10)$

$3(9) + 20$

$27 + 20$

$10th$ term = $47$

Is this correct?


Solution 1:

Divide by $3^n$ and define $u_n=a_n/3^n$. Solve the resulting equation for $u_n$ (this involves computing a sum) and retrieve $a_n$.

Solution 2:

For a linear difference equation we break the problem up into $2$ parts: find the general solution to the homogeneous equation and then add any particular solution to the inhomogeneous equation to get the general solution. For the homogeneous equation $$a_{h,n}-3a_{h,n-1}=0$$ Take the general solution to be $a_{h,n}=C\cdot r^n$. Then $$C\cdot r^n-3C\cdot r^{n-1}=C\cdot r^{n-1}(r-3)=0$$ So $r=3$. For the inhomogeneous equatio we hope for a solution of the form $a_{p,n}=An+B$. Then $$a_{p,n}=An+B=3a_{p,n-1}+2n=3\left(A(n-1)+B\right)+2n=3An-3A+3B+2n$$ So $-2An=2n$ therefore $A=-1$ and $3A=-3=2B$ so $B=-\frac32$ and our general solution is $$a_n=a_{h,n}+a_{p,n}=C\cdot3^n-n-\frac32$$ The initial condition is $$a_0=C-\frac32=1$$ So $C=\frac52$ and the solution to the initial value problem is $$a_n=\frac52\cdot3^n-n-\frac32$$ This agrees with the first few iterates of @FoobazJohn.