This is a follow up to another question on the second-order approximation to log-determinant in Boyd's textbook, the excerpt can be found here:
Here, $f$ is the log-determinant, $f(Z) = \log(\det(Z))$, where $Z$ is symmetric positive definite.
The final equation,
$f(Z) \approx f(x) + \text{tr}(X^{-1} (Z-X)) - (1/2) \text{tr}(X^{-1} (Z-X) X^{-1} (Z-X))$ admittedly looks nothing like the second-order approximation as defined by Boyd earlier.
I would have expected that the second-order/Hessian term is written as: $f(Z) \approx f(x) + \text{tr}(X^{-1} (Z-X)) - (1/2) \text{tr}((Z-X)^T X^{-2} (Z-X))$ instead. At least this somewhat resembles the second-order term.
Why is the original express the correct second-order term?
And if it is correct, then what is expression of the Hessian $\nabla^2 f(X)$ of log-determinant? It is not apparent to me how this term can be extracted out of the second-order approximation.



$$(\log \det X)'(H)=\mathrm{trace}(X^{-1}H^T),\\ (\log \det X)''(H,K)=-\mathrm{trace}((X^{-1})^TKX^{-1}H^T)$$