Given two functions $f(x) = \frac{1}{2}(e^x+e^{-x})$ and $g(x) = \frac{1}{2}(e^x - e^{-x})$, calculate
$$ \int\frac{g(x)}{f(x)} \, dx. $$
Observing that $f'(x) = g(x)$, this is very easy to do. Just take $u = f(x)$ and therefore $du = f'(x)\,dx$. Now we have
$$ \int \frac{f'(x)}{f(x)} \, dx = \int \frac{du}{u} = \ln |u| + C = \ln\left|\frac{1}{2}(e^x+e^{-x})\right|+C. $$
However, this solution is wrong. The correct one is $\ln|e^x+e^{-x}| + C$. I see how we could get that, just plug in $g(x)$ and $f(x)$ directly, and we get
$$ \int \frac{\frac{1}{2}(e^x - e^{-x})}{\frac{1}{2}(e^x+e^{-x})} \, dx. $$
Cancelling the $\frac{1}{2}$'s and taking $u = e^x+e^{-x}$ and $du = (e^x-e^{-x}) dx$ gives us
$$ \int \frac{du}{u} = \ln|u| + C = \ln|e^x+e^{-x}| + C. $$
I can't see where I made a mistake in my approach, and I'd be really grateful if you pointed it out.
Note that if $K$ is a constant, $\ln|K\cdot h(x)|= \ln|K|+\ln|h(x)|$. In other words, the $1/2$ in the log can get 'absorbed' into the $+C$ term.