Differential Equations 2.3: Exact Equations

Differential Equations

Units and Topics

Unit 2. First Order Equations

2.3 Exact Equations

Some first order equations say that a function F(t, y) of two variables stays constant along each solution. Such an equation is called exact, and it is solved by finding the function F. This topic covers partial derivatives, the test that shows whether an equation is exact, the method that finds F, and integrating factors that make an equation exact.

You need Topics 2.1 and 2.2 for this topic. The topic uses the chain rule and the integrals of powers.

1. Partial Derivatives

A function F(t, y) of two variables has two derivatives of first order. The partial derivative with respect to t is the derivative of F with respect to t while y is treated as a constant. It is written ∂F/∂t. The partial derivative with respect to y is the derivative with respect to y while t is treated as a constant. It is written ∂F/∂y.

F(t, y)∂F/∂t∂F/∂y
t² + y²2t2y
t²y2tyt²
t² + ty²2t + y²2ty
et sin yet sin yet cos y

In the second row, the derivative with respect to t treats y as a constant factor, so the derivative of t²y is 2ty. The derivative with respect to y treats t² as a constant factor, so the derivative is t².

The chain rule for F(t, y(t))

When y is a function of t, the expression F(t, y(t)) depends only on t. Its derivative with respect to t has two terms: one term for the direct dependence on t, and one term for the dependence through y.

d/dt [F(t, y(t))] = ∂F/∂t + ∂F/∂y y′

For F = t²y, this gives 2ty + t²y′, which agrees with the product rule.

2. Exact Equations

In this topic a first order equation is written in the form

M(t, y) + N(t, y) y′ = 0

The equation is called exact when there is a function F(t, y) with

∂F/∂t = M and ∂F/∂y = N

By the chain rule of Part 1, the left side of an exact equation is the derivative of F(t, y(t)) with respect to t. The equation then says that this derivative is 0, so F is constant along each solution.

Solutions of an exact equation. The solutions satisfy F(t, y) = C, where C is a constant. This is an implicit solution in the sense of Topic 2.1.

A first example

The equation (2t + y²) + 2ty y′ = 0 has M = 2t + y² and N = 2ty. The third row of the table in Part 1 shows that these are the two partial derivatives of F = t² + ty². So the equation is exact, and its solutions satisfy

t² + ty² = C

The check differentiates this relation with respect to t, with y as a function of t.

t² + ty² = Cthe implicit solution2t + y² + 2ty y′ = 0differentiate both sides. The term ty² needs the product rule and the chain rule(2t + y²) + 2ty y′ = 0this is the equation

3. The Test for Exactness

The function F is usually not known in advance. A test shows whether it exists. For a function F with continuous second derivatives, the order of two partial derivatives does not matter: differentiating first with respect to t and then with respect to y gives the same result as the opposite order. If ∂F/∂t = M and ∂F/∂y = N, this means that the derivative of M with respect to y is equal to the derivative of N with respect to t.

The test. The equation M + N y′ = 0 is exact when ∂M/∂y = ∂N/∂t. This holds for functions M and N with continuous partial derivatives on a rectangle of the plane.

Equation∂M/∂y∂N/∂tExact
(2t + y²) + 2ty y′ = 02y2yYes
(2ty + 1) + (t² + 2y) y′ = 02t2tYes
t + y y′ = 000Yes
y + 2t y′ = 012No
(3ty + y²) + (t² + ty) y′ = 03t + 2y2t + yNo

In the test, M is differentiated with respect to y, and N is differentiated with respect to t. Each function is differentiated with respect to the variable of the other partial derivative of F.

4. Finding the Function F

The method has four steps.

  1. Check that ∂M/∂y = ∂N/∂t.
  2. Integrate M with respect to t, with y treated as a constant. The constant of integration can depend on y, so it is written as a function g(y).
  3. Differentiate the result with respect to y, and set it equal to N. This gives g′(y).
  4. Integrate g′(y) to find g(y). The solutions are F(t, y) = C.

A complete example

Solve (2ty + 1) + (t² + 2y) y′ = 0 with the initial condition y(0) = 1.

∂M/∂y = 2t and ∂N/∂t = 2tthe equation is exactF = ∫ (2ty + 1) dt = t²y + t + g(y)integrate M with respect to t, with y as a constant∂F/∂y = t² + g′(y)differentiate the result with respect to yt² + g′(y) = t² + 2yset this equal to Ng′(y) = 2ysubtract t² from both sidesg(y) = y²integrate. A constant is not needed here, because it is part of CF = t²y + t + y²the function Ft²y + t + y² = Cthe implicit solution

In the fifth line, the terms with t cancel, and g′(y) contains only y. This happens for each exact equation. If a term with t is left in g′(y), the equation is not exact, or the work contains an error.

