# Convolution is fun!

Given two functions $f$ and $g$, their convolution is

$\displaystyle (f*g)(t) = \int_{-\infty}^{\infty} f(\tau) g(t - \tau) \, \mathrm{d} \tau.$

Let us choose $f(x) = x$ and $g(x) = \frac{1}{1 + x^2}$. Now we have that

$\displaystyle (f * g)(t) = \int_{-\infty}^{\infty} \frac{\tau}{1 + (t - \tau)^2} \, \mathrm{d}\tau.$

Let us set $x = t - \tau$, which implies that $\tau = t - x$, $\frac{\mathrm{d}x}{\mathrm{d}\tau} = -1$, and so $\mathrm{d}\tau = -\mathrm{d}x$. Also, as $\tau \to \infty$, $x \to -\infty$ and vice versa. Finally, we can integrate:

\displaystyle \begin{aligned} (f*g)(t) &= \int_{\infty}^{-\infty} - \frac{t - x}{1 + x^2} \, \mathrm{d}x \\ &= \int_{-\infty}^{\infty} \frac{t - x}{1 + x^2} \, \mathrm{d}x \\ &= \int_{-\infty}^{\infty} \frac{t}{1 + x^2} - \frac{x}{1 + x^2} \, \mathrm{d}x \\ &= \Bigg[ t \arctan x \Bigg]_{x = -\infty}^{x = \infty} - \Bigg[ \frac{1}{2} \ln |x^2 + 1| \Bigg]_{x = -\infty}^{x = \infty} \\ &= t \Bigg[ \frac{\pi}{2} - \Bigg( - \frac{\pi}{2} \Bigg) \Bigg] - \lim_{x \to \infty} \Bigg[ \frac{1}{2} \ln |x^2 + 1| - \frac{1}{2} \ln |(-x)^2 + 1| \Bigg] \\ &= \pi t - \lim_{x \to \infty} [0] \\ &= \pi t. \end{aligned}

Now, what happens if we compute

$\displaystyle (g * f)(t) = \int_{-\infty}^{\infty} f(t - \tau) g(\tau) \, \mathrm{d}\tau$

instead? Let us take a look:

\displaystyle \begin{aligned} (g*f)(t) &= \int_{-\infty}^{\infty} \frac{t - \tau}{1 + \tau^2} \, \mathrm{d} \tau \\ &= \int_{-\infty}^{\infty} \frac{t}{1 + \tau^2} - \frac{\tau}{1 + \tau} \, \mathrm{d} \tau \\ &= \Bigg[ t \arctan \tau \Bigg]_{\tau = -\infty}^{\tau = \infty} - \Bigg[ \frac{1}{2} \ln |1 + \tau^2| \Bigg]_{\tau = -\infty}^{\tau = \infty} \\ &= t \Bigg[ \frac{\pi}{2} - \Bigg( - \frac{\pi}{2} \Bigg) \Bigg] - \lim_{\tau \to \infty} \Bigg[ \frac{1}{2} \ln |1 + \tau^2| - \frac{1}{2} \ln |1 + (-\tau)^2|\Bigg] \\ &= \pi t - \lim_{\tau \to \infty} [0] \\ &= \pi t. \end{aligned}

This is not a coincidence, since convolution commutes. To see that, set $x = t - \tau$, which implies $\tau = t - x, \mathrm{d}\tau = -\mathrm{d}x$. Note also that as $\tau \to \infty$, $x \to -\infty$. Now,

\displaystyle \begin{aligned} (f*g)(t) &= \int_{\infty}^{-\infty} -f(t-x) g(x) \, \mathrm{d}x \\ &= \int_{-\infty}^{\infty} f(t-x) g(x) \, \mathrm{d} x, \end{aligned}

which is $(g*f)(t)$.

However, there exist pairs of functions for which convolution does not converge. Let us demonstrate an example. We will reuse $g$, yet redefine $f$ to be $f(x) = x^2$. Here we go:

\displaystyle \begin{aligned} (f*g)(t) &= \int_{-\infty}^{\infty} f(\tau)g(t - \tau) \, \mathrm{d} \tau \\ &= \int_{-\infty}^{\infty} \frac{\tau^2}{1 + (t - \tau)^2} \, \mathrm{d} \tau. \end{aligned}

