Give the equation $$y[n]-y[n-1] +\frac14y[n-2]= x[n]$$ With initial conditions $$y[0]=0\\ y[1]= 0$$ Find the step response.

I have been able to get the solution $$y[n] =C_1(\frac12)^n +C_2(\frac12)^n + 1,,$$ I am have problem finding $C_1$ and $C_2$. How do I find $C_1$ and $C_2$?

  • $\begingroup$ given difference equation is correct ? $\endgroup$ – Arpit Jain Jun 8 '17 at 5:52
  • $\begingroup$ Yes is correct..need to find the step response of the equation. $\endgroup$ – Didi Jun 8 '17 at 5:55
  • $\begingroup$ It doesn't look sensible to me; 1/4[n-2] doesn't look right. Please proof-read. $\endgroup$ – Marcus Müller Jun 8 '17 at 6:04
  • $\begingroup$ if difference equation is correct, then isn't it Y[n] = X[n] = Y[n-1] + (1/4) *[n-2]. making transfer function equal to 1 ? $\endgroup$ – Arpit Jain Jun 8 '17 at 6:06
  • 2
    $\begingroup$ so, I think this boils down to a very basic math question: you've got an equation with two unknowns, and you have two known pairs of $n\mapsto Y[n]$. What's stopping you from simply inserting those? Also, how did you get to your solution? Doesn't make much sense to me, since you can rewrite it to $Y[n] = \left(\frac12\right)^n\left(C_1+C_2\right) + 1= \frac{\tilde C}{2^n} + 1$, which only has one unknown, so I think your "solution" really isn't all that good. $\endgroup$ – Marcus Müller Jun 8 '17 at 7:20

As shown in other answers, one way to solve such problems is using the $\mathcal{Z}$-transform. However, your approach of finding a general and a particular solution also works, but you've got a few things wrong. Since this looks like homework, I'll just try to give you a few essential hints to enable you to solve the problem yourself (and to actually learn something).

You seem to have found the characteristic polynomial and its solutions:


The characteristic polynomial has a double root at $\lambda=\frac12$, which must be taken into account when forming the general solution. That's where you've gone wrong. You treated the double root as two distinct single roots, which doesn't work. The solution of the homogeneous difference equation ($x[n]=0$) has the form

$$y_h[n]=C_1\left(\frac12\right)^n+C_2n\left(\frac12\right)^n,\qquad n\ge 0\tag{2}$$

A particular solution (taking into account the excitation $x[n]=u[n]$) can be found by inspection:


First determine $C_3$ by simply plugging the particular solution $(3)$ into the difference equation. The final solution is then given by


The constants $C_1$ and $C_2$ must now be chosen such that the given initial conditions are satisfied.

  • $\begingroup$ I have plugged C3 into the difference equation and got 1 . Final solution Y[n]= C1(1/2)^n + C2n(1/2)^n + 1, so can I just choose the value of C1 and C2 randomly to satisfy the initial conditions $\endgroup$ – Didi Jun 8 '17 at 10:50
  • $\begingroup$ @Didi: How can you get $1$ for $C_3$? Absolutely impossible. And what do you mean by "choosing $C_1$ and $C_2$ randomly"? The initial conditions have to be satisfied, which gives two equations for two unknowns with one unique solution. No randomness about that. $\endgroup$ – Matt L. Jun 8 '17 at 10:57
  • $\begingroup$ Ok...I am confused now. C3= C1+C2+1. is this right. $\endgroup$ – Didi Jun 8 '17 at 11:05
  • $\begingroup$ @Didi: Plug $y_p[n]=C_3$ into the difference equation (ignoring $y_h[n]$ for the moment) and solve for $C_3$. This should be very simple, and it should give you an answer different from $1$. $\endgroup$ – Matt L. Jun 8 '17 at 11:43

If your difference equation is:


then it describes a system with the following transfer function:


If $x[n]=u[n]$ is the unit step function, i.e.:

$$u[n]=\begin{cases} 1, & \text{for } n \ge 0\\ 0, & \text{for } n < 0 \end{cases}$$ then its $z$-transform $\displaystyle U(z)=\frac{1}{1-z^{-1}}$ and the unit step response, in $z$-domain, is:


