Handling Logarithmic and Rational Forcing Functions
What you'll learn: How to apply variation of parameters to solve non-homogeneous ODEs when the forcing function is logarithmic (like ln(x)) or rational (like 1/x).
Why This Matters
The method of undetermined coefficients works beautifully for polynomial, exponential, and trigonometric forcing functions—but it completely fails when your forcing function is ln(x), 1/x, or other non-elementary functions. This is where variation of parameters becomes your essential tool.
The Core Idea
When you have a second-order linear ODE like:
y'' + p(x)y' + q(x)y = f(x)
where f(x) = ln(x) or f(x) = 1/x, you cannot guess a particular solution form. Instead, variation of parameters uses the formula:
y_p(x) = -y₁(x)∫[y₂(x)f(x)/W(x)]dx + y₂(x)∫[y₁(x)f(x)/W(x)]dx
where y₁ and y₂ are solutions to the homogeneous equation and W(x) is the Wronskian.
Example Setup
Consider: y'' + y = ln(x)
First, solve the homogeneous equation to get y₁ = cos(x) and y₂ = sin(x). The Wronskian is W = 1.
Now you'd compute integrals like:
∫sin(x)·ln(x) dx∫cos(x)·ln(x) dx
These integrals require integration by parts and cannot be avoided—there's no shortcut pattern like with undetermined coefficients.
The Key Insight
Logarithmic and rational functions don't have derivatives that cycle back to similar forms, so you must perform actual integration. The beauty of variation of parameters is that it always works, regardless of how messy the forcing function is.
Key Takeaway: When facing forcing functions like ln(x) or 1/x, variation of parameters is mandatory—no pattern-guessing works, and you must compute the integrals explicitly using techniques like integration by parts.