# Combined signal folding and shifting

Let $g[n] = f[-n]$(n is the time index). Then what will be expression for $g[n+k]$.

Is $g[n+k] = f[-n + k]$ or $g[n+k] = f[-n - k]$. Which one is true and Why?

• This isn't really a signal-processing question at all; instead, this is a simple algebraic substitution problem. – Jason R Sep 30 '13 at 13:09
• @JasonR Yes, it is a simple algebraic substitution problem, but far too many people get it wrong because of poor notation which leads to wrong understanding of the material. See, for example, this question – Dilip Sarwate Sep 30 '13 at 16:48

The statement $g[n]=f[-n]$ is meaningless unless you assign some numerical value to $n$, e.g. $g=f[-3]$, and if you do say that $n=3$, then the equality $g = f[-3]$ tells you nothing about the relationship between $g[n+k]=g[3+k]$ to the value taken on $f[\cdot]$ for any choice of argument.

What you really meant to say is that

$$\text{For all integers } n, g[n]=f[-n]$$

which asserts that the equality holds for all choices of $n$, and in this case, it follows by definition that $g[n+k] = f[-n-k]$; you just need to negate the argument $n+k$ of $g$ (to get $-n-k$) and use it (it meaning $-n-k$) as the argument of $f$ exactly as the definition says you should. The complicated arguments in another answer that claim that $g[n+k]=f[-n+k]$ are wrong, as discussed in the comments following that answer.

I'll try to explain this with example. Let the signals be discrete & k=2. The bold numbers indicate sample at time 0(I am not well versed with editing here)

Let f[n] = {1,1,1,1}
Thus f[-n] = {1,1,1,1} = g[n]
Now g[n+2] = {1,1,1,1,0,0}

Now how can you obtain the same answer from f[n]
f[n-2] = {0,0,1,1,1,1}
And if we invert this signal ie f[-(n-2)], we get {1,1,1,1,0,0} which is g[n+2].
Thus g[n+2] = f[-(n-2)] = f[-n+2]
Hence proved.
The theoretical answer are the rules followed in Shift & Scale
y[n] = x[an+b]
If you shift first & then scale, then
1) y[n] = x[n+k]
2) Then scale y[n] by a

If you scale first & then shift, then
1) y[n] = x[a(n+(b/a))] ie scale x[n] by a first
2) Shift y[n] by (b/a)

• No, this is wrong. The definition $g[n] = f[-n]$ means that to find the value of $g$ at any time index, take the negative of whatever appears in the square brackets following $g$, and use that in the square brackets following $f$. Thus, $g[n+2] = f[-n-2]$, not $g[n+2]=f[-n+2]$ as KharoBangdo claims. Note that $g[n+2]=f[-n+2]$ implies, upon setting $n=0$ that $g=f$ which is patently false; by definition, $g = f[-2]$. – Dilip Sarwate Sep 30 '13 at 13:00
• @DilipSarwate So what did i do wrong in my example? – KharoBangdo Sep 30 '13 at 14:28
• Denote the signal $\{1,1,1,1,0,\mathbf 0\}$ as $h[\cdot]$, that is, $h[-2]=1, h[-1]=0, h = 0$, etc. Thus, for all integers $n$, $h[n] = g[n+2]$. Denote the signal $\{\mathbf 0, 0, 1,1,1,1\}$ as $e[\cdot]$ so that $e = 1$, $e=0$, $e=1$, etc., that is, for all integers $m$, whether positive or negative, $e[m] = f[m-2]$. In particular, we can substitute any number, even a negative number such as $(-n)$, as the argument $m$ for $e[\cdot]$ and find $e[(-n)] = f[(-n)-2] = f[-n-2]$. Then, we have that for all choices of $n$, $$g[n+2] = h[n] = e[-n] = f[-n-2].$$ – Dilip Sarwate Sep 30 '13 at 20:53
• That should have been $e = 0$, not $e=1$. – Dilip Sarwate Sep 30 '13 at 21:04