[Notes on Diffy Qs home] [PDF version] [Buy paperback on Amazon]

[next] [prev] [prev-tail] [tail] [up]

1.8 Exact equations

Note: 1–2 lectures, §1.6 in [EP], §2.6 in [BD]

Another type of equation that comes up quite often in physics and engineering is an exact equation. Suppose F(x,y) is a function of two variables, which we call the potential function. The naming should suggest potential energy, or electric potential. Exact equations and potential functions appear when there is a conservation law at play, such as conservation of energy. Let us make up a simple example. Let

 2 2 F(x,y) = x + y .


PIC

Figure 1.15: Solutions to  2 2 F(x,y) = x + y = C for various C .


We are interested in the lines of constant energy, that is lines where the energy is conserved; we want curves where F(x,y) = C , for some constant C . In our example, the curves x2 + y2 = C are circles. See Figure 1.15.

We take the total derivative of F :

 ∂F ∂F dF = ---dx + ---dy. ∂x ∂y

For convenience, we will make use of the notation of Fx = ∂F∂x and Fy = ∂F∂y . In our example,

dF = 2xdx + 2ydy.

We apply the total derivative to F (x,y) = C , to find the differential equation dF = 0 . The differential equation we obtain in such a way has the form

 dy Mdx + Ndy = 0, or M + N ---= 0. dx

An equation of this form is called exact if it was obtained as dF = 0 for some potential function F . In our toy example, we obtain the equation

 dy- 2xdx + 2ydy = 0, or 2x + 2ydx = 0.

Since we obtained this equation by differentiating  2 2 x + y = C , the equation is exact. We often wish to solve for y in terms of x . In our example,

 √------- y = ± C 2 − x2.

An interpretation of the setup is that at each point ⃗v = (M, N ) is a vector in the plane, that is, a direction and a magnitude. As M and N are functions of (x,y) , we have a vector field. The particular vector field ⃗v that comes from an exact equation is a so-called conservative vector field, that is, a vector field that comes with a potential function F (x,y) , such that

 ( ) ⃗v = ∂F-, ∂F- . ∂x ∂y

Let γ be a path in the plane starting at (x1,y1) and ending at (x2,y2) . If we think of ⃗v as force, then the work required to move along γ is

∫ ∫ ⃗v(⃗r) ⋅ d⃗r = Mdx + Ndy = F(x2,y2) − F (x1,y1). γ γ

That is, the work done only depends on endpoints, that is where we start and where we end. For example, suppose F is gravitational potential. The derivative of F given by ⃗v is the gravitational force. What we are saying is that the work required to move a heavy box from the ground floor to the roof, only depends on the change in potential energy. That is, the work done is the same no matter what path we took; if we took the stairs or the elevator. Although if we took the elevator, the elevator is doing the work for us. The curves F(x,y) = C are those where no work need be done, such as the heavy box sliding along without accelerating or breaking on a perfectly flat roof, on a cart with incredibly well oiled wheels.

An exact equation is a conservative vector field, and the implicit solution of this equation is the potential function.

1.8.1 Solving exact equations

Now you, the reader, should ask: Where did we solve a differential equation? Well, in applications we generally know M and N , but we do not know F . That is, we may have just started with  dy 2x + 2ydx = 0 , or perhaps even

 dy x + y-- = 0. dx

It is up to us to find some potential F that works. Many different F will work; adding a constant to F does not change the equation. Once we have a potential function F , the equation  ( ) F x,y(x ) = C gives an implicit solution of the ODE.

Example 1.8.1: Let us find the general solution to  dy 2x + 2ydx = 0 . Forget we knew what F was.

If we know that this is an exact equation, we start looking for a potential function F . We have M = 2x and N = 2y . If F exists, it must be such that Fx(x,y) = 2x . Integrate in the x variable to find

 2 F(x,y) = x + A(y),
(1.5)

for some function A(y) . The function A is the “constant of integration”, though it is only constant as far as x is concerned, and may still depend on y . Now differentiate (1.5) in y and set it equal to N , which is what Fy is supposed to be:

2y = Fy(x,y) = A ′(y).

