Absolute value of an integral Question: Let $f(x)\in C^1[a,b]$ and $f(x)\neq 0$ in $a\leq x\leq b$, then $$\left|\int_{a}^b f(x) dx\right|=  \int_{a}^b |f(x)| dx  \tag{1}$$
My views: We have $$\left|\int_{a}^b f(x) dx\right|\leq  \int_{a}^b |f(x)| dx  $$
Now $f(x)\neq 0$ in $a\leq x\leq b$, so we have either $f(x)>0$ in $a\leq x\leq b$ or $f(x)<0$ in $a\leq x\leq b$.
Then we have the equality as given in $(1)$. How to use the fact that $f(x)\in C^1[a,b]$?
 A: Based on OP's request, let me prove a more general claim:

Theorem. Let $\mathbf{f} : [a, b] \to \mathbb{R}^d$ be continuous. Then the followings are equivalent:

*

*$ \left\| \int_{a}^{b} \mathbf{f}(x) \, \mathrm{d}x \right\| = \int_{a}^{b} \| \mathbf{f}(x) \| \, \mathrm{d}x $

*$\mathbf{f}(x) = \| \mathbf{f}(x) \| \mathbf{u}$ for some $\mathbf{u} \in \mathbb{R}^d$ with $\|\mathbf{u}\| = 1$.


$(1)\impliedby(2)$ : Suppose (2) holds. Then
$$ \left\| \int_{a}^{b} \mathbf{f}(x) \, \mathrm{d}x \right\|
= \left\| \left( \int_{a}^{b} \| \mathbf{f}(x) \| \, \mathrm{d}x \right) \mathbf{u} \right\|
= \left( \int_{a}^{b} \| \mathbf{f}(x) \| \, \mathrm{d}x \right) \left\| \mathbf{u} \right\|
= \int_{a}^{b} \| \mathbf{f}(x) \| \, \mathrm{d}x. $$
$(1) \implies (2)$ :
Case 1. If $\int_{a}^{b} \mathbf{f}(x) \, \mathrm{d}x=\mathbf{0}$, then (1) implies $\int_{a}^{b} \| \mathbf{f}(x) \| \, \mathrm{d}x = 0$. Being an integral of a continuous function, this implies that $\|\mathbf{f}(x)\|$ is identically zero. Then the same is true for $\mathbf{f}(x)$, and so, any unit vector $\mathbf{u}$ will work.
Case 2. Now suppose $\int_{a}^{b} \mathbf{f}(x) \, \mathrm{d}x \neq \mathbf{0}$. Let $\mathbf{u} = \left(\int_{a}^{b} \mathbf{f}(x) \, \mathrm{d}x\right)/\left\|\int_{a}^{b} \mathbf{f}(x) \, \mathrm{d}x\right\|$. Then
$$
\left\| \int_{a}^{b} \mathbf{f}(x) \, \mathrm{d}x \right\|
= \mathbf{u} \cdot \left( \int_{a}^{b} \mathbf{f}(x) \, \mathrm{d}x \right)
= \int_{a}^{b} \mathbf{u} \cdot \mathbf{f}(x) \, \mathrm{d}x, $$
and so, the equality (1) implies that
$$ \int_{a}^{b} (\| \mathbf{f}(x) \| - \mathbf{u} \cdot \mathbf{f}(x)) \, \mathrm{d}x = 0. $$
However, Cauchy–Schwarz inequality shows that the integrand $\| \mathbf{f}(x) \| - \mathbf{u} \cdot \mathbf{f}(x)$ is always non-negative. So it follows that $\| \mathbf{f}(x) \| - \mathbf{u} \cdot \mathbf{f}(x) = 0$ identically on $[a, b]$ and therefore the claim is proved.
