Linear First-Order Differential Equations — Theory
1. Standard form
A first-order differential equation is called linear if it can be written in the form:
\[
\frac{dy}{dx}+P(x)y=Q(x).
\]
The function \(P(x)\) is the coefficient of \(y\), and \(Q(x)\) is the forcing term or right side.
Both \(P(x)\) and \(Q(x)\) must depend only on \(x\).
2. Why the equation is not usually separable
A linear equation may not be separable because the right side after solving for \(y'\) is:
\[
\frac{dy}{dx}=Q(x)-P(x)y.
\]
This expression is often not a simple product of an \(x\)-part and a \(y\)-part.
Instead, we use the integrating factor method.
3. Integrating factor
The integrating factor is:
\[
\mu(x)=e^{\int P(x)\,dx}.
\]
This factor is chosen so that after multiplication, the left side becomes one product derivative.
4. Multiply the equation by the integrating factor
Start with:
\[
\frac{dy}{dx}+P(x)y=Q(x).
\]
Multiply every term by \(\mu(x)\):
\[
\mu(x)\frac{dy}{dx}+\mu(x)P(x)y=\mu(x)Q(x).
\]
The left side becomes:
\[
\frac{d}{dx}\left[\mu(x)y\right].
\]
5. Product-derivative form
After multiplying by the integrating factor, the equation becomes:
\[
\frac{d}{dx}\left[\mu(x)y\right]=\mu(x)Q(x).
\]
This is now easy to integrate:
\[
\mu(x)y=\int \mu(x)Q(x)\,dx+C.
\]
Finally, divide by \(\mu(x)\):
\[
y(x)=\frac{\int \mu(x)Q(x)\,dx+C}{\mu(x)}.
\]
6. Initial value problem form
If an initial condition is given,
\[
y(x_0)=y_0,
\]
then a clean formula is:
\[
y(x)=
\frac{
\mu(x_0)y_0+\int_{x_0}^{x}\mu(t)Q(t)\,dt
}{
\mu(x)
}.
\]
This formula automatically includes the initial condition.
7. Worked example
Solve:
\[
\frac{dy}{dx}+2y=e^{-x},
\qquad
y(0)=0.
\]
Here:
\[
P(x)=2,
\qquad
Q(x)=e^{-x}.
\]
The integrating factor is:
\[
\mu(x)=e^{\int 2\,dx}=e^{2x}.
\]
Multiply the equation by \(e^{2x}\):
\[
e^{2x}\frac{dy}{dx}+2e^{2x}y=e^{2x}e^{-x}.
\]
The left side is a product derivative:
\[
\frac{d}{dx}\left(e^{2x}y\right)=e^x.
\]
Integrate:
\[
e^{2x}y=e^x+C.
\]
Divide by \(e^{2x}\):
\[
y=e^{-x}+Ce^{-2x}.
\]
Apply \(y(0)=0\):
\[
0=1+C
\quad\Longrightarrow\quad
C=-1.
\]
Therefore:
\[
y=e^{-x}-e^{-2x}.
\]
8. Scaled example matching one-third coefficient
If the equation is:
\[
\frac{dy}{dx}+2y=\frac{1}{3}e^{-x},
\qquad
y(0)=0,
\]
then the same method gives:
\[
y=\frac{1}{3}\left(e^{-x}-e^{-2x}\right).
\]
9. Geometric meaning
The differential equation can be rewritten as:
\[
y'=Q(x)-P(x)y.
\]
A slope field uses this formula to show the direction of the solution curve at many points.
The solution curve through \((x_0,y_0)\) follows these slope marks.
10. Numerical solution preview
Some linear equations have integrals that are difficult to simplify by hand.
The integrating factor formula remains valid, but numerical methods are useful for plotting.
A common numerical method is the fourth-order Runge–Kutta method:
\[
y_{n+1}
=
y_n
+
\frac{h}{6}
\left(k_1+2k_2+2k_3+k_4\right).
\]
The graph uses the equivalent slope equation:
\[
y'=Q(x)-P(x)y.
\]
12. Common mistakes
- Not putting the equation in standard form: the method requires \(y' + P(x)y = Q(x)\).
- Using the wrong sign for \(P(x)\): move terms carefully before identifying \(P(x)\).
- Forgetting the integrating factor: do not integrate \(P(x)y\) directly.
- Multiplying only part of the equation: the integrating factor must multiply every term.
- Forgetting the product rule: the left side becomes \(\frac{d}{dx}[\mu(x)y]\).
- Forgetting to divide by \(\mu(x)\): after integration, solve for \(y\).
- Using the initial condition too early: first derive the integrated form, then substitute \(x=x_0\) and \(y=y_0\).
- Ignoring graph units: axis tick labels should include numerical values and units when interpreting a model.