Linear Algebra & DE · Unit 2 · Topic 07

Exact differential equations: two partial derivatives decide everything.

Short answer

\(M\,dx + N\,dy = 0\) is exact when \(\dfrac{\partial M}{\partial y} = \dfrac{\partial N}{\partial x}\). Its solution is

\[\int M\,dx \;(y\text{ constant}) + \int(\text{terms of } N \text{ free of } x)\,dy = c\]

For example, \((2xy + 3)\,dx + (x^2 + 4y)\,dy = 0\) is exact and gives \(x^2y + 3x + 2y^2 = c\).

Engineering MathsB Tech / BEBSc
01

What makes an equation exact

Before you start: you need partial differentiation.

A first-order equation can be written as \(M\,dx + N\,dy = 0\), where \(M\) and \(N\) are functions of \(x\) and \(y\). Sometimes the left side is the total differential of a single function \(u(x, y)\). Then the equation just says \(du = 0\), and the solution is \(u = c\). Such an equation is called exact.

Test for exactness

\(M\,dx + N\,dy = 0\) is exact if and only if \[\frac{\partial M}{\partial y} = \frac{\partial N}{\partial x}\]

Solution of an exact equation

\[\int M\,dx \;(y \text{ constant}) + \int (\text{terms of } N \text{ without } x)\,dy = c\]

Why the test works: if \(du = M\,dx + N\,dy\), then \(M = u_x\) and \(N = u_y\). So \(M_y = u_{xy}\) and \(N_x = u_{yx}\), and these mixed partials are equal for any smooth \(u\).

Why the solution rule works: integrating \(M\) with \(y\) held constant picks up every term of \(u\) that contains \(x\). A term of \(u\) in \(y\) alone has no \(x\) in it, so it only shows up in \(N\), as a term free of \(x\). The second integral collects exactly those terms, and nothing gets counted twice.

02

Method and integrating factors

  1. Write the equation as \(M\,dx + N\,dy = 0\) and read off \(M\) and \(N\), signs included.
  2. Test: find \(M_y\) and \(N_x\). If they are equal, the equation is exact.
  3. Integrate \(M\) with respect to \(x\), treating \(y\) as a constant.
  4. Integrate only the terms of \(N\) that have no \(x\), with respect to \(y\).
  5. Add the two results and set the sum equal to \(c\).

If \(M_y \ne N_x\), the equation is not exact. Often you can multiply it by an integrating factor (IF), a function \(\mu(x, y)\) that makes \(\mu M\,dx + \mu N\,dy = 0\) exact. Four standard rules cover almost every textbook question:

WhenIntegrating factor
\(M\) and \(N\) homogeneous of the same degree, \(Mx + Ny \ne 0\)\(\dfrac{1}{Mx + Ny}\)
Form \(y\,f_1(xy)\,dx + x\,f_2(xy)\,dy = 0\), \(Mx - Ny \ne 0\)\(\dfrac{1}{Mx - Ny}\)
\(\dfrac{M_y - N_x}{N} = f(x)\), a function of \(x\) alone\(e^{\int f(x)\,dx}\)
\(\dfrac{N_x - M_y}{M} = g(y)\), a function of \(y\) alone\(e^{\int g(y)\,dy}\)

Check the rules in this order. After multiplying by the IF, test for exactness again before you integrate. It takes ten seconds and catches most slips.

03

Solved examples

Example 1: A direct exact equation

Easy

Solve \((2xy + 3)\,dx + (x^2 + 4y)\,dy = 0\).

  1. \(M = 2xy + 3\), \(N = x^2 + 4y\). \(M_y = 2x\) and \(N_x = 2x\), so the equation is exact.
  2. \(\int M\,dx = x^2y + 3x\) (with \(y\) constant).
  3. Terms of \(N\) without \(x\): just \(4y\). \(\int 4y\,dy = 2y^2\).

Answer\(x^2y + 3x + 2y^2 = c\)