The initial condition gives the constant.

0²(1) + 0 + 1² = Csubstitute t = 0 and y = 1C = 1the constantt²y + t + y² = 1the solution in implicit form

This relation is a quadratic equation for y, so here an explicit solution can be found.

y² + t²y + (t − 1) = 0write the relation as a quadratic equation in yy = (−t² ± √t⁴ − 4(t − 1))/2the quadratic formulay = (−t² + √t⁴ − 4t + 4)/2the positive root, because y(0) = 1 requires (0 + √4)/2 = 1

Starting with N

The method can also start with N. Integrate N with respect to y, write the constant of integration as a function h(t), differentiate with respect to t, and set the result equal to M. Both orders give the same function F. It is sensible to start with the function that is easier to integrate.

Try it: the curves F(t, y) = C

The gray segments are the direction field of the exact equation that the menu selects. The blue curve is the solution curve through the green point. The page draws it by following the direction field in both directions. The sliders move the point. The value of F is the same at each point of the blue curve.

5. Separable Equations Are Exact

A separable equation y′ = g(t)h(y) can be written as

−g(t) + 1/h(y) y′ = 0

Here M = −g(t) contains only t, and N = 1/h(y) contains only y. Both derivatives of the test are 0, so the equation is exact. The function F is −G(t) + H(y), where G is an integral of g and H is an integral of 1/h. The solutions H(y) − G(t) = C are the solutions of Topic 2.1. Separation of variables is a special case of the method of this topic.

6. Integrating Factors

An equation that is not exact can sometimes be made exact by multiplying it by a function μ. The function μ is called an integrating factor, as in Topic 2.2.

An example

The equation (3ty + y²) + (t² + ty) y′ = 0 is not exact, by the last row of the table in Part 3. Multiply it by μ = t.

(3t²y + ty²) + (t³ + t²y) y′ = 0the equation after the multiplication by t∂M/∂y = 3t² + 2tythe derivative of the new M with respect to y∂N/∂t = 3t² + 2tythe derivative of the new N with respect to t. The new equation is exactF = ∫ (3t²y + ty²) dt = t³y + t²y²/2 + g(y)integrate the new M with respect to t∂F/∂y = t³ + t²y + g′(y)differentiate with respect to yg′(y) = 0comparison with the new N = t³ + t²yt³y + t²y²/2 = Cthe implicit solution

Finding an integrating factor that depends only on t

The expression

(∂M/∂y − ∂N/∂t)/N

measures how far the equation is from being exact. If this expression contains only t, call it r(t). Then μ(t) = e∫ r(t) dt is an integrating factor.

∂M/∂y − ∂N/∂t = (3t + 2y) − (2t + y) = t + yfor the example aboveN = t² + ty = t(t + y)factor Nr(t) = (t + y)/(t(t + y)) = 1/tthe quotient contains only tμ = e∫ (1/t) dt = eln t = tthe integrating factor, for t greater than 0

This rule does not always work, because the quotient often contains y. An integrating factor can also depend on y, or on both variables. The test of Part 3 checks any function that is proposed as an integrating factor. For the equation y + 2t y′ = 0, the factor μ = y gives y² + 2ty y′ = 0, which is exact, because both derivatives of the test are 2y.

The linear equation

The linear equation y′ + p(t)y = q(t) of Topic 2.2 can be written as (p(t)y − q(t)) + y′ = 0, with M = p(t)y − q(t) and N = 1. The quotient of the rule is (p(t) − 0)/1 = p(t), so the integrating factor is e∫ p(t) dt. This is the integrating factor of Topic 2.2.

7. An Example from Physics: Energy of a Mass on a Spring

A block of mass m moves on a smooth horizontal surface. A spring with the spring constant k exerts the force −kx on the block, where x is the position of the block, measured from the position at which the spring is relaxed. The second law of Newton gives m dv/dt = −kx.

The velocity can be treated as a function of the position. By the chain rule, dv/dt = dv/dx(dx/dt) = v dv/dx. The second law then becomes an equation for v as a function of x. In this part, x has the role of t, v has the role of y, and v′ stands for dv/dx.

kx + mv v′ = 0 M = kx and N = mvthe two functions∂M/∂v = 0 and ∂N/∂x = 0the equation is exactF = ∫ kx dx = kx²/2 + g(v)integrate M with respect to x∂F/∂v = g′(v) = mvset the derivative with respect to v equal to Ng(v) = mv²/2integratekx²/2 + mv²/2 = Cthe implicit solution

The function F is the sum of the potential energy of the spring and the kinetic energy of the block. The constant C is the total mechanical energy E. The exact equation is the statement that the energy is conserved.