which you can write as:


where $C_1$ and $C_2$ are constants to be determined. Knowing that ($z$-transform tables):

$$\frac{z^{-1}}{(1-az^{-1})^2}\rightleftharpoons nu[n]a^{n-1}$$

and using the time-shift property you can deduce that:

$$\frac{1}{(1-az^{-1})^2}\rightleftharpoons (n+1)u[n+1]a^{n}.$$



All you need to do now is to use the initial conditions to get $C_1$ and $C_2$ ($y_u[0]=0$ and $y_u[1]=0$). You will find two equations and both give you $C_1+C_2=0$ which is not sufficient to find the coefficients. You need then to compute $y_u[2]$ which you will find equal to $1$. Using this, you get in the end:


  • $\begingroup$ Your PFE is wrong. See the details in my answer. $\endgroup$ – msm Jun 8 '17 at 10:21
  • $\begingroup$ The final solution in this answer is correct! $\endgroup$ – Matt L. Jun 8 '17 at 10:55
  • $\begingroup$ (Even though we actually don't want to give full solutions for homework questions.) $\endgroup$ – Matt L. Jun 8 '17 at 10:55
  • $\begingroup$ @msm Sorry, what does PFE stand for? $\endgroup$ – Learn_and_Share Jun 8 '17 at 12:25
  • $\begingroup$ @MattL. You're right, I should've just hinted to the derivations. $\endgroup$ – Learn_and_Share Jun 8 '17 at 12:27

Taking the $z$-transform and applying the initial conditions, $$Y(z)-z^{-1}Y(z)+\frac14z^{-2}Y(z)=X(z)$$ $$Y(z)\left(1-z^{-1}+\frac{1}{4}z^{-2}\right)=X(z)$$ $$\frac{Y(z)}{X(z)}=H(z)=\frac{1}{1-z^{-1}+\frac{1}{4}z^{-2}}=\frac{1}{(1-\frac12z^{-1})^2}=\frac{z^2}{(z-\frac12)^2}$$ Hence, the step response is given by the inverse $z$-transform of $\frac{z^2}{(z-\frac12)^2}\cdot\frac{z}{z-1}$. Can you do it?

Update - Due to a mistake in another answer, I will give a complete answer.

Using partial fraction expansion:

$$\begin{align} F(z)=\frac{S(z)}{z}=\frac{z^2}{(z-\frac12)^2(z-1)}=\frac{A}{(z-\frac12)^2}+\frac{B}{z-\frac12}+\frac{C}{z-1} \end{align}$$ gives $$C=(z-1)F(z)\biggr\vert_{z=1}=\frac{z^2}{(z-\frac12)^2}\biggr\vert_{z=1}=4$$ $$A=(z-\frac12)^2F(z)\biggr\vert_{z=\frac12}=\frac{z^2}{z-1}\biggr\vert_{z=\frac12}=-\frac12$$ $$B=\frac{d}{dz}\left((z-\frac12)^2F(z)\right)\biggr\vert_{z=\frac12}=\frac{2z(z-1)-z^2}{(z-1)^2}\biggr\vert_{z=\frac12}=\frac{z(z-2)}{(z-1)^2}\biggr\vert_{z=\frac12}=-3$$ Now use a table of $z$-transforms and its properties to find the final result:


  • $\begingroup$ I have plugged C3 into the difference equation and got 1 . Final solution Y[n]= C1(1/2)^n + C2n(1/2)^n + 1, so can I just choose the value of C1 and C2 randomly to satisfy the initial conditions? $\endgroup$ – Didi Jun 8 '17 at 10:48
  • $\begingroup$ @msm: There's a mistake in your final solution: for $n=1$ you get $s[1]=2$, but it should be $0$ (initial conditions), whereas the solution in MedNait's answer appears to be correct. $\endgroup$ – Matt L. Jun 8 '17 at 10:54
  • $\begingroup$ @MattL. The point was the PFE in the mentioned answer which is wrong. $\endgroup$ – msm Jun 8 '17 at 11:09
  • $\begingroup$ @msm: Yes, I only referred to the final solution as a reference; I haven't checked the derivation. $\endgroup$ – Matt L. Jun 8 '17 at 11:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.