---
title: Shifting, reversing and scaling time
heading: What x(at + b) does to a signal
eyebrow: C9 · Lesson 2 · Shifting, reversing and scaling time
xp: 40
---

::: hook
An echo is the same sound arriving later, x(t − d). A tape played at double speed is x(2t), shorter and higher. Played backward it's x(−t). These three operations on the time variable come up constantly, most of all in convolution, where one signal is flipped and slid past another. They're easy to state and easy to get backward: x(2t − 4) is not x(2t) moved 4 to the right. Getting the order right once, carefully, saves a great deal of confusion later.
:::

::: play
- The faint curve is x(t): a ramp from 0 to 1 over the first second, then flat for a second. The bright curve is $y(t) = x(at + b)$.
- Set a = 1 and change b: positive b moves the signal left, earlier. Set b = 0 and change a: a = 2 squeezes it into half the time, and a negative a flips it.
- Now set a = 2 and b = −4. The signal starts at t = 2, not t = 4: the readout shows where x's start lands.
:::
:::

```sim plot
view: graph
x: t = -4..6
y: x = -0.3..1.4
slider: a = -3..3 = 1 step 0.25
slider: b = -6..6 = 0 step 0.5
plot: t*(step(t) - step(t - 1)) + (step(t - 1) - step(t - 2)) | dashed | label: x(t)
plot: (a*t + b)*(step(a*t + b) - step(a*t + b - 1)) + (step(a*t + b - 1) - step(a*t + b - 2)) | samples: 1500 | label: x(at + b)
readout: x(0) appears at t = -b/a | digits: 3
readout: duration, s = 2/abs(a) | digits: 3
```

::: predict
## x(t) has a sharp corner at t = 0. Where is that corner in $y(t) = x(2t - 4)$?

- [ ] t = 4
- [x] t = 2
- [ ] t = −2
- [ ] t = 8

::: reveal
t = 2. The corner happens where the argument is 0: $2t - 4 = 0$. Writing $x(2t - 4) = x(2(t - 2))$ shows it as "squeeze by 2, then delay by 2", not delay by 4.
:::
:::

::: nameit
## The three operations

| Operation | Signal | Effect |
|---|---|---|
| shift | $x(t - t_0)$ | delayed by $t_0$ (moved right) when $t_0 > 0$ |
| reversal | $x(-t)$ | mirrored about t = 0 |
| scaling | $x(at)$ | squeezed by $\lvert a\rvert$ when $\lvert a\rvert > 1$, stretched when $\lvert a\rvert < 1$ |

For a combination, solve for where the argument takes a value: a feature of x at $t_0$ appears in $x(at + b)$ where $at + b = t_0$,

$$t = \frac{t_0 - b}{a}$$

Equivalently, $x(at + b) = x(a(t + b/a))$: scale by a, then shift by $-b/a$. A signal lasting D seconds lasts $D/\lvert a\rvert$ after scaling, and its energy becomes $E/\lvert a\rvert$.

## Even and odd parts

x is **even** if $x(-t) = x(t)$ (like cos) and **odd** if $x(-t) = -x(t)$ (like sin). Every signal is the sum of an even and an odd part:

$$x_e(t) = \frac{x(t) + x(-t)}{2}, \qquad x_o(t) = \frac{x(t) - x(-t)}{2}$$

The product of two even or two odd signals is even; an even times an odd is odd.

## In discrete time

Shifts and reversal work the same way with whole-number shifts. Scaling is different: $x[2n]$ keeps only the even-numbered samples (**decimation**) and throws the rest away, and $x[n/2]$ only makes sense for even n, so the gaps have to be filled, usually with zeros (**expansion**).
:::

::: example
## x(t) is the ramp-and-flat signal above, nonzero from 0 to 2. Describe $x(-2t + 3)$.

::: solution
1. **Track the argument.** The argument $u = -2t + 3$ runs from 0 to 2 as t runs from 1.5 down to 0.5.
2. **Where it lives.** So the signal lives on 0.5 ≤ t ≤ 1.5, half as long, and reversed.
3. **Place each part.** The ramp (u from 0 to 1) is at t from 1.5 down to 1, and the flat part at t from 1 down to 0.5.

