I'm given a difference equation, $y[n]-0.4y[n-1]=x[n]$, and asked to find the natural response $y_n[n]$, forced response $y_f[n]$ and complete response $y[n]$ if $x[n]=4 (0.25)^nu[n]$ and $y[0]=0$.

By one approach I've read, $$ \text{characteristic equation:}\quad z-0.4=0 \quad\therefore y_n[n]=A(0.4)^n \\ \\ y_f[n]=B(0.25)^n \quad\text{substitute back into diffeq:}\\ B(0.25)^n -0.4B(0.25)^{n-1}=B(0.25)^n - \frac{0.4}{0.25}B(0.25)^n= 4(0.25)^nu[n]\\ \therefore B=-\frac{20}{3}, \quad y_f[n]=-\frac{20}{3}(0.25)^nu[n]\\ \therefore y[n] = A(0.4)^n-\frac{20}{3}(0.25)^nu[n]\\ y[0]=0 \rightarrow A=\frac{20}{3} \\ y[n]= \frac{20}{3}(0.4)^n-\frac{20}{3}(0.25)^nu[n]\\ $$ Great! Alternatively, I should be able to determine $y[n]$ by taking the inverse z Transform of $Y(z)=H(z)X(z)$, which in this case is (I'm pretty sure) $$ Y(z)= \frac{z}{z-0.4}\cdot 4 \frac{z}{z-0.25}\\ \begin{align} \frac{Y(z)}{z} &= \frac{4z}{(z-0.4)(z-0.25)}=\frac{C}{z-0.4}+\frac{D}{z-0.25}\\ &=\frac{32}{3} \frac{1}{z-0.4} - \frac{20}{3}\frac{1}{z-0.25}\\ \end{align}\\ \therefore Y(z)=\frac{1}{3} \left[\frac{32z}{z-0.4} - \frac{20z}{z-0.25}\right]\\ \therefore y[n]= \left[ \frac{32}{3}(0.4)^n - \frac{20}{3}(0.25)^n \right] u[n] $$ which is almost the same, but not quite.

Where did I go wrong? Also, in the second approach, how do you take into account the initial condition of $y[0]=0$? And thirdly, in the first approach, is the first term of $y[n]$ multiplied by $u[n]$ or not? If so, how do you show this?

(for anyone wondering, this is not homework for a course, just self study...)

  • 1
    $\begingroup$ Don't you mean $y[-1]=0$ instead of $y[0]=0$? $\endgroup$ – Matt L. Aug 20 '15 at 6:54
  • $\begingroup$ The question says y[0]=0 but I guess its mistaken. But its not clear to me why y[0] can't be zero... $\endgroup$ – Westerley Aug 20 '15 at 17:02

The way to solve such problems is to use the unilateral $\mathcal{Z}$-transform, which allows you to take initial conditions into account. Note that the unilateral $\mathcal{Z}$-transform of $y[n-1]$ is


where $Y(z)$ is the $\mathcal{Z}$-transform of $y[n]$. Using $(1)$ you can transform the given difference equation $y[n]-\frac25 y[n-1]=x[n]$, resulting in

$$Y(z)=\frac{X(z)}{1-\frac{2}{5}z^{-1}}+\frac{\frac{2}{5}\cdot y[-1]}{1-\frac{2}{5}z^{-1}}\tag{2}$$

With $X(z)$ given by


Eq. $(2)$ becomes (after partial fraction expansion)


From $(4)$, the resulting output sequence is


Eq. $(5)$ is the general form of the output sequence of the given system with the given input sequence. The value $y[-1]$ is the initial condition of the system, i.e. the state the system is in right before the input signal starts. With $y[-1]=0$ you obtain the same solution as you obtained using the inverse $\mathcal{Z}$-transform (neglecting any initial conditions by using $y[n-1]\Longleftrightarrow z^{-1}Y(z)$).

With the given constraint $y[0]=0$, you can obtain the required value of $y[-1]$ by considering the difference equation at $n=0$:

$$y[0]-\frac25 y[-1]=x[0]=4$$

which gives $y[-1]=-10$. Plugging that value into Eq. $(5)$ finally gives the result



As Matt L pointed out, your initial condition is wrong. y[0] is NOT 0, it's 4. This is obvious from the difference equation. Once you use y[0] = 4, both results come out to be the same.

  • $\begingroup$ As mentioned in my comment to @matt, the question does say y[0]=0 but it's likely wrong... but its not clear to me why y[0] CAN'T be zero... I see that x[0] is 4, but why can't the natural response at n=0 cancel out that? $\endgroup$ – Westerley Aug 20 '15 at 17:03
  • $\begingroup$ Note that $y[0]$ can be zero by an appropriate choice of the initial condition $y[-1]$ (see my answer). $\endgroup$ – Matt L. Aug 21 '15 at 7:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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