Example 2: Trigonometric and exponential terms

Easy

Solve \((e^y + 1)\cos x\,dx + e^y\sin x\,dy = 0\).

  1. \(M_y = e^y\cos x\) and \(N_x = e^y\cos x\). Exact.
  2. \(\int (e^y + 1)\cos x\,dx = (e^y + 1)\sin x\).
  3. Every term of \(N = e^y\sin x\) contains \(x\), so the second integral is zero.

Answer\((e^y + 1)\sin x = c\)

Example 3: With an initial condition

Easy

Solve \((3x^2 + 2xy)\,dx + (x^2 + 2y)\,dy = 0\), given \(y(1) = 2\).

  1. \(M_y = 2x = N_x\). Exact.
  2. \(\int M\,dx = x^3 + x^2y\). Terms of \(N\) without \(x\): \(2y\), giving \(y^2\).
  3. General solution: \(x^3 + x^2y + y^2 = c\). Put \(x = 1\), \(y = 2\): \(1 + 2 + 4 = 7\).

Answer\(x^3 + x^2y + y^2 = 7\)

Example 4: A polynomial equation

Medium

Solve \((x^2 - 4xy - 2y^2)\,dx + (y^2 - 4xy - 2x^2)\,dy = 0\).

  1. \(M_y = -4x - 4y\) and \(N_x = -4y - 4x\). Exact.
  2. \(\int M\,dx = \dfrac{x^3}{3} - 2x^2y - 2xy^2\).
  3. Terms of \(N\) without \(x\): \(y^2\), giving \(\dfrac{y^3}{3}\). Add and multiply through by 3.

Answer\(x^3 - 6x^2y - 6xy^2 + y^3 = c\)

Example 5: IF for a homogeneous equation

Medium

Solve \(x^2y\,dx - (x^3 + y^3)\,dy = 0\).

  1. \(M_y = x^2\) but \(N_x = -3x^2\). Not exact. Both \(M\) and \(N\) are homogeneous of degree 3.
  2. \(Mx + Ny = x^3y - x^3y - y^4 = -y^4\). So the IF is \(-\dfrac{1}{y^4}\); we can drop the minus sign and use \(\dfrac{1}{y^4}\).
  3. New equation: \(\dfrac{x^2}{y^3}\,dx - \left(\dfrac{x^3}{y^4} + \dfrac{1}{y}\right)dy = 0\). Check: both partials equal \(-\dfrac{3x^2}{y^4}\). ✓
  4. \(\int \dfrac{x^2}{y^3}\,dx = \dfrac{x^3}{3y^3}\). Terms without \(x\): \(-\dfrac{1}{y}\), giving \(-\log|y|\).

Answer\(\dfrac{x^3}{3y^3} - \log|y| = c\)

Example 6: IF depending on x alone

Medium

Solve \((x^2 + y^2 + x)\,dx + xy\,dy = 0\).

  1. \(M_y = 2y\), \(N_x = y\). Not exact.
  2. \(\dfrac{M_y - N_x}{N} = \dfrac{y}{xy} = \dfrac{1}{x}\), a function of \(x\) alone. IF \(= e^{\int dx/x} = x\).
  3. Multiply: \((x^3 + xy^2 + x^2)\,dx + x^2y\,dy = 0\). Now \(M_y = 2xy = N_x\). ✓
  4. \(\int M\,dx = \dfrac{x^4}{4} + \dfrac{x^2y^2}{2} + \dfrac{x^3}{3}\). Every term of \(N\) has \(x\). Multiply by 12.

Answer\(3x^4 + 6x^2y^2 + 4x^3 = c\)

Example 7: IF depending on y alone

Exam level

