I've tried my best to solve this recurrence relation into a closed form formula for generality but I couldn't. So, is there someone to help me to solve this recurrence relation into a closed form solution. Can any one can help me?
$a_n = 3a_{n-1}+2n+4$
$a_1 = 4$
A hint:
The "Master Theorem", as it is called in these circles, tells you that the solution is of the form $$a_n=a\cdot 3^n + b\> n+c$$ with coefficients $a$, $b$, $c$ to be determined.