**Answer:** $x(-2t + 3)$ lives on 0.5 ≤ t ≤ 1.5, half as long and reversed: the ramp runs from t = 1.5 down to 1, and the flat part from 1 down to 0.5.
:::
:::

::: example
## Find the even and odd parts of $x(t) = e^{-t}u(t)$.

::: solution
1. **Reverse the signal.**
   $$x(-t) = e^{t}u(-t)$$
2. **Even part.** A symmetric two-sided decay:
   $$x_e(t) = \tfrac12 e^{-\lvert t\rvert}$$
3. **Odd part.**
   $$x_o(t) = \tfrac12 \operatorname{sgn}(t)e^{-\lvert t\rvert}$$
4. **Check.** Adding them gives back $e^{-t}$ for t > 0 and 0 for t < 0.

**Answer:** $x_e(t) = \tfrac12 e^{-\lvert t\rvert}$ and $x_o(t) = \tfrac12 \operatorname{sgn}(t)e^{-\lvert t\rvert}$.
:::
:::

::: example
## x[n] = [1, 2, 3] for n = 0 to 2, and 0 elsewhere. Find x[2 − n] and x[2n].

::: solution
1. **Reverse and shift, x[2 − n].** At n = 0 it's x[2] = 3, at n = 1 it's x[1] = 2, at n = 2 it's x[0] = 1.
2. **Read it off.** That's [3, 2, 1] on n = 0 to 2: reversed and shifted back into place.
3. **Compress, x[2n].** At n = 0 it's x[0] = 1, at n = 1 it's x[2] = 3, and x[4] is 0, so x[2n] is [1, 3].
4. **What compressing loses.** The sample x[1] = 2 is simply gone. Compressing a discrete signal throws samples away, which a continuous signal never does.

**Answer:** x[2 − n] is [3, 2, 1] and x[2n] is [1, 3], both starting at n = 0.
:::
:::

::: check
given: a = 2 | 3 | -2 | 0.5; b = -6 | 4 | 3; t0 = 0 | 1 | 2
answer: (t0 - b)/a
unit: s
tolerance: 0.5%

## x(t) has a spike at t = {t0}. Where is it in $x(\given{a}t + \given{b})$?

::: right
Right. Solve $\given{a}t + \given{b} = \given{t0}$: t = {answer} s.
:::

::: misses
- [t0 - b] Divide by the scale factor too.
- [(t0 + b)/a] Solve $at + b = t_0$: the shift enters with a minus sign.
- [any] Not yet. Set the argument equal to {t0} and solve for t.
:::
:::

::: check
given: D = 2 | 5 | 12; a = 3 | 0.25 | -4
answer: D/abs(a)
unit: s
tolerance: 0.5%

## x(t) lasts {D} s. How long does $x(\given{a}t)$ last?

::: right
Right. D/|a| = {answer} s.
:::

::: misses
- [D*abs(a)] A factor bigger than 1 squeezes the signal into less time.
- [any] Not yet. D/|a|.
:::
:::

::: check
kind: parts
given: p = 1 | 4 | -2; q = 3 | 0 | 5

## A signal has $x(2) = \given{p}$ and $x(-2) = \given{q}$.

::: part
answer: (p + q)/2
tolerance: 0.5%

### What is its even part at t = 2?

::: misses
- [any] $(x(t) + x(-t))/2$.
:::
:::

::: part
answer: (p - q)/2
tolerance: 0.5%

### What is its odd part at t = 2?

::: misses
- [(q - p)/2] That's the odd part at t = −2.
- [any] Not yet. $(x(t) - x(-t))/2$.
:::
:::
:::

::: check
given: L = 7 | 11 | 15
answer: ceil(L/2)
tolerance: 0

## x[n] is nonzero for n = 0 to {L} − 1 and zero elsewhere. For how many n is $x[2n]$ nonzero?

::: right
Right. Only the even-numbered samples survive: {answer}.
:::

