How many $2020$-digit-numbers divisible by 3 satisfying the digits are $2, 4, 5, 7$ and digits $4, 5$ must not stand next to one another are there? 
Determine how many $2020$-digit-numbers simultaneously satisfy these three constraints:
i/ every digit of the number is one of the following: $2, 4, 5, 7$;
ii/ digits $4$ and $5$ must not stand next to one another;
iii/ the number is divisible by $3$.

Let $x_n, y_n, z_n, t_n$ be the number of $n$-digit-numbers that end with $2, 4, 5, 7$ respectively $(n \in \mathbb Z^+)$.
We have that $x_n + y_n + z_n + t_n = S_n$.
(with $S_n$ being that number of $n$-digit-numbers that satisfy the first two conditions of the problem).
It can be seen that $t_n = x_n, y_n = z_n \implies \left\{ \begin{align} x_{n + 1} &= x_n + 2y_n\\ y_{n + 1} &= S_n\\ S_{n + 1} &= 2(x_n + y_n) \end{align} \right. \implies S_{n + 2} = 3S_{n + 1} + 2S_n$.
There exist constants $p$ and $q$ such that $S_n$ can always be expressed in the form of $p\alpha^n + q\beta^n$ for $\forall n \in \mathbb Z^+$ where $\alpha$ and $\beta$ are roots of the equation $x^2 - 3x - 2 = 0$.
Furthermore, it can be obtained that $S_1 = 4$ and $S_2 = 10$.
$\implies \left\{ \begin{align} \alpha + \beta &= 3\\ \alpha\beta &= - 2\\ p + q &= 4\\ p\alpha + q\beta &= 10 \end{align} \right.$ $\implies \left\{ \begin{align} (\alpha, \beta) = \left(\dfrac{3 + \sqrt{17}}{2}, \dfrac{3 - \sqrt{17}}{2}\right)\\ (p, q) = \left(2 + \dfrac{4}{\sqrt{17}}, 2 - \dfrac{4}{\sqrt{17}}\right)\end{align} \right.$
$$ \implies S_n = 2\left[\left(1 + \dfrac{2}{\sqrt{17}}\right) \cdot \left(\dfrac{3 + \sqrt{17}}{2}\right)^n + \left(1 + \dfrac{2}{\sqrt{17}}\right) \cdot \left(\dfrac{3 - \sqrt{17}}{2}\right)^n \right]$$

This is an answer to your question about solving the recurrence relation.
The method of solving a linear recurrence relation such as yours is as follows.
Solve $x^2-3x-2=0$. This has roots $\frac{3+\sqrt {17}}{2}$ and $\frac{3-\sqrt {17}}{2}$. 
Then $S_n=A\left(\frac{3+\sqrt {17}}{2}\right)^n+B\left(\frac{3-\sqrt {17}}{2}\right)^n$ for constants $A$ and $B$. 
The constants can be found from the values of $S_1$ and $S_2$.
Obtaining your recurrence relation 
There were some queries about your derivation of this. However, it can be obtained as follows.
$$x_{n+1}=t_{n+1}=S_n$$
$$y_{n+1}=S_n-z_n, z_{n+1}=S_n-y_n$$
Therefore
$$y_{n+1}+z_{n+1}=2S_n-y_n-z_n$$
$$S_{n+1}-2S_n=2S_n-(S_n-2S_{n-1})$$
$$S_{n+1}=3S_n+2S_{n-1}.$$
