Given U1 = 1, U2 = 2, find UN = 2U (n-2) + U (n-1) + 1 Solve how to deduce the general term formula

Given U1 = 1, U2 = 2, find UN = 2U (n-2) + U (n-1) + 1 Solve how to deduce the general term formula

Un= 2U(n-2) +U(n-1) +1
Un- 2U(n-1) -1/2= -[U(n-1) -2U(n-2) -1/2 ]
{un - 2U (n-1) - 1 / 2} is an equal ratio sequence, q = - 1
Un- 2U(n-1) -1/2 = (-1)^(n-2) .(U2- 2U1 -1/2)
=(1/2).(-1)^(n-1)
Un+ (1/6)(-1)^n + 1/2 = 2[ U(n-1) + (1/6)(-1)^n + 1/2]
{UN + (1 / 6) (- 1) ^ n + 1 / 2} is an equal ratio sequence, q = 2
Un+ (1/6)(-1)^n + 1/2 = 2^(n-1) .(U1+ (1/6)(-1)^1 + 1/2)
= (2/3).2^n
Un = -(1/6)(-1)^n - 1/2 +(2/3).2^n