Find a recurrence relation for the number of ternary strings of length n that do not contain two consecutive 0s or two consecutive 1s. Note: Problem from "Kenneth Rosen's DM and it's applications" and solution from "Students solution guide for use with ... applications"

Let P(n) be the number of strings not containg two containing two consecutive zeros or two consecutive ones.

I got the answer 
P(n)=P(n-1)+2P(n-2)+2P(n-3)+...+2P(0) +2

but then the book says the sequence also satisfies the recurrence relation 
P(n)=2P(n-1)+P(n-2). I am not able to understand this part.
$$P(n-1)=P(n-2)+2P(n-3)+\dots+2$$

So

$$P(n)-P(n-1)=P(n-1)+P(n-2)$$
Let, 
$F(n)$=the number of such strings with length $n$. 

$Z(n)$=the number of such strings with length $n$ starting with $0$. 

$W(n)$=the number of such strings with length $n$ starting with $1$. 

$T(n)$=the number of such strings with length $n$ starting with $2$. 

So, $F(n)=Z(n)+W(n)+T(n)$ ... (I)

But, we can easily notice that

$Z(n)=T(n-1)+W(n-1)$

$W(n)=T(n-1)+Z(n-1)$

$T(n)=T(n-1)+W(n-1)+Z(n-1)$

Putting them in equation (I), we get 

$F(n)$

$= T(n-1)+W(n-1)+T(n-1)+Z(n-1)+T(n-1)+W(n-1)+Z(n-1)$

$= ( T(n-1)+W(n-1)+Z(n-1) ) + ( T(n-1)+W(n-1)+Z(n-1) ) + T(n-1)$

$= 2F(n-1) + T(n-1)$       [ From equation (I) ]

But $T(n-1)$ means you have a $2$ in the second place, which means that you can do anything with the rest of the places, in $F(n-2)$ ways. Therefore,

$F(n) = 2F(n-1) + F(n-2)$