1

I have this system:

$$ y[n] = -\frac{1}{2} x[n+2] - y[n+1] $$

I have no idea how to prove if the system is linear or not, because, it depends on future outputs...

Thanks for the help

Matt L.
  • 89,963
  • 9
  • 79
  • 179
johnny
  • 11
  • 1

3 Answers3

4

Matt's original answer, regarding linearity, is correct.

Let $\mathbb{T}\{ . \}$ be the linear operator that maps input $x[n]$ to output $y[n]$.

$$ y[n] = \mathbb{T}\{ x[n] \} $$

the sole necessary definition for linearity is simply whether superposition applies for all possible inputs. for a discrete-time system, if, for two completely arbitrary inputs, $x_1[n]$ and $x_2[n]$, this

$$ y_1[n] + y_2[n] = \mathbb{T}\{ x_1[n] \} + \mathbb{T}\{ x_2[n] \} = \mathbb{T}\{ x_1[n] + x_2[n] \} \quad \forall n \in \mathbb{Z}$$

is true, then the system is Linear. that is the sole criterion.

the scaling property

$$ \begin{align} a \cdot y[n] &= a \cdot \mathbb{T}\{ x[n] \} \\ & = \mathbb{T}\{ a \cdot x[n] \} \quad \forall n \in \mathbb{Z}, a \in \mathbb{C} \\ \end{align} $$

can be derived directly from the superposition property, first for integer $a$, then for reciprocal integer $a$, then for real and rational $a$. a little more handwaving regarding continuity and limits is needed to extend this to any real $a$, and not much else is needed to extend to $a \in \mathbb{C} $.

Linearity is solely a property of the system. it is not a property of the input. so if it is true for one particular input, if the system is Linear, it's also true for any other input.

similarly, for Time-Invariance, if, for a discrete-time $y[n] = \mathbb{T}\{ x[n] \}$, then

$$ y[n-N] = \mathbb{T}\{ x[n-N] \} \quad \forall n,N \in \mathbb{Z} $$

if the discrete-time system satisfies that criterion, it's Time-Invariant. likewise, Time-Invariancy is a property solely of the system, not of the inputs to the system.

if a system satisfies both criteria for Linearity and Time-Invariancy, then it is "LTI" and we get to use all this cool Fourier and Z-transform technique on it.

the system as depicted by the OP is LTI, however, it is also anti-causal (which is also "acausal", but "acausal" is a less specific property than "anti-causal") .

robert bristow-johnson
  • 20,661
  • 4
  • 38
  • 76
  • I obviously agree with your statement that linearity is solely a property of the system. However, a non-zero initial condition is part of the system, and in this way it affects the system's properties. As I've mentioned above, the OP's system could be linear (and time-invariant) if it is initially at rest. If not, it will be neither. I've copied a relevant piece of text of Oppenheim and Schafer's DTSP into my answer to clear up this point. – Matt L. Oct 02 '14 at 17:27
  • since this is not the position you're taking @MattL., i won't edit your answer with it. this is the sole definition of the system from the OP: $$ y[n] = -\frac{1}{2} x[n+2] - y[n+1] $$ . now, tell us all, if $y_1[n]=\mathbb{T}{x_1[n]}$ is the output of that system as it is defined with any arbitrary input $x_1[n]$, and if $y_2[n]$ is the output of that system with any arbitrary input $x_2[n]$, does or does not this system satisfy this criterion (as depicted in your original answer): $$ a\ y_1[n] + b\ y_2[n] = \mathbb{T}{ a\ x_1[n] + b \ x_2[n] } $$?? that is the only issue. – robert bristow-johnson Oct 02 '14 at 17:45
  • I've removed the snippet from Oppenheim and Schafer from my answer (since you didn't like it) and added a proof that the system is linear only if it is initially at rest (zero initial condition) and non-linear otherwise. – Matt L. Oct 02 '14 at 20:05
  • listen, i really like O&S, and even though i've been accused (long ago on comp.dsp by Eric Jacobsen) of "quoting O&S scripture" as a substitute for proof (it was about whether or not the DFT inherently windows or inherently periodically extends its finite input data), i have, in the past, found where O&S definitions (or at least 1 definition) do not square with other lit and other disciplines. so, to begin with, if $h[n]$ are all constant with respect to everything else except $n$, would you say that this is LTI: $$ y[n] = \sum\limits_{i=-\infty}^{+\infty} h[i] x[n-i] $$ ?? – robert bristow-johnson Oct 02 '14 at 20:35
  • Of course a system described by convolution is LTI. Problem is that a system with non-zero initial conditions is not fully described by convolution. What do you think: is $y[n]=x[n]+c$ with an arbitrary constant $c$ LTI? And this is exactly what a non-zero initial condition does to a system. – Matt L. Oct 03 '14 at 06:53
  • then you contradict yourself, @MattL. the system the OP presents has a well-defined anti-causal impulse response. whether you call it "$c$" or call it "$y[0]$", it is directly proportional (i.e. "linear") to some sum of $x[n]$. scale $x[n]$ by some constant $A$ and $y[0]$ must scale by the same constant. just to keep things more conventional, let's say it's a causal system ($h[n]=0 \ \forall n<0$): you are not allowed to say "Hey, we're gonna scale $x[n]$ for $n\ge0$ by $A$, but we're not gonna scale $x[n]$ for $n<0$ by that same $A$." that's not how the Linearity property works. – robert bristow-johnson Oct 03 '14 at 13:39
  • Regarding the claim that "Linearity is solely a property of the system. it is not a property of the input. so if it is true for one particular input, if the system is Linear, it's also true for any other input." I'm not sure I'm interpreting this claim correctly, but I don't think it is true. Consider the system $x[n]=|y[n]|$. Then, for an input $x[n]=x_1[n]+x_2[n]$, if $x_1[n]$ and $x_2[n]$ are always positive, the system will behave as if it were linear, but it's not. – MBaz Oct 08 '14 at 21:31
  • but you don't get to pick $x_1[n]$ and $x_2[n]$. the Devil gets to choose the input. so if $$ \mathbf{T}{x_1[n] + x_2[n] } = \mathbf{T}{x_1[n] } + \mathbf{T}{x_2[n] } $$ for any $x_1[n]$ and $x_2[n]$ the Devil can toss at you, then the system is linear. – robert bristow-johnson Oct 08 '14 at 22:53
  • @robertbristow-johnson Robert, can you point me to a proof that additivity implies linearity? I have a counterexample for complex scalars: the system $T\lbrace x(t)\rbrace=x^*(t)$ (found here) is additive but it's nonlinear: $T\lbrace t\rbrace=t$ for real $t$, but $T\lbrace jt\rbrace=-jt$. – MBaz Dec 08 '14 at 01:04
  • @MBaz, you can prove that superposition (what you're calling "additivity") will get you to homogeniety (or "scaling") for any scaler that is rational. there has to be a little bit of handwaving regarding continuity of the LTI system to get from a rational scaler to an irrational scaler that is arbitrarily close by. first do it for the scaler = 2. then show that it also works for 3. then you induction to show it works for any integer scaler $N$. then you can show it works for a scaler $\frac{1}{M}$ for any integer $M$. then it's easy to show it for $\frac{N}{M}$. – robert bristow-johnson Dec 08 '14 at 02:59
  • @robertbristow-johnson, Thanks, I'll try. Would you agree, though, that this process can't be extended to complex scalars? – MBaz Dec 08 '14 at 03:06
  • @MBaz no, i don't know why you would conclude that. when you deal with complex numbers, you treat $j$ just like any other scaler, but continue to retain the property that $j^2 = -1$, whenever you see that. otherwise you deal with $j$ no differently than you would any real number. – robert bristow-johnson Dec 08 '14 at 19:20
  • but now i am starting to get your counterexample. i seem to remember some discussion about that. lemme think about it. – robert bristow-johnson Dec 08 '14 at 19:22
3

For linearity it is irrelevant if the output depends on future values. This only affects the system's causality. For linearity you just need to check whether the response to the signal

$$ax_1[n] + bx_2[n]$$

equals

$$ay_1[n] + by_2[n]$$

where $y_1[n]$ and $y_2[n]$ are the individual responses to inputs $x_1[n]$ and $x_2[n]$, respectively.

And of course you can write the input/output relation as

$$y[n+1] = -\frac12 x[n+2] - y[n]\tag{1}$$

I will now characterize all sequences that satisfy the recursion (1) for the specific input signal $x[n]=\delta[n]$. Applying the $\mathcal{Z}$-transform to (1) we get (with $X(z)=1$)

$$Y(z)=-\frac12\frac{z^2}{1+z}\tag{2}$$

The function $Y(z)$ corresponds to one left-sided sequence and to one right-sided sequence. Note that left-sided and right-sided doesn't necessarily mean anti-causal and causal, but it only means that $y(n)=0$ for $n>N$ or for $n<N$, respectively, for some positive or negative integer $N$. These two sequences are given by

$$y_{p1}[n]=\frac12 (-1)^{n}u(n+1)\tag{3}$$ and $$y_{p2}[n]=-\frac12 (-1)^n u(-n-2)\tag{4}$$

Note that neither (3) nor (4) is causal. The sequences $y_{p1}[n]$ and $y_{p2}[n]$ are particular solutions of the difference equation (1) for $x[n]=\delta[n]$. They are in fact impulse responses of two different linear time-invariant (LTI) systems described by the difference equation (1). The impulse response $y_{p1}[n]$ was mentioned by Dilip Sarwate in a comment below, and something similar to $y_{p2}[n]$ was mentioned by Robert B.-J. I completely agree with them that the difference equation (1) describes an LTI system, if it is used to describe a system with either (3) or (4) as impulse response.

However, the sequences (3) and (4) are not the only sequences that satisfy (1). Looking at the homogeneous difference equation

$$y[n+1]=-y[n]\tag{5}$$

we see that

$$y_h[n]=c(-1)^n,\quad c\in\mathbf{R}\tag{6}$$

is a solution of (5). Consequently, the general solution of (1) (with $x[n]=\delta[n]$) can be written as

$$y[n]=y_{p1}[n]+y_h[n]=\frac12 (-1)^{n}u(n+1) + c(-1)^n\tag{7}$$

Of course we could as well have used $y_{p2}[n]$ to define the general solution. Note that $y_{p2}[n]$ is obtained from (7) by choosing $c=-1/2$.

Now assume that we scale the input signal and use $x[n]=2\delta[n]$ instead. Obviously, the solutions $y_{p1}[n]$ and $y_{p2}[n]$ will change accordingly, but the general solution (7) will not (unless $c=0$ or $c=-1/2$), because the homogeneous solution (6) does not depend on $x[n]$. This is why I claim that the difference equation (1) does not necessarily describe an LTI system. In our case, it describes exactly two LTI systems and an infinite number of systems which are neither linear nor time-invariant.

Matt L.
  • 89,963
  • 9
  • 79
  • 179
  • Thanks for your answer,

    So in this case, I have:

    ay1(n) = a(-0.5x1(n+2) - y(n+1)) by2(n) = b(-0.5x2(n+2) - y(n+1))

    And the response to ax1(n)+bx2(n) is:

    -0.5(ax1(n+2)+bx2(n+2)) - y(n+1)

    But this is not equal to y1(n)+y2(n) so I guess my system is not linear right ?

    Thanks again !

    – johnny Oct 01 '14 at 15:37
  • @johnny No, it is linear. Your equations are incorrect. – Jim Clay Oct 01 '14 at 17:02
  • @johnny: I've added more information to my answer. – Matt L. Oct 02 '14 at 08:01
  • @JimClay: I know what you mean by saying 'it is linear', but to be precise we have to say that we don't know, unless the initial condition is given. If $y(0)\neq 0$, the system is neither linear nor time-invariant. – Matt L. Oct 02 '14 at 08:03
  • @MattL. Good point. – Jim Clay Oct 02 '14 at 13:37
  • @JimClay, actually, i think the point of Matt's is not correct. the state of the system at $n=0$, which is $y[0]$ is due to the history of the system before $n=0$ (or maybe, in this crazy case, it's the "history" after $n=0$, since this filter is sorta going in "reverse time". nonetheless, whether it's at $n=-\infty$ (the normal causal case that is physical realizable), or $n=+\infty$ (this anti-causal example), the assumption is made that the system is "completely relaxed" at the infinities (but in normal causal cases, we only worry about $-\infty$). as it is, this system is LTI. – robert bristow-johnson Oct 02 '14 at 16:05
  • @robertbristow-johnson: I'm not sure what you mean by "not correct". A system with non-zero initial conditions is definitely not linear and not time-invariant. That's straightforward to show. Or did you mean something else? – Matt L. Oct 02 '14 at 16:08
  • @robertbristow-johnson: I'm sorry but you're wrong about this. Simple example: an LTI system's output must be zero for zero input. Now assume that there's a non-zero initial condition, then there will be an output signal, even with zero input signal. – Matt L. Oct 02 '14 at 16:23
  • initial conditions have nothing to do with whether a system is LTI or not. initial states are actually a function of the input, for causal systems the input before $t=0$, and for anti-causal systems the input after $t=0$, but those anti-causal systems are running in reverse time sorta like the "anomaly" depicted in the last episode of Star Trek Next Generation. but it's only in the nature of the input/output equation that either Linearity or Time-Invariancy is determined. – robert bristow-johnson Oct 02 '14 at 16:27
  • Matt, you're wrong about the semantics and the ontology. this is an LTI and anti-causal system. these are properties of the system not of its inputs nor of the history of the inputs. – robert bristow-johnson Oct 02 '14 at 16:28
  • and the "assumption" made (if that's what you want to call it) is that at infinity (which infinity depends on the causality of the system), the system is "completely relaxed" which means all states within the system have values of zero. the initial states (normally at $t=0$) are a function of that input. – robert bristow-johnson Oct 02 '14 at 16:31
  • @robertbristow-johnson: You're confusing 'initial condition' with the state of the system given past values of the input signal. You can have an input signal starting at $n=0$ AND a non-zero initial condition $y[-1]=c$. This causes the system to be neither linear nor time-variant, even if it is described by a linear difference equation with constant coefficients. Please see my updated answer above. – Matt L. Oct 02 '14 at 17:05
  • i'm not confusing it at all, Matt. the mistake is yours in not equating "initial condition" of an LTI system (assuming a causal system) with the history of the input. the reference to O&S take me back a bit (since i have so much respect for it), but they get even the definition of "Nyquist frequency" wrong (w.r.t. the rest of the lit) so i am not totally surprized. from the POV of metric spaces (you know, including Normed Linear Spaces and Hilbert Spaces and Functional Analysis), and a few other Control Systems books, O&S are wrong about the definition in the example they depict. – robert bristow-johnson Oct 02 '14 at 17:32
  • okay, the $h[n]$ i get is $$ h[n] = \frac12 (-1)^n u[-n-1] $$ where $u[n]$ is discrete-time unit step function $$ u[n] \triangleq \begin{cases} 1, & \text{if }n \ge 0 \ 0, & \text{if }n < 0 \end{cases} n \in \mathbb{Z} $$ is that what you get, Matt? (note it's not causal, it's anti-causal). the big question is: which is it, Matt. is it $$y_1[0] = c$$ or is it $$y_2[0] = c$$? if you say "both", then does that satisfy the criterion for testing for Linearity? what happens to this condition if you add $y_1[n]$ to $y_2[n]$? or scale either of them? you will have a problem fixing $y_1[0]=c$. – robert bristow-johnson Oct 02 '14 at 21:15
  • so the fatal flaw is that this statement: $$y[n] = \frac12 (-1)^n \sum_{k=2}^{n+1} (-1)^k x[k] + (-1)^n y[0]$$ and this statement $$y[n] = \frac12 (-1)^n \sum_{k=2}^{n+1} (-1)^k x[k] + (-1)^n c$$ are not the same thing. the latter depicts a system that is not linear, yet the former is and must be linear. that's the flaw in your proof, Matt. BTW, i am still not verifying your "unrolled" difference equation. it should come out to be the standard convolution summation where $h[n]$ is anti-causal and $y[0]$ is half of the summation. in this case the "history" of $y[0]$ is $y[n]$ for $n>0$. – robert bristow-johnson Oct 03 '14 at 01:45
  • @robertbristow-johnson: This is my last comment, but again, you're wrong, because you don't seem to appreciate that the initial condition $y[0]=c$ is part of the system (it was stored in its memory before it has seen any input signal) and that's why it's independent of the input signal, and it's also independent of the current output signal, so there is no such thing as $y_1[0]$ or $y_2[0]$ (unless you agree that they are the same), it's just $y[0]=c$ for all 3 input signals (and output signals) that I use in the test. If you don't agree it's fine with me, I give up. – Matt L. Oct 03 '14 at 07:23
  • @MattL., what you appear to understand is that $$y[n] = \sum\limits_{i=-\infty}^{+\infty} h[i] x[n-i]$$ is linear (and also time-invariant), but you don't seem to understand that for causal systems $$y[0] = \sum\limits_{i=0}^{+\infty} h[i] x[-i]$$ and for anti-causal systems $$y[0] = \sum\limits_{i=-\infty}^{0} h[i] x[-i]$$. say you want to test for the scaling property, you cannot just say "hey, we're gonna double $x[n]$, to see if $y[n]$ also doubles, yet we're gonna leave '$c$' the same value." not if $c=y[0]$. if you double $x[n]$, you also have to double $y[0]$. – robert bristow-johnson Oct 03 '14 at 13:27
  • i find it amazing and somewhat appalling that 4 people upvoted this answer even though it is proven to be wrong. – robert bristow-johnson Oct 03 '14 at 13:47
  • careful @DilipSarwate, MattL has O&S supporting him (which i also find a bit appalling, but O&S have some other definitions wrong, most notably their definition of "Nyquist frequency"). you can see this in the edit history. but it's still a wrong and the folks at comp.dsp for the most part agree. – robert bristow-johnson Oct 04 '14 at 19:44
  • @DilipSarwate: This impulse response is the same I've written down in my answer (unless there's a typo which I haven't noticed yet). Why would O&S (or I for that matter) say otherwise??? But the point is that this impulse response of course only defines the system's behavior for zero initial conditions. Also note that, as you know, a difference equation does not uniquely describe a system. If you have one pole you have two different possible ROCs (corresponding to two different impulse responses), and infinitely many possible contributions to the output signal caused by initial conditions. – Matt L. Oct 05 '14 at 11:11
  • @DilipSarwate: One point where Robert and I seem to disagree is that initial conditions do have an influence on the linearity (and time-invariance) of a system. Just out of curiosity, do you agree that a simple system described by $y[n]=ay[n-1]+bx[n]$ is NOT LTI if its initial condition $y[0]\neq 0$ or don't you? – Matt L. Oct 05 '14 at 11:30
  • "One point where Robert and I seem to disagree is that initial conditions do have an influence on the linearity (and time-invariance) of a system." yes, that is precisely correct. i am saying that, for a causal system (instead of an imaginary acausal system), that the initial conditions depend on the history of the input, $x[n]$ for $n\le0$, while what defines the system itself are the $h[n]$. that difference equation has an $h[n]$ that fully describes it. if that is the case, then it's linear according to how you first defined what it means to be linear: the $ax_1[n]+bx_2[n]$ thing. – robert bristow-johnson Oct 05 '14 at 18:02
  • @DilipSarwate, Matt, in an earlier edit, put in a photo of the example problem in O&S (that i confess, i did not try to find in my 1989 edition). i don't think he misinterpreted O&S (like i did think that Dale Dalrymple did about DFS and DFT). i just think that O&S agree with Matt on definitions, but they have to be ignoring $x[n]$ for $n\le0$ and say that the system is non-existent for negative time or something like that. – robert bristow-johnson Oct 05 '14 at 18:12
  • @DilipSarwate: I've updated my answer one more time because I'm not happy with our disagreement which I believe is at least partly based on misunderstandings. I've replaced some old parts by a new explanation, not because I think that what I had written was wrong, but because I've tried to write a clearer exposition of what I mean. Please have a look and let me know at what point our opinions diverge. – Matt L. Oct 08 '14 at 07:41
  • @robertbristow-johnson: I rolled back your edits, because they introduced some other layout problems that I was too lazy to correct. In principal I agree with $h[n]$ for impulse responses, but in this case I've tried to emphasize the fact that they are particular solutions to the LDE, so here my notation is closer to common LDE notation than to standard DSP notation. – Matt L. Oct 08 '14 at 12:04
  • i was curious about layout problems, and in the edit history. i see it. somehow, at multiple places, SE seemed to remove some "$" signs. it wasn't what i typed. oh well. – robert bristow-johnson Oct 08 '14 at 12:12
  • @MattL., just wanted to send you a note that i have spun this question off into a new simplified question that goes after the main issue where we disagree. – robert bristow-johnson Oct 08 '14 at 18:47
0

so, using Matt's original criterion for the property of "Linearity": if $y_1[n]$ is the output when $x_1[n]$ is the input and $y_2[n]$ is the output when $x_2[n]$ is input, is

$$a \ y_1[n] + b \ y_2[n]$$

the output of the same system when

$$a \ x_1[n] + b \ x_2[n]$$

is the input?

since the system is fully and solely described as

$$ y[n] = -\frac12 x[n+2] - y[n+1] $$

, this depends on whether equality is maintained with the above substitution. is

$$ a \ y_1[n] + b \ y_2[n] \ = \ -\frac12 \left(a \ x_1[n+2] + b \ x_2[n+2] \right) - \left(a \ y_1[n+1] + b \ y_2[n+1] \right) $$

true or not? if it's true, the system is linear according to the criterion Matt L first held out. if not, it's not linear.

robert bristow-johnson
  • 20,661
  • 4
  • 38
  • 76
  • I've updated my answer one more time because I'm not happy with our disagreement which I believe is at least partly based on misunderstandings. I've replaced some old parts by a new explanation, not because I think that what I had written was wrong, but because I've tried to write a clearer exposition of what I mean. Please have a look and let me know at what point our opinions diverge. – Matt L. Oct 08 '14 at 07:42
  • okay, @MattL., i am reviewing it. changing $$y[n] = -\frac12 x[n+2] - y[n+1]$$ to $$y[n+1] = -\frac12 x[n+2] - y[n]$$ does seem to change the operation of the system from one that is left-sided to one that is right-sided. this zero-input, non-zero output case $$y[n] = -y[n+1]$$ clearly, in-and-of-itself depicts something that cannot be linear. it was something i was considering at comp.dsp a couple days ago.. for me, i have trouble with this because it seems to make marginal stability the LTI issue. – robert bristow-johnson Oct 08 '14 at 12:03
  • so @MattL., is stability a property that is orthogonal to LTI or does the property of stability affect whether or not a system is LTI? – robert bristow-johnson Oct 08 '14 at 12:17