Multivariable calculus

Second partials of the Gaussian e^(-x^2-y^2)

For f(x,y) = e^(-x^2-y^2) the second partials are f_xx = (4x^2 - 2) e^(-x^2-y^2), f_yy = (4y^2 - 2) e^(-x^2-y^2), and f_xy = f_yx = 4xy e^(-x^2-y^2). At the origin the Hessian is -2 times the identity, so the bump has a local maximum of 1 there.

f(x,y)=ex2y2f(x,y) = e^{-x^{2}-y^{2}}
fx=2xex2y2\frac{\partial f}{\partial x} = -2x\,e^{-x^{2}-y^{2}}
fy=2yex2y2\frac{\partial f}{\partial y} = -2y\,e^{-x^{2}-y^{2}}

Second and mixed partials

2fx2=(4x22)ex2y2\frac{\partial^2 f}{\partial x^2} = (4x^{2}-2)\,e^{-x^{2}-y^{2}}
2fyx=4xyex2y2\frac{\partial^2 f}{\partial y\,\partial x} = 4xy\,e^{-x^{2}-y^{2}}
2fy2=(4y22)ex2y2\frac{\partial^2 f}{\partial y^2} = (4y^{2}-2)\,e^{-x^{2}-y^{2}}

Chain rule out, then product rule back in

The exponent is u=x2y2u = -x^2 - y^2. Holding yy fixed, ux=2x\frac{\partial u}{\partial x} = -2x, so the first partials are the original bump scaled by the inner derivative.

fx=2xex2y2,fy=2yex2y2\frac{\partial f}{\partial x} = -2x\,e^{-x^{2}-y^{2}}, \qquad \frac{\partial f}{\partial y} = -2y\,e^{-x^{2}-y^{2}}

Now fxf_x is a genuine product of two things that both depend on xx, so differentiating it in xx needs the product rule: the 2x-2x gives 2-2, and the exponential gives back 2x-2x times itself.

2fx2=2ex2y2+(2x)(2x)ex2y2=(4x22)ex2y2\frac{\partial^2 f}{\partial x^2} = -2e^{-x^{2}-y^{2}} + (-2x)(-2x)e^{-x^{2}-y^{2}} = (4x^{2}-2)\,e^{-x^{2}-y^{2}}

The mixed partial is easier, because differentiating 2xex2y2-2x\,e^{-x^2-y^2} in yy leaves the 2x-2x alone as a constant and only touches the exponential.

2fyx=(2x)(2y)ex2y2=4xyex2y2\frac{\partial^2 f}{\partial y\,\partial x} = (-2x)(-2y)\,e^{-x^{2}-y^{2}} = 4xy\,e^{-x^{2}-y^{2}}

The mistake: skipping the product rule on the pure second partials

Writing fxx=4x2ex2y2f_{xx} = 4x^2 e^{-x^2-y^2} is the usual error. It comes from applying the chain rule twice and never noticing that 2x-2x is a function of xx as well. The missing 2-2 is not a detail: it is the entire reason the surface curves downward near the origin, where 4x24x^2 is small.

Test any candidate at (0,0)(0,0). The Gaussian has a peak there, so fxx(0,0)f_{xx}(0,0) must be negative. The correct expression gives 2-2; the version without the product rule gives 00 and would call the peak degenerate.

Note also that the mixed partial genuinely does not need the product rule, since 2x-2x is constant with respect to yy. Knowing which of the three needs it is the whole skill here.

Reading the bump off the Hessian

Both first partials vanish only at the origin, since the exponential is never zero. There fxx=fyy=2f_{xx} = f_{yy} = -2 and fxy=0f_{xy} = 0, so D=(2)(2)0=4>0D = (-2)(-2) - 0 = 4 > 0 with fxx<0f_{xx} < 0: a local maximum, of height f(0,0)=1f(0,0) = 1.

The sign of fxxf_{xx} flips where 4x22=04x^2 - 2 = 0, that is at x=±1/20.707x = \pm 1/\sqrt{2} \approx 0.707. Inside that band the cross section curves downward like the top of a hill, outside it curves upward as the tail flattens toward zero. That flip is what makes the Gaussian look like a bell rather than a paraboloid.

Adding the two pure second partials gives 2f=(4x2+4y24)ex2y2\nabla^{2} f = (4x^{2}+4y^{2}-4)\,e^{-x^{2}-y^{2}}, which vanishes on the unit circle. Inside that ring the average curvature is negative and the surface is dome shaped, outside it the average curvature is positive as the tails level off toward zero. So the single curvature fxxf_{xx} changes sign on a pair of straight lines, while the two curvatures added together change sign on a circle.

The mixed partial 4xyex2y24xy\,e^{-x^2-y^2} is zero along both axes and changes sign between quadrants, which says the surface is untwisted along the axes and twisted in between.

Frequently asked questions

Why does f_xx have a -2 in it?

Because fx=2xex2y2f_x = -2x\,e^{-x^2-y^2} is a product of two xx dependent factors. The product rule gives 2ex2y2-2e^{-x^2-y^2} from differentiating 2x-2x and 4x2ex2y24x^2 e^{-x^2-y^2} from the exponential, which combine to (4x22)ex2y2(4x^2-2)e^{-x^2-y^2}.

Where does the Gaussian stop curving downward?

Along the xx direction the curvature fxx=(4x22)ex2y2f_{xx} = (4x^2-2)e^{-x^2-y^2} changes sign at x=±1/2x = \pm 1/\sqrt{2}. Closer to the yy axis than that the cross section is concave down, and beyond it the tail is concave up.