I am building an utility model, and I am confused how to make assumptions about second order equations. The First order condition is simple, it is the problem of $$\max_{M} u(H(M),M)$$ where $H(M)$ is an increasing, concave function. $H$ is health and $M$ is the medical expenses. And the first order condition reads $$\frac{du}{dM}=\frac{\partial u}{\partial H}H'(M)+\frac{\partial u}{\partial M}=0$$ However, when I want to check the second order condition $\frac{d^2u}{dM^2}$, I got confused about the cross derivatives. Is it $$\frac{\partial^2 u}{\partial H^2}(H'(M))^2+\frac{\partial u}{\partial H}H''(M)+\frac{\partial^2 u}{\partial M^2} $$
However I am not confidient, I think I lost the cross derivative term. But how to add this cross derivative, and how to calculate $\frac{\partial^2u}{\partial H\partial M}$?
I have looked up in several textbooks, but have not find satisfactory answers. Many thanks in advance, for suggestions of reference, or suggestions of solutions.
Colin