# Initial values are lost (diff eq to Transfer function)?

I read eternal Julius O. Smith III and he says that

$$x_{n-m} = z^{-m}X(z)$$

Particularly, difference relation

$$y_{n} = y_{n-1} + x_{n}$$

is solved by by

$$Y = z^{-1}Y + X = {X \over (1-z^{-1})}$$

Applied impulse function $x[n] = [1,0,0,0,0,0]$ so that $X = 1 + 0 z^{-1} + 0 z ^{-2} + \ldots = 1$, we can get the impulse response $Y = 1/(1-z^{-1}) = 1 + z^{-1} + z^{-2} + \ldots.$ This seems right. However, my generating functions and Laplace method (see how y'' is translated into $s^2Y$-sy(0) - y'(0)) suggest that we

$$y_1 + y_2 z^{-1} + y_3 z^{-2} + \ldots = z (y_1 z^{-1} + y_2 z^{-2} + \dots) = z^{-1} (y_0 + y_1 z^{-1} + y_2 z^{-2} + \dots - y_0) = z (Y - y_0)$$

and recurrence is translated into

$$z( Y - y_0) = Y + z(X -x_0)$$

whereupon

$$Y = z^{-1}Y + X -x_0 + y_0 = {X + y_0 - x_0 \over 1-z^{-1}}$$

I do not know what to do with $x_0$. It seems be able to conflict with definition of X or duplicate it. I mean that X already contains $x_0$. What does it mean? Anyway, is Julius Smith III right that we can solve the difference equations this way? Why should we ignore $y_0$?

• You question starts with difference equations and ends with differential equations? How did you come up with the equation after "suggest that we"? – copper.hat Jul 28 '14 at 20:05
• @copper.hat What is the difference? I read that Z-transform is a counterpart of Laplace transform. Do you mean that unlike Laplace transform, z does not have any initial values? Do you give a hint to answer that way? What is the point of your comment? – Val Jul 28 '14 at 20:16
• There is a similarity between the z-transform and the Laplace transform. But I have no idea how you leaped to the $y_1+y_2 z^{-1}+...$ formula above. – copper.hat Jul 28 '14 at 20:22
• @copper.hat You may read a book or point me to the error that I made (if that is your point). I do not prohibit users to follow the links that I have posted. – Val Jul 28 '14 at 20:28
• Val. I am fairly familiar with both z- and Laplace-transforms. You start by asking a question about a difference equation/z-transform of shifted sequence (which you have transcribed incorrectly) and then leap to another difference equation which you have pulled from nowhere. I am aware that I may read a book thanks. And I did point out the source of confusion. Your ball. – copper.hat Jul 28 '14 at 20:46

## 1 Answer

If I understand correctly you are asking two questions. The first is about an apparent issue because you are not using the fact that $y_0 = y_{-1} + x_0$. The second is if you can solve difference equations using the z-transform.

A few comments first:

My discussion ignores issues of convergence and existence of the z-transform. I assume that the relevant transforms are defined on $|z|>R$ for some $R$.

Given a sequence $x: \mathbb{Z} \to \mathbb{R}$, the unilateral z-transform of $x$ is given by $\hat{x}(z) = \sum_{n=0}^\infty x_n z^{-1}$. A sequence is called causal iff $x_n = 0$ for all $n <0$.

Define the right-shift $(Rx)_n = x_{n-1}$. Note that $(Rx)_0 = x_{-1}$. Then we have $\widehat{Rx} (z) = x_{-1}+ z^{-1} \hat{x}(z)$. If $x$ is causal (in fact, if $x_{-1} = 0$), then $(Rx)_0 = 0$ and $\widehat{Rx} (z) = z^{-1} \hat{x}(z)$.

If $x$ is causal, then it should be clear that $\widehat{R^kx} (z) = z^{-k} \hat{x}(z)$, where $R^k$ is $R\circ \cdots \circ R$ (that is, $k$ times).

Define the left-shift $(Lx)_n = x_{n+1}$. Note that if $x$ is causal , then $Lx$ is not necessarily causal because we have $(Lx)_{-1} = x_0$. In this case, we have $\widehat{Lx} (z) = z (\hat{x}(z)-x_0)$.

The point is that with causal sequences and the unilateral z-transform, a right shift corresponds to multiplication by $z^{-1}$, but a left shift needs to be modified slightly before multiplying by $z$.

Now for the first issue:

In the question above, the equation is $y_n = y_{n-1}+x_n$. Note that this can be written as $y_n = (Ry)_n + x_n$ or more succinctly as $y = Ry+x$. Furthermore, setting $n=0$ gives $y_0 = y_{-1} + x_0$.

Taking the transform gives $\hat{y}(z) = y_{-1} + z^{-1} \hat{y}(z) + \hat{x}(z)$. This gives $\hat{y}(z) = {y_{-1}+\hat{x}(z) \over 1- z^{-1}}$. If $y$ is causal, then $y_{-1} = 0$ and the formula simplifies to the formula above, that is, $\hat{y}(z) = {\hat{x}(z) \over 1- z^{-1}}$. So far, so good.

If I understand what it is that you did above (after the phrase "suggest that we"), you consider the equivalent equation $y_{n+1} = y_n + x_{n+1}$, which can be written as $Ly = y+Lx$. Taking transforms gives $z ( \hat{y}(z)-y_0) = \hat{y}(z) + z ( \hat{x}(z)-x_0)$, dividing across by $z$ gives $\hat{y}(z)-y_0 = z^{-1} \hat{y}(z) + \hat{x}(z)-x_0$, which simplifies to $\hat{y}(z) = {y_{0}-x_0+\hat{x}(z) \over 1- z^{-1}}$.

Since $y_0 = y_{-1} + x_0$, the two equations are equal.

Now the second question:

If two different sequences $x,y$ satisfy $x_n = y_n$ for all $n \ge 0$ then we have $\hat{x} = \hat{y}$, that is, the unilateral z-transform only 'cares' about the values of $x$ when $n \ge 0$. Hence if we use this transform to solve difference equations, at best it will tell us about solution behaviour for $n \ge 0$.

If $x,y$ are causal and $\hat{x} = \hat{y}$, then we have $x=y$. This is what allows us to find a solution to a difference equation.

Suppose you have a difference equation of the form (taken from the notes you referred to) $y_n = \sum_{k=0}^M b_k x_{n-k} - \sum_{k=0}^N a_k y_{n-k}$, and both $x,y$ are causal. Then this can be written as $y =\sum_{k=0}^M b_k R^k x - \sum_{k=0}^N a_k R^k y$, and taking transforms yields $\hat{y}(z) = \sum_{k=0}^M b_k z^{-k} \hat{x}(z) - \sum_{k=0}^N a_k z^{-k} \hat{y}(z)$, or equivalently, $\hat{y}(z) = \hat{h}(z) \hat{x}(z)$, where $\hat{h}(z) = { \sum_{k=0}^M b_k z^{-k} \over 1+\sum_{k=0}^N a_k z^{-k}}$.

Hence if one is given a suitable causal $x$, then to solve the equation one computes $\hat{x}$, multiplies it (pointwise) by $\hat{h}$ to get $\hat{y}$ and then computes the sequence that $y$ that corresponds to $\hat{y}$. Then this will be the unique causal solution to the difference equation.

• Where did I declare something to be obvious??? – copper.hat Jul 29 '14 at 14:03
• It seems that shifting both left and right we can have equations with all initial values = 0! That is brilliant! Also, when I Z-transform $R[x_0, x_1, \ldots] = [0, x_0, x_1, \ldots]$, I'll get $0 + x_0 z^{-1}+ x_1 z^{-2} + \ldots = z^{-1} \sum_0^\infty{x_n z^{-n}} = z^{-1} X(z)$ -- no initial value whereas $L[x_0, x_1, \ldots] = [x_0 | x_1, x_2, \ldots]$ is encoded by $x_1 + x_2 z^{-1} + x_3z^{-2} + \ldots = z(x_0 + x_1z^{-1}+x_2z^{-2} + \ldots - x_0) = z(X(z) - x_0)$. You see how naturally Z-transform itself points us when initial values are necessary and when they must be abridged. – Val Jul 30 '14 at 10:46
• I meant to say shift left and right sides of the equation. Now, I see that even non-casual systems, i.e. when $y_n = b_{n+1}$, that is when y depends on data from the future, and, thus $b_0$ is important, $Y(z)=z(B(z)-b_0)$. Yet, if we right-shift both sides of equation, $y_{n-1} = b_n$, aka multiply Z-transfrom by $z^{-1}$, we'll get rid of $b_0$: $z^{-1}Y(z) = B(z)$. Does that mean that $b_0$ = 0? That is interesting. – Val Jul 30 '14 at 12:34
• Wait, this means that $y_{n+1} = y_n$ is a series of all zeroes. It is because $y_0 = y_{n-1} = 0$ then $y_1 = y_0 = 0$ and so on. All $y_n$ are zero in this case. This eliminates the possibility to have anything else in the sequence. Particularly, fibonacci sequence y_1 and y_0 must be zeroes because they must conform $y_n = y_{n-1} + y_{n-2}.$ I see that I can introduce non-zeroes by adding something to $y_n$, e.g. $y_n = y_{n-1} + b_n.$ How do you do that for Fibbonacci or it is non-casual? – Val Jul 31 '14 at 10:42
• I have asked latter in another question. I have also discovered that there is a way to make the Fibbonacci casual, math.stackexchange.com/questions/279868 -- we need to add a delta-pulse: $y_n = y_{n-1} + y_{n-2} +\delta$ – Val Jul 31 '14 at 11:35