I have a recursive relation algorithm which is defined as follows:
$$F_n = 3(F_{n-1} - F_{n-2}) + F_{n-3}$$ $$F_0 = 0$$ $$F_1 = 1$$ $$F_2 = 4$$
From calculating the first few values, I know this is equivalent to $F_n = n^2$, however I don't quite know how to derive that. I tried substituting and telescoping, but I couldn't find an appropriate pattern.
How would I do this?
You've conjectured that $F_n=n^2$ for all $n.$ You know it is true for $n=0,1,2,$ and if you happen to know that $F_k=k^2$ for $k=n-1,n-2,n-3,$ then since $$F_{n-1}-F_{n-2}=(n-1)^2-(n-2)^2=\bigl((n-1)+(n-2)\bigr)\bigl((n-1)-(n-2)\bigr)=2n-3,$$ we have $$F_n=3(F_{n-1}-F_{n-2})+F_{n-3}=6n-9+(n-3)^2=6n-9+n^2-6n+9=n^2.$$ Hence, by (strong) induction, we're done.
How can one derive this, though (aside from guessing)?
Well, subtracting $2F_{n-1}-F_{n-2}$ from both sides of the recurrence relation yields $$F_n-2F_{n-1}+F_{n-2}=F_{n-1}-2F_{n-2}+F_{n-3},$$ or equivalently, $$F_n-2F_{n-1}+F_{n-2}=F_{n-1}-2F_{(n-1)-1}+F_{(n-1)-2}.\tag{$\star$}$$ This shows that there is some constant $c$ such that $$F_n-2F_{n-1}+F_{n-2}=c\tag{$\heartsuit$}$$ for all $n$, which is very readily proved from $(\star)$ by induction. In particular, letting $n=2$ shows us that $c=4-2\cdot 1+0=2.$ Hence, adding $F_{n-1}-F_{n-2}$ to both sides of $(\heartsuit)$ and making the substitution $c=2$ shows us that $$F_n-F_{n-1}=F_{n-1}-F_{n-2}+2$$ for all $n,$ meaning that the difference between subsequent terms increases by $2$ every time. So, $F_1-F_0=1,$ then $F_2-F_1=3,$ $F_3-F_2=3,$ etc. In general, we have $F_k-F_{k-1}=2k-1$ for all $k\ge1.$ Recalling/observing that $$\sum_{k=0}^n(2k-1)=n^2$$ for all $n\geq1,$ we're done.