4.6.6Ordinary Differential Equations

Exact equations — exactness condition, finding potential function

1,844 words8 min readdifficulty · medium2 backlinks

1. What is an exact equation?

WHAT is a total differential? From multivariable calculus, for any smooth F(x,y)F(x,y): dF=Fxdx+Fydy.dF = \frac{\partial F}{\partial x}\,dx + \frac{\partial F}{\partial y}\,dy.

So comparing dF=Mdx+NdydF = M\,dx + N\,dy term-by-term gives the two defining equations:   Fx=M,Fy=N  \boxed{\;\frac{\partial F}{\partial x} = M, \qquad \frac{\partial F}{\partial y} = N\;}

This is the heart of everything: MM and NN are the two partial derivatives of one potential function FF.


2. Deriving the exactness condition (from scratch)

HOW we derive it. Suppose FF exists. Then M=FxM = F_x and N=FyN = F_y. Differentiate each in the other variable:

\qquad \frac{\partial N}{\partial x} = \frac{\partial}{\partial x}\!\left(\frac{\partial F}{\partial y}\right) = F_{yx}.$$ By **Clairaut's / Schwarz's theorem**, if $F$ has continuous second partials the mixed partials are equal: $F_{xy} = F_{yx}$. Therefore > [!formula] Exactness condition > $$\boxed{\;\dfrac{\partial M}{\partial y} = \dfrac{\partial N}{\partial x}\;}$$ > This is **necessary**. On a simply-connected (no-holes) region it is also **sufficient** — so it's a full test. > [!recall]- Why is the condition only "necessary" without the region assumption? > Because $\frac{\partial M}{\partial y}=\frac{\partial N}{\partial x}$ guarantees the field is *curl-free*, but to integrate it into a single-valued $F$ you also need the region to have no holes (simply connected). On the whole plane this is automatic, so for exam purposes the test is both necessary and sufficient. --- ## 3. HOW to find the potential function $F$ > [!intuition] The "integrate, then patch" method > We rebuild $F$ from its two partial derivatives. Integrating $F_x = M$ recovers $F$ **up to a function of $y$** (because $y$ acts like a constant during $x$-integration). We then use $F_y = N$ to pin down that leftover function. **Step-by-step recipe:** 1. **Check exactness:** confirm $M_y = N_x$. 2. **Integrate $M$ in $x$:** $F = \displaystyle\int M\,dx + g(y)$ — the unknown $g(y)$ is the "constant" of $x$-integration. 3. **Differentiate w.r.t. $y$** and set equal to $N$: $F_y = \frac{\partial}{\partial y}\!\int M\,dx + g'(y) = N$. 4. **Solve for $g'(y)$**, integrate to get $g(y)$. 5. **Write the solution** $F(x,y) = c$. (Symmetric alternative: integrate $N$ in $y$, add $h(x)$, then match $F_x = M$.) --- ![[4.6.06-Exact-equations-—-exactness-condition,-finding-potential-function.png]] --- ## 4. Worked examples > [!example] Example 1 — clean exact equation > Solve $(2xy + 3)\,dx + (x^2 - 1)\,dy = 0.$ > > **Identify:** $M = 2xy+3$, $N = x^2 - 1$. > > **Step 1 — Test.** $M_y = 2x$, $N_x = 2x$. Equal ⟹ exact. *Why this step? No point hunting for $F$ unless it exists.* > > **Step 2 — Integrate $M$ in $x$:** > $$F = \int (2xy+3)\,dx + g(y) = x^2 y + 3x + g(y).$$ > *Why $g(y)$? Anything depending only on $y$ has zero $x$-derivative, so it's invisible to $M$.* > > **Step 3 — Differentiate in $y$, match $N$:** > $$F_y = x^2 + g'(y) \stackrel{!}{=} x^2 - 1 \;\Rightarrow\; g'(y) = -1.$$ > *Why? $F_y$ must equal $N$ by definition of the potential.* > > **Step 4 — Integrate:** $g(y) = -y$. > > **Answer:** $\;x^2 y + 3x - y = c.$ > [!example] Example 2 — exponential/trig mix > Solve $(e^{y} + \cos x)\,dx + (x e^{y} + 2y)\,dy = 0.$ > > **Test:** $M_y = e^{y}$, $N_x = e^{y}$ ⟹ exact. > > **Integrate $M$:** $F = \int(e^y + \cos x)\,dx + g(y) = x e^y + \sin x + g(y).$ > > **Match $N$:** $F_y = x e^y + g'(y) = x e^y + 2y \Rightarrow g'(y)=2y \Rightarrow g(y)=y^2.$ > > **Answer:** $\;x e^y + \sin x + y^2 = c.$ > [!example] Example 3 — verifying a NON-exact equation > Test $y\,dx - x\,dy = 0.$ Here $M=y$, $N=-x$: $M_y = 1$, $N_x = -1$. **Not equal ⟹ not exact.** > *Why care?* You must NOT apply the potential method directly. (It can be made exact by an integrating factor $\mu = 1/x^2$, giving $d(y/x)=0$ — a separate topic.) --- ## 5. Common mistakes (Steel-man + fix) > [!mistake] "$M_y$ means differentiate $M$ with respect to $x$." > **Why it feels right:** $M$ multiplies $dx$, so it seems "tied" to $x$. **Fix:** The exactness test deliberately *cross-differentiates*: differentiate $M$ (the $dx$ coefficient) by $y$, and $N$ (the $dy$ coefficient) by $x$. It mirrors $F_{xy}=F_{yx}$. > [!mistake] Forgetting $g(y)$ (or writing a plain constant $+c$). > **Why it feels right:** Indefinite integrals usually just add "$+C$". **Fix:** When integrating in $x$, the "constant" can still depend on $y$. Dropping it loses the entire $-y$ or $y^2$ term and gives a wrong solution. > [!mistake] Applying the potential method to a non-exact equation. > **Why it feels right:** The recipe is mechanical and tempting. **Fix:** Always run $M_y \stackrel{?}{=} N_x$ FIRST. If it fails, find an integrating factor instead. > [!mistake] Re-integrating terms already accounted for. > When you match $F_y$ to $N$, the part of $N$ that comes from $\partial_y(\int M\,dx)$ is **already inside $F$**. Only the leftover defines $g'(y)$. Subtracting carefully avoids double-counting. --- ## 6. Active recall #flashcards/maths When is $M\,dx+N\,dy=0$ called exact? ::: When the LHS is the total differential $dF$ of some $F(x,y)$, i.e. $\exists F$ with $F_x=M,\ F_y=N$. State the exactness condition. ::: $\partial M/\partial y = \partial N/\partial x$ (on a simply-connected region this is also sufficient). Why does the exactness condition come from mixed partials? ::: Because $M=F_x,\ N=F_y\Rightarrow M_y=F_{xy},\ N_x=F_{yx}$, and $F_{xy}=F_{yx}$ (Clairaut). First step to find $F$? ::: Integrate $M$ with respect to $x$: $F=\int M\,dx + g(y)$. What is $g(y)$ and how do you find it? ::: The $y$-only "constant" of $x$-integration; found by setting $F_y=N$ and solving $g'(y)$, then integrating. What is the general solution once $F$ is found? ::: $F(x,y)=c$. Test $y\,dx-x\,dy=0$: exact? ::: No, since $M_y=1\ne N_x=-1$. Solve $(2xy+3)dx+(x^2-1)dy=0$. ::: $x^2y+3x-y=c$. --- > [!recall]- Feynman: explain to a 12-year-old > Picture a treasure map with hills and valleys, and lines drawn around the hill at each height — like contour lines on a real map. The equation $M\,dx+N\,dy=0$ is a rule saying "walk so your height never changes — stay on one contour line." If the two numbers $M$ and $N$ pass a simple matching test ($M_y=N_x$), it means a real hill $F$ exists. We then **rebuild the hill** by adding up its slopes, and the answer is just "you're on the line where the hill's height equals $c$." > [!mnemonic] Remember the test & recipe > **"My Nx — cross your partials."** Test: differentiate the *other* variable ($M_y = N_x$). Recipe: **I-D-M-I** — **I**ntegrate $M$, **D**ifferentiate in $y$, **M**atch $N$, **I**ntegrate $g'$. > [!intuition] Connections > - [[Total Differential & Partial Derivatives]] — the engine behind $dF=F_x dx+F_y dy$. > - [[Clairaut's Theorem (Equality of Mixed Partials)]] — justifies the exactness condition. > - [[Integrating Factors for ODEs]] — what to do when the equation is *not* exact. > - [[Separable Equations]] & [[Linear First-Order ODEs]] — special cases that can be made exact. > - [[Conservative Vector Fields & Potential Functions]] — exactness is curl-free; $F$ is the potential. > - [[Level Curves & Contour Lines]] — geometry of $F(x,y)=c$. ## 🖼️ Concept Map ```mermaid flowchart TD ODE[M dx + N dy = 0] F[Potential function F x,y] TD[Total differential dF] FX[F_x = M] FY[F_y = N] CL[Clairaut theorem F_xy = F_yx] TEST[Exactness test M_y = N_x] SC[Simply-connected region] INT[Integrate M over x] PATCH[Patch using F_y = N] SOL[Solution F x,y = c] ODE -->|is exact if| TD TD -->|comes from| F TD -->|compare terms| FX TD -->|compare terms| FY FX -->|differentiate in y| CL FY -->|differentiate in x| CL CL -->|yields| TEST SC -->|makes sufficient| TEST TEST -->|then recover| F FX -->|integrate| INT INT -->|then| PATCH FY -->|pins down| PATCH PATCH -->|gives| SOL F -->|level curve| SOL ``` ## 🔊 Hinglish (regional understanding) > [!intuition]- Hinglish mein samjho > Dekho, **exact equation** ka idea bahut simple hai. Maano ek pahaadi (hill) hai jiski height ek function $F(x,y)$ se milti hai. Us pahaadi par jo contour lines hoti hain (same height wali lines), unka equation hota hai $F(x,y)=c$. Agar tumhara ODE $M\,dx+N\,dy=0$ asal mein kisi $F$ ka **total differential** $dF$ hai, toh solution turant $F(x,y)=c$ ban jaata hai. Bas wahi pahaadi $F$ dhoondhni hai. > > Lekin har equation aisi nahi hoti. Isliye pehle **test** lagao: $\partial M/\partial y = \partial N/\partial x$. Yeh test kyun? Kyunki agar $F$ exist karta hai toh $M=F_x$ aur $N=F_y$, aur mixed partial derivatives barabar hote hain ($F_{xy}=F_{yx}$, Clairaut theorem). Isliye cross-derivatives match karne chahiye. Agar match nahi karein, toh equation exact nahi — phir integrating factor wala alag method lagta hai. > > $F$ nikaalne ka tareeka: pehle $M$ ko $x$ ke respect mein integrate karo, isse milta hai $F=\int M\,dx + g(y)$. Yahan $g(y)$ ek "constant" hai jo $y$ par depend kar sakta hai (kyunki $x$-integration mein $y$ constant jaisa behave karta hai). Isko mat bhoolna — yahi sabse common galti hai! Phir is $F$ ko $y$ ke respect mein differentiate karke $N$ ke barabar rakho, $g'(y)$ nikaal lo, integrate karo, bas. Answer: $F(x,y)=c$. > > Yeh matter karta hai kyunki bahut saari mushkil dikhne wali ODEs asal mein bas total differentials hain — ek baar pehchaan liya toh sirf integration ka kaam reh jaata hai, aur physics mein yeh "conservative field" aur "potential energy" se bilkul connected hai. ![[audio/4.6.06-Exact-equations-—-exactness-condition,-finding-potential-function.mp3]]

Go deeper — visual, from zero

Test yourself — Ordinary Differential Equations

Connections