index
Today’s note (Jan 8): first-order linear ODEs, integrating factors, and integration by parts, with every small step shown.
First-order linear ODE
dxdy+P(x)y=Q(x),
where P(x) and Q(x) are known functions.
To solve it, multiply both sides by a function μ(x) so that the left-hand side becomes the derivative of a product.
Definition (Integrating factor)
For y′+P(x)y=Q(x), choose
μ(x)=e∫P(x)dx.Using the chain rule (ef(x))′=ef(x)f′(x) and the fact that (∫P(x)dx)′=P(x), we get
(μ(x)y(x))′=μ(x)P(x)y(x)+μ(x)y′(x).Multiplying the original equation by μ(x) makes the left side collapse to a single derivative:
(μ(x)y(x))′=μ(x)Q(x).Integrating both sides then gives
y(x)=μ(x)1(∫μ(x)Q(x)dx+C).
We deliberately pick μ(x) so that
μ(x)y′(x)+μ(x)P(x)y(x)=(μ(x)y(x))′,
turning the left-hand side into one derivative.
Recall (Integration by parts refresher)
Use this when integrating products (like polynomials times exponentials):
∫udv=uv−∫vdu.Equivalently, the product rule says ∫f′(x)g(x)dx+∫f(x)g′(x)dx=f(x)g(x)+C.
Example 1 — y′+2y=xe−x
Here P(x)=2, so μ(x)=e∫2dx=e2x.
Multiplying by e2x:
e2xy′+2e2xy=xex.
Since (e2xy)′=(e2x)′y+e2xy′=2e2xy+e2xy′, the left side is
(e2xy)′=xex.
Integrate both sides:
e2xy(x)=∫xexdx.
Use integration by parts with u=x, dv=exdx:
∫xexdx=xex−∫exdx=xex−ex+C=(x−1)ex+C.
Therefore
e2xy(x)=(x−1)ex+C,
so
y(x)=(x−1)e−x+Ce−2x.
Example 2 — y′+x1y=x3(x>0)
Here P(x)=x1, so μ(x)=e∫x1dx=x.
Multiplying by x gives
xy′+y=x4.
Check the product derivative: (xy)′=xy′+y, so
(xy)′=x4.
Integrate:
xy=∫x4dx=5x5+C,
so
y(x)=5x4+xC.
Example 3 — y′−y=e2x with y(0)=1
Here P(x)=−1, so μ(x)=e∫−1dx=e−x.
Multiply by e−x:
e−xy′−e−xy=ex.
Using (e−xy)′=(e−x)′y+e−xy′=−e−xy+e−xy′, we get
(e−xy)′=ex.
Integrate:
e−xy(x)=∫exdx=ex+C.
So
y(x)=e2x+Cex.
Apply the initial condition y(0)=1:
1=e0+Ce0⇒C=0,
giving the particular solution
y(x)=e2x.