::: misses
- [floor(L/2)] Count n = 0 too.
- [2*L] Decimation keeps fewer samples, not more.
- [any] Not yet. Count the even numbers from 0 to {L} − 1.
:::
:::

::: check
given: n0 = 2 | 5 | -3; k = 4 | 10
answer: k - n0
tolerance: 0

## x[n] has its largest sample at n = {n0}. Where is it in $y[n] = x[\given{k} - n]$?

::: right
Right. Solve $\given{k} - n = \given{n0}$: n = {answer}.
:::

::: misses
- [n0 - k] Solve $k - n = n_0$ for n.
- [k + n0] The reversal flips the sign of $n_0$.
- [any] Not yet. Set the argument to {n0}.
:::
:::

::: check
given: E = 4 | 10; a = 2 | 5 | 0.5
answer: E/a
tolerance: 0.5%

## A signal has energy {E}. What is the energy of $x(\given{a}t)$?

::: right
Right. The same values over 1/{a} of the time: E/{a} = {answer}.
:::

::: misses
- [E*a] Squeezing the signal shortens it, so less energy.
- [E] Scaling time changes how long the signal lasts, and so its energy.
- [any] Not yet. Substitute u = at in the integral.
:::
:::

::: check
kind: choice

## Is $t\cos(t)$ even, odd, or neither?

- [ ] Even
- [x] Odd
- [ ] Neither
- [ ] Both

::: misses
- [1] t is odd and cos is even; their product changes sign with t.
- [3] Check $x(-t)$: it's exactly $-x(t)$.
- [4] Only the zero signal is both.
:::
:::

::: check
kind: parts
given: T = 2 | 4; a = 2 | 3; b = 1 | 4

## x(t) is nonzero only for 0 ≤ t ≤ {T}. Where is $x(\given{a}t + \given{b})$ nonzero?

::: part
answer: -b/a
tolerance: 0.5%

### Where does it start?

::: misses
- [-b] Divide by the compression too: $at + b = 0$.
- [any] Solve $at + b = 0$.
:::
:::

::: part
answer: (T - b)/a
tolerance: 0.5%

### Where does it end?

::: misses
- [any] Solve $at + b = T$.
:::
:::
:::

::: check
kind: parts
given: t0 = -2 | -0.5 | 0.7 | 1.5

## $x(t) = e^{-t}u(t)$. At t = {t0}:

::: part
answer: exp(-abs(t0))/2
tolerance: 0.5%

### What is its even part?

::: misses
- [any] $x_e(t) = \tfrac12 e^{-\lvert t\rvert}$.
:::
:::

::: part
answer: (1 - 2*step(-t0))*exp(-abs(t0))/2
tolerance: 0.5%

### And its odd part?

::: misses
- [any] $x_o(t) = \tfrac12\operatorname{sgn}(t)e^{-\lvert t\rvert}$.
:::
:::
:::

::: explain
## Why does $x(2t - 4)$ start at t = 2 instead of t = 4?

::: model
The signal y(t) = x(2t − 4) takes whatever value x has at the point 2t − 4. x starts where its own argument is 0, so y starts where 2t − 4 = 0, which is t = 2. The time axis is squeezed by 2 before the shift is applied to it, so a shift of 4 in the argument becomes a shift of 4/2 = 2 in time. Factoring the argument as 2(t − 2) makes this visible: squeeze by 2, then delay by 2.
:::
:::

::: practice

::: check
given: a = 2 | -1 | 4; b = 3 | -8
answer: -b/a
unit: s
tolerance: 0.5%

## Where does x's value at t = 0 appear in $x(\given{a}t + \given{b})$?

::: misses
- [any] Solve at + b = 0.
:::
:::

::: check
given: p = 2 | 6; q = 1 | -4
answer: (p + q)/2
tolerance: 0.5%

## x(1) = {p} and x(−1) = {q}. What is the even part at t = 1?

::: misses
- [any] The average of the two.
:::
:::

::: check
given: D = 3 | 8; a = 2 | 0.5
answer: D/a
unit: s
tolerance: 0.5%

## A {D} s signal is played as x({a}t). How long does it last?

::: misses
- [any] D/a.
:::
:::
:::
