# shifting and reversing the signal

Say I have a signal $x[n]$.

What is $x[3-n]$?

My solution #1.

$x[-n]$, reverse first. Then, $x[-(n-3)]$, shift to the right by 3.

My solution #2.

$x[n-3]$, shift right by 3. Then $x[-(n-3)]$, reverse the entire shifted signal.

Both of my solution is incorrect. Why?

Independent variable transformations (such as exemplified in your question) play an important role in mathematical formulation of signal processing concepts and therefore should be understood well and practiced without difficulties before any real mastery of subsequent concepts. Fortunately they're easy to master! as long as a few tricks has been followed carefully. The most important rule is to break a composite transform into basic transform steps, one at a time.

Method-1: given $x[n]$ to find $x[3-n]$ proceed as follows:

1. Define $x_1[n] = x[-n]$ , (reversal of $x[n]$ about origin)

2. Define $x_2[n] = x_1[n-3] = x[-n]|_{n=n-3} = x[-(n-3)] = x[3-n]$ , (right shift of $x_1[n]$ by 3 samples)

Hence $x[3-n]$ can be obtained from $x[n]$ by first reversing $x[n]$ about origin and then shifting the reversed signal $x_1[n]$ to right by 3 samples.

NOTE-1: While decomposing a composite transform such as $n=3-n$ into its simple steps, you can define a new signal at each step such as $x_1[.]$ and $x_2[.]$, which results in a more cumbersome notation but eventually pays off so that you can clearly see the result of every simple transformation independently.

Method-2: The following set of steps could also be used to get the same result: Given $x[n]$ to find $x[3-n]$ proceed as follows:

1. Define $x_1[n] = x[n+3]$ , meaning a left sihft of $x[n]$ by 3 samples.

2. Define $x_2[n] = x_1[-n] \rightarrow x_2[n]= x[3-n]$ , meaning a reversal of $x_1[n]$ by about origin.

Hence $x[3-n]$ can be obtained from $x[n]$ by first shifting $x[n]$ left by 3 samples and then reversing the resulting signal $x_1[n]$ about the origin.

NOTE-2: Be careful to observe the following during step-2: $$x_1[n]|_{n=-n}=x_1[-n] = x[n+3] |_{n=-n} = x[(-n) + 3] = x[-n+3] = x[3-n]$$ and not $$x_1[-n] = x[-(n+3) ],$$ a commonly practiced mistake...

• Neat. Come become a wiki entry? – Laurent Duval Oct 11 '16 at 15:00
• @LaurentDuval wiki entry ? – Fat32 Oct 11 '16 at 20:24

all changes are performed on the variable $n$, thus for $x[3-n]$, we can treat from two approaches:

(1) $x[n]$ shifts to $x[n+3]$, and then reverts to $x[-n+3]$

(2) $x[n]$ firstly reverts to $x[-n]$, and then shifts to $x[-(n-3)] = x[-n+3]$