I am preparing for exam and one of the past exam questions requires showing that the Hessian of $g(\lambda)$, given that
$$\begin{align} \nabla g(\lambda) &= b - A^T x \\ x_i &= p_i \exp(e_i^T A \lambda - 1) \end{align}$$
is $$\nabla^2 g(\lambda) = -A^T X A$$
where $X_{ii} = x_i$ and its nondiagonal elements are $0$, and $e_i$ has $1$ for the $i$th element and $0$s elsewhere. Considering the time constraints, I need to be able to do this in about 5 or 10 minutes.
Doing the computation accurately requires paying very close attention to the indices, taking cases for the diagonal and nondiagonal elements of the Hessian, and showing that the Hessian can be factored as indicated. I can do this, but it took me about half an hour the first time, and I am curious if there is a test-taking strategy I can use to get faster at solving these sorts of problems.
If memorizing the derivation is not an option, what is the most time-efficient way to compute a complicated Hessian by hand?
Please note that my question is not about the particulars of this exam question. I want to know general strategies for organizing my thinking on paper. In fact, I would really appreciate seeing handwritten examples of solving this sort of problem rather than Mathjax.