Solve \((y^4 + 2y)\,dx + (xy^3 + 2y^4 - 4x)\,dy = 0\).

  1. \(M_y = 4y^3 + 2\), \(N_x = y^3 - 4\). Not exact.
  2. \(\dfrac{N_x - M_y}{M} = \dfrac{-3y^3 - 6}{y(y^3 + 2)} = -\dfrac{3}{y}\). IF \(= e^{-3\log y} = \dfrac{1}{y^3}\).
  3. Multiply: \(\left(y + \dfrac{2}{y^2}\right)dx + \left(x + 2y - \dfrac{4x}{y^3}\right)dy = 0\). Both partials are \(1 - \dfrac{4}{y^3}\). ✓
  4. \(\int M\,dx = xy + \dfrac{2x}{y^2}\). Terms of \(N\) without \(x\): \(2y\), giving \(y^2\).

Answer\(xy + \dfrac{2x}{y^2} + y^2 = c\)

Example 8: The Mx − Ny rule

Exam level

Solve \(y(1 + xy)\,dx + x(1 - xy)\,dy = 0\).

  1. This has the form \(y\,f_1(xy)\,dx + x\,f_2(xy)\,dy = 0\). Here \(M = y + xy^2\), \(N = x - x^2y\).
  2. \(Mx - Ny = xy + x^2y^2 - xy + x^2y^2 = 2x^2y^2\). IF \(= \dfrac{1}{2x^2y^2}\).
  3. Multiply: \(\left(\dfrac{1}{2x^2y} + \dfrac{1}{2x}\right)dx + \left(\dfrac{1}{2xy^2} - \dfrac{1}{2y}\right)dy = 0\). Both partials are \(-\dfrac{1}{2x^2y^2}\). ✓
  4. \(\int M\,dx = -\dfrac{1}{2xy} + \tfrac{1}{2}\log x\). Terms of \(N\) without \(x\): \(-\dfrac{1}{2y}\), giving \(-\tfrac{1}{2}\log y\).
  5. So \(-\dfrac{1}{2xy} + \tfrac{1}{2}\log\dfrac{x}{y} = c\). Multiply by 2 (for \(x, y > 0\)).

Answer\(\log\dfrac{x}{y} - \dfrac{1}{xy} = c\)

Vipul Sir's tip

Before reaching for any integrating factor rule, look at the equation for half a minute. If every term has the same degree, try \(\dfrac{1}{Mx + Ny}\). If you see \(xy\) bundled together, try \(\dfrac{1}{Mx - Ny}\). Otherwise compute \(M_y - N_x\) and see whether dividing by \(N\) or by \(M\) kills one of the variables.

04

Common mistakes

1. Integrating all of \(N\) as well

In Example 1, integrating all of \(N = x^2 + 4y\) with respect to \(y\) adds an extra \(x^2y\), giving \(2x^2y + 3x + 2y^2 = c\). That is wrong. The \(x^2y\) term already came from \(\int M\,dx\). Only the terms of \(N\) without \(x\) go into the second integral.

2. Testing the wrong partial derivatives

The test is \(\dfrac{\partial M}{\partial y} = \dfrac{\partial N}{\partial x}\): differentiate the \(dx\) coefficient with respect to \(y\). Comparing \(M_x\) with \(N_y\) tells you nothing.

3. Mixing up the two one-variable IF formulas

For a function of \(x\), divide \(M_y - N_x\) by \(N\). For a function of \(y\), divide \(N_x - M_y\) by \(M\). The order of subtraction changes between the two. Swap it and the IF comes out as \(y^3\) instead of \(\dfrac{1}{y^3}\) in Example 7, and the new equation is still not exact.

05

Practice questions

Try each one on paper before you open the answer.

Q1Solve \((x + y)\,dx + (x - y)\,dy = 0\).

\(M_y = 1 = N_x\), exact. \(\int M\,dx = \dfrac{x^2}{2} + xy\); the \(x\)-free part of \(N\) is \(-y\), giving \(-\dfrac{y^2}{2}\).

\(x^2 + 2xy - y^2 = c\).

