[Math] Calculating the convolution of a piecewise function

convolutionfourier analysis

Let

$$f(x) = \begin{cases} \frac{1}{2}, & \text{if $\rvert x\lvert \le 1$
} \\ 0, & \text{otherwise} \end{cases}$$

I want to calculate the convolution of $f$ with itself.

I am given the following formula:

$$f*g=\int_{-\infty}^{+\infty} f(y)g(x-y) dy$$

so, $ \space f*f=\int_{-\infty}^{+\infty} f(y)f(x-y) dy$. How do I evaluate this integral?

While doing some research online I found that one can calculate the convolution by using the fourier-transform. $$\mathcal F(f(x)f(x))=\frac{1}{\sqrt{2 \pi}} \hat{f}(k) *\hat{f}(k)$$

The problem with using this method is that I don't know how to multiply a piecewise function with itself. Would it just be:

$$f(x) =
\begin{cases}
\color{red}{\frac{1}{4}}, & \text{if $\rvert x\lvert \le 1$ } \\
0, & \text{otherwise}
\end{cases}$$

or am I doing something wrong here?

Best Answer

Use the original definition: $$\space f*f=\int_{-\infty}^{+\infty} f(y)f(x-y) dy$$ When $|y|>-1$, $f(y)=0$, otherwise it is $\frac{1}{2}$. So the integral is reduced to $$\frac{1}{2}\int_{-1}^{1} f(x-y) dy$$

Now substitute $t=x-y$,

$$\frac{1}{2}\int_{x-1}^{x+1} f(t) dt$$

It is easy to see when $x\leq -2$ or $x\geq 2$, $f(t)$ is entirely $0$, so this function is equal to $0$ in those intervals. Between $-2$ and $2$, $f(t)$ is $\frac{1}{2}$ in the green region:

Piece-wise function 1

In this picture, the upper boundary of the green region is $y=x+1$, the lower boundary is $x-1$. The height of the green region is the distance we want. So you can see that the integral is equal to $$(x+1)-(-1)=x+2, \quad\quad -2\leq x\leq 0\\ 1-(x-1)=2-x, \quad\quad 0\leq x\leq 2$$

And this is the required function after multiplying by $\frac{1}{4}$.

Related Question