Differential EquationsSolving First-Order Equations6 of 7
Solving First-Order Equations · 6

Exact Equations

We need a way to solve differential equations like (2xy) dx+(x2+2y) dy=0\xpiece{(2xy)\,dx} + \ypiece{(x^2 + 2y)\,dy} = 0, where xx and yy cannot be separated and the equation is not linear.

1

Level curves and zero height change

Before solving the differential equation, let's look at the kind of curve its solution comes from: a level curve, which is the path in the x,yx, y plane where a 3D surface stays at a constant height. For the surface x2y+y2\func{x^2y + y^2} sliced at height 5\func{5}, the level curve is:

x2y+y2\displaystyle \func{x^2y + y^2} =5\displaystyle = \func{5}

Walking along this curve keeps our height fixed at 5\func{5}, which links a small step (dx,dy)(\xpiece{dx}, \ypiece{dy}) in the x,yx, y plane directly to the slopes of the surface.

Level curves and zero height change
x2y+y2=5\htmlClass{lc-green}{x^2y + y^2} = \htmlClass{lc-green}{5}
xx
yy
dx\htmlClass{lc-blue}{dx}
dy\htmlClass{lc-orange}{dy}
change in height=  ?\text{change in height} = \;?

When we take a derivative with respect to one variable while holding the other variable fixed as a constant, we write ∂\oper{\partial} instead of dd. Adding the height change from the xx step (shown in blue) and the height change from the yy step (shown in orange) gives the differential form of the level curve:

(2xy)⏟∂∂x(x2y+y2)dx+(x2+2y)⏟∂∂y(x2y+y2)dy\displaystyle \underbrace{\xpiece{(2xy)}}_{\oper{\frac{\scriptstyle\partial}{\scriptstyle\partial x}}\func{(x^2y + y^2)}} \xpiece{dx} + \underbrace{\ypiece{(x^2 + 2y)}}_{\oper{\frac{\scriptstyle\partial}{\scriptstyle\partial y}}\func{(x^2y + y^2)}} \ypiece{dy} =0\displaystyle = 0

Dividing both sides by dx\xpiece{dx} writes the exact same zero-height-change condition using the slope dydx\frac{\ypiece{dy}}{\xpiece{dx}}:

2xy+(x2+2y)dydx\displaystyle \xpiece{2xy} + \ypiece{(x^2 + 2y)}\frac{\ypiece{dy}}{\xpiece{dx}} =0\displaystyle = 0

On the level curve x2y+y2=5\func{x^2y + y^2} = \func{5}, any small step (dx,dy)(\xpiece{dx}, \ypiece{dy}) along the curve makes the height changes (2xy) dx\xpiece{(2xy)\,dx} and (x2+2y) dy\ypiece{(x^2 + 2y)\,dy} equal and opposite, so they cancel out and keep the height at 5\func{5}.

A step stays on the level curve only when the height changes from its horizontal and vertical parts cancel each other out.
2

Solving an exact equation by rebuilding the surface

Now suppose we are given the differential equation on its own and asked to find the curves that solve it:

(2xy) dx+(x2+2y) dy\displaystyle \xpiece{(2xy)\,dx} + \ypiece{(x^2 + 2y)\,dy} =0\displaystyle = 0

When the dx\xpiece{dx} piece and the dy\ypiece{dy} piece are the xx and yy derivatives of a single surface, the equation is called an exact equation, and we solve it by undoing those derivatives to rebuild the surface.

