Multivariable calculus
Second partials of ln(e^x + e^y)
For f(x,y) = ln(e^x + e^y) write S = e^x + e^y. Then f_xx = f_yy = e^x e^y / S^2 and the mixed partial f_xy = f_yx = -e^x e^y / S^2. Every entry of the Hessian has the same magnitude, so the discriminant f_xx f_yy - f_xy^2 is exactly zero at every point and the function is convex but flat along one direction.
Second and mixed partials
Differentiating the log-sum-exp
Write , which is positive for all real inputs, so the logarithm is defined everywhere. The chain rule gives inner over outer, and only one term of survives each partial derivative.
Those two first partials are the softmax weights: each is between and , and they add to exactly . Differentiate in with the quotient rule, remembering that contains .
For the mixed partial the numerator is constant in , so only the denominator contributes, and it contributes with a minus sign.
The mistake: treating the denominator as a constant
The tempting wrong move is to say that since looks like an exponential, differentiating again just returns . That ignores the hiding inside . The wrong answer climbs toward as pulls ahead of , whereas the true curvature decays to out there and never exceeds anywhere.
A useful check is the identity , which follows because and . Since lies strictly between and , the curvature is always positive and peaks at on the line .
The other slip is the sign of the mixed partial. It has to be negative: raising increases , which shrinks the weight , so the slope in the direction goes down.
A Hessian with determinant zero
All three second partials have the same magnitude , with a minus sign only on the mixed one, so the discriminant collapses.
The reason is a symmetry you can see without any calculus. Adding the same constant to both inputs multiplies by , so . The function is exactly linear along the diagonal direction, which means zero curvature there and forces a zero eigenvalue in the Hessian.
The other eigenvalue is , which is positive, so the surface curves upward across the diagonal. A Hessian that is positive semidefinite everywhere makes this function convex, which is why log-sum-exp is a standard smooth stand-in for the maximum of and .
Frequently asked questions
Why is the discriminant of ln(e^x + e^y) always zero?
Because , the function is linear along the diagonal, so the Hessian has a zero eigenvalue in that direction. Concretely all three second partials share the magnitude , and cancels .
How large can f_xx get?
At most . Since with strictly between and , the product is largest when , which happens exactly on the line .