Consider a particle moving along a line. Its acceleration and initial velocity are given by

\begin{align*} a(t) &= 2t-4\\ v(0) &= 3 \end{align*}

for \(0\leq t\leq 4\).

The velocity of the particle at time \(t\) is

\[ v(t) = \answer {t^2-4t+3}. \]

The total distance the particle travels on the interval \([0,4]\) is

\[ \int _0^4 \left |v(t)\right | \d t = \answer {4}. \]
Note
\[ v(t)=(t-1)(t-3). \]
Therefore, \(v\) is negative on the interval \((1,3)\).
We have to compute the integral
\[ \int _0^4 \left |v(t)\right | \d t =\int _0^1 \left |v(t)\right | \d t+\int _1^3 \left |v(t)\right | \d t+\int _3^4 \left |v(t)\right | \d t. \]
Therefore,
\[ \int _0^4 \left |v(t)\right | \d t =\int _0^1 v(t) \d t-\int _1^3v(t)\d t+\int _3^4 v(t) \d t. \]