Tutorials › Calculus III › Divergence of a Gradient and the Laplacian

Curl and Divergence · Tutorial 906 of 999

Divergence of a Gradient and the Laplacian

Compute a scalar function’s Laplacian in Cartesian coordinates by differentiating its gradient and taking the divergence.

Advanced 8 min read

What You'll Learn

  • Define the gradient, divergence, and Laplacian of a scalar function in Cartesian coordinates
  • Derive the Laplacian formula from the definitions of gradient and divergence
  • Compute Laplacians of scalar functions in two and three variables
  • Evaluate a Laplacian at a specified point and check the calculation
  • Distinguish the pure second partial derivatives in the Laplacian from mixed partial derivatives

From a Scalar Function to the Laplacian

A scalar function assigns a number to each point in its domain. Its gradient turns the function into a vector field, and the divergence measures a particular combination of the vector field’s component derivatives. Applying divergence to the gradient therefore produces a scalar function built from second derivatives of the original function.

This operation is called the Laplacian. It is useful in multivariable calculus because it gathers the function’s pure second partial derivatives into one quantity. The calculations are direct once the order of operations is clear: first find the gradient, then take its divergence.

Definitions in Cartesian Coordinates

Let \(f(x,y)\) be a scalar function of two variables. Its gradient is the vector whose components are the first partial derivatives of \(f\):

$$ \nabla f = \left\langle \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y} \right\rangle. $$

For a two-dimensional vector field \(\mathbf{F}(x,y)=\langle P(x,y),Q(x,y)\rangle\), its divergence is the scalar function

$$ \nabla\cdot\mathbf{F} = \frac{\partial P}{\partial x} + \frac{\partial Q}{\partial y}. $$

In three variables, a scalar function \(f(x,y,z)\) has gradient \(\nabla f=\langle f_x,f_y,f_z\rangle\). For a vector field \(\mathbf{F}=\langle P,Q,R\rangle\), divergence is \(\nabla\cdot\mathbf{F}=P_x+Q_y+R_z\). Here subscripts denote partial differentiation with respect to the indicated variable.

Definition: The Laplacian of a scalar function \(f\), denoted \(\Delta f\) or \(\nabla^2 f\), is the divergence of its gradient: \(\Delta f=\nabla\cdot(\nabla f)\). In Cartesian coordinates, this is the sum of the pure second partial derivatives, with one term for each variable.

For the usual classical formulas, assume \(f\) has continuous second partial derivatives on the region under consideration. This smoothness condition ensures that the second derivatives used in the formula exist and behave regularly. In two and three dimensions, the formulas are

$$ \Delta f(x,y) = \frac{\partial^2 f}{\partial x^2} + \frac{\partial^2 f}{\partial y^2}, \qquad \Delta f(x,y,z) = \frac{\partial^2 f}{\partial x^2} + \frac{\partial^2 f}{\partial y^2} + \frac{\partial^2 f}{\partial z^2}. $$

The notation \(\nabla^2 f\) here means the Laplacian of the scalar function, not a vector of second derivatives. The result is a scalar function.

Why the Formula Works

The formula follows directly from the definitions. In two variables, first take the gradient of \(f\). Its first component is \(f_x\), and its second component is \(f_y\). Now apply the divergence formula for a two-dimensional vector field: differentiate the first component with respect to \(x\), and the second component with respect to \(y\), then add.

1
Form the gradient.
\(\nabla f=\langle f_x,f_y\rangle\).
2
Apply divergence.
\(\nabla\cdot(\nabla f)=\partial_x(f_x)+\partial_y(f_y)\).
3
Recognize the second partials.
\(\partial_x(f_x)=f_{xx}\) and \(\partial_y(f_y)=f_{yy}\), so \(\Delta f=f_{xx}+f_{yy}\).

Thus, the sum of pure second partials is not an unrelated shortcut: it is exactly what results from taking the divergence of the gradient. The same substitution in three variables adds the derivative of the third gradient component with respect to \(z\), giving \(\Delta f=f_{xx}+f_{yy}+f_{zz}\).

$$ \nabla\cdot(\nabla f) = \frac{\partial}{\partial x}\left(\frac{\partial f}{\partial x}\right) + \frac{\partial}{\partial y}\left(\frac{\partial f}{\partial y}\right) + \frac{\partial}{\partial z}\left(\frac{\partial f}{\partial z}\right) = f_{xx}+f_{yy}+f_{zz}. $$

For a function of only \(x\) and \(y\), the \(z\)-component is absent, so the two-variable formula applies. A function of three variables uses all three terms.

Worked Examples

Worked Example: A Polynomial in Two Variables

Find the Laplacian of \(f(x,y)=x^2+3xy+y^2\), and evaluate it at \((1,-2)\).

First calculate the gradient by differentiating \(f\) once with respect to each variable:

$$ f_x=2x+3y, \qquad f_y=3x+2y, \qquad \nabla f=\langle 2x+3y,\,3x+2y\rangle. $$

Take the divergence of this vector field. Differentiate its first component with respect to \(x\), and its second component with respect to \(y\):

$$ \Delta f = \frac{\partial}{\partial x}(2x+3y) + \frac{\partial}{\partial y}(3x+2y) = 2+2 = 4. $$

The Laplacian is the constant function \(4\), so its value at \((1,-2)\) is also \(4\). As a check, the direct second partials are \(f_{xx}=2\) and \(f_{yy}=2\), whose sum is \(4\).

Worked Example: Exponential and Polynomial Terms

Let \(f(x,y)=e^{x+y}+x^2y\). Find \(\Delta f\), then evaluate it at \((0,1)\).

Differentiate first with respect to \(x\), treating \(y\) as constant, and then with respect to \(y\), treating \(x\) as constant:

$$ f_x=e^{x+y}+2xy, \qquad f_y=e^{x+y}+x^2. $$

Differentiate each component in its own variable to take the divergence:

$$ f_{xx} = \frac{\partial}{\partial x}(e^{x+y}+2xy) = e^{x+y}+2y, $$ $$ f_{yy} = \frac{\partial}{\partial y}(e^{x+y}+x^2) = e^{x+y}. $$

Therefore,

$$ \Delta f = f_{xx}+f_{yy} = 2e^{x+y}+2y. $$

At \((0,1)\), \(x+y=1\), so \(e^{x+y}=e\), and \(2y=2\). Hence \(\Delta f(0,1)=2e+2\). To check, evaluate the gradient there: \(f_x(0,1)=e\) and \(f_y(0,1)=e\). The \(x\)-derivative of the first component at that point is \(e+2\), while the \(y\)-derivative of the second is \(e\); their sum is \(2e+2\), as required.

Worked Example: A Polynomial in Three Variables

For \(f(x,y,z)=x^2y+y^2z+z^2x\), find the Laplacian and evaluate it at \((1,2,3)\).

First find all three components of the gradient:

$$ f_x=2xy+z^2, \qquad f_y=x^2+2yz, \qquad f_z=y^2+2zx. $$

Now differentiate each component with respect to its corresponding variable:

$$ f_{xx}=2y, \qquad f_{yy}=2z, \qquad f_{zz}=2x. $$

Adding these pure second partials gives

$$ \Delta f=2y+2z+2x=2(x+y+z). $$

At \((1,2,3)\), this is \(2(1+2+3)=12\). Check using divergence of the gradient: at the point, the gradient components are \(2(1)(2)+3^2=13\), \(1^2+2(2)(3)=13\), and \(2^2+2(3)(1)=10\). Their required derivatives are \(f_{xx}=2(2)=4\), \(f_{yy}=2(3)=6\), and \(f_{zz}=2(1)=2\). The divergence is \(4+6+2=12\), confirming the result.

A Common Mistake: Adding Mixed Partial Derivatives

The Laplacian adds pure second partial derivatives. In two variables these are \(f_{xx}\) and \(f_{yy}\), not every possible second partial derivative. Mixed derivatives such as \(f_{xy}\) and \(f_{yx}\) do not appear in the Cartesian formula for the Laplacian.

Worked Example: Correcting a Mixed-Derivative Error

Consider \(f(x,y)=x^2y+y^2\), and evaluate its Laplacian at \((1,2)\). The gradient is

$$ \nabla f=\langle 2xy,\,x^2+2y\rangle. $$

Taking divergence gives \(\partial_x(2xy)=2y\) and \(\partial_y(x^2+2y)=2\). Thus \(\Delta f=2y+2\), and \(\Delta f(1,2)=2(2)+2=6\).

A common incorrect calculation adds the mixed partials as well: \(f_{xy}=2x\) and \(f_{yx}=2x\). At \((1,2)\), each is \(2\), so adding these to the correct terms would give \(4+2+2+2=10\). That is not the Laplacian. The correction is to use only the derivatives that divergence specifies: differentiate each gradient component with respect to its matching coordinate. The answer is \(6\).

Interpreting the Result

Each term in the Laplacian records how the function’s rate of change in one coordinate direction changes along that same direction. The Laplacian adds those coordinate-wise second derivatives. A positive value means their sum is positive at that point; a negative value means the sum is negative. The value alone does not tell you that every individual second derivative has the same sign.

A useful special case is a function whose Laplacian is zero throughout a region. Such a function is called harmonic there, provided the necessary second derivatives exist. This definition highlights why the Laplacian is important: it supplies a concise condition on the combined second-order behavior of a scalar function. The definition does not mean that each second partial must separately vanish; only their sum is required to be zero.

Key takeaway: To compute the Laplacian in Cartesian coordinates, form the gradient and take its divergence. In two variables, add \(f_{xx}\) and \(f_{yy}\); in three variables, also add \(f_{zz}\). Do not include mixed partial derivatives.

Check Your Understanding

Use the definition of the Laplacian to answer each question.

  1. For \(f(x,y)=x^2-4y^2\), find \(\nabla f\) and \(\Delta f\).
  2. For \(g(x,y)=x^2y+xy^2\), compute \(g_{xx}\), \(g_{yy}\), and \(\Delta g\).
  3. For \(h(x,y,z)=x^2+y^2+z^2\), find \(\Delta h\).
  4. Why does taking the divergence of the gradient produce pure second partials rather than mixed partials?
  5. If \(f_{xx}=5\) and \(f_{yy}=-5\) at a point, what is the Laplacian there, regardless of the values of the mixed partials?