# Is this piecewise-defined system time-invariant?

$$$$G_c \qquad y[n] = \begin{cases} u[n] & \text{if} & n<0\\ 2u[n] & \text{if} & n\ge 0 \end{cases}$$$$

I found this question in web: Whether or not is this time-invariant. The short answer is no. But I want to make sure I know how to prove this.

Let's take a certain $$n<0$$ then $$y[n] = 2u[n]$$. Now, let's put instead of $$n \rightarrow (n + n_0)>0$$. Since, it is time-invariant then $$y[n+n_0] = u[n+n_0]$$.
But $$(n+n_0)>0$$, so $$y[n+n_0] = 2u[n+n_0]$$. So the only chance is: $$u[n+n_0] = 0$$, but since $$n$$ and $$n_0$$ where randomly chosen then, this system can be time-varying as long as always $$u[n+n_0]=0 \rightarrow u[n] =0$$ and $$y[n] =0$$ which doesn't hold as a system. So it is not time-varying. Does this makes sense?

• It looks like y[n] is a signal, not a system. Time invariance is a property of systems and makes no sense for signals. Dec 20 '20 at 20:08
• Usually $u[n]$ is notation for the unit step function, is this what you meant? Just by the definition, I suspect not and you should edit you question to clarify what is $u[n]$ and what is $y[n]$. Is $u[n]$ the input signal and $y[n]$ the output signal? Dec 20 '20 at 20:46
• @Engineer Some texts use $u_n$ as a signal. But yes -- it can be confusing, and should be clarified. Dec 21 '20 at 3:54

Let us suppose that the system with input $$x$$ is defined by:

$$$$y[n] = \begin{cases} x[n] & \text{if} & n<0\\ 2x[n] & \text{if} & n\ge 0 \end{cases}$$$$

As answered by @TimWescott, the two-part definition suggests a lack of time invariance. Finding a counter-example could be a good start. For instance a two-part signal whose behavior when multiplied by 2 is visible. Indeed a modification of the Heavide jump is interesting:

$$$$x_0[n] = \begin{cases} -1& \text{if} & n<0\\ \phantom{-}1 & \text{if} & n\ge 0 \end{cases}$$$$ along with the right-shifted version: $$$$x_1[n] = \begin{cases} -1 & \text{if} & n<1\\ \phantom{-}1 & \text{if} & n\ge 1\,. \end{cases}$$$$

You get:

$$$$y_0[n] = \begin{cases} -1& \text{if} & n<0\\ \phantom{-}2 & \text{if} & n\ge 0 \end{cases}$$$$ along with the output for the right-shifted version: $$$$y_1[n] = \begin{cases} -1 & \text{if} & n<0\\ -2 & \text{if} & n=0\\ \phantom{-}2 & \text{if} & n\ge 1\,. \end{cases}$$$$ which are not time-shifted versions of each other.

Your proof errs in two places. The first is probably just a typo, where you say "$$n<0$$ then $$y[n] = 2u[n]$$". If $$n < 0$$, then $$y[n] = 0$$, not the other way around.

The second error is the deeper one:

but since $$n$$ and $$n_0$$ where randomly chosen then, this system can be time-varying as long as always $$u[n+n_0]=0 \rightarrow u[n] =0$$ and $$y[n] =0$$ which doesn't hold as a system. So it is not time-varying.

The system is time invariant if for *absolutely any choice of $$n$$ and $$n_0$$, the results are the same, only time shifted. So you can't put constraints on $$n$$ and $$n_0$$ -- the system has to behave the same way no matter what time it is.

All I have to do to show time invariance is to choose $$n$$ and $$n_0$$ such that either $$n \ge 0$$ and $$n + n_0 < 0$$, or $$n < 0$$ and $$n + n_0 \ge 0$$. That's it -- the system clearly and obviously behaves differently in those two cases.

Basically, at $$n = 0$$, the behavior of the system changes markedly -- it's time-varying.