Algebraic issues with the calculation of the second derivative of $(a+be^x)/(ae^x+b)$ I'm trying to work out the 2nd derivative of $\dfrac{a+be^x}{ae^x+b}$
I have $f''=\dfrac{(ae^x+b)^2(b^2-a^2)e^x-2ae^x(ae^x+b)(b^2-a^2)e^x}{(ae^x+b)^4}$
There are so many terms, and I'm seriously confused on how to cancel it down.
The mark scheme says I should expect: $\dfrac{(b^2-a^2)(b-ae^x)e^x}{(ae^x+b)^3}$
How do I get from my working to the answer?

From your computation, we have
\begin{align}
f''(x)&=\dfrac{(ae^x+b)^2(b^2-a^2)e^x-2ae^x(ae^x+b)(b^2-a^2)e^x}{(ae^x+b)^4}\\
&=\dfrac{(b^2-a^2)(ae^x+b)e^x[(ae^x+b)-2ae^x]}{(ae^x+b)^4}\\
&=\dfrac{(b^2-a^2)e^x(b-ae^x)}{(ae^x+b)^3}.
\end{align}
