# There appears to be a contradiction with the recurrence solutiom

Consider the equation : $$y[n]-\frac{1}{2}y[n-1]=x[n]$$ where $$x[n]:=\left(\frac{1}{3}\right)^{n}u[n]$$. First, I founded the homogenous solution $$y_{h}:=A\frac{1}{2^{n}}$$ $$y_{h}[n]=\frac{1}{2^{n}}y[0]$$ where I insist $$A=y[0]$$. Furthermore, The particular solution is given of the form $$y_{p}[n]:=B\left(\frac{1}{3}\right)^{n}$$ I shall determine $$B$$ as follow : $$B\left(\frac{1}{3}\right)^{n}u[n]-\frac{1}{2}B\left(\frac{1}{3}\right)^{n-1}u[n-1]=\left(\frac{1}{3}\right)^{n}u[n]$$ \begin{align*} \implies B&=\frac{\displaystyle\left(\frac{1}{3}\right)^{n}u[n]}{\displaystyle\left(\frac{1}{3}\right)^{n}u[n]-\frac{1}{2}\displaystyle\left(\frac{1}{3}\right)^{n-1}u[n-1]}\\ \\ &=\frac{\displaystyle\left(\frac{1}{3}\right)^{n}}{\displaystyle\left(\frac{1}{3}\right)^{n}-\displaystyle\frac{1}{2}\left(\frac{1}{3}\right)^{n-1}}\\ \\ &=-2 \end{align*}

So now that we have $$B=-2$$, We are given the initial rest condition so what I did was sub $$n=0$$ in difference equation $$y[0]-\frac{1}{2}y[-1]=x[0]$$ $$\implies y[0]=1$$ $$**\text{So this means A=y[0]=1}**$$ However, the major issue is that : $$y[0]-\frac{1}{2}y[-1]=x[0]$$ $$\implies y[0]=1$$ $$\implies y[n]:= y_{h}[n]+y_{p}[n] \implies y[0]=y_{h}[0]+y_{p}[0]=1$$ $$\implies A\left(\frac{1}{2}\right)^{0} -2\left(\frac{1}{3}\right)^{0}=1$$ $$\implies A=3$$ So I have $$A=1$$ and $$A=3$$, an obvious contradiction and I hope someone can help me

• You never say what your actual initial condition (I assume $y[0]$) is. Nor do you say if this is a typical problem where $y[-1]$ is undefined. Mar 5, 2021 at 0:56
• The idea is that applying rest condition gives $y[0]-0.5y[-1]=x[0]$ but $x[0]=(1/3)^{0}=0$ and $y[-1]$ is $0$ so $y[0]=1$. @TimWescott Mar 5, 2021 at 7:58
• I don't see why you can't assume that $y[n] = 0$ for all $n<0$. The solution will for $y[n]$ will involve $u[n]$ too.
– IanJ
Mar 6, 2021 at 19:32

From the comments under Tim Wescott's answer, it seems that there is still some confusion concerning the correct way to solve such problems. Let's consider the non-homogeneous difference equation (DE)

$$y[n]-p y[n-1]=q^n,\qquad p\neq q\tag{1}$$

with initial value $$y[-1]=c$$. Note that initially we don't restrict the forcing function on the right-hand side of $$(1)$$ to equal zero for $$n<0$$.

As correctly shown in the OP, the general solution to the homogeneous DE has the form

$$y_h[n]=Ap^n\tag{2}$$

which is also called the natural response, and a particular solution (forced response) of $$(1)$$ is given by

$$y_p[n]=Bq^n\tag{3}$$

The constant $$B$$ is determined by substituting $$(3)$$ into $$(1)$$:

$$Bq^n-pBq^{n-1}=q^n\tag{4}$$

from which we obtain $$B=\frac{q}{q-p}$$. Consequently, the general solution of the non-homogeneous DE $$(1)$$ is

$$y[n]=y_h[n]+y_p[n]=Ap^n+\frac{q}{q-p}q^n\tag{5}$$

Note that the solution $$(5)$$ is valid for all values of $$n$$.

The value of $$A$$ is determined by the initial condition $$y[-1]=c$$. Substituting $$n=-1$$ into $$(5)$$ and setting it equal to $$c$$ results in

$$A=cp-\frac{p}{q-p}\tag{6}$$

The solution to the initial value problem is hence given by

$$y[n]=cp^{n+1}+\frac{1}{q-p}\left[q^{n+1}-p^{n+1}\right]\tag{7}$$

We now only consider values $$n\ge 0$$, simply because that's the range we're interested in.

Note that the term $$cp^{n+1}$$ in $$(7)$$ is the zero-input response (ZIR), and the remaining term is the zero-state response (ZSR).

From an engineering point of view, composing the solution into a ZSR and a ZIR appears more natural and more useful than the classical decomposition into a homogeneous and a particular solution, because the decomposition of the solution into ZSR and ZIR separates the contributions arising from an external input and from internal conditions, respectively.

where I insist $$A=y[0]$$

There's your problem. $$y[n] = y_h[n] + y_p[n]$$, so $$y[0]$$ must equal $$y_h[0] + y_p[0] = A + B$$.

Can you take it from here?

• Wait, I was just noticing that in my finding of $B$, don't you think the entire problem is ill-posed because there are two different values for $B$ if $n=0$ and $n>0$. I am referring to my derivation of finding $B$ where I wrongly removed $u[n]$ and $u[n-1]$. Mar 4, 2021 at 22:21
• But here $A=A+B \implies B=0$ which is not the case according to OP? Mar 4, 2021 at 23:26
• The OP is saying $y[0]-\frac{1}{2}y[-1]=x[0]$. You can't do that -- $y[-1]$ is undefined. All you know about $y$ (if the problem is framed in the usual way) is that $y[0] = 1$ is true. Mar 5, 2021 at 1:51
• Well, and the given difference equation. The difference equation establishes $B$, $y[0] = 1$, and some arithmetic, establishes $A$. Mar 5, 2021 at 2:05