Multivariable calculus

Partial Derivatives of x^2 y e^x

For f(x,y) = x^2 y e^x, the partial with respect to x is x y (x + 2) e^x, and the partial with respect to y is x^2 e^x. Differentiating in x needs the product rule on x^2 times e^x with y held fixed. Differentiating in y does not, because f is linear in y.

f(x,y)=x2yexf(x,y) = x^{2} y e^{x}
fx=xy(x+2)ex\frac{\partial f}{\partial x} = xy(x+2)e^{x}
fy=x2ex\frac{\partial f}{\partial y} = x^{2}e^{x}

Only one of the two partials needs the product rule

Before you reach for a rule, ask which variable is moving. To find fx\frac{\partial f}{\partial x}, freeze yy. What is left is the constant yy multiplying x2exx^{2}e^{x}, and that is a genuine product of two functions of xx, so the product rule applies.

fx=y(2xex+x2ex)\frac{\partial f}{\partial x} = y\left(2x\,e^{x} + x^{2}e^{x}\right)

Both terms share xexx e^{x}, so factor it out. Factoring is worth the extra line: the factored form is what you need later when you set the gradient to zero.

fx=xy(x+2)ex\frac{\partial f}{\partial x} = xy(x+2)e^{x}

Now freeze xx instead. With xx constant, x2exx^{2}e^{x} is one fixed number and ff is that number times yy, a straight line in yy. The derivative of a constant times yy is the constant, so no product rule is involved at all.

fy=x2ex\frac{\partial f}{\partial y} = x^{2}e^{x}

The mistake: differentiating every factor at once

The usual error is to see three factors, x2x^{2}, yy, and exe^{x}, and try to apply a three-way product rule in xx. That produces a stray term where yy has been differentiated to 1, and the answer picks up an extra x2exx^{2}e^{x} that does not belong.

Hold the line on this: a partial derivative in xx treats yy exactly like the number 7. You would never differentiate the 7 in 7x2ex7x^{2}e^{x}, and yy gets the same treatment.

  • In fx\frac{\partial f}{\partial x}, the product rule pairs x2x^{2} with exe^{x} only. The yy rides along as a constant multiplier.
  • In fy\frac{\partial f}{\partial y}, there is no product of two yy-dependent factors, so the product rule has nothing to act on.
  • A quick sanity check: fy\frac{\partial f}{\partial y} must not contain yy, because ff is degree one in yy.

Check the answer at a point

Evaluating at (1,1)(1,1) gives numbers you can hold in your head. From the factored form, fx(1,1)=(1)(1)(3)e=3e\frac{\partial f}{\partial x}(1,1) = (1)(1)(3)e = 3e, and fy(1,1)=e\frac{\partial f}{\partial y}(1,1) = e.

f(1,1)=3e,  e\nabla f(1,1) = \langle 3e,\; e \rangle

The ratio 3 to 1 says the surface climbs three times as fast in the xx direction as in the yy direction at that point, which matches the fact that xx appears both as a power and inside the exponential while yy appears only once.

Frequently asked questions

Why does the x-partial need the product rule but the y-partial does not?

Because the product rule only fires when two factors both depend on the variable you are differentiating. In xx, both x2x^{2} and exe^{x} depend on xx. In yy, only the single factor yy depends on yy, and x2exx^{2}e^{x} is a frozen constant, so the derivative is that constant.

Where is the x-partial equal to zero?

Set xy(x+2)ex=0xy(x+2)e^{x} = 0. Since exe^{x} is never zero, the zeros are x=0x = 0, x=2x = -2, and y=0y = 0. Combining that with fy=x2ex=0\frac{\partial f}{\partial y} = x^{2}e^{x} = 0, which forces x=0x = 0, the critical points are the whole line x=0x = 0.