# Convolution of two piecewise functions

$$\phi(t)=\begin{cases}1&t\in[0,1)\\0&\text{otherwise}\end{cases}$$ and $$\psi(t)=\begin{cases}1&t\in[0,1/2)\\-1&t\in[1/2,1)\\0&\text{otherwise}\end{cases}$$

I know that $\mathcal{F}^{-1}[\hat{\phi}\cdot\hat{\psi}]=\frac{1}{\sqrt{2\pi}}\phi*\psi$, but I am supposed to find the convolution using the definition $f*g=\int_{-\infty}^\infty f(t-x)g(x)dx$. My biggest problem is how do I go about finding the bounds of integration? How do I know when $t-x\in[0,1/2)$?

By definition, $$\phi\ast\psi(t)=\int_{-\infty}^{\infty}\phi(t-x)\psi(x)\;dx=\int_{-\infty}^{\infty}\phi(x)\psi(t-x)\;dx$$ $\phi(x)=0$ unless $0\leq x<1$, in which case $\phi(x)=1$. Therefore $$\int_{-\infty}^{\infty}\phi(x)\psi(t-x)\;dx=\int_0^1\psi(t-x)\;dx$$ Now consider a few cases. If $t\geq 2$ then $t-x\geq t-1\geq 1$ for all $x\in[0,1]$, so the integral is zero. Similarly, if $t<0$ then $t-x\leq t<0$ for all $x\in[0,1]$, so again the integral is zero.
So that leaves $0\leq t<2$. If $0\leq t<1$ then $t-x\in [0,1)$ when $0\leq x\leq t$, so $$\int_0^1\psi(t-x)\;dx=\int_0^t\psi(t-x)\;dx=\int_0^t\psi(x)\;dx$$ and this integral is equal to $t$ if $0\leq t<\frac{1}{2}$, and is equal to $\frac{1}{2}-(t-\frac{1}{2})=1-t$ if $\frac{1}{2}\leq t<1$.
Finally, if $1\leq t<2$, then $t-x\in[0,1)$ when $t-1<x\leq 1$, hence $$\int_0^1\psi(t-x)\;dx=\int_{t-1}^1\psi(x)\;dx$$ which is equal to $\frac{1}{2}-(t-1)-\frac{1}{2}=1-t$ if $1\leq t<\frac{3}{2}$, and is equal to $-[1-(t-1)]=t-2$ if $\frac{3}{2}\leq t<2$.
You may consider this fact: Convolution commutes with translations, i.e. writing $T_xf(z) = f(y-x)$, and hence $supp(T_xf) = x + supp(f)$, you have $$T_x(f \ast g) = (T_x f) \ast g = f \ast (T_x g)$$. Since the second function consists of two shifted copies of the indicator function of the half-interval you only have to compute the convolution of $\phi$ with the indicator function of $[0,1/2]$, i.e. the dilated version of that function.