Integrating, we find  2 A(y) = y . We could add a constant of integration if we wanted to, but there is no need. We found F (x,y) = x2 + y2 . Next for a constant C , we solve

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

for y in terms of x . In this case, we obtain  √------- y = ± C 2 − x2 as we did before.

Exercise 1.8.1: Why did we not need to add a constant of integration when integrating A ′(y) = 2y ? Add a constant of integration, say 3 , and see what F you get. What is the difference from what we got above, and why does it not matter?

The procedure, once we know that the equation is exact, is:

(i)
Integrate Fx = M in x resulting in F (x,y) = something + A(y) .
(ii)
Differentiate this F in y , and set that equal to N , so that we may find A(y) by integration.

The procedure can also be done by first integrating in y and then differentiating in x . Pretty easy huh? Let’s try this again.

Example 1.8.2: Consider now 2x + y + xy dy= 0 dx .

OK, so M = 2x + y and N = xy . We try to proceed as before. Suppose F exists. Then Fx (x,y) = 2x + y . We integrate:

 2 F(x,y) = x + xy + A(y)

for some function A (y) . Differentiate in y and set equal to N :

 ′ N = xy = Fy(x,y) = x + A (y).

But there is no way to satisfy this requirement! The function xy cannot be written as x plus a function of y . The equation is not exact; no potential function F exists.

Is there an easier way to check for the existence of F , other than failing in trying to find it? Turns out there is. Suppose M = Fx and N = Fy . Then as long as the second derivatives are continuous,

∂M ∂2F ∂ 2F ∂N ----= ----- = -----= ---. ∂y ∂y ∂x ∂x∂y ∂x

Let us state it as a theorem. Usually this is called the Poincarè Lemma5.

Theorem 1.8.1 (Poincarè). If M and N are continuously differentiable functions of (x,y) , and ∂M ∂N -∂y = ∂x . Then near any point there is a function F (x,y) such that  ∂F M = ∂x and  ∂F N = ∂y .

The theorem doesn’t give us a global F defined everywhere. In general, we can only find the potential locally, near some initial point. By this time, we have come to expect this from differential equations.

Let us return to the example above where M = 2x + y and N = xy . Notice My = 1 and Nx = y , which are clearly not equal. The equation is not exact.

Example 1.8.3: Solve

dy- −2x-−-y- dx = x − 1 , y(0) = 1.

We write the equation as

(2x + y) + (x − 1)dy-= 0, dx

so M = 2x + y and N = x − 1 . Then

My = 1 = Nx.

The equation is exact. Integrating M in x , we find

F (x,y) = x2 + xy + A (y).

Differentiating in y and setting to N , we find

 ′ x − 1 = x + A (y).

So A ′(y) = −1 , and A (y) = − y will work. Take F (x,y) = x 2 + xy − y . We wish to solve x2 + xy − y = C . First let us find C . As y(0) = 1 then F(0,1) = C . Therefore 02 + 0 × 1 − 1 = C , so C = −1 . Now we solve x2 + xy − y = −1 for y to get

 −x2 − 1 y = -------. x − 1

Example 1.8.4: Solve

−---y---dx + ---x---dy = 0, y(1) = 2. x 2 + y2 x2 + y2

We leave to the reader to check that My = Nx .

This vector field (M, N ) is not conservative if considered as a vector field of the entire plane minus the origin. The problem is that if a curve γ was a circle around the origin, say starting at (1,0) and ending at (1,0) going counterclockwise, then if F existed we would expect

 ∫ ∫ − y x 0 = F (1,0) − F (1,0) = Fxdx + Fydy = --2---2dx + -2----2dy = 2π. γ γx + y x + y

That is nonsense! We leave the computation of the path integral to the interested reader, or you can consult your multivariable calculus textbook. So there is no potential function F defined everywhere outside the origin (0,0) .

If we think back to the theorem, it did not guarantee such a function anyway. It only guaranteed a potential function locally. As y(1) = 2 we start at the point (1,2) . Considering x > 0 and integrating M in x or N in y we find

F (x,y) = arctan(y∕x).