Solving an exact equation by rebuilding the surface
(2xy) dx+(x2+2y) dy=0Function=  ?\displaystyle \begin{aligned}\xpiece{(2xy)\,dx} + \ypiece{(x^2 + 2y)\,dy} &= 0\\[6pt]\func{\text{Function}} &= \;?\end{aligned}
Text solution
Integrate the dx\xpiece{dx} piece with respect to xxHolding yy constant recovers the terms containing xx, while any term made purely of yy that disappeared during differentiation becomes an unknown function g(y)\func{g(y)}:
Function\displaystyle \func{\text{Function}} =∫2xy dx\displaystyle = \oper{\int} \xpiece{2xy}\,\oper{dx} =x2y+g(y)\displaystyle = \func{x^2y + g(y)}
Take the yy derivative and match it to the dy\ypiece{dy} pieceDifferentiating our expression with respect to yy while holding xx constant must match the dy\ypiece{dy} piece x2+2y\ypiece{x^2 + 2y}:
∂∂y(x2y+g(y))=x2+2yx2+g′(y)=x2+2yg′(y)=2y\displaystyle \begin{aligned} \oper{\frac{\partial}{\partial y}}\bigl(\func{x^2y + g(y)}\bigr) &= \ypiece{x^2 + 2y} \\ \ypiece{x^2 + g'(y)} &= \ypiece{x^2 + 2y} \\ \ypiece{g'(y)} &= \ypiece{2y} \end{aligned}
Integrate g′(y)\ypiece{g'(y)} with respect to yy and set the function equal to C\func{C}Undoing the yy derivative recovers the pure-yy term, and slicing the rebuilt surface at any constant height C\func{C} gives the solution curves:
g(y)=∫2y dy=y2x2y+y2=C\displaystyle \begin{aligned} \func{g(y)} &= \oper{\int} \ypiece{2y}\,\oper{dy} = \func{y^2} \\ \func{x^2y + y^2} &= \func{C} \end{aligned}

So the solutions are all the level curves where the surface x2y+y2\func{x^2y + y^2} stays at a constant height C\func{C}.

3

The exactness test

If we change a single number in our equation, the rebuilding method runs into a contradiction:

(3xy) dx+(x2+2y) dy\displaystyle \xpiece{(3xy)\,dx} + \ypiece{(x^2 + 2y)\,dy} =0\displaystyle = 0

Before integrating, we need a quick test to tell whether the dx\xpiece{dx} and dy\ypiece{dy} pieces actually come from the same 3D surface.

The exactness test
(3xy) dx+(x2+2y) dy\displaystyle \xpiece{(3xy)\,dx} + \ypiece{(x^2 + 2y)\,dy} =0\displaystyle = 0
exact?\displaystyle \text{exact?}

For any differential equation written in the form

M⏟dx piece dx+N⏟dy piece dy\displaystyle \underbrace{\xpiece{M}}_{\text{dx piece}}\,\xpiece{dx} + \underbrace{\ypiece{N}}_{\text{dy piece}}\,\ypiece{dy} =0\displaystyle = 0

the two pieces come from the same smooth surface if and only if taking the opposite derivative of each piece gives the same result:

∂M∂y⏟My\displaystyle \underbrace{\frac{\oper{\partial} \xpiece{M}}{\oper{\partial y}}}_{\xpiece{M_y}} =∂N∂x⏟Nx\displaystyle = \underbrace{\frac{\oper{\partial} \ypiece{N}}{\oper{\partial x}}}_{\ypiece{N_x}}

Here the subscript in My\xpiece{M_y} tells us which variable we are differentiating with respect to while holding the other variable fixed.

On our original equation (2xy) dx+(x2+2y) dy=0\xpiece{(2xy)\,dx} + \ypiece{(x^2 + 2y)\,dy} = 0, the opposite derivatives match:

My=∂∂y(2xy)=2x,Nx=∂∂x(x2+2y)=2x\displaystyle \begin{aligned} \xpiece{M_y} &= \oper{\frac{\partial}{\partial y}}\xpiece{(2xy)} = \xpiece{2x}, \\ \ypiece{N_x} &= \oper{\frac{\partial}{\partial x}}\ypiece{(x^2 + 2y)} = \ypiece{2x} \end{aligned}

On the changed equation (3xy) dx+(x2+2y) dy=0\xpiece{(3xy)\,dx} + \ypiece{(x^2 + 2y)\,dy} = 0, the opposite derivatives disagree, telling us right away that no single surface has both slopes:

My\displaystyle \xpiece{M_y} =∂∂y(3xy)\displaystyle = \oper{\frac{\partial}{\partial y}}\xpiece{(3xy)} =3x≠Nx\displaystyle = \xpiece{3x} \neq \ypiece{N_x} =∂∂x(x2+2y)\displaystyle = \oper{\frac{\partial}{\partial x}}\ypiece{(x^2 + 2y)} =2x\displaystyle = \ypiece{2x}

Around a tiny dx\xpiece{dx}-by-dy\ypiece{dy} square, stepping dx\xpiece{dx} then dy\ypiece{dy} must reach the same height as stepping dy\ypiece{dy} then dx\xpiece{dx}. That happens when My=Nx\xpiece{M_y} = \ypiece{N_x}, so the exact slopes (2xy,x2+2y)(\xpiece{2xy}, \ypiece{x^2 + 2y}) fit a smooth surface patch, while the changed slopes (3xy,x2+2y)(\xpiece{3xy}, \ypiece{x^2 + 2y}) leave a height gap that no surface can fit.

Stepping around any small square in either order lands at the same corner height and forms a smooth surface patch only when the two slopes change at matching rates.
4

Rewriting an equation and using an initial condition

An exact equation often starts out solved for dydx\frac{\ypiece{dy}}{\xpiece{dx}} as a fraction, paired with a starting point that picks out one specific level curve:

dydx\displaystyle \frac{\ypiece{dy}}{\xpiece{dx}} =−2xy−3x2x2+4y3,y(1)\displaystyle = \frac{\xpiece{-2xy - 3x^2}}{\ypiece{x^2 + 4y^3}}, \qquad y(1) =1\displaystyle = 1

To test for exactness and rebuild the surface, we first clear the fraction and move every term to one side so the equation equals zero.

Rewriting an equation and using an initial condition
dydx=−2xy−3x2x2+4y3y(1)=1level curve=  ?\displaystyle \begin{aligned}\frac{\ypiece{dy}}{\xpiece{dx}} &= \frac{\xpiece{-2xy - 3x^2}}{\ypiece{x^2 + 4y^3}}\\[8pt]y(1) &= 1\\[6pt]\text{level curve} &= \;?\end{aligned}
Text solution
Clear the denominator and move all terms to one sideMultiplying by x2+4y3\ypiece{x^2 + 4y^3} and dx\xpiece{dx} puts the equation into M dx+N dy=0\xpiece{M\,dx} + \ypiece{N\,dy} = 0 form:
(x2+4y3) dy\displaystyle \ypiece{(x^2 + 4y^3)\,dy} =(−2xy−3x2) dx\displaystyle = \xpiece{(-2xy - 3x^2)\,dx}
(2xy+3x2) dx+(x2+4y3) dy\displaystyle \xpiece{(2xy + 3x^2)\,dx} + \ypiece{(x^2 + 4y^3)\,dy} =0\displaystyle = 0
Check that the opposite derivatives matchDifferentiating M\xpiece{M} with respect to yy and N\ypiece{N} with respect to xx confirms the equation is exact:
My=∂∂y(2xy+3x2)=2x,Nx=∂∂x(x2+4y3)=2x\displaystyle \begin{aligned} \xpiece{M_y} &= \oper{\frac{\partial}{\partial y}}\xpiece{(2xy + 3x^2)} = \xpiece{2x}, \\ \ypiece{N_x} &= \oper{\frac{\partial}{\partial x}}\ypiece{(x^2 + 4y^3)} = \ypiece{2x} \end{aligned}
Integrate the dx\xpiece{dx} piece with respect to xxHolding yy constant recovers the xx terms and adds g(y)\func{g(y)} for any pure-yy terms:
Function\displaystyle \func{\text{Function}} =∫(2xy+3x2) dx\displaystyle = \oper{\int} \xpiece{(2xy + 3x^2)}\,\oper{dx} =x2y+x3+g(y)\displaystyle = \func{x^2y + x^3 + g(y)}
Take the yy derivative and match it to the dy\ypiece{dy} pieceSetting the yy derivative of our function equal to N\ypiece{N} cancels x2x^2 on both sides and leaves g′(y)\ypiece{g'(y)} in terms of yy alone:
∂∂y(x2y+x3+g(y))=x2+4y3x2+g′(y)=x2+4y3g′(y)=4y3g(y)=∫4y3 dy=y4\displaystyle \begin{aligned} \oper{\frac{\partial}{\partial y}}\bigl(\func{x^2y + x^3 + g(y)}\bigr) &= \ypiece{x^2 + 4y^3} \\ \ypiece{x^2 + g'(y)} &= \ypiece{x^2 + 4y^3} \\ \ypiece{g'(y)} &= \ypiece{4y^3} \\ \func{g(y)} &= \oper{\int} \ypiece{4y^3}\,\oper{dy} \\ &= \func{y^4} \end{aligned}
Set the function equal to C\func{C} and plug in (1,1)(1, 1)Substituting x=1x = 1 and y=1y = 1 into the level-curve equation finds the slice height C\func{C}:
x2y+x3+y4=C(1)2(1)+(1)3+(1)4=C3=C\displaystyle \begin{aligned} \func{x^2y + x^3 + y^4} &= \func{C} \\ (1)^2(1) + (1)^3 + (1)^4 &= \func{C} \\ 3 &= \func{C} \end{aligned}

So the solution is the level curve x2y+x3+y4=3\func{x^2y + x^3 + y^4} = \func{3}, which we leave in this implicit form without solving for yy.

Each starting point (x0,y0)(x_0, y_0) sets the slice height C\func{C} on the surface z=x2y+x3+y4z = \func{x^2y + x^3 + y^4}, picking out the level curve through (x0,y0)(x_0, y_0) without solving for yy.

Every starting point on the floor has a height on the surface above it, and slicing the surface at that height traces the whole solution curve through the point without ever solving for y.
5

Fixing a non-exact equation with an xx-only integrating factor

Now let's take an equation that cannot be separated and also fails the exactness test:

(2y2+3x) dx+(2xy) dy\displaystyle \xpiece{(2y^2 + 3x)\,dx} + \ypiece{(2xy)\,dy} =0\displaystyle = 0

If an exact equation had a common factor divided out of both sides, the right side stayed 00 while M\xpiece{M} and N\ypiece{N} changed. We can make it exact again by multiplying the whole equation by an integrating factor μ(x)\oper{\mu(x)} that depends only on xx.

Fixing a non-exact equation with an x-only integrating factor
(2y2+3x) dx+(2xy) dy=0μ(x)=  ?\displaystyle \begin{aligned}\xpiece{(2y^2 + 3x)\,dx} + \ypiece{(2xy)\,dy} &= 0\\[6pt]\oper{\mu(x)} &= \;?\end{aligned}

An xx-only integrating factor μ(x)\oper{\mu(x)} exists whenever subtracting the opposite derivatives and dividing by N\ypiece{N} cancels yy completely, leaving a function of xx alone:

μ′μ=My−NxN(must contain x only),μ(x)=e∫(My−Nx)/N dx\displaystyle \begin{aligned} \oper{\frac{\mu'}{\mu}} &= \frac{\xpiece{M_y} - \ypiece{N_x}}{\ypiece{N}} \\ &\quad \text{(must contain } x \text{ only)}, \\ \oper{\mu(x)} &= e^{\oper{\int} (\xpiece{M_y} - \ypiece{N_x})/\ypiece{N}\,\oper{dx}} \end{aligned}
Text solution
Check the opposite derivativesDifferentiating M\xpiece{M} with respect to yy and N\ypiece{N} with respect to xx shows they do not match:
My=∂∂y(2y2+3x)=4y,Nx=∂∂x(2xy)=2y\displaystyle \begin{aligned} \xpiece{M_y} &= \oper{\frac{\partial}{\partial y}}\xpiece{(2y^2 + 3x)} = \xpiece{4y}, \\ \ypiece{N_x} &= \oper{\frac{\partial}{\partial x}}\ypiece{(2xy)} = \ypiece{2y} \end{aligned}
Test My−NxN\frac{\xpiece{M_y} - \ypiece{N_x}}{\ypiece{N}} and compute μ(x)\oper{\mu(x)}Dividing the difference by N=2xy\ypiece{N} = \ypiece{2xy} cancels yy completely, and integrating in the exponent of ee gives the multiplier:
My−NxN=4y−2y2xy=2y2xy=1xμ(x)=e∫(1/x) dx=eln⁡x=x\displaystyle \begin{aligned} \frac{\xpiece{M_y} - \ypiece{N_x}}{\ypiece{N}} &= \frac{\xpiece{4y} - \ypiece{2y}}{\ypiece{2xy}} = \frac{2y}{2xy} = \frac{1}{x} \\ \oper{\mu(x)} &= e^{\oper{\int} (1/x)\,\oper{dx}} = e^{\ln x} = \oper{x} \end{aligned}
Multiply the entire equation by μ(x)=x\oper{\mu(x)} = \oper{x} and re-check exactnessMultiplying both pieces by x\oper{x} puts back the missing factor so the new opposite derivatives match:
x(2y2+3x) dx+x(2xy) dy=0(2xy2+3x2) dx+(2x2y) dy=0\displaystyle \begin{aligned} \oper{x}\xpiece{(2y^2 + 3x)\,dx} + \oper{x}\ypiece{(2xy)\,dy} &= 0 \\ \xpiece{(2xy^2 + 3x^2)\,dx} + \ypiece{(2x^2y)\,dy} &= 0 \end{aligned}
∂∂y(2xy2+3x2)\displaystyle \oper{\frac{\partial}{\partial y}}\xpiece{(2xy^2 + 3x^2)} =4xy\displaystyle = 4xy =∂∂x(2x2y)\displaystyle = \oper{\frac{\partial}{\partial x}}\ypiece{(2x^2y)}
Rebuild the surface from the multiplied equationIntegrating the new dx\xpiece{dx} piece with respect to xx and matching its yy derivative to the new dy\ypiece{dy} piece gives g′(y)=0\ypiece{g'(y)} = 0:
Function=∫(2xy2+3x2) dx=x2y2+x3+g(y)2x2y+g′(y)=2x2yg′(y)=0g(y)=0\displaystyle \begin{aligned} \func{\text{Function}} &= \oper{\int} \xpiece{(2xy^2 + 3x^2)}\,\oper{dx} \\ &= \func{x^2y^2 + x^3 + g(y)} \\ \ypiece{2x^2y + g'(y)} &= \ypiece{2x^2y} \\ \ypiece{g'(y)} &= 0 \\ \func{g(y)} &= 0 \end{aligned}

Setting the rebuilt function equal to C\func{C} gives the level-curve solutions x2y2+x3=C\func{x^2y^2 + x^3} = \func{C}.

6

Integrating factors that depend on yy

When dividing My−Nx\xpiece{M_y} - \ypiece{N_x} by N\ypiece{N} leaves both xx and yy in the fraction, as in

(2xy) dx+(2x2+3y) dy\displaystyle \xpiece{(2xy)\,dx} + \ypiece{(2x^2 + 3y)\,dy} =0\displaystyle = 0

we test whether the missing multiplier depends only on yy instead, written μ(y)\oper{\mu(y)}.

Integrating factors that depend on y
μ(x) ⁣:μ′μ=My−NxNμ(y) ⁣:μ′μ=  ?\displaystyle \begin{alignedat}{2}&\oper{\mu(x)}\!:\quad&\frac{\oper{\mu'}}{\oper{\mu}} &= \frac{\xpiece{M_y} - \ypiece{N_x}}{\ypiece{N}}\\[10pt]&\oper{\mu(y)}\!:\quad&\frac{\oper{\mu'}}{\oper{\mu}} &= \;?\end{alignedat}

When μ\oper{\mu} depends on yy, taking the yy derivative applies the product rule to μ(y)M\oper{\mu(y)}\xpiece{M}, which flips the subtraction order in the numerator and divides by M\xpiece{M} instead of N\ypiece{N}:

μ′μ=Nx−MyM(must contain y only),μ(y)=e∫(Nx−My)/M dy\displaystyle \begin{aligned} \oper{\frac{\mu'}{\mu}} &= \frac{\ypiece{N_x} - \xpiece{M_y}}{\xpiece{M}} \\ &\quad \text{(must contain } y \text{ only)}, \\ \oper{\mu(y)} &= e^{\oper{\int} (\ypiece{N_x} - \xpiece{M_y})/\xpiece{M}\,\oper{dy}} \end{aligned}
Text solution
Check exactness and test My−NxN\frac{\xpiece{M_y} - \ypiece{N_x}}{\ypiece{N}}The opposite derivatives disagree, and dividing by N=2x2+3y\ypiece{N} = \ypiece{2x^2 + 3y} fails to cancel yy:
My=∂∂y(2xy)=2x,Nx=∂∂x(2x2+3y)=4xMy−NxN=2x−4x2x2+3y=−2x2x2+3y(still contains both xand y)\displaystyle \begin{aligned} \xpiece{M_y} &= \oper{\frac{\partial}{\partial y}}\xpiece{(2xy)} = \xpiece{2x}, \\ \ypiece{N_x} &= \oper{\frac{\partial}{\partial x}}\ypiece{(2x^2 + 3y)} = \ypiece{4x} \\ \frac{\xpiece{M_y} - \ypiece{N_x}}{\ypiece{N}} &= \frac{\xpiece{2x} - \ypiece{4x}}{\ypiece{2x^2 + 3y}} \\ &= \frac{-2x}{\ypiece{2x^2 + 3y}} \\ &\quad \text{(still contains both } x \\ &\quad \text{and } y\text{)} \end{aligned}
Test Nx−MyM\frac{\ypiece{N_x} - \xpiece{M_y}}{\xpiece{M}} and compute μ(y)\oper{\mu(y)}Dividing Nx−My\ypiece{N_x} - \xpiece{M_y} by M=2xy\xpiece{M} = \xpiece{2xy} cancels xx completely and leaves a function of yy alone:
Nx−MyM=4x−2x2xy=2x2xy=1yμ(y)=e∫(1/y) dy=eln⁡y=y\displaystyle \begin{aligned} \frac{\ypiece{N_x} - \xpiece{M_y}}{\xpiece{M}} &= \frac{\ypiece{4x} - \xpiece{2x}}{\xpiece{2xy}} = \frac{2x}{2xy} = \frac{1}{y} \\ \oper{\mu(y)} &= e^{\oper{\int} (1/y)\,\oper{dy}} = e^{\ln y} = \oper{y} \end{aligned}
Multiply the entire equation by μ(y)=y\oper{\mu(y)} = \oper{y} and verify exactnessMultiplying every term by y\oper{y} makes both opposite derivatives equal 4xy4xy:
y(2xy) dx+y(2x2+3y) dy=0(2xy2) dx+(2x2y+3y2) dy=0\displaystyle \begin{aligned} \oper{y}\xpiece{(2xy)\,dx} + \oper{y}\ypiece{(2x^2 + 3y)\,dy} &= 0 \\ \xpiece{(2xy^2)\,dx} + \ypiece{(2x^2y + 3y^2)\,dy} &= 0 \end{aligned}
∂∂y(2xy2)\displaystyle \oper{\frac{\partial}{\partial y}}\xpiece{(2xy^2)} =4xy\displaystyle = 4xy =∂∂x(2x2y+3y2)\displaystyle = \oper{\frac{\partial}{\partial x}}\ypiece{(2x^2y + 3y^2)}
Rebuild the surface from the multiplied equationIntegrating the new dx\xpiece{dx} piece with respect to xx and matching its yy derivative to the new dy\ypiece{dy} piece recovers the missing y3\func{y^3} term:
Function=∫2xy2 dx=x2y2+g(y)2x2y+g′(y)=2x2y+3y2g′(y)=3y2g(y)=∫3y2 dy=y3\displaystyle \begin{aligned} \func{\text{Function}} &= \oper{\int} \xpiece{2xy^2}\,\oper{dx} \\ &= \func{x^2y^2 + g(y)} \\ \ypiece{2x^2y + g'(y)} &= \ypiece{2x^2y + 3y^2} \\ \ypiece{g'(y)} &= \ypiece{3y^2} \\ \func{g(y)} &= \oper{\int} \ypiece{3y^2}\,\oper{dy} = \func{y^3} \end{aligned}

Setting the rebuilt function equal to C\func{C} gives the level-curve solutions x2y2+y3=C\func{x^2y^2 + y^3} = \func{C}.

Key concepts

Before testing for exactness, check whether the variables already separate: an equation like (2x) dx+(3y2) dy=0\xpiece{(2x)\,dx} + \ypiece{(3y^2)\,dy} = 0 integrates term-by-term right away, whereas a sum like x2+2y\ypiece{x^2 + 2y} inside (2xy) dx+(x2+2y) dy=0\xpiece{(2xy)\,dx} + \ypiece{(x^2 + 2y)\,dy} = 0 keeps xx and yy added together so we cannot separate them.

To solve an equation where xx and yy cannot be separated, clear any fractions and move all terms to one side so it reads M dx+N dy=0\xpiece{M\,dx} + \ypiece{N\,dy} = 0, then check the opposite derivatives:

Exact right away (My=Nx\xpiece{M_y} = \ypiece{N_x})

In (2xy) dx+(x2+2y) dy=0\xpiece{(2xy)\,dx} + \ypiece{(x^2 + 2y)\,dy} = 0, both My\xpiece{M_y} and Nx\ypiece{N_x} equal 2x2x. Rebuild the surface by integrating M\xpiece{M} with respect to xx to get ∫2xy dx=x2y+g(y)\oper{\int} \xpiece{2xy}\,\oper{dx} = \func{x^2y + g(y)}, differentiating with respect to yy to match N\ypiece{N} (x2+g′(y)=x2+2y  ⟹  g(y)=y2\ypiece{x^2 + g'(y)} = \ypiece{x^2 + 2y} \implies \func{g(y)} = \func{y^2}), and setting the completed function equal to a constant height: x2y+y2=C\func{x^2y + y^2} = \func{C}.

Needs an xx-only multiplier (My≠Nx\xpiece{M_y} \neq \ypiece{N_x}, and My−NxN\frac{\xpiece{M_y} - \ypiece{N_x}}{\ypiece{N}} cancels yy)

In (2y2+3x) dx+(2xy) dy=0\xpiece{(2y^2 + 3x)\,dx} + \ypiece{(2xy)\,dy} = 0, dividing by the single-term piece N=2xy\ypiece{N} = \ypiece{2xy} gives 4y−2y2xy=1x\frac{\xpiece{4y} - \ypiece{2y}}{\ypiece{2xy}} = \frac{1}{x}. Multiply the whole equation by μ(x)=e∫(1/x) dx=x\oper{\mu(x)} = e^{\oper{\int} (1/x)\,\oper{dx}} = \oper{x} before rebuilding the surface.

Needs a yy-only multiplier (My≠Nx\xpiece{M_y} \neq \ypiece{N_x}, and Nx−MyM\frac{\ypiece{N_x} - \xpiece{M_y}}{\xpiece{M}} cancels xx)

In (2xy) dx+(2x2+3y) dy=0\xpiece{(2xy)\,dx} + \ypiece{(2x^2 + 3y)\,dy} = 0, dividing by the single-term piece M=2xy\xpiece{M} = \xpiece{2xy} gives 4x−2x2xy=1y\frac{\ypiece{4x} - \xpiece{2x}}{\xpiece{2xy}} = \frac{1}{y}. Multiply the whole equation by μ(y)=e∫(1/y) dy=y\oper{\mu(y)} = e^{\oper{\int} (1/y)\,\oper{dy}} = \oper{y} before rebuilding the surface.

Initial condition y(x0)=y0y(x_0) = y_0

Plug (x0,y0)(x_0, y_0) directly into your final equation Function=C\func{\text{Function}} = \func{C} to find the number C\func{C}, and leave the curve in implicit form.

7

Practice

1

Solve (2xy+4x) dx+(x2−3y2) dy=0\xpiece{(2xy + 4x)\,dx} + \ypiece{(x^2 - 3y^2)\,dy} = 0.

Check My\xpiece{M_y} and Nx\ypiece{N_x} first; after integrating the dx\xpiece{dx} piece with respect to xx, what stands in for the pure-yy terms that disappeared when taking the xx derivative?

Check the opposite derivatives:
My=∂∂y(2xy+4x)=2x,Nx=∂∂x(x2−3y2)=2x\displaystyle \begin{aligned} \xpiece{M_y} &= \oper{\frac{\partial}{\partial y}}\xpiece{(2xy + 4x)} = \xpiece{2x}, \\ \ypiece{N_x} &= \oper{\frac{\partial}{\partial x}}\ypiece{(x^2 - 3y^2)} = \ypiece{2x} \end{aligned}
Since My=Nx\xpiece{M_y} = \ypiece{N_x}, the equation is exact. Integrate the dx\xpiece{dx} piece with respect to xx:
Function\displaystyle \func{\text{Function}} =∫(2xy+4x) dx\displaystyle = \oper{\int} \xpiece{(2xy + 4x)}\,\oper{dx} =x2y+2x2+g(y)\displaystyle = \func{x^2y + 2x^2 + g(y)}
Differentiate with respect to yy and match to the dy\ypiece{dy} piece:
x2+g′(y)=x2−3y2g′(y)=−3y2g(y)=∫(−3y2) dy=−y3\displaystyle \begin{aligned} \ypiece{x^2 + g'(y)} &= \ypiece{x^2 - 3y^2} \\ \ypiece{g'(y)} &= \ypiece{-3y^2} \\ \func{g(y)} &= \oper{\int} \ypiece{(-3y^2)}\,\oper{dy} = \func{-y^3} \end{aligned}
Watch out: If you instead integrate both pieces separately, getting x2y+2x2\func{x^2y + 2x^2} from M\xpiece{M} and x2y−y3\func{x^2y - y^3} from N\ypiece{N}, remember that x2y\func{x^2y} is the same shared term seen from both directions; adding it twice gives the wrong answer 2x2y+2x2−y3=C2x^2y + 2x^2 - y^3 = C (and leaving off =C= C writes only the surface x2y+2x2−y3\func{x^2y + 2x^2 - y^3}).
Set the completed function equal to C\func{C}:
x2y+2x2−y3\displaystyle \func{x^2y + 2x^2 - y^3} =C\displaystyle = \func{C}
2

Solve dydx=−3x2y−2xx3+2y\frac{dy}{dx} = \frac{-3x^2y - 2x}{x^3 + 2y} with y(1)=2y(1) = 2.

Multiply by the denominator and move everything to one side so the equation equals 00 before checking My\xpiece{M_y} and Nx\ypiece{N_x}.

Clear the fraction and move all terms to the left side:
(x3+2y) dy=(−3x2y−2x) dx(3x2y+2x) dx+(x3+2y) dy=0\displaystyle \begin{aligned} \ypiece{(x^3 + 2y)\,dy} &= \xpiece{(-3x^2y - 2x)\,dx} \\ \xpiece{(3x^2y + 2x)\,dx} + \ypiece{(x^3 + 2y)\,dy} &= 0 \end{aligned}
Watch out: Moving (−3x2y−2x) dx\xpiece{(-3x^2y - 2x)\,dx} to the left side without flipping its signs gives (−3x2y−2x) dx+(x3+2y) dy=0\xpiece{(-3x^2y - 2x)\,dx} + \ypiece{(x^3 + 2y)\,dy} = 0, where My=−3x2≠Nx=3x2\xpiece{M_y} = \xpiece{-3x^2} \neq \ypiece{N_x} = \ypiece{3x^2} makes an exact equation look non-exact (or leads to −x3y−x2+y2=1-x^3y - x^2 + y^2 = 1).
Check the opposite derivatives:
My=∂∂y(3x2y+2x)=3x2,Nx=∂∂x(x3+2y)=3x2\displaystyle \begin{aligned} \xpiece{M_y} &= \oper{\frac{\partial}{\partial y}}\xpiece{(3x^2y + 2x)} = \xpiece{3x^2}, \\ \ypiece{N_x} &= \oper{\frac{\partial}{\partial x}}\ypiece{(x^3 + 2y)} = \ypiece{3x^2} \end{aligned}
Integrate the dx\xpiece{dx} piece with respect to xx:
Function\displaystyle \func{\text{Function}} =∫(3x2y+2x) dx\displaystyle = \oper{\int} \xpiece{(3x^2y + 2x)}\,\oper{dx} =x3y+x2+g(y)\displaystyle = \func{x^3y + x^2 + g(y)}
Differentiate with respect to yy and match to the dy\ypiece{dy} piece:
x3+g′(y)=x3+2yg′(y)=2yg(y)=∫2y dy=y2\displaystyle \begin{aligned} \ypiece{x^3 + g'(y)} &= \ypiece{x^3 + 2y} \\ \ypiece{g'(y)} &= \ypiece{2y} \\ \func{g(y)} &= \oper{\int} \ypiece{2y}\,\oper{dy} = \func{y^2} \end{aligned}
Set the function equal to C\func{C} and substitute x=1,y=2x = 1, y = 2:
x3y+x2+y2=C(1)3(2)+(1)2+(2)2=C7=C\displaystyle \begin{aligned} \func{x^3y + x^2 + y^2} &= \func{C} \\ (1)^3(2) + (1)^2 + (2)^2 &= \func{C} \\ 7 &= \func{C} \end{aligned}
Watch out: Swapping the coordinates in y(1)=2y(1) = 2 and plugging in x=2,y=1x = 2, y = 1 gives C=(2)3(1)+(2)2+(1)2=13C = (2)^3(1) + (2)^2 + (1)^2 = 13 and the wrong curve x3y+x2+y2=13x^3y + x^2 + y^2 = 13.
x3y+x2+y2\displaystyle \func{x^3y + x^2 + y^2} =7\displaystyle = \func{7}
3

Solve (3xy+2y2) dx+(x2+2xy) dy=0\xpiece{(3xy + 2y^2)\,dx} + \ypiece{(x^2 + 2xy)\,dy} = 0.

When My\xpiece{M_y} and Nx\ypiece{N_x} do not match, factor xx out of N=x2+2xy\ypiece{N} = \ypiece{x^2 + 2xy} to see how My−Nx\xpiece{M_y} - \ypiece{N_x} simplifies.

Check the opposite derivatives:
My=∂∂y(3xy+2y2)=3x+4y,Nx=∂∂x(x2+2xy)=2x+2y\displaystyle \begin{aligned} \xpiece{M_y} &= \oper{\frac{\partial}{\partial y}}\xpiece{(3xy + 2y^2)} = \xpiece{3x + 4y}, \\ \ypiece{N_x} &= \oper{\frac{\partial}{\partial x}}\ypiece{(x^2 + 2xy)} = \ypiece{2x + 2y} \end{aligned}
Since My≠Nx\xpiece{M_y} \neq \ypiece{N_x}, test for an xx-only integrating factor by dividing My−Nx\xpiece{M_y} - \ypiece{N_x} by N\ypiece{N}:
My−NxN=(3x+4y)−(2x+2y)x2+2xy=x+2yx(x+2y)=1xμ(x)=e∫(1/x) dx=eln⁡x=x\displaystyle \begin{aligned} \frac{\xpiece{M_y} - \ypiece{N_x}}{\ypiece{N}} &= \frac{\xpiece{(3x + 4y)} - \ypiece{(2x + 2y)}}{\ypiece{x^2 + 2xy}} = \frac{x + 2y}{x(x + 2y)} = \frac{1}{x} \\ \oper{\mu(x)} &= e^{\oper{\int} (1/x)\,\oper{dx}} = e^{\ln x} = \oper{x} \end{aligned}
Multiply the entire equation by μ(x)=x\oper{\mu(x)} = \oper{x}:
(3x2y+2xy2) dx+(x3+2x2y) dy\displaystyle \xpiece{(3x^2y + 2xy^2)\,dx} + \ypiece{(x^3 + 2x^2y)\,dy} =0\displaystyle = 0
Watch out: Forgetting to multiply the original equation by μ(x)=x\oper{\mu(x)} = \oper{x} before integrating (and integrating the old dx\xpiece{dx} piece 3xy+2y2\xpiece{3xy + 2y^2} instead) gives the wrong answer 32x2y+2xy2=C\frac{3}{2}x^2y + 2xy^2 = C.
Integrate the new dx\xpiece{dx} piece with respect to xx and match its yy derivative to the new dy\ypiece{dy} piece:
Function=∫(3x2y+2xy2) dx=x3y+x2y2+g(y)x3+2x2y+g′(y)=x3+2x2yg′(y)=0g(y)=0\displaystyle \begin{aligned} \func{\text{Function}} &= \oper{\int} \xpiece{(3x^2y + 2xy^2)}\,\oper{dx} = \func{x^3y + x^2y^2 + g(y)} \\ \ypiece{x^3 + 2x^2y + g'(y)} &= \ypiece{x^3 + 2x^2y} \\ \ypiece{g'(y)} &= 0 \\ \func{g(y)} &= 0 \end{aligned}
x3y+x2y2\displaystyle \func{x^3y + x^2y^2} =C\displaystyle = \func{C}
4

Solve (2xy) dx+(3x2+4y) dy=0\xpiece{(2xy)\,dx} + \ypiece{(3x^2 + 4y)\,dy} = 0.

Compare M=2xy\xpiece{M} = \xpiece{2xy} and N=3x2+4y\ypiece{N} = \ypiece{3x^2 + 4y}: dividing the difference of the derivatives by which piece will cancel xx out completely?

Check the opposite derivatives:
My=∂∂y(2xy)=2x,Nx=∂∂x(3x2+4y)=6x\displaystyle \begin{aligned} \xpiece{M_y} &= \oper{\frac{\partial}{\partial y}}\xpiece{(2xy)} = \xpiece{2x}, \\ \ypiece{N_x} &= \oper{\frac{\partial}{\partial x}}\ypiece{(3x^2 + 4y)} = \ypiece{6x} \end{aligned}
Since My≠Nx\xpiece{M_y} \neq \ypiece{N_x} and M=2xy\xpiece{M} = \xpiece{2xy} is a single term, test for a yy-only integrating factor using Nx−MyM\frac{\ypiece{N_x} - \xpiece{M_y}}{\xpiece{M}}:
Nx−MyM\displaystyle \frac{\ypiece{N_x} - \xpiece{M_y}}{\xpiece{M}} =6x−2x2xy\displaystyle = \frac{\ypiece{6x} - \xpiece{2x}}{\xpiece{2xy}} =4x2xy\displaystyle = \frac{4x}{2xy} =2y\displaystyle = \frac{2}{y}
Watch out: Using My−Nx\xpiece{M_y} - \ypiece{N_x} instead of Nx−My\ypiece{N_x} - \xpiece{M_y} when dividing by M\xpiece{M} flips the sign to −2y-\frac{2}{y}, giving μ(y)=y−2\oper{\mu(y)} = y^{-2} instead of y2\oper{y^2}, and the multiplied equation still fails the exactness test: My=−2xy2\xpiece{M_y} = \xpiece{-\frac{2x}{y^2}} but Nx=6xy2\ypiece{N_x} = \ypiece{\frac{6x}{y^2}}.
Find μ(y)\oper{\mu(y)} and multiply the entire equation by y2\oper{y^2}:
μ(y)=e∫(2/y) dy=e2ln⁡y=y2(2xy3) dx+(3x2y2+4y3) dy=0\displaystyle \begin{aligned} \oper{\mu(y)} &= e^{\oper{\int} (2/y)\,\oper{dy}} = e^{2\ln y} = \oper{y^2} \\ \xpiece{(2xy^3)\,dx} + \ypiece{(3x^2y^2 + 4y^3)\,dy} &= 0 \end{aligned}
Integrate the new dx\xpiece{dx} piece with respect to xx and match its yy derivative to the new dy\ypiece{dy} piece:
Function=∫2xy3 dx=x2y3+g(y)3x2y2+g′(y)=3x2y2+4y3g′(y)=4y3g(y)=∫4y3 dy=y4\displaystyle \begin{aligned} \func{\text{Function}} &= \oper{\int} \xpiece{2xy^3}\,\oper{dx} = \func{x^2y^3 + g(y)} \\ \ypiece{3x^2y^2 + g'(y)} &= \ypiece{3x^2y^2 + 4y^3} \\ \ypiece{g'(y)} &= \ypiece{4y^3} \\ \func{g(y)} &= \oper{\int} \ypiece{4y^3}\,\oper{dy} \\ &= \func{y^4} \end{aligned}
x2y3+y4\displaystyle \func{x^2y^3 + y^4} =C\displaystyle = \func{C}
5

Solve (y2+2ex)+2ydydx=0(y^2 + 2e^x) + 2y\frac{dy}{dx} = 0 with y(0)=1y(0) = 1.

Multiply through by dx\xpiece{dx} to find M\xpiece{M} and N\ypiece{N}, then check whether My−Nx\xpiece{M_y} - \ypiece{N_x} divides cleanly by N=2y\ypiece{N} = \ypiece{2y}.

Multiply by dx\xpiece{dx} and check the opposite derivatives:
(y2+2ex) dx+(2y) dy=0My=∂∂y(y2+2ex)=2y,Nx=∂∂x(2y)=0\displaystyle \begin{aligned} \xpiece{(y^2 + 2e^x)\,dx} + \ypiece{(2y)\,dy} &= 0 \\ \xpiece{M_y} = \oper{\frac{\partial}{\partial y}}\xpiece{(y^2 + 2e^x)} &= \xpiece{2y}, \qquad \ypiece{N_x} = \oper{\frac{\partial}{\partial x}}\ypiece{(2y)} = \ypiece{0} \end{aligned}
Since My≠Nx\xpiece{M_y} \neq \ypiece{N_x}, divide My−Nx\xpiece{M_y} - \ypiece{N_x} by N=2y\ypiece{N} = \ypiece{2y} to find μ(x)\oper{\mu(x)}:
My−NxN=2y−02y=1μ(x)=e∫1 dx=ex\displaystyle \begin{aligned} \frac{\xpiece{M_y} - \ypiece{N_x}}{\ypiece{N}} &= \frac{\xpiece{2y} - \ypiece{0}}{\ypiece{2y}} = 1 \\ \oper{\mu(x)} &= e^{\oper{\int} 1\,\oper{dx}} = \oper{e^x} \end{aligned}
Multiply the entire equation by μ(x)=ex\oper{\mu(x)} = \oper{e^x}:
(exy2+2e2x) dx+(2exy) dy\displaystyle \xpiece{(e^xy^2 + 2e^{2x})\,dx} + \ypiece{(2e^xy)\,dy} =0\displaystyle = 0
Watch out: When multiplying 2ex\xpiece{2e^x} by ex\oper{e^x}, add the exponents to get 2e2x\xpiece{2e^{2x}} (which integrates to e2x\func{e^{2x}}); leaving that term as 2ex2e^x gives the wrong curve exy2+2ex=3e^xy^2 + 2e^x = 3.
Integrate the new dx\xpiece{dx} piece with respect to xx and match its yy derivative to the new dy\ypiece{dy} piece:
Function=∫(exy2+2e2x) dx=exy2+e2x+g(y)2exy+g′(y)=2exyg′(y)=0g(y)=0\displaystyle \begin{aligned} \func{\text{Function}} &= \oper{\int} \xpiece{(e^xy^2 + 2e^{2x})}\,\oper{dx} = \func{e^xy^2 + e^{2x} + g(y)} \\ \ypiece{2e^xy + g'(y)} &= \ypiece{2e^xy} \\ \ypiece{g'(y)} &= 0 \\ \func{g(y)} &= 0 \end{aligned}
Set the function equal to C\func{C} and plug in x=0,y=1x = 0, y = 1:
exy2+e2x=Ce0(1)2+e2(0)=C1+1=C2=C\displaystyle \begin{aligned} \func{e^xy^2 + e^{2x}} &= \func{C} \\ e^0(1)^2 + e^{2(0)} &= \func{C} \\ 1 + 1 &= \func{C} \\ 2 &= \func{C} \end{aligned}
Watch out: Treating e0e^0 as 00 instead of 11 when substituting x=0x = 0 gives C=0C = 0 and the wrong answer exy2+e2x=0e^xy^2 + e^{2x} = 0.
exy2+e2x\displaystyle \func{e^xy^2 + e^{2x}} =2\displaystyle = \func{2}