Integrating equations with units I was looking through an old copy of Barron's AP Physics and found this problem relating to impulse which I was initially confused about how to integrate.

Example 6.1 During a collision with a wall lasting from $t=0$ to $t=2\text{ s}$, the force acting on a $2\text{-kg}$ object is given by the equation $\mathbf{F} = (4\mathrm{\ kg\ m/s^4})t(2s-t)\hat{i}$

They work out that the integral is equal to:
$$\frac{16}{3}\hat{i}\frac{\text{kg m}}{\text{s}}$$
I am confused about the role of the units in the problem.
Looking at the answer, it seems that if I were to just ignore all the units and simply integrate $4t\cdot(2-t)$ that would give me $16/3$, and because that is a force I know it to be $\mathrm{kg\,m/s}$ or $\mathrm{N}$.
Why it would be OK to ignore the units in the integral though is somewhat unintuitive to me (other than that I know the end result must be a force) and I feel like it may get me into trouble with other problems.
Can someone explain how it is that the scalar values of the original unit quantities still give you the correct answer?
 A: You know that you can pull a multiplicative constant out in front of an integral, right?
$$\int cf(t)\mathrm{d}t = c\int f(t)\mathrm{d}t$$
where $f(t)$ is any function of $t$, like $t^2$ or $t(2\text{ s} - t)$ (and $c$ does not depend on $t$).
Units can be part of that constant factor too. In this case, the constant factor is $4\mathrm{\ kg\ m/s^4}$.
The reason this all works is that an integral is basically an addition. You're computing the value of a function, in your case $4\mathrm{\ kg\ m/s^4}t(2\text{ s} - t)\hat{i}$ at some time $t$, multiplying it by a small increment in time $\mathrm{d}t$, and adding up the result for all possible times. Take a look at the units of the different pieces you add up:
$$\begin{align}
&4\color{blue}{\mathrm{\ kg\ m/s^4}}\color{red}{t}\color{green}{(2\text{ s} - t)}\hat{i}\color{purple}{\mathrm{d}t} \\
\text{units: }&(1)\color{blue}{(\mathrm{kg\ m/s^4})}\color{red}{(\text{s})}\color{green}{(\text{s})}(1)\color{purple}{(\text{s})} = \frac{\text{kg m}}{\text{s}^4}\text{s}^3 = \frac{\text{kg m}}{\text{s}}
\end{align}$$
So you're adding up things which have units of $\text{kg m/s}$. Thus, your result will have the same units. Since the units are a constant factor, it doesn't matter whether you pull them out in advance or leave them in for the integration.
A: This probably is why it is useful to use variables. If we just let $q=4\,{\rm kg\,m/s^4}$ and $h=2\,{\rm s}$, then your force is
$$
\mathbf{F}=qt\left(h-t\right)\hat{\mathbf{i}}
$$
We then integrate this over time $t$,
$$
\int_0^t\mathbf{F}\,dt'=q\int_0^tt'\left(h-t'\right)dt'\,\hat{\mathbf{i}}
$$
we get,
$$
\int_0^t\mathbf{F}\,dt'=q\frac{-2t^3-6ht^2}{6}\,\hat{\mathbf{i}}\Rightarrow\frac{16}{3}[q][t][h]\hat{\mathbf{i}}
$$
where $[q]$ represents the units of $q$ and likewise for the other variables. Looking at these, we get
$$
\rm{\frac{kg\,m}{s^4}\cdot s^3=\frac{kg\,m}{s}}
$$
which is the unit of impulse, not force.
It is my opinion, then, that the appropriate way is to wrap the units into a variable, integrate, then apply the units.
