How to integrate $$\int_0^T \frac{C(Ae^{kt} - Be^{-kt}) + D}{(Ae^{kt} + Be^{-kt})^2} dt$$ where A, B, C, D and k are some constants?
I tried using integration by parts where $U = C(Ae^{kt} - Be^{-kt}) + D$ and $dV = (Ae^{kt} + Be^{-kt})^{-2}$.
Using the usual formula for anti-derivate, I got $V = -(Ae^{kt} + Be^{-kt})^{-1}(kAe^{kt} - kBe^{-kt})^{-1}$. However, if I then recompute $dV$ from this $V$, I can't get back to the original $dV = (Ae^{kt} + Be^{-kt})^{-2}$.
What did I do wrong? Is there another way to derive this integral?
Update
Use substitution: Let $u = (Ae^{kt} + Be^{-kt})^{-1}$. It follows that $du = -\frac{k(Ae^{kt} - Be^{-kt})}{(Ae^{kt} + Be^{-kt})^2}$. But how do I incorporate the constant D?
Solution
See user5713492's answer below.
If we integrate by parts, $$\begin{align}\int\frac{(Ae^{kt}-Be^{-kt})^2}{(Ae^{kt}+Be^{-kt})^2}dt&=-\frac1{k(Ae^{kt}+Be^{-kt})}(Ae^{kt}-Be^{-kt})+\frac1k\int\frac{k(Ae^{kt}+Be^{-kt})}{(Ae^{kt}+Be^{-kt})}dt\\ &=-\frac{(Ae^{kt}-Be^{-kt})}{k(Ae^{kt}+Be^{-kt})}+t+C_1\end{align}$$ And $(Ae^{kt}+Be^{-kt})^2-(Ae^{kt}-Be^{-kt})^2=4AB$ so we can say $$\begin{align}I&=\int\frac{C(Ae^{kt}-Be^{-kt})+D}{(Ae^{kt}+Be^{-kt})^2}dt\\ &=\int\frac{C(Ae^{kt}-Be^{-kt})+\frac D{4AB}(Ae^{kt}+Be^{-kt})^2-\frac D{4AB}(Ae^{kt}-Be^{-kt})^2}{(Ae^{kt}+Be^{-kt})^2}dt\\ &=-\frac C{k(Ae^{kt}+Be^{-kt})}+\frac D{4AB}t+\frac D{4AB}\frac{(Ae^{kt}-Be^{-kt})}{k(Ae^{kt}+Be^{-kt})}-\frac D{4AB}t+C_2\\ &=\frac{D(Ae^{kt}-Be^{-kt})-4ABC}{4kAB(Ae^{kt}+Be^{-kt})}+C_2\end{align}$$