For a block with m = 1 kg on a spring with k = 4 N/m that passes the position x = 0 with the velocity 2 m/s:

E = (4)(0)²/2 + (1)(2)²/2 = 2 Jthe energy from the given position and velocity(4)x²/2 + (1)(0)²/2 = 2at the greatest distance, the velocity is 0x² = 1solve for x²x = 1 mthe greatest distance from the relaxed position

Common Mistakes

  • Differentiating M with respect to t and N with respect to y in the test. The test uses ∂M/∂y and ∂N/∂t.
  • Applying the test to an equation that is not in the form M + N y′ = 0. All terms must be on the left side.
  • Adding a constant C instead of a function g(y) after the integration with respect to t. The constant of that integration can depend on y.
  • Adding the integral of M and the integral of N. Terms that appear in both integrals, such as t²y in Part 4, would be counted two times.
  • Writing F(t, y) as the answer. The answer is the relation F(t, y) = C.
  • Applying the method to an equation that is not exact. The sign that this has happened is a term with t in g′(y).

Summary

IdeaStatement
Partial derivative ∂F/∂tThe derivative with respect to t, with y treated as a constant
Chain ruled/dt [F(t, y(t))] = ∂F/∂t + ∂F/∂y y′
Exact equationM + N y′ = 0 with M = ∂F/∂t and N = ∂F/∂y
Test∂M/∂y = ∂N/∂t
SolutionsF(t, y) = C
Finding FIntegrate M with respect to t, add g(y), and find g from ∂F/∂y = N
Integrating factor μ(t)If r = (∂M/∂y − ∂N/∂t)/N contains only t, then μ = e∫ r dt
Mass on a springkx + mv v′ = 0 is exact, and F is the energy kx²/2 + mv²/2

Practice

Work each problem on paper first. Then open the answer to check your work.

1. Find the two partial derivatives of F = t³y² + 4y.

∂F/∂t = 3t²y², because y² is treated as a constant factor and the term 4y is treated as a constant.

∂F/∂y = 2t³y + 4, because t³ is treated as a constant factor.

2. Which of these equations are exact: (2t + y) + (t + 2y) y′ = 0, y² + ty y′ = 0, and (cos t + y) + (t + ey) y′ = 0?

(2t + y) + (t + 2y) y′ = 0 is exact, because ∂M/∂y = 1 and ∂N/∂t = 1.

y² + ty y′ = 0 is not exact, because ∂M/∂y = 2y and ∂N/∂t = y.

(cos t + y) + (t + ey) y′ = 0 is exact, because ∂M/∂y = 1 and ∂N/∂t = 1.

3. Solve (2t + y) + (t + 2y) y′ = 0 with y(0) = 2. Give the solution in implicit form.

∂M/∂y = 1 and ∂N/∂t = 1the equation is exactF = ∫ (2t + y) dt = t² + ty + g(y)integrate M with respect to t∂F/∂y = t + g′(y) = t + 2yset the derivative with respect to y equal to Ng′(y) = 2y, so g(y) = y²integratet² + ty + y² = Cthe implicit solution0 + 0 + 2² = Csubstitute t = 0 and y = 2t² + ty + y² = 4the solution, with C = 4

4. Solve (3t² + 2ty) + (t² + 3y²) y′ = 0 with y(1) = 1. Give the solution in implicit form.

∂M/∂y = 2t and ∂N/∂t = 2tthe equation is exactF = ∫ (3t² + 2ty) dt = t³ + t²y + g(y)integrate M with respect to t∂F/∂y = t² + g′(y) = t² + 3y²set the derivative with respect to y equal to Ng′(y) = 3y², so g(y) = y³integratet³ + t²y + y³ = Cthe implicit solution1 + 1 + 1 = Csubstitute t = 1 and y = 1t³ + t²y + y³ = 3the solution, with C = 3

5. Show that y + 2t y′ = 0 is not exact, and solve it with the integrating factor μ = y.

∂M/∂y = 1 and ∂N/∂t = 2, so the equation is not exact.

y² + 2ty y′ = 0multiply the equation by y∂M/∂y = 2y and ∂N/∂t = 2ythe new equation is exactF = ∫ y² dt = ty² + g(y)integrate the new M with respect to t∂F/∂y = 2ty + g′(y) = 2tyset the derivative with respect to y equal to the new Ng′(y) = 0so g is a constant, which is part of Cty² = Cthe implicit solution

The equation is also separable, and the method of Topic 2.1 gives the same solutions.

6. A block with m = 2 kg moves on a spring with k = 8 N/m. It passes the position x = 0 with the velocity 3 m/s. Find the energy, the speed of the block at x = 1 m, and the greatest distance from the relaxed position.

