I'm stuck in this relation:
$f(n) = f(n-1) + 3n - 1$
I've tried to search everywhere if I could find this kind of example where there is only root and that is '1' but all in vain. And all the previous experience of mine about recurrence relations has failed here because when we come to solve the non homogeneous part the two arbitrary variable cancel each other and we're left with nothing. Please somebody suggest how this can be done.
I am not completely sure if I understand correctly what you mean by "solving" the relation. However, I hope the following helps:
The relation can be written as $$f(n) - f(n-1) = 3n - 1$$ Hence,
$$f(n) = f(0) + \sum_{k=1}^n f(k) - f(k-1) = f(0) + \sum_{k=1}^n (3k - 1) = f(0) - n + 3\sum_{k=1}^n k$$
Using the summation formula for natural numbers $\sum_{k=1}^n k = n(n+1)/2$, we get $$f(n) = f(0) + \frac{3}{2} n(n+1) - n$$