# Integrating a function within a convolution, variable substitution

Let $f(x)= \begin{cases} 1 & |x|\lt 1 \\ 0 & |x|\ge 1 \end{cases}$

I want to find the convolution $f(x) \ast f(x) = \int\limits^{\infty}_{-\infty}f(y)f(x-y)\,\mathrm{d}y$

I started out by: $\;\;=\int\limits_{-1}^{1}f(x-y)\,\mathrm{d}y\;\;$ from here I tried variable substitution: $t=x-y,\;\; \mathrm{d}t=-\mathrm{d}y$

and then I get $\int\limits^{x-1}_{x+1}-\mathrm{d}t=-t|^{x-1}_{x+1}=-(x-1-x-1)=2$

I know the answer is $f(x)\ast f(x) = \begin{cases} 2-|x| & |x|\lt 2 \\ 0 & |x|\ge 2\end{cases}\;\;$ but can not figure out why (here's the Wolfram alpha answer).

Thank you for your time and effort.

-
Your first equality ($=\int_1^1f(x-y)dy$) isn't true. – anonymous Sep 22 '12 at 11:10

Try to solve this, rewriting $f$ as $f(x)=\mathbf 1_{|x|\lt1}$.
For every $y$, $f(y)f(x-y)=\mathbf 1_{|y|\lt1}\mathbf 1_{|x-y|\lt1}=\mathbf 1_{-1\lt y\lt1}\mathbf 1_{x-1\lt y\lt x+1}=\mathbf 1_{y\in D(x)}$ with $$D(x)=(-1,1)\cap(x-1,x+1).$$ Thus, $D(x)=\varnothing$ if $|x|\geqslant2$, $D(x)=(x-1,1)$ if $x\in[0,2)$, and $D(x)=(-1,x+1)$ if $x\in(-2,0]$.
Then, $f\ast f(x)$ is the length of the interval $D(x)$. This length is $0$ if $|x|\geqslant2$, $2-x$ if $x\in[0,2]$, and $x+2$ if $x\in[-2,0]$.
To summarize, $f\ast f(x)=0$ if $|x|\geqslant2$ and $f\ast f(x)=2-|x|$ if $|x|\leqslant2$.