Skip to content
LeetQuant
F1 Mathematical Reasoning and Calculus

F1 · Mathematical Reasoning and Calculus · Lesson 5 of 6

Partial Derivatives and Double Integrals

Gradients, two-variable extrema with the Hessian test, a first look at constrained optimisation, and double integrals over regions, the step behind every joint-density question.

18 min

Partial derivatives and the gradient

For f(x,y)f(x, y), the partial derivative fxf_x differentiates in xx holding yy fixed. The gradient ∇f=(fx,fy)\nabla f = (f_x, f_y) points in the direction of fastest increase and is zero at any interior extremum. The second derivatives form the Hessian

H=(fxxfxyfxyfyy),H = \begin{pmatrix} f_{xx} & f_{xy} \\ f_{xy} & f_{yy} \end{pmatrix},

which is symmetric for smooth ff (fxy=fyxf_{xy} = f_{yx}). Near a critical point, f(p+h)≈f(p)+12h⊤Hhf(p + h) \approx f(p) + \tfrac12 h^\top Hh: the second-order Taylor expansion in two variables.

The second-derivative test in two variables

At a critical point, let D=det⁡H=fxxfyy−fxy2D = \det H = f_{xx}f_{yy} - f_{xy}^2.

ConditionConclusion
D>0D > 0, fxx>0f_{xx} > 0local minimum (HH positive definite)
D>0D > 0, fxx<0f_{xx} < 0local maximum (HH negative definite)
D<0D < 0saddle point (eigenvalues of opposite sign)
D=0D = 0inconclusive

The logic is the eigenvalue one: DD is the product of the two eigenvalues of HH, so D<0D < 0 means one direction curves up and another curves down.

Worked example

classify the critical points

Find and classify the critical points of f(x,y)=x3−3x+y2f(x, y) = x^3 - 3x + y^2.

Show solution

fx=3x2−3f_x = 3x^2 - 3 and fy=2yf_y = 2y. Both vanish at (1,0)(1, 0) and (−1,0)(-1, 0).

The Hessian is (6x002)\begin{pmatrix} 6x & 0 \\ 0 & 2 \end{pmatrix}, so D=12xD = 12x.

  • At (1,0)(1, 0): D=12>0D = 12 > 0 and fxx=6>0f_{xx} = 6 > 0, a local minimum with f=−2f = -2.
  • At (−1,0)(-1, 0): D=−12<0D = -12 < 0, a saddle. Along the xx-axis it is a maximum of x3−3xx^3 - 3x; along the yy-direction ff increases like y2y^2.

There is no global minimum, because f→−∞f \to -\infty as x→−∞x \to -\infty. Local tests never settle global questions on an unbounded domain.

Double integrals over regions

∬Rf dA\iint_R f\,dA is computed as an iterated integral. Fix the outer variable, find the range of the inner variable from the region's boundary, integrate, then integrate the result:

∬Rf dA=∫ab(∫g1(x)g2(x)f(x,y) dy)dx.\iint_R f\,dA = \int_a^b \left( \int_{g_1(x)}^{g_2(x)} f(x, y)\,dy \right) dx .

Fubini's theorem lets you swap the order (for integrable ff, in particular any non-negative or bounded ff on a bounded region), but the limits change: redraw the region and read it the other way. Always sketch the region first. Most mistakes are wrong limits, not wrong antiderivatives.

The link to probability

If (X,Y)(X, Y) has joint density f(x,y)f(x, y), then P((X,Y)∈R)=∬Rf dAP((X, Y) \in R) = \iint_R f\,dA, the marginal is fX(x)=∫f(x,y) dyf_X(x) = \int f(x, y)\,dy, and E[g(X,Y)]=∬gf dA\mathbb{E}[g(X, Y)] = \iint g f\,dA. When XX and YY are independent uniforms on [0,1][0, 1], f=1f = 1 on the unit square and probability is simply area: P(Y<X2)=∫01x2 dx=13P(Y < X^2) = \int_0^1 x^2\,dx = \tfrac13. This is the engine behind geometric-probability questions.

Polar coordinates and the Gaussian integral

With x=rcos⁡θx = r\cos\theta, y=rsin⁡θy = r\sin\theta, the area element becomes dA=r dr dθdA = r\,dr\,d\theta. This proves the Gaussian integral from the previous lesson: if I=∫e−x2/2 dxI = \int e^{-x^2/2}\,dx, then