So the implicit solution is arctan(y∕x) = C . Solving, y = tan(C)x . That is, the solution is a straight line. Solving y(1) = 2 gives us that tan(C ) = 2 , and so y = 2x is the desired solution. See Figure 1.16, and note that the solution only exists for x > 0 .


PIC

Figure 1.16: Solution to − x2y+y2dx + x2x+y2dy = 0 , y(1) = 2 , with initial point marked.


Example 1.8.5: Solve

x2 + y2 + 2y(x + 1)dy-= 0. dx

The reader should check that this equation is exact. Let M = x2 + y2 and N = 2y(x + 1) . We follow the procdure for exact equations

F (x,y) = 1-x3 + xy2 + A(y), 3

and

 ′ 2y(x + 1) = 2xy + A (y).

Therefore A′(y) = 2y or A (y) = y2 and F(x,y) = 13x3 + xy2 + y2 . We try to solve F (x,y) = C . We easily solve for y2 and then just take the square root:

 3 ∘ ----------- y2 = C-−-(1∕3)x--, so y = ± C-−-(1∕3)x-3. x + 1 x + 1

When x = − 1 , the term in front of dy dx vanishes. You can also see that our solution is not valid in that case. However, one could in that case try to solve for x in terms of y starting from the implicit solution 1 3 2 2 3x + xy + y = C . In this case the solution is somewhat messy and we leave it as implicit.

1.8.2 Integrating factors

Sometimes an equation Mdx + Ndy = 0 is not exact, but it can be made exact by multiplying with a function u (x,y) . That is, perhaps for some nonzero function u (x,y) ,

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

is exact. Any solution to this new equation is also a solution to Mdx + Ndy = 0 .

In fact, a linear equation

dy ( ) ---+ p (x )y = f(x), or p(x)y − f (x )dx + dy = 0 dx

is always such an equation. Let  ∫ r(x) = e p(x)dx be the integrating factor for a linear equation. Multiply the equation by r(x) and write it in the form of M + N dydx-= 0 .

 dy r(x)p (x)y − r(x)f (x) + r(x )---= 0. dx

Then M = r(x)p(x)y − r(x)f(x) , so My = r(x)p(x) , while N = r(x) , so  ′ Nx = r(x) = r(x )p (x ) . In other words, we have an exact equation. So integrating factors for linear functions are just a special case of integrating factors for exact equations.

But how do we find the integrating factor u ? Well, given an equation

Mdx + Ndy = 0,

u should be a function such that

-∂[ ] -∂-[ ] ∂y uM = uyM + uMy = ∂x uN = uxN + uNx.

Therefore,

(My − Nx)u = uxN − uyM.

At first it may seem we replaced one differential equation by another one. True, but hope is not lost.

A strategy that often works is to look for a u that is a function of x alone, or a function of y alone. If u is a function of x alone, that is u(x ) , then we write  ′ u(x) instead of ux , and uy is just zero. Then

My-−-Nx-u = u ′. N

In particular, My−Nx -N--- ought to be a function of x alone (not depend on y ). If so, then we have a linear equation

 ′ My − Nx u − --------u = 0. N

Letting  My−Nx P (x) = N , we solve using the standard integrating factor method, to find  ∫ P(x)dx u(x) = Ce . The constant in the solution is not relevant, we need any nonzero solution, we take C = 1 . So  ∫ u(x) = e P(x)dx is the integrating factor.

Similarly we could try a function of the form u(y) . Then

My − Nx --------u = −u′. M

In particular My−Nx --M-- ought to be a function of y alone. If so, then we have a linear equation

u′ + My-−-Nx-u = 0. M

Letting Q (y) = MyM−Nx we find  ∫ u(y) = Ce − Q(y)dy , and we can take C = 1 . So  ∫ u(y) = e− Q (y)dy is the integrating factor.

Example 1.8.6: Solve

 2 2 x--+-y- + 2y dy-= 0. x + 1 dx

Let M = x2+y2 x+1 and N = 2y . Compute

M − N = --2y- − 0 = -2y--. y x x + 1 x + 1

As this is not zero, the equation is not exact. We notice

 My − Nx 2y 1 1 P(x) = ---N----= x +-1-2y-= x-+-1

is a function of x alone. We compute the integrating factor

 ∫ e P(x)dx = eln(x+1) = x + 1.

