# Solving a second order difference equation

I need to solve the following 2nd order difference equation

$$3y[n]-y[n-1]+y[n-2]={\bigg(\frac{1}{2}\bigg)}^{n} u[n]$$

where $u[n]$ is Heaviside's step function. I started by trying to find the homogeneous solution:

$$3-z^{-1}+z^{-2}=3-\frac{1}{z}+\frac{1}{z^2}=3z^2-z+1$$

Homogeneous equation:

$$3z^2-z+1=0\leftrightarrow z=\frac{1\pm\sqrt{1-4\times 3\times 1}}{2\times 3}\leftrightarrow z_1=\frac{1+\sqrt{11}i}{6};z_2=\frac{1-\sqrt{11}i}{6}$$

Since I have complex numbers I don't know how to write the homogeneous solution with the constants $C_1$ and $C_2$. I also don't know how to find the particular solution.

• Your problem is incomplete y[-2] and y[-1] need to be specified – user28715 Oct 21 '17 at 21:15
• @StanleyPawlukiewicz y[n]=0, for n<0 is the only additional information that I have – Maria Barroso Oct 21 '17 at 21:21
• @StanleyPawlukiewicz I have to calculate y[n] for n>=0, in discrete SLIT of second order – Maria Barroso Oct 21 '17 at 21:23
• tutorial.math.lamar.edu/Classes/DE/HOHomogeneousDE.aspx This link explains what to do when you get complex roots to a homogenous differential equation – itismeghasyam Oct 21 '17 at 21:33

You can indeed proceed with the complex roots $z_1$ and $z_2$ as well as with the real ones.

In order for a particular solution you may assume a solution of type: $$y_p[n] = K ( \frac{1}{2})^n u[n]$$

And plug it into the LCCDE to find the undetermined coefficient $K=1/5$.

Then assuming a homogeneous solution of the form (for causal system) $$y_h[n] = C_1 z_1^n u[n] + C_2 z_2^n u[n]$$

You have the complete solution as: $$y[n] = y_h[n] + y_p[n] = (C_1 z_1^n + C_2 z_2^n + \frac{1}{5} (\frac{1}{2})^n) u[n]$$

In order to find $C_1$ and $C_2$ you can get $2$ equations from $y[0]$ and $y[1]$ by explicitly solving them from the LCCDE via recursion, which yields $y[0] = 1/3$ and $y[1] = 5/18$. Then you have the following:

$$\begin{cases} y[0] = \frac{1}{3} &= C_1 + C_2 + \frac{1}{5} \\ y[1] = \frac{5}{18} &= C_1 z_1 + C_2 z_2 + \frac{1}{10} \\ \end{cases}$$

Solve this system for $C_1$ and $C_2$ to complete the procedure...

Alternateley you can also consider the following. When have a LCCDE with real coefficients, its consequence is the fact that the roots associated with the homogeneous equation will be either real or in complex-conjugate pairs, as you have found.

Furthermore you can deduce from the LCDDE with real coefficients that its solution $y[n]$ must be real valued, for a real input $x[n]$.

Hence you can deduce from these that the constants $C_1$ and $C_2$ of those two complex roots should be constrained like $C = C_1 = C_2$ or $C = C_1 = C_2^*$ then you can see that the complex roots will merge:

$$C_1 z_1^n + C_2 z_2^n = C (z_1^n + (z_1^n)^* ) = 2C \mathcal{Re} \{z_1^n\}$$

or like

$$C_1 z_1^n + C_2 z_2^n = C z_1^n + (C_1z_1^n)^* = 2 \mathcal{Re} \{C z_1^n\}$$

Conversion to polar form helps like: $$z_1 = |z_1| e^{j\phi_1} \Rightarrow 2C \mathcal{Re}\{z_1^n\} =2C |z_1|^n\cos(\phi_1 n)$$

or like $$C = |C|e^{j\theta_C}, ~~z_1 = |z_1| e^{j\phi_1} \longrightarrow 2 \mathcal{Re}\{C z_1^n\} =2 |C| |z_1|^n\cos(\phi_1 n + \theta_C)$$