I2=∬e−(x2+y2)/2 dx dy=∫02π∫0∞e−r2/2 r dr dθ=2π⋅1,I^2 = \iint e^{-(x^2 + y^2)/2}\,dx\,dy = \int_0^{2\pi}\int_0^\infty e^{-r^2/2}\,r\,dr\,d\theta = 2\pi \cdot 1,

so I=2πI = \sqrt{2\pi}. The extra rr is what makes the inner integral elementary.

Worked example

swap the order to make it possible

Evaluate ∫01∫y1ex2 dx dy\displaystyle\int_0^1 \int_y^1 e^{x^2}\,dx\,dy.

Show solution

ex2e^{x^2} has no elementary antiderivative, so the inner integral is stuck. Describe the region instead: 0≤y≤x≤10 \le y \le x \le 1, a triangle below the diagonal. Reading it with xx outside, xx runs over [0,1][0, 1] and yy over [0,x][0, x]:

∫01∫0xex2 dy dx=∫01xex2 dx=[12ex2]01=e−12≈0.859.\int_0^1 \int_0^x e^{x^2}\,dy\,dx = \int_0^1 xe^{x^2}\,dx = \Big[\tfrac12e^{x^2}\Big]_0^1 = \frac{e - 1}{2} \approx 0.859 .

The inner integral produced exactly the factor xx needed for the substitution u=x2u = x^2. When an iterated integral looks impossible, try the other order.

Worked example

a joint density

(X,Y)(X, Y) has density f(x,y)=c(x+y)f(x, y) = c(x + y) on the unit square. Find cc, the marginal density of XX, E[X]\mathbb{E}[X] and P(X+Y<1)P(X + Y < 1).

Show solution

Normalise. ∫01∫01(x+y) dy dx=∫01(x+12) dx=1\int_0^1\int_0^1 (x + y)\,dy\,dx = \int_0^1 (x + \tfrac12)\,dx = 1, so c=1c = 1.

Marginal. fX(x)=∫01(x+y) dy=x+12f_X(x) = \int_0^1 (x + y)\,dy = x + \tfrac12 on [0,1][0, 1], and E[X]=∫01x(x+12) dx=13+14=712\mathbb{E}[X] = \int_0^1 x(x + \tfrac12)\,dx = \tfrac13 + \tfrac14 = \tfrac{7}{12}.

Probability over a region. The region x+y<1x + y < 1 is the triangle under the anti-diagonal, so for fixed xx, yy runs from 0 to 1−x1 - x:

∫01∫01−x(x+y) dy dx=∫01[x(1−x)+12(1−x)2]dx=16+16=13.\int_0^1\int_0^{1 - x}(x + y)\,dy\,dx = \int_0^1 \left[x(1 - x) + \tfrac12(1 - x)^2\right]dx = \tfrac16 + \tfrac16 = \tfrac13 .

Sanity check: the density is smallest near the origin, so the lower triangle should carry less than half the mass, and 13<12\tfrac13 < \tfrac12. Also, the density is symmetric in xx and yy, so P(X<Y)=12P(X < Y) = \tfrac12 without any integration.

Knowledge check

What is the origin for f(x,y)=x2+4xy+y2f(x, y) = x^2 + 4xy + y^2?

Knowledge check

Which integral equals ∫01∫x1g(x,y) dy dx\int_0^1\int_x^1 g(x, y)\,dy\,dx?

Knowledge check

XX and YY are independent and uniform on [0,1][0, 1]. What is P(X>2Y)P(X > 2Y)?

Key takeaways

  • Interior extrema have ∇f=0\nabla f = 0; classify them with D=fxxfyy−fxy2D = f_{xx}f_{yy} - f_{xy}^2: D<0D < 0 saddle, D>0D > 0 min or max by the sign of fxxf_{xx}.
  • Under a constraint, solve ∇f=λ∇g\nabla f = \lambda\nabla g.
  • Sketch the region before writing limits; swapping the order can turn an impossible integral into a substitution.
  • Joint density questions are double integrals; for independent uniforms on the unit square, probability is area.
  • Polar coordinates add a factor rr, which is how the Gaussian integral is evaluated.

Practice problems

Finished reading?

Answer the 3 knowledge checks to complete this lesson (0 done).