Q2Solve \((2x\cos y + 3x^2y)\,dx + (x^3 - x^2\sin y - y)\,dy = 0\).

\(M_y = -2x\sin y + 3x^2 = N_x\), exact. \(\int M\,dx = x^2\cos y + x^3y\); the \(x\)-free part of \(N\) is \(-y\).

\(x^2\cos y + x^3y - \dfrac{y^2}{2} = c\).

Q3Solve \(y\,e^{xy}\,dx + (x\,e^{xy} + 2y)\,dy = 0\).

\(M_y = e^{xy} + xy\,e^{xy} = N_x\), exact. \(\int M\,dx = e^{xy}\); the \(x\)-free part of \(N\) is \(2y\).

\(e^{xy} + y^2 = c\).

Q4Solve \((x^2y - 2xy^2)\,dx - (x^3 - 3x^2y)\,dy = 0\).

Homogeneous, \(Mx + Ny = x^2y^2\). IF \(= \dfrac{1}{x^2y^2}\) gives \(\left(\dfrac{1}{y} - \dfrac{2}{x}\right)dx - \left(\dfrac{x}{y^2} - \dfrac{3}{y}\right)dy = 0\), which is exact.

\(\dfrac{x}{y} - 2\log x + 3\log y = c\).

Q5Solve \((x^2 + y^2 + 2x)\,dx + 2y\,dy = 0\).

\(\dfrac{M_y - N_x}{N} = \dfrac{2y}{2y} = 1\), so IF \(= e^x\).

\(\int e^x(x^2 + 2x + y^2)\,dx = e^x(x^2 + y^2)\). Answer: \(e^x(x^2 + y^2) = c\).

Q6Solve \((3x^2y^4 + 2xy)\,dx + (2x^3y^3 - x^2)\,dy = 0\).

\(\dfrac{N_x - M_y}{M} = \dfrac{-6x^2y^3 - 4x}{xy(3xy^3 + 2)} = -\dfrac{2}{y}\), so IF \(= \dfrac{1}{y^2}\).

New \(M = 3x^2y^2 + \dfrac{2x}{y}\). Answer: \(x^3y^2 + \dfrac{x^2}{y} = c\).

Stuck on a question?

Bring it to a free demo class and work through it with Vipul Sir. Book on WhatsApp.

06

Frequently asked questions

What is an exact differential equation?

An equation \(M\,dx + N\,dy = 0\) whose left side is the total differential \(du\) of some function \(u(x, y)\). Its solution is \(u(x, y) = c\).

How do you check whether a differential equation is exact?

Write it as \(M\,dx + N\,dy = 0\) and compare \(\dfrac{\partial M}{\partial y}\) with \(\dfrac{\partial N}{\partial x}\). If they are equal, it is exact.

What is an integrating factor?

A function you multiply a non-exact equation by so that it becomes exact. Multiplying does not change the solution curves, as long as the factor is not zero there.

Which integrating factor rule should I use?

Homogeneous equation: \(\dfrac{1}{Mx + Ny}\). Form \(y f_1(xy)\,dx + x f_2(xy)\,dy\): \(\dfrac{1}{Mx - Ny}\). Otherwise test whether \(\dfrac{M_y - N_x}{N}\) depends on \(x\) only or \(\dfrac{N_x - M_y}{M}\) depends on \(y\) only.

Related lessons

← All 12 Linear Algebra & DE topics
Vipul Sir
Written by Vipul Sir

Vipul Sir has taught mathematics for over 15 years to HSC, CBSE, ICSE, IGCSE/IB, Diploma, Engineering and BSc students at VVS Classes in Goregaon and Vile Parle, Mumbai. He teaches every class himself, concepts first and exam technique second.

Linear Algebra and Differential Equations

Get Linear Algebra & DE right, with Vipul Sir beside you.

Concept-first classes in small batches in Goregaon and Vile Parle, or online. Your first class is free.

WhatsApp↗