Need help to understand the integral rules used solving the convolution of two functions

convolutionintegration

I am teaching myself how convolution works, there's a question which looks like this – find the convolution of the following two functions $f$ and $g$.

graphics of f and g

I understand the problem intuitively that the resulting function should be essentially the product of $f$ sweeping over $g$, and since the functions are quite simple, I can find key points like when $x = 0, 1, 2, 3$ and interpolate the graph of the resulting function easily.

While reading through the "solution" of this problem in my textbook, for the intersection of $0 \le x \lt 1$, the author wrote this: for $0\leq x<1$,
$$\int_{-\infty}^{\infty} g(t)\cdot f(x-t)dt=\int_{0}^x 2t\cdot dt=\frac{x^2}{2}\cdot 2.$$
which I'm having trouble to understand. How exactly did he replace the $\infty$ and $-\infty$ with $0$ and $x$, and how exactly did he turn the whole $g(t) \cdot f(x-t)$ into $2t$?

Best Answer

Hint. Note that $f(x-t)=2$ when $0\leq x-t\leq 1$, i.e. $x-1\leq t\leq x$, otherwise it is zero. Hence $$\int_{-\infty}^{\infty} g(t)f(x-t)dt=\int_{x-1}^x g(t)2 dt.$$ Now if $x\in[0,1)$ then what is $g(t)$ for $t\in [x-1,0]$? And for $t\in [0,x]$?