Exact Differential Equations

Section 1.4 of Differential Equations

Learning Objectives
  1. Understand the concept of exact differential equations
  2. Apply the test for exactness: $\frac{\partial M}{\partial y} = \frac{\partial N}{\partial x}$
  3. Solve exact equations by finding the potential function $F(x,y)$
  4. Interpret solutions geometrically as level curves
  5. Connect to conservative vector fields and real-world applications

What are Exact Differential Equations?

An exact differential equation has the standard form:

$$M(x,y)\,dx + N(x,y)\,dy = 0$$

We call it exact if there exists a function $F(x,y)$ such that:

$$dF = \frac{\partial F}{\partial x}dx + \frac{\partial F}{\partial y}dy = M\,dx + N\,dy$$

This means:

Geometric Interpretation

The solution is given implicitly by $F(x,y) = C$. Geometrically, the solution curves are the level curves (contours) of the surface $F(x,y)$. This elegant connection to multivariable calculus makes exact equations powerful.

Real-World Motivation

Exact equations arise naturally in:

The theory of exact equations is deeply connected to the work of Alexis Clairaut and Euler in the 18th century. Clairaut's theorem on the equality of mixed partial derivatives provides the mathematical foundation for the exactness test — a beautiful bridge between multivariable calculus and differential equations.

— Alexis Clairaut (1713–1765), who proved the symmetry of mixed partial derivatives

Theory and Exactness Test

Definition: Exact Differential Equation The equation $M(x,y)\,dx + N(x,y)\,dy = 0$ is exact in a domain $D$ if there exists a function $F(x,y)$ defined on $D$ such that $\displaystyle\frac{\partial F}{\partial x} = M(x,y)$ and $\displaystyle\frac{\partial F}{\partial y} = N(x,y)$ for all $(x,y) \in D$.
Theorem: Test for Exactness If $M(x,y)$ and $N(x,y)$ have continuous partial derivatives in a simply connected domain $D$, then $$M\,dx + N\,dy = 0 \text{ is exact} \iff \frac{\partial M}{\partial y} = \frac{\partial N}{\partial x}$$

Proof Sketch

Forward direction ($\Rightarrow$): If the equation is exact, then $F$ exists with $\frac{\partial F}{\partial x} = M$ and $\frac{\partial F}{\partial y} = N$. By Clairaut's theorem (equality of mixed partials),

$$\frac{\partial M}{\partial y} = \frac{\partial^2 F}{\partial y \partial x} = \frac{\partial^2 F}{\partial x \partial y} = \frac{\partial N}{\partial x}$$

Backward direction ($\Leftarrow$): If $\frac{\partial M}{\partial y} = \frac{\partial N}{\partial x}$, the vector field $(M, N)$ is conservative, so a potential function $F$ exists. (This uses the condition that the domain is simply connected.)

Finding the Potential Function

If exactness is confirmed, solve for $F(x,y)$ by integration, treating $y$ as a constant first, then use the second equation to find the arbitrary function of $y$.

Key Insight The solution to an exact equation $M\,dx + N\,dy = 0$ is always given implicitly as $F(x,y) = C$. The challenge is finding $F$.

Step-by-Step Solution Method

Before You Start Make sure the equation is in the standard form $M(x,y)\,dx + N(x,y)\,dy = 0$.

Step 1: Identify M and N

Extract $M(x,y)$ (coefficient of $dx$) and $N(x,y)$ (coefficient of $dy$).

Step 2: Check for Exactness

Compute $\displaystyle\frac{\partial M}{\partial y}$ and $\displaystyle\frac{\partial N}{\partial x}$. If they are equal, proceed. If not, the equation is not exact.

Step 3: Integrate M with Respect to x

Find $\displaystyle F(x,y) = \int M(x,y)\,dx + g(y)$, where $g(y)$ is an arbitrary function of $y$ (not a constant!).

Step 4: Differentiate and Match with N

Compute $\displaystyle\frac{\partial F}{\partial y}$ and set it equal to $N(x,y)$:

$$\frac{\partial}{\partial y}\left[\int M\,dx\right] + g'(y) = N$$

Solve for $g'(y)$.

Step 5: Integrate to Find g(y)

Integrate $g'(y)$ to find $g(y)$. You may ignore the constant of integration here.

Step 6: Write the Solution

The general solution is:

$$F(x,y) = C$$

Step 7: Apply Initial Condition (if given)

If an initial condition $(x_0, y_0)$ is given, substitute to find the value of $C$.

Worked Examples

Solution

Step 1: $M = 2xy + 3$, $N = x^2 + 4y$

Step 2: Check exactness: $$\frac{\partial M}{\partial y} = 2x, \quad \frac{\partial N}{\partial x} = 2x \quad \checkmark$$ The equation is exact.

Step 3: Integrate $M$ with respect to $x$: $$F = \int (2xy + 3)\,dx = x^2y + 3x + g(y)$$

Step 4: Differentiate $F$ with respect to $y$: $$\frac{\partial F}{\partial y} = x^2 + g'(y)$$ Set equal to $N$: $$x^2 + g'(y) = x^2 + 4y \quad \Rightarrow \quad g'(y) = 4y$$

Step 5: Integrate: $$g(y) = \int 4y\,dy = 2y^2$$

Step 6: General solution: $$x^2y + 3x + 2y^2 = C$$

Solution

Step 1: $M = ye^{xy} + 2x$, $N = xe^{xy} + 2y$

Step 2: Check exactness: $$\frac{\partial M}{\partial y} = e^{xy} + xye^{xy}, \quad \frac{\partial N}{\partial x} = e^{xy} + xye^{xy} \quad \checkmark$$

Step 3: Integrate $M$ with respect to $x$: $$F = \int (ye^{xy} + 2x)\,dx = e^{xy} + x^2 + g(y)$$

Step 4: Differentiate with respect to $y$: $$\frac{\partial F}{\partial y} = xe^{xy} + g'(y) = xe^{xy} + 2y \quad \Rightarrow \quad g'(y) = 2y$$

Step 5: $g(y) = y^2$

Step 6: General solution: $$e^{xy} + x^2 + y^2 = C$$

Note: This elegant result shows how exact equations can yield surprisingly simple potentials.

Solution

Step 1: $M = 3x^2y + y^3$, $N = x^3 + 3xy^2 + 1$

Step 2: Check exactness: $$\frac{\partial M}{\partial y} = 3x^2 + 3y^2, \quad \frac{\partial N}{\partial x} = 3x^2 + 3y^2 \quad \checkmark$$

Step 3: Integrate $M$ with respect to $x$: $$F = \int (3x^2y + y^3)\,dx = x^3y + xy^3 + g(y)$$

Step 4: Differentiate with respect to $y$: $$\frac{\partial F}{\partial y} = x^3 + 3xy^2 + g'(y) = x^3 + 3xy^2 + 1 \quad \Rightarrow \quad g'(y) = 1$$

Step 5: $g(y) = y$

Step 6: General solution: $$x^3y + xy^3 + y = C$$

Solution

Step 1: $M = 2x + y$, $N = x - 3y^2$

Step 2: Check exactness: $$\frac{\partial M}{\partial y} = 1, \quad \frac{\partial N}{\partial x} = 1 \quad \checkmark$$

Step 3: Integrate $M$ with respect to $x$: $$F = \int (2x + y)\,dx = x^2 + xy + g(y)$$

Step 4: Differentiate with respect to $y$: $$\frac{\partial F}{\partial y} = x + g'(y) = x - 3y^2 \quad \Rightarrow \quad g'(y) = -3y^2$$

Step 5: $g(y) = -y^3$

Step 6: General solution: $$x^2 + xy - y^3 = C$$

Step 7: Apply initial condition $y(1) = 2$: $$1^2 + 1(2) - 2^3 = C \quad \Rightarrow \quad 1 + 2 - 8 = C \quad \Rightarrow \quad C = -5$$

Particular solution: $$x^2 + xy - y^3 = -5$$

Physical Context: Exact Equations in Engineering

In mechanical engineering, conservative force fields correspond to exact equations. Consider a particle moving in a 2D force field where:

$$(2xy + y\cos(xy))\,dx + (x^2 + x\cos(xy))\,dy = 0$$

The terms represent components of a conservative force F = (Fₓ, Fᵧ) where the potential energy function F(x,y) satisfies:

$$\frac{\partial F}{\partial x} = M \quad \text{and} \quad \frac{\partial F}{\partial y} = N$$

Solution

Step 1: Check exactness.

$M = 2xy + y\cos(xy)$, $\quad N = x^2 + x\cos(xy)$

$$\frac{\partial M}{\partial y} = 2x + \cos(xy) - xy\sin(xy)$$

$$\frac{\partial N}{\partial x} = 2x + \cos(xy) - xy\sin(xy)$$

They are equal! ✓ The equation is exact.

Step 2: Find F by integrating M with respect to x:

$$F = \int (2xy + y\cos(xy))\,dx = x^2y + \sin(xy) + g(y)$$

Step 3: Differentiate with respect to y and equate to N:

$$\frac{\partial F}{\partial y} = x^2 + x\cos(xy) + g'(y) = x^2 + x\cos(xy)$$

So $g'(y) = 0$, hence $g(y) = \text{constant}$.

General solution: $$x^2y + \sin(xy) = C$$

Engineering Insight: In engineering, exact equations often arise from energy conservation principles. The potential function F(x,y) represents the total energy of the system, and F(x,y) = C means energy is conserved along solution curves. This deep connection between exact ODEs and conservative fields is one of the most important links between differential equations and physics.

Solving an Exact Equation with Polynomial Terms

Consider the differential equation:

$$(2xy - 9x^2)\,dx + (2y + x^2 + 1)\,dy = 0$$

Solution

Step 1: Identify M and N, then check exactness.

$M = 2xy - 9x^2$, $\quad N = 2y + x^2 + 1$

$$\frac{\partial M}{\partial y} = 2x$$

$$\frac{\partial N}{\partial x} = 2x$$

They are equal! ✓ The equation is exact.

Step 2: Find F by integrating M with respect to x:

$$F(x,y) = \int (2xy - 9x^2)\,dx + h(y) = x^2y - 3x^3 + h(y)$$

Step 3: Differentiate with respect to y and use the condition on N:

$$\frac{\partial F}{\partial y} = x^2 + h'(y) = N = 2y + x^2 + 1$$

Therefore: $h'(y) = 2y + 1$

Step 4: Integrate to find h(y):

$$h(y) = \int (2y + 1)\,dy = y^2 + y$$

General solution: $$x^2y - 3x^3 + y^2 + y = C$$

Key Observation: Notice how the potential function $F(x,y) = x^2y - 3x^3 + y^2 + y$ is a beautiful polynomial. This example shows how exactness conditions allow us to reconstruct the underlying potential from its partial derivatives. The "puzzle piece" property of exact equations ensures that the cross-partial derivatives match perfectly.

Handling Exponential Functions

Consider the differential equation with exponential terms:

$$(ye^{2x} + 8)\,dx + \left(\frac{1}{2}e^{2x} - 7y\right)\,dy = 0$$

Solution

Step 1: Identify M and N, then verify exactness.

$M = ye^{2x} + 8$, $\quad N = \frac{1}{2}e^{2x} - 7y$

$$\frac{\partial M}{\partial y} = e^{2x}$$

$$\frac{\partial N}{\partial x} = \frac{1}{2} \cdot 2e^{2x} = e^{2x}$$

They are equal! ✓ The equation is exact.

Step 2: Integrate M with respect to x (careful with exponentials):

$$F(x,y) = \int (ye^{2x} + 8)\,dx + h(y)$$

For the first term: $\int ye^{2x}\,dx = \frac{y}{2}e^{2x}$ (treating y as constant)

$$F(x,y) = \frac{y}{2}e^{2x} + 8x + h(y)$$

Step 3: Differentiate F with respect to y and match with N:

$$\frac{\partial F}{\partial y} = \frac{1}{2}e^{2x} + h'(y) = \frac{1}{2}e^{2x} - 7y$$

Therefore: $h'(y) = -7y$

Step 4: Integrate to find h(y):

$$h(y) = \int (-7y)\,dy = -\frac{7y^2}{2}$$

General solution: $$\frac{1}{2}ye^{2x} + 8x - \frac{7y^2}{2} = C$$

Caution with Exponentials: When integrating $ye^{2x}$ with respect to $x$, remember that $y$ is treated as a constant. The factor $\frac{1}{2}$ appears because of the chain rule: $\frac{d}{dx}\left[\frac{y}{2}e^{2x}\right] = y e^{2x}$. Careful handling of exponential integration is essential to avoid errors.

Combining Multiple Function Types

Consider an exact equation that blends trigonometric and polynomial functions:

$$(\sin x + 4xy)\,dx + (2x^2 - \cos y)\,dy = 0$$

Solution

Step 1: Identify M and N, then check exactness.

$M = \sin x + 4xy$, $\quad N = 2x^2 - \cos y$

$$\frac{\partial M}{\partial y} = 4x$$

$$\frac{\partial N}{\partial x} = 4x$$

They are equal! ✓ The equation is exact.

Step 2: Integrate M with respect to x:

$$F(x,y) = \int (\sin x + 4xy)\,dx + h(y)$$

$$F(x,y) = -\cos x + 2x^2y + h(y)$$

Step 3: Differentiate with respect to y and use the N condition:

$$\frac{\partial F}{\partial y} = 2x^2 + h'(y) = 2x^2 - \cos y$$

Therefore: $h'(y) = -\cos y$

Step 4: Integrate to find h(y):

$$h(y) = \int (-\cos y)\,dy = -\sin y$$

General solution: $$2x^2y - \cos x - \sin y = C$$

The Beautiful Puzzle: Notice how the potential function $F(x,y) = 2x^2y - \cos x - \sin y$ elegantly combines polynomial, trigonometric, and mixed terms. The exactness condition $\frac{\partial M}{\partial y} = \frac{\partial N}{\partial x}$ ensures that everything fits together perfectly like puzzle pieces. Each component of the potential function contributes naturally from the structure of M and N, demonstrating the deep harmony of exact equations.

📝 Exam-Style Practice Problems

These problems are similar in style and difficulty to past exam questions. Click each problem to reveal the step-by-step solution.

Practice 1: $(2xy + e^x)\,dx + (x^2 + \cos y)\,dy = 0$

Solution

Step 1: Verify exactness

$M = 2xy + e^x$, $N = x^2 + \cos y$

$$\frac{\partial M}{\partial y} = 2x, \quad \frac{\partial N}{\partial x} = 2x \quad \checkmark$$

The equation is exact.

Step 2: Find the potential function $F(x,y)$

Integrate $M$ with respect to $x$:

$$F(x,y) = \int (2xy + e^x)\,dx = x^2y + e^x + g(y)$$

Step 3: Differentiate with respect to $y$ and match

$$\frac{\partial F}{\partial y} = x^2 + g'(y) = N = x^2 + \cos y$$

Therefore, $g'(y) = \cos y$, so $g(y) = \sin y$.

Step 4: Write the general solution

$$\boxed{x^2y + e^x + \sin y = C}$$
Practice 2: $(3x^2 + y\cos(x))\,dx + (\sin(x) - 4y^3)\,dy = 0$

Solution

Step 1: Verify exactness

$M = 3x^2 + y\cos(x)$, $N = \sin(x) - 4y^3$

$$\frac{\partial M}{\partial y} = \cos x, \quad \frac{\partial N}{\partial x} = \cos x \quad \checkmark$$

The equation is exact.

Step 2: Find $F(x,y)$ by integrating $M$ with respect to $x$

$$F(x,y) = \int (3x^2 + y\cos(x))\,dx = x^3 + y\sin(x) + g(y)$$

Step 3: Differentiate with respect to $y$ and find $g(y)$

$$\frac{\partial F}{\partial y} = \sin x + g'(y) = N = \sin(x) - 4y^3$$

Thus, $g'(y) = -4y^3$, so $g(y) = -y^4$.

Step 4: Write the general solution

$$\boxed{x^3 + y\sin x - y^4 = C}$$
Practice 3: $(y^2 + \ln x)\,dx + (2xy - 3)\,dy = 0$

Solution

Step 1: Verify exactness

$M = y^2 + \ln x$, $N = 2xy - 3$

$$\frac{\partial M}{\partial y} = 2y, \quad \frac{\partial N}{\partial x} = 2y \quad \checkmark$$

The equation is exact.

Step 2: Integrate $M$ with respect to $x$

$$F(x,y) = \int (y^2 + \ln x)\,dx = xy^2 + x\ln x - x + g(y)$$

(Note: $\int \ln x\,dx = x\ln x - x$ by integration by parts)

Step 3: Differentiate with respect to $y$ and find $g(y)$

$$\frac{\partial F}{\partial y} = 2xy + g'(y) = N = 2xy - 3$$

Thus, $g'(y) = -3$, so $g(y) = -3y$.

Step 4: Write the general solution

$$\boxed{xy^2 + x\ln x - x - 3y = C}$$

Interactive Exactness Checker & Visualizer

Geometric Interpretation: 3D Surface and Level Curves

Below is a 3D visualization of the potential function $F(x,y) = x^2y + 3x + 2y^2$ from Example 1. The solution curves are the level curves (contours) of this surface.

Key Observation: The gradient $\nabla F = \left(\frac{\partial F}{\partial x}, \frac{\partial F}{\partial y}\right) = (M, N)$ is always perpendicular to the level curves. This is why exact equations give such clean geometric structure.

الَّذِي خَلَقَ سَبْعَ سَمَاوَاتٍ طِبَاقًا مَا تَرَىٰ فِي خَلْقِ الرَّحْمَنِ مِنْ تَفَاوُتٍ
"He who created seven heavens in layers. You will not see any inconsistency in the creation of the Most Merciful."
— Quran 67:3

Exact equations reveal a hidden harmony — the condition ∂M/∂y = ∂N/∂x is a statement of perfect consistency. Just as creation exhibits no inconsistency, exact equations arise from systems where every part fits together in perfect balance. Recognizing this pattern is both a mathematical skill and an appreciation of the order in the universe.

Practice Problems & Quiz

Progress: 0/6

Q1: Which equation is exact?

Q2: Is $(2xy^3 + 1)\,dx + (3x^2y^2)\,dy = 0$ exact?

Q3: For the exact equation $(2xy)\,dx + (x^2)\,dy = 0$, what is $F(x,y)$?

Q4: What is the solution to $(\cos y)\,dx - (x \sin y)\,dy = 0$?

Q5: Given $F(x,y) = x^2y + y^3 = C$ with $y(0) = 1$, find $C$.

Q6: Why does $\frac{\partial M}{\partial y} = \frac{\partial N}{\partial x}$ guarantee exactness?

Quick Reference Card

Exact Equation Form

$$M(x,y)\,dx + N(x,y)\,dy = 0$$

Exactness Test

$$\frac{\partial M}{\partial y} = \frac{\partial N}{\partial x} \quad \Rightarrow \text{ exact}$$

Solution Method

  1. Check exactness
  2. Find $F = \int M\,dx + g(y)$
  3. Compute $\frac{\partial F}{\partial y}$ and set equal to $N$ to find $g'(y)$
  4. Integrate to get $g(y)$
  5. Solution: $F(x,y) = C$

Key Theorems

Clairaut's Theorem: If $\frac{\partial^2 F}{\partial x \partial y}$ and $\frac{\partial^2 F}{\partial y \partial x}$ are continuous, they are equal.

Connection to Calculus III

$M\,dx + N\,dy$ is a conservative vector field if and only if $\frac{\partial M}{\partial y} = \frac{\partial N}{\partial x}$.