← Back to Math 055

2.4 Exact Equations: Class Notes

2.4a

A partial derivative is an ordinary derivative holding all but one variable constant.

Computation and notation: for f(x,y)=x2y3,

fx=∂f∂x=2xy3fy=∂f∂y=3x2y2

Here fx treats y as a constant, and fy treats x as a constant. Taking one more partial derivative:

fxy=∂2f∂y∂x=6xy2fyx=6xy2

The second mixed partial derivatives are equal: fxy=fyx.

Recall

For y=f(x), dydx=f′(x) (rise over run), so dy=f′(x)dx. This is the differential of y.

Now, for z=f(x,y),

dz=fxdx+fydy

This is the full differential of z, or the exact differential.

Consider f(x,y)=C as a level curve of a surface. For example, if f(x,y)=x2+y2, then z=f(x,y)=C becomes x2+y2=C, a circle of radius C. Each such circle is a level curve of the surface z=x2+y2:

Paraboloid z = x squared + y squared with the level curves at z = 1 and z = 4

The bowl-shaped surface z=x2+y2. Horizontal slices at z=1 and z=4 are circles; projected down to the xy-plane (dashed) they are the level curves x2+y2=1 and x2+y2=4.

For the level curve f(x,y)=C, the (full) exact differential is

fxdx+fydy=0

For our work, we will consider

Mdx+Ndy=0,

the solution to which is f(x,y)=C. So M plays the role of fx and N plays the role of fy:

f(x,y)↙ ∂∂x∂∂y ↘fx=MN=fy

In a problem, M and N are the starting point, and we look for f (for instance, f(x,y)=∫Mdx). Since the mixed partials of f are equal, if such an f exists then

fxy=My=Nx=fyx

This is the test for exactness: Mdx+Ndy=0 is exact when My=Nx.

2.4b

Example

Determine whether the given differential equation is exact. If it is exact, solve it.

(sin⁡y−ysin⁡x)dx+(cos⁡x+xcos⁡y−y)dy=0

Solution

If My=Nx, then Mdx+Ndy=0 is exact. Here

M=sin⁡y−ysin⁡x,N=cos⁡x+xcos⁡y−y

My=cos⁡y−sin⁡x,Nx=−sin⁡x+cos⁡y

These are equal, so the equation is exact. Integrate M with respect to x:

f(x,y)=∫Mdx=∫(sin⁡y−ysin⁡x)dx=xsin⁡y+ycos⁡x+h(y)

Tip: The "constant" of integration is a function h(y), because y is constant with respect to x.

Now use fy=N: differentiate with respect to y and set it equal to N:

xcos⁡y+cos⁡x+h′(y)=cos⁡x+xcos⁡y−y

The terms xcos⁡y and cos⁡x cancel, leaving

h′(y)=−y⇒h(y)=−12y2+k

f(x,y)=xsin⁡y+ycos⁡x−12y2+k

The solution has the form f(x,y)=C (the constant k is absorbed into C):

Answer: xsin⁡y+ycos⁡x−12y2=C

Example

(1+ln⁡x+yx)dx=(1−ln⁡x)dy

Solution

Put the equation in the form Mdx+Ndy=0:

(1+ln⁡x+yx)dx+(ln⁡x−1)dy=0

M=1+ln⁡x+yx,N=ln⁡x−1

My=1x,Nx=1x

These are equal, so the equation is exact. Integrating M with respect to x would need integration by parts for ln⁡x, so start with N instead:

f(x,y)=∫Ndy=∫(ln⁡x−1)dy=yln⁡x−y+g(x)

Now use M=fx:

1+ln⁡x+yx=yx+g′(x)⇒g′(x)=1+ln⁡x

For ∫ln⁡xdx, integrate by parts with u=ln⁡x, dv=dx, so du=1xdx, v=x:

g(x)=∫(1+ln⁡x)dx=x+xln⁡x−x+k=xln⁡x+k

The solution has the form f(x,y)=C:

Answer: yln⁡x−y+xln⁡x=C

Note: the form of the solution is not y=… or f(x,y)=…; it is f(x,y)=C, an implicit solution.

Aside

Starting with f=∫Mdx gives the same result:

f=x+xln⁡x−x+yln⁡x+h(y)=xln⁡x+yln⁡x+h(y)

and fy=N gives h′(y)=−1, so h(y)=−y+k.

2.4c

Example

Solve the given initial-value problem.

(ex+y)dx+(2+x+yey)dy=0,y(0)=1

Solution

Here My=1 and Nx=1, so the equation is exact. This time, integrate both M and N:

(1)f(x,y)=∫Mdx=∫(ex+y)dx=ex+xy+h(y)

(2)f(x,y)=∫Ndy=∫(2+x+yey)dy=2y+xy+∫yeydy

Integrate by parts with u=y, dv=eydy, so du=dy, v=ey: ∫yeydy=yey−ey. So

f(x,y)=2y+xy+yey−ey+g(x)

Comparing (1) and (2): the term xy appears in both; the terms with only y give h(y)=2y+yey−ey, and the term with only x gives g(x)=ex. Combining them:

2y+xy+yey−ey+ex=C

Check: fx=y+ex=M and fy=2+x+yey+ey−ey=2+x+yey=N, so fxdx+fydy=0 is (y+ex)dx+(2+x+yey)dy=0.

Use the initial condition y(0)=1: when x=0, y=1:

2+0+e−e+1=C⇒C=3

Answer: 2y+xy+yey−ey+ex=3

Example

Solve the given differential equation by finding an appropriate integrating factor.

cos⁡xdx+(1+2y)sin⁡xdy=0

Solution

My=0,Nx=(1+2y)cos⁡x

These are not equal, so the equation is not exact. The integrating factor is either

μ(x)=e∫My−NxNdxorμ(y)=e∫Nx−MyMdy

Then μMdx+μNdy=0 is exact. Try μ(x):

My−NxN=−(1+2y)cos⁡x(1+2y)sin⁡x=−cot⁡x

μ(x)=e∫−cot⁡xdx=e−ln⁡|sin⁡x|=eln⁡|sin⁡x|−1=csc⁡x

The minus sign moves into the logarithm as the exponent −1. Multiply the equation by csc⁡x:

csc⁡xcos⁡xdx+csc⁡x(1+2y)sin⁡xdy=0cot⁡xdx+(1+2y)dy=0

This is exact (now My=0=Nx). Integrate M with the substitution u=sin⁡x:

f(x,y)=∫cot⁡xdx=∫cos⁡xsin⁡xdx=∫duu=ln⁡|sin⁡x|+h(y)

Now fy=N:

h′(y)=1+2y⇒h(y)=y+2ln⁡|y|+k=y+ln⁡y2+k

Answer: ln⁡|sin⁡x|+y+ln⁡y2=C

2.4d

Where does the integrating factor come from?

We want μMdx+μNdy=0 to be exact, so we need

(μM)y=(μN)xμyM+μMy=μxN+μNxμyM−μxN=(Nx−My)μ

If μ=μ(x,y) depends on both variables, this is a partial differential equation (PDE), which is not for this class.

Suppose μ=μ(x). Then μy=0, and we have

μxμ=My−NxN⇒ln⁡μ=∫My−NxNdx⇒μ=e∫My−NxNdx

If μ=μ(y), then μx=0, and

μyμ=Nx−MyM⇒μ=e∫Nx−MyMdy