# linear recurrence relation with inhomogeneous trigonometric term

Find the explicit sequence that satisfy:

$$x_{n+2}-3x_{n+1}+2x_n= \cos^2(\frac{\pi}{2}n)\sin(\frac{\pi}{6}n)$$

and the initial condition $$x_0=x_1=0$$

My first attempt was to compute some term and guess the law: $$x_2=x_3=0$$

$$x_4=\frac{\sqrt3}{2}$$

$$x_5=3\frac{\sqrt3}{2}$$

$$x_6=4\sqrt3$$

$$x_7=9\sqrt3$$

$$x_8=19\sqrt3$$

$$x_9=39\sqrt3$$

$$x_{10}=\frac{391}{2}\sqrt3$$

then i try to follow the wikipedia article https://en.wikipedia.org/wiki/Recurrence_relation#Solving_non-homogeneous_linear_recurrence_relations_with_constant_coefficients

but i don't know the form of the inhomogeneous solution.

• What have you tried? – Michael Burr Oct 8 '18 at 11:44
• i compute some of the first term to find a law, but nothing... then i tried variation of parameter but the integral becomes ugly (there must be another easiest method) – polbos Oct 8 '18 at 11:48
• Please include your attempt in your question. Otherwise, your question is in danger of being closed due to missing context. – Michael Burr Oct 8 '18 at 11:57
• Do you know Z transforms? – Paul Oct 8 '18 at 12:01
• no but thank you for the advice – polbos Oct 8 '18 at 12:30

This is a linear difference equation so the solution can be written as

$$x_n = x^h_n + x^p_n \\ x^h_{n+2}-3x^h_{n+1}+2x^h_n= 0\\ x^p_{n+2}-3x^p_{n+1}+2x^p_n= \cos^2(\frac{\pi}{2}n)\sin(\frac{\pi}{6}n)$$

the difficult part is to obtain $$x^p_n$$ so we will focus that. Making

$$x^p_n = a e^{\frac{i \pi n}{3}}+b e^{-\frac{1}{3} i \pi n}+c e^{\frac{2 i \pi n}{3}}+d e^{-\frac{2}{3} i \pi n}$$

after substituting and grouping terms we get at

$$\frac{1}{4} e^{-\frac{2}{3} i \pi n} \left(-i \left(4 \sqrt{3} a+1\right) e^{i \pi n}+i \left(4 \sqrt{3} b+1\right) e^{\frac{i \pi n}{3}}+\left(-8 i \sqrt{3} c+12 c+i\right) e^{\frac{4 i \pi n}{3}}+4 \left(3+2 i \sqrt{3}\right) d-i\right) = 0$$

and then solving

$$\left\{ \begin{array}{rcl} 4 \left(3+2 i \sqrt{3}\right) d-i&=&0 \\ 4 \sqrt{3} b+1&=&0 \\ 4 \sqrt{3} a+1&=&0 \\ -8 i \sqrt{3} c+12 c+i&=&0 \\ \end{array} \right.$$

we obtain

$$\left\{ \begin{array}{rcl} a&=&-\frac{1}{4 \sqrt{3}} \\ b&=&-\frac{1}{4 \sqrt{3}} \\ c&=&\frac{1}{336} \left(-12 i+8 \sqrt{3}\right) \\ d&=&\frac{1}{336} \left(12 i+8 \sqrt{3}\right) \\ \end{array} \right.$$

• @polbos Here $x^p_n$ represents a particular solution to the complete recurrence equation. – Cesareo Oct 8 '18 at 16:18