I recently uncovered an old copy of Mathematics for Chemists by Charles Perrin from 1970. I've been doing some of the problems in it. In the Differentiation section of the 1st chapter (functions of a single variable), I found a problem that I can't solve.

It gives a titration formula for a weak base w/ a strong acid.

[H^{+}] + M°[H^{+}]/([H^{+}] + K) - K_{w}/[H^{+}] = M

M° is the initial concentration of the base and M is the concentration of acid added (neglecting volume change on addition). "This is a cubic in [H^{+}] that cannot be solved for either [H^{+}] or pH as a function of M. Use the above result to find an equation to be solved determine those values of [H^{+}] which maximize or minimize d(pH)/dM."

I differentiated the equation to get dM/d[H^{+}].

dM/d[H^{+}] = 1 + M°K/([H^{+}] + K]^{2} + K_{w}/[H^{+}]^{2}

But this is far as I got. The next step should be to solve for d[H^{+}]/dM, but the algebra doesn't work out. The answer given in the back of the book is:

K_{w}/[H^{+}]^{2} + M°K([H^{+}] - K)/([H^{+}] + K)^{3} = 1

I can't see how to get from dM/d[H^{+}] to the answer given by the author. I think I'm missing something simple, but I can't imagine what it is. Thank you in advance for any assistance.