E = (8)(0)²/2 + (2)(3)²/2 = 9 Jthe energy from the given position and velocity(8)(1)²/2 + (2)v²/2 = 9the energy at x = 14 + v² = 9calculate the two termsv = √5 = 2.2 m/sthe speed at x = 1 m(8)x²/2 = 9at the greatest distance, the velocity is 0x² = 9/4, so x = 1.5 mthe greatest distance

Python Practice

Step 1. The function F stays constant

Part 2 found that the solutions of (2t + y²) + 2ty y′ = 0 satisfy t² + ty² = C. Solving the equation for y′ gives y′ = −(2t + y²)/2ty. The code below follows the solution with y(1) = 2 by the method of Euler from t = 1 to t = 2. It then prints y and the value of F = t² + ty². At the start, F is 1 + 4 = 5.

Python

The method gives y = 0.7071 and F = 5.0000. The value of F at the end is the same as at the start. Now start at y(1) = 3, where F is 1 + 9 = 10. The last value should be close to 10.

Python

Step 2. The test at one point

A partial derivative can be estimated in the same way as an ordinary derivative: change one variable by a small amount d, keep the other variable fixed, and divide the change of the function by the change of the variable. The code below defines the functions M and N of the equation (2t + y²) + 2ty y′ = 0 and estimates ∂M/∂y and ∂N/∂t at the point t = 1, y = 2. The word def defines a function, and return gives its value.

Python

Both values are 4, which agrees with ∂M/∂y = 2y and ∂N/∂t = 2y at y = 2. Now test the equation (3ty + y²) + (t² + ty) y′ = 0 of Part 6 at the same point. Change the two lines that begin with return. The values should be 7 and 4, so this equation is not exact.

Python

Step 3. An integrating factor

The code below repeats the test for the equation (3ty + y²) + (t² + ty) y′ = 0, which is not exact. Part 6 found the integrating factor μ = t. Multiply both functions by t: put t * ( in front of each expression and ) after it. Both values should then be 7.

Python

The test at one point does not prove that an equation is exact, because the two derivatives must agree at all points. It is a quick way to find an error.

Step 4. From the implicit solution to values of y

Part 4 found the implicit solution t²y + t + y² = C of the equation (2ty + 1) + (t² + 2y) y′ = 0, and the explicit solution y = (−t² + √t⁴ − 4(t − C))/2. The code below calculates the solution with C = 1 at the times 0, 1, and 2. The second print line substitutes the values in the implicit solution as a check. The square root is typed as np.sqrt.

Python

The values of y are 1, 0, and −0.268, and the check gives 1 at all three times. The initial condition y(0) = 2 gives C = 0 + 0 + 2² = 4. Change the first line. The values of y should be 2, 1.303, and 0.449.

Python

Step 5. The energy of a mass on a spring

Part 7 found that kx²/2 + mv²/2 stays constant for a block on a spring. The code below calculates the energy E from the position x0 and the velocity v0 at one instant. It then solves the energy equation for the speed at the position x = 0.5 m.

kx²/2 + mv²/2 = Ethe energy equationmv²/2 = E − kx²/2subtract the potential energyv² = (2E − kx²)/mmultiply by 2 and divide by mv = √v²the speed is the square root of this value

Python

The energy is 2 J, and the speed at x = 0.5 m is 1.73 m/s. Now give the block the velocity 3 m/s at x = 0. The energy should be 4.5 J, and the speed at x = 0.5 m should be about 2.83 m/s.

Python

Quiz

This quiz has 5 questions on this topic. A question asks you either to choose one answer or to type numbers. The page grades your answers and explains each one. A number can be typed as a whole number, a decimal, a fraction such as 1/3, or a calculation such as sqrt(18)/2 or arccos(1/2). The page shows the value of a calculation next to the box. Angles in a calculation are in degrees. The Calculator button under each question opens a calculator. Your answers are saved in your browser, so they are still on the page when you come back to it.

Choose how your answers are checked

1. Which condition shows that the equation M + N y′ = 0 is exact?

2. Which of these equations is exact?

3. The solutions of (2t + y) + (t + 2y) y′ = 0 satisfy t² + ty + y² = C. Find C for the solution with y(1) = 2.

4. For the exact equation (2t + y²) + (2ty + 3y²) y′ = 0, the integration of M with respect to t gives F = t² + ty² + g(y). What is g(y)?

5. A block with m = 2 kg moves on a spring with k = 8 N/m, so that kx²/2 + mv²/2 is constant. The block has the velocity 4 m/s at x = 0. Find its speed at x = 1 m, in m/s.

Next: Topic 2.4, Substitutions