We multiply our given equation by (x + 1) to obtain

x2 + y2 + 2y(x + 1)dy-= 0, dx

which is an exact equation that we solved in Example 1.8.5. The solution was

 ∘ ----------- y = ± C-−-(1∕3)x3. x + 1

Example 1.8.7: Solve

y2 + (xy + 1)dy-= 0. dx

First compute

My − Nx = 2y − y = y.

As this is not zero, the equation is not exact. We observe

 My-−-Nx- -y 1- Q (y) = M = y2 = y

is a function of y alone. We compute the integrating factor

 ∫ e− Q(y)dy = e−lny = 1. y

Therefore we look at the exact equation

y + xy +-1-dy-= 0. y dx

The reader should double check that this equation is exact. We follow the procdure for exact equations

F(x,y) = xy + A (y),

and

xy + 1 1 ′ ------ = x + --= x + A (y). y y
(1.6)

Consequently A ′(y) = 1 y or A (y) = lny . Thus F(x,y) = xy + lny . It is not possible to solve F (x,y) = C for y in terms of elementary functions, so let us be content with the implicit solution:

xy + lny = C.

We are looking for the general solution and we divided by y above. We should check what happens when y = 0 , as the equation itself makes perfect sense in that case. We plug in y = 0 to find the equation is satisfied. So y = 0 is also a solution.

1.8.3 Exercises

Exercise 1.8.2: Solve the following exact equations, implicit general solutions will suffice:
a) (2xy + x2)dx + (x2 + y2 + 1 )dy = 0
b) x5 + y5dy = 0 dx
c)  x 3 2dy e + y + 3xy dx-= 0
d) (x + y)cos(x) + sin(x) + sin(x)y′ = 0

Exercise 1.8.3: Find the integrating factor for the following equations making them into exact equations:
a)  xy y xy e dx + xe dy = 0
b) ex+y3 y2 dx + 3xdy = 0
c) 4(y2 + x)dx + 2x+2y2dy = 0 y
d) 2sin(y)dx + x cos(y)dy = 0

Exercise 1.8.4: Suppose you have an equation of the form:  -dy f(x) + g(y )dx = 0 .
a) Show it is exact.
b) Find the form of the potential function in terms of f and g .

Exercise 1.8.5: Suppose that we have the equation f(x)dx − dy = 0 .
a) Is this equation exact?
b) Find the general solution using a definite integral.

Exercise 1.8.6: Find the potential function F(x,y) of the exact equation 1+xy ( ) -x-dx + 1∕y + xdy = 0 in two different ways.
a) Integrate M in terms of x and then differentiate in y and set to N .
b) Integrate N in terms of y and then differentiate in x and set to M .

Exercise 1.8.7: A function u (x,y) is said to be harmonic function if uxx + uyy = 0 .
a) Show that − uydx + uxdy = 0 is an exact equation. Therefore there exists (at least locally) the so-called harmonic conjugate function v(x,y) such that vx = −uy and vy = ux .
Verify that the following u are harmonic and find the corresponding harmonic conjugates v :
b) u = 2xy
c) u = ex cosy
d)  3 2 u = x − 3xy

Exercise 1.8.101: Solve the following exact equations, implicit general solutions will suffice:
a) cos(x) + yexy + xexyy′ = 0
b) (2x + y)dx + (x − 4y)dy = 0
c)  x ydy e + e dx = 0
d) (3x 2 + 3y)dx + (3y2 + 3x)dy = 0

Exercise 1.8.102: Find the integrating factor for the following equations making them into exact equations:
a) 1ydx + 3ydy = 0
b) dx − e−x−ydy = 0
c) (cos(x2)+ 1)dx + 12dy = 0 y y y
d) ( y2) 2y +-x dx + (2y + x)dy = 0

Exercise 1.8.103: a) Show that every separable equation y′ = f(x)g(y) can be written as an exact equation, and verify that it is indeed exact. b) Using this rewrite  ′ y = xy as an exact equation, solve it and verify that the solution is the same as it was in Example 1.3.1.

5Named for the French polymath Jules Henri Poincarè (1854–1912).