Setting $t - \tau = x$, we have that $\tau = t - x$, $\frac{\mathrm{d}\tau}{\mathrm{d}x} = -1$, and so $\mathrm{d}\tau = -\mathrm{d}x$. Once again, as $\tau \to \infty$, $x \to -\infty$, and vice versa. Finally

\displaystyle \begin{aligned} \int_{\infty}^{-\infty} - \frac{(t - x)^2}{1 + x^2} \, \mathrm{d}x &= \int_{-\infty}^{\infty} \frac{(t - x)^2}{1 + x^2} \, \mathrm{d}x \\ &= \int_{-\infty}^{\infty} \frac{t^2 - 2tx + x^2}{1 + x^2} \, \mathrm{d}x \\ &= \int_{-\infty}^{\infty} \frac{t^2}{ 1 + x^2 } \, \mathrm{d}x - \int_{-\infty}^{\infty} \frac{ 2tx }{ 1 + x^2 } \, \mathrm{d}x + \int_{-\infty}^{\infty} \frac{x^2 }{1 + x^2 } \, \mathrm{d}x \\ &= \pi t^2 - \Bigg[ t \ln |1 + x^2| \Bigg]_{x = -\infty}^{x = \infty} + \int_{-\infty}^{\infty} \frac{x^2}{1 + x^2} \, \mathrm{d}x \\ &= \pi t^2 - \lim_{x \to \infty} \Bigg[ t \ln |1 + x^2| - t \ln |1 + (-x)^2| \Bigg] + \int_{-\infty}^{\infty} \frac{x^2}{1 + x^2} \, \mathrm{d}x \\ &= \pi t^2 = \lim_{x \to \infty} [0] + \int_{-\infty}^{\infty} \frac{x^2}{1 + x^2} \, \mathrm{d}x \\ &= \pi t^2 + \int_{-\infty}^{\infty} \frac{x^2}{1 + x^2} \, \mathrm{d}x, \end{aligned}

which does not converge. In order to prove divergence, first observe that $\frac{x^2}{1+x^2} \in [0, 1)$. Next, let us choose $\varepsilon \in (0, 1)$. Now,

\displaystyle \begin{aligned} \frac{x^2}{1 + x^2} &> \varepsilon & \Longleftrightarrow \\ x^2 &> \varepsilon + \varepsilon x^2 & \Longleftrightarrow \\ (1 - \varepsilon) x^2 &> \varepsilon & \Longleftrightarrow \\ x^2 &> \frac{\varepsilon}{1 - \varepsilon} & \Longleftrightarrow \\ |x| &> \sqrt{\frac{\varepsilon}{1 - \varepsilon}} = \delta.& \end{aligned}

Since such $\delta > 0$ and $\varepsilon$ exist, $\int_{-\infty}^{\infty} \frac{x^2}{1 + x^2} \, \mathrm{d}x$ diverges by Lemma 1.

Lemma 1 Let $f \colon \mathbb{R} \to \mathbb{R}$ be a continuous function. If there exist $a \in \mathbb{R}$ and $\varepsilon > 0$ such that $f(x) > \varepsilon$ when $x < a$ and there exists $b > a$ and $\varepsilon_b \geq 0$ such that $f(x) \geq \varepsilon_b$ when $x > b$, then $\int_{-\infty}^{\infty} f(x) \, \mathrm{d}x = \infty$.
Proof

Let $C = \int_a^b f(x) \, \mathrm{d}x$. Since $f$ is continuous, $C$ is finite. Now

$\displaystyle \int_{-\infty}^{\infty} f(x) \, \mathrm{d}x = \int_{-\infty}^a f(x) \, \mathrm{d}x + C + \int_b^{\infty} f(x) \, \mathrm{d}x.$

Since $f(x) \geq 0$ when $x > b$, $\int_b^{\infty} f(x) \, \mathrm{d}x \geq 0$. Finally,

$\displaystyle \int_{-\infty}^a f(x) \, \mathrm{d}x > \lim_{b \to -\infty} \varepsilon_a(a - b) = \infty$.