9.4 Linear Differential Equations
A linear equation $\tfrac{dy}{dx}+Py=Q$ becomes an exact derivative when multiplied by the integrating factor $e^{\int P\,dx}$: then $\tfrac{d}{dx}(y\cdot\text{I.F.})=Q\cdot\text{I.F.}$, and one integration finishes the job. Mixing tanks, circuits and drug infusions all lead to such equations.
A hospital drip delivers a drug into a patient's blood at a steady $50$ mg per hour, while the body removes a quarter of whatever is present each hour. If $A$ mg are present after $t$ hours, then $$\dfrac{dA}{dt}=50-0.25A,\qquad\text{i.e.}\qquad \dfrac{dA}{dt}+0.25A=50.$$ This particular equation happens to be separable, but change the drip rate to vary through the day โ say $50+20\sin t$ โ and separation is impossible. The same shape of equation, "rate of change + (constant or function) ร amount = input", describes salt in a tank of flowing brine, the charge on a capacitor in a circuit, a savings account with regular deposits, and an object falling through air. These are the linear differential equations.
The method for solving them is one of the neatest tricks in calculus. The product rule says $\dfrac{d}{dx}(y\,R)=R\dfrac{dy}{dx}+\dfrac{dR}{dx}\,y$. If we can choose a multiplier $R(x)$ with $\dfrac{dR}{dx}=PR$, then $R\left(\dfrac{dy}{dx}+Py\right)$ is exactly $\dfrac{d}{dx}(yR)$, and the whole equation can be integrated in one step. That multiplier is the integrating factor $e^{\int P\,dx}$. This section develops the method, its twin for equations that are linear in $x$, and its applications.
Linear Equations and the Integrating Factor
A first-order differential equation of the form $$\dfrac{dy}{dx}+Py=Q,$$ where $P$ and $Q$ are constants or functions of $x$ only, is called a linear differential equation of the first order (in $y$). The unknown $y$ and its derivative appear only to the first power, are not multiplied together, and do not appear inside other functions.
Similarly, $\dfrac{dx}{dy}+P_1x=Q_1$, where $P_1$ and $Q_1$ are constants or functions of $y$ only, is a linear differential equation in $x$ (with $y$ as the independent variable).
For the linear equation $\dfrac{dy}{dx}+Py=Q$, the function $$\text{I.F.}=e^{\int P\,dx}$$ is called the integrating factor. Any one antiderivative $\int P\,dx$ may be used (no "$+C$" is needed here), and the result is simplified with $e^{\log u}=u$: for instance $e^{\int\frac3x\,dx}=e^{3\log x}=x^3$ for $x\gt0$.
Let $P$ and $Q$ be continuous on an interval $I$, and let $R=e^{\int P\,dx}$ be an integrating factor. Then the general solution of $\dfrac{dy}{dx}+Py=Q$ on $I$ is given by $$y\cdot\text{I.F.}=\int Q\cdot\text{I.F.}\;dx+C.$$ Likewise, the general solution of $\dfrac{dx}{dy}+P_1x=Q_1$ is $x\cdot e^{\int P_1\,dy}=\displaystyle\int Q_1\,e^{\int P_1\,dy}\,dy+C$.
Proof. Since $R=e^{\int P\,dx}$, the chain rule gives $R'=PR$, and $R\gt0$. Multiplying the equation by $R$: $$R\dfrac{dy}{dx}+PRy=QR,$$ that is, $R\dfrac{dy}{dx}+R'y=QR$, which by the product rule says $$\dfrac{d}{dx}(yR)=QR.$$ So $yR$ is an antiderivative of $QR$: $yR=\int QR\,dx+C$. Conversely, every function of this form satisfies $\dfrac{d}{dx}(yR)=QR$, and dividing by $R\ne0$ recovers the equation. The $\dfrac{dx}{dy}$ form is the same argument with the letters exchanged. $\blacksquare$
- Put the equation in standard form $\dfrac{dy}{dx}+Py=Q$: the coefficient of $\dfrac{dy}{dx}$ must be $1$. Read off $P$ and $Q$, with their signs.
- Find $\text{I.F.}=e^{\int P\,dx}$ and simplify it.
- Write $y\cdot\text{I.F.}=\displaystyle\int Q\cdot\text{I.F.}\,dx+C$, and do the integral (often by parts or by substitution).
- Divide by I.F. to get $y$; apply any initial condition to find $C$; check by substituting back.
- If the equation is not linear in $y$, try $\dfrac{dx}{dy}$: it may be linear in $x$.
Particular Solutions and Equations Linear in x
Applications: Mixing, Circuits and Infusions
A common pattern: a quantity $A(t)$ receives a steady input and loses a fixed fraction of itself per unit time, so $\dfrac{dA}{dt}=(\text{rate in})-kA$. In standard form $\dfrac{dA}{dt}+kA=(\text{rate in})$, with $\text{I.F.}=e^{kt}$. With a constant input $r$ the solution is $$A=\dfrac rk+\left(A_0-\dfrac rk\right)e^{-kt},$$ which approaches the equilibrium (steady-state) value $\dfrac rk$; the number $\dfrac1k$ is the time constant. In an electric circuit with a resistor $R$, a capacitor $C$ and a battery of voltage $E$, the capacitor voltage obeys $RC\dfrac{dV}{dt}+V=E$ โ the same equation with $k=\dfrac{1}{RC}$.
1. Not making the coefficient of $\dfrac{dy}{dx}$ equal to $1$. For $x\dfrac{dy}{dx}+3y=x^2$, $P$ is $\dfrac3x$, not $3$, and $Q$ is $x$, not $x^2$. Divide first.
2. Losing the sign of $P$. In $\dfrac{dy}{dx}-2xy=x$, $P=-2x$ and $\text{I.F.}=e^{-x^2}$, not $e^{x^2}$.
3. Forgetting to multiply $Q$ by the I.F. The right-hand side is $\int Q\cdot\text{I.F.}\,dx$, not $\int Q\,dx$.
4. Putting $+C$ in the wrong place. Add $C$ when integrating $Q\cdot\text{I.F.}$, before dividing by I.F.: $yx^3=\tfrac15x^5+C$ gives $y=\tfrac15x^2+\tfrac{C}{x^3}$, not $\tfrac15x^2+C$.
5. Not simplifying $e^{\log(\cdot)}$. $e^{\int\cot x\,dx}=e^{\log\sin x}=\sin x$; $e^{-\log x}=\tfrac1x$.
6. Missing the $\dfrac{dx}{dy}$ form. If $y$ appears non-linearly but $x$ appears only to the first power, rewrite as $\dfrac{dx}{dy}+P_1x=Q_1$.
Exercises
- 1 $\dfrac{dy}{dx}+3y=e^{2x}$
- 2 $x\dfrac{dy}{dx}-y=x^3$ ($x\gt0$)
- 3 $\dfrac{dy}{dx}+y\cot x=x$ ($0\lt x\lt\pi$)
- 4 $(1+x^2)\dfrac{dy}{dx}+2xy=1$
- 5 $\dfrac{dy}{dx}=y^2+x$
- 6 $(x+y+1)\dfrac{dy}{dx}=1$
- 1 $\dfrac{dy}{dx}+3y=e^{2x}$
- 2 $x\dfrac{dy}{dx}-y=x^3$ ($x\gt0$)
- 3 $\dfrac{dy}{dx}+y\cot x=x$ ($0\lt x\lt\pi$)
- 4 $(1+x^2)\dfrac{dy}{dx}+2xy=1$
- 5 $(x+y+1)\dfrac{dy}{dx}=1$
- 6 $\dfrac{dy}{dx}+y=\sin x$
- 7 $\dfrac{dy}{dx}-2xy=x$
- 8 $\dfrac{dy}{dx}+\dfrac yx=\cos x$ ($x\gt0$)
- 9 $\cos^2x\,\dfrac{dy}{dx}+y=1$ ($-\tfrac\pi2\lt x\lt\tfrac\pi2$)
- 1 $\dfrac{dy}{dx}+y=e^x$, $y(0)=1$
- 2 $x\dfrac{dy}{dx}+y=x\cos x$ ($x\gt0$), $y(\pi)=0$
- 3 $\dfrac{dy}{dx}-\dfrac yx=xe^x$ ($x\gt0$), $y(1)=e$
- 4 $\dfrac{dy}{dx}+y\tan x=\cos^2x$ ($-\tfrac\pi2\lt x\lt\tfrac\pi2$), $y(0)=1$
- 5 $\dfrac{dx}{dy}+x=2y$, $x=0$ when $y=0$
- 1 Mixing. A $200$ L tank contains $5$ kg of dissolved salt. Brine with $0.1$ kg/L flows in at $10$ L/min and the mixture flows out at $10$ L/min. Find $A(t)$ and the amount of salt after $30$ minutes.
- 2 Charging a capacitor. In a circuit with $R=10\ \text{k}\Omega$, $C=100\ \mu\text{F}$ (so $RC=1$ s) and a $9$ V battery, the capacitor voltage satisfies $\dfrac{dV}{dt}+V=9$, $V(0)=0$. Find $V(t)$ and the time to reach $8$ V.
- 3 Drug infusion. A drip delivers $50$ mg/h and the body removes $25\%$ of the amount present per hour: $\dfrac{dA}{dt}=50-0.25A$, $A(0)=0$. Find $A(t)$, the steady level, and the time to reach $90\%$ of it.
- 4 Falling with air resistance. A parachutist's speed obeys $\dfrac{dv}{dt}=9.8-0.2v$ (m/s per s), with $v(0)=0$. Find $v(t)$, the terminal speed, and $v(5)$.
- 5 Saving continuously. An account earns $6\%$ per year compounded continuously and receives deposits at $\text{โน}\,12\,000$ per year spread evenly, so $\dfrac{dP}{dt}=0.06P+12\,000$, $P(0)=0$. Find $P(t)$ and the balance after $10$ years.
- 6 Find the curve through $(0,3)$ whose slope at every point $(x,y)$ is $2x-y$.
How this is examined: a 1-mark question asks for the integrating factor; a 3- or 5-mark question asks for a general or particular solution, frequently with an integral by parts. JEE adds properties of the solution (a maximum, a limit, a value at a point) and the $\tfrac{dx}{dy}$ form.
E1. Board ยท 1 mark The integrating factor of $x\dfrac{dy}{dx}-y=x^2\log x$ ($x\gt0$) is (A) $x$ (B) $\dfrac1x$ (C) $\log x$ (D) $e^{-x}$
E2. Board ยท 1 mark AssertionโReason. Assertion (A): the integrating factor of $\dfrac{dy}{dx}+y=x^2$ is $e^x$. Reason (R): the integrating factor of $\dfrac{dy}{dx}+Py=Q$ is $e^{\int P\,dx}$. (A) Both A and R are true and R is the correct explanation of A (B) Both A and R are true but R is not the correct explanation of A (C) A is true but R is false (D) A is false but R is true
E3. Board ยท 3 marks Solve $x\dfrac{dy}{dx}+y=x\log x$ ($x\gt0$).
E4. Board ยท 5 marks Find the particular solution of $\dfrac{dy}{dx}+2y\cot x=3x^2\operatorname{cosec}^2x$ ($0\lt x\lt\pi$), given that $y=0$ when $x=\dfrac\pi2$.
E5. JEE Main If $y=y(x)$ satisfies $\dfrac{dy}{dx}+y=e^{-x}$ and $y(0)=0$, then the maximum value of $y(x)$ for $x\ge0$ is (A) $\dfrac1e$ (B) $e$ (C) $1$ (D) $\dfrac2e$
E6. JEE Advanced (Numerical answer.) Let $y(x)$ solve $\dfrac{dy}{dx}+2xy=2xe^{-x^2}$ with $y(0)=1$. Find the value of $e\cdot y(1)$.
Research question. Does a capacitor charge exactly as the linear differential equation $RC\dfrac{dV}{dt}+V=E$ predicts โ and can you measure the capacitance from the charging curve?
Why it matters. RC circuits set the timing in camera flashes, heart pacemakers, traffic-light controllers and the touch sensors in phone screens. Engineers design them with exactly the solution $V=E\left(1-e^{-t/RC}\right)$ from this section, and they measure unknown capacitors by timing the charging curve.
What to do.
- With your teacher, connect a $9$ V battery, a $100\ \text{k}\Omega$ resistor, a $100\ \mu\text{F}$ capacitor (fully discharged) and a switch in series, with a digital multimeter across the capacitor.
- Close the switch and record the voltage every $2$ s for $50$ s (film the meter with a phone to read it accurately).
- Plot $\log\left(1-\dfrac VE\right)$ against $t$. Explain why the theory predicts a straight line of slope $-\dfrac{1}{RC}$, and find the slope of your best-fit line.
- Calculate the measured $RC$ and hence $C$. Compare with the value printed on the capacitor (usually $\pm20\%$).
Tools: Battery, resistor, capacitor, switch, multimeter, phone camera, spreadsheet.
Hand in: Your circuit diagram, data table, the plot with its line of best fit, the measured time constant and capacitance with percentage difference, and a short discussion of the sources of error.
Going further. Disconnect the battery and let the capacitor discharge through the resistor. Show that now $RC\dfrac{dV}{dt}+V=0$ (a separable equation, Section 9.2) and check that the time constant is the same.
๐งช Self-check quiz
Q1. Which equation is linear in $y$?
Q2. The integrating factor of $\dfrac{dy}{dx}+\dfrac1xy=x^2$ ($x\gt0$) is
Q3. The integrating factor of $\dfrac{dy}{dx}-y\tan x=\cos x$ ($-\tfrac\pi2\lt x\lt\tfrac\pi2$) is
Q4. The general solution of $\dfrac{dy}{dx}+y=1$ is
Q5. The integrating factor of $\dfrac{dx}{dy}+\dfrac xy=y$ ($y\gt0$) is