How to solve this recurrence relation? $f_n = 3f_{n-1} + 12(-1)^n$ How to solve this particular recurrence relation  ?
$$f_n = 3f_{n-1} + 12(-1)^n,\quad f_1 = 0$$
such that $f_2 = 12, f_3 = 24$ and so on.
I tried out a lot but due to $(-1)^n$ I am not able to solve this recurrence?
Any help will be highly appreciated.
Please this is no homework. I came across this while solving a problem on SPOJ

$f(1)=0$; $f(n)=3f(n-1)+12(-1)^n=3\Big(3f(n-2)+12(-1)^{n-1}\Big)+12(-1)^n$
For $n\ge 3$ you have
$$\begin{align*}
f(n)&=3f(n-1)+12(-1)^n\\
&=3\Big(3f(n-2)+12(-1)^{n-1}\Big)+12(-1)^n\\
&=9f(n-2)+36(-1)^{n-1}+12(-1)^n\\
&=9f(n-2)+12(-1)^{n-1}\Big(3+(-1)\Big)\\
&=9f(n-2)+24(-1)^{n-1}\\
&=9f(n-2)-24(-1)^n\\
&=\begin{cases}9f(n-2)-24,&\text{if }n\text{ is even}\\
9f(n-2)+24,&\text{if }n\text{ is odd}\;.\end{cases}
\end{align*}$$
Now you can solve separately for the even and odd subsequences. 
Let $a_0=0$ and $a_{n+1}=9a_n+24$ for $n\ge 0$. Substitute $b_n=a_n-d$ for some as yet unknown $d$, so that $a_n=b_n+d$, and the recurrence becomes $b_{n+1}+d=9(b_n+d)+24=9b_n+9d+24$, or $b_{n+1}=9b_n+8d+24$. If we set $d=-3$, this becomes $b_{n+1}=9b_n$, a simple exponential sequence whose solution has the closed form $b_n=9^nb_0$. And since $b_0=a_0-(-3)=3$, we immediately find the closed form $b_n=3\cdot9^n=3^{2n+1}$, whence $a_n=b_n+d=3^{2n+1}-3$. Now check that $f(2n+1)=a_n$, and you’ll see that $f(2n+1)=3^{2n+1}-3$. In other words, $f(n)=3^n-3$ when $n$ is odd.
You can handle the even subsequence similarly. You find that $d=3$, $b_n=9^{n-1}b_1=9^n$ (since $b_1=a_1-3=9$), and $a_n=9^n+3$. But $a_n=f(2n)$, so $f(2n)=9^n+3=3^{2n}+3$, i.e., $f(n)=3^n+3$ when $n$ is even. Combining the two, we have $f(n)=3^n-3(-1)^n$.
