Second-Order ODE Solver
Solve second-order linear ordinary differential equations with constant coefficients (homogeneous and non-homogeneous). Auto-derives the characteristic equation, classifies the damping regime (over/critical/under-damped), gives the closed-form y(x), and shows an interactive solution curve plus phase-plane (y, y') trajectory.
Your ad blocker is preventing us from showing ads
MiniWebtool is free because of ads. If this tool helped you, please support us by upgrading for ad-free browsing and more daily uses, or allowlist MiniWebtool.com and reload.
- Allow ads for MiniWebtool.com, then reload
- Or upgrade for ad-free browsing and higher daily limits
About Second-Order ODE Solver
The Second-Order ODE Solver takes a linear ordinary differential equation of the form aยทyโณ + bยทyโฒ + cยทy = g(x) with constant real coefficients, automatically derives its characteristic equation, classifies the damping regime (overdamped, critically damped, underdamped, undamped or unstable), and produces both a symbolic closed-form solution and a high-accuracy numerical solution. The interactive output pairs a dual-curve time plot of y(x) and yโฒ(x) with a phase-plane trajectory of (y, yโฒ) โ a view that exposes the regime at a glance: spiral-in for underdamped, node-in for overdamped, closed loop for undamped, spiral-out for unstable.
What Is a Second-Order Linear ODE With Constant Coefficients?
A second-order linear ordinary differential equation with real constant coefficients is an equation of the form
where a โ 0, b, c are real constants and g(x) is the forcing term. Two initial conditions y(xโ) = yโ and yโฒ(xโ) = yโฒโ turn this into an initial-value problem with a unique solution on a neighbourhood of xโ โ this follows from the Picard-Lindelรถf theorem applied to the equivalent first-order system.
If g(x) = 0 the equation is homogeneous. Otherwise it is non-homogeneous, and the full solution decomposes as
where y_h is the general solution of the associated homogeneous equation (contains two free constants) and y_p is any particular solution of the full equation. Applying the two initial conditions fixes the two free constants.
The Characteristic Equation
Guessing y = e^(rยทx) in the homogeneous equation gives the characteristic (or auxiliary) equation
a quadratic whose discriminant ฮ = bยฒ โ 4ac controls the entire qualitative behaviour:
Three Root Cases & the Damping Regime
| Discriminant ฮ = bยฒ โ 4ac | Roots of aยทrยฒ + bยทr + c = 0 | Homogeneous solution y_h(x) | Physical regime |
|---|---|---|---|
| ฮ > 0 | Two distinct real roots rโ, rโ | Cโยทe^(rโยทx) + Cโยทe^(rโยทx) | Overdamped โ slow monotonic return to equilibrium (both roots negative). |
| ฮ = 0 | One repeated real root r = โb/(2a) | (Cโ + Cโยทx)ยทe^(rยทx) | Critically damped โ fastest return without oscillation. |
| ฮ < 0 | Complex conjugate roots ฮฑ ยฑ ฮฒยทi with ฮฑ = โb/(2a), ฮฒ = โ(โฮ)/(2a) | e^(ฮฑยทx)ยท(Cโยทcos(ฮฒยทx) + Cโยทsin(ฮฒยทx)) | Underdamped (ฮฑ < 0) โ decaying oscillation; undamped (ฮฑ = 0) โ pure sinusoidal motion; unstable (ฮฑ > 0) โ growing oscillation. |
Method of Undetermined Coefficients (Non-homogeneous Case)
When g(x) takes one of the following simple forms, the method of undetermined coefficients supplies a particular solution by assuming a trial of the same form with unknown coefficients and solving for them:
- Constant g(x) = k. Trial: y_p = K. If c = 0 multiply by x; if b = 0 also, multiply by x again.
- Polynomial of degree n. Trial: general polynomial of degree n. Multiply by x or xยฒ if the constant or linear term resonates.
- Exponential g(x) = Aยทe^(kยทx). Trial: y_p = Kยทe^(kยทx). If k coincides with a characteristic root, multiply by x (simple root) or xยฒ (double root) โ this is resonance.
- Sinusoidal g(x) = Aยทcos(ฯยทx) + Bยทsin(ฯยทx). Trial: y_p = Kโยทcos(ฯยทx) + Kโยทsin(ฯยทx). Multiply by x if iฯ is a root (pure-frequency resonance).
- Products and sums follow by linearity and the product rule.
Reading the Phase Plane
The equivalent first-order system is u = y, v = yโฒ with uโฒ = v and vโฒ = (g(x) โ bยทv โ cยทu)/a. Plotting v against u parametrically in x gives the phase-plane trajectory. For homogeneous autonomous systems (no x in g), orbits are uniquely determined by their starting point (yโ, yโฒโ) and reveal the regime at a glance:
- Underdamped: trajectory spirals inward toward the origin.
- Overdamped: trajectory approaches origin along an invariant line (slow eigenvector).
- Critically damped: degenerate node, trajectory tangent to the single eigenvector.
- Undamped: closed ellipse encircling the origin โ perpetual oscillation.
- Unstable: trajectory spirals or runs outward to infinity.
Worked Example: Driven Damped Harmonic Oscillator
Consider the equation yโณ + 2ยทyโฒ + 5ยทy = 10 with y(0) = 0, yโฒ(0) = 0 โ a driven, underdamped system.
- Characteristic equation: rยฒ + 2r + 5 = 0 โ ฮ = 4 โ 20 = โ16 โ r = โ1 ยฑ 2i.
- Homogeneous solution: y_h = e^(โx)ยท(Cโยทcos 2x + Cโยทsin 2x).
- Particular solution for constant forcing g = 10: try y_p = K, so 5K = 10, giving y_p = 2.
- Apply ICs: y(0) = 0 โ Cโ + 2 = 0 โ Cโ = โ2. yโฒ(0) = 0 โ โCโ + 2Cโ = 0 โ Cโ = โ1.
- Final answer: y(x) = 2 โ e^(โx)ยท(2ยทcos 2x + sin 2x) โ oscillates with decaying envelope and limit y โ 2.
How to Use This Calculator
- Enter the coefficients a, b, c in the top row. a must be non-zero (otherwise the equation is first-order).
- Type the forcing term g(x), or leave it as 0 for a homogeneous problem. Closed-form particular solutions are derived for constants, polynomials up to degree 2, and single exponentials Aยทe^(kยทx) including the resonance case.
- Provide initial conditions (xโ, yโ, yโฒโ). Both y and yโฒ at xโ must be specified because the equation is second-order.
- Pick the x range for the plots. The solver integrates outward from xโ in both x-directions using RK4.
- Click Solve & Visualize. You get the characteristic equation with its roots on the complex plane, the damping-regime classification, the homogeneous and particular closed-form solutions, a dual-curve time plot of y and yโฒ, and the phase-plane trajectory.
Common Applications
- Mechanical spring-mass-damper systems: mยทxโณ + cยทxโฒ + kยทx = F(t). Overdamped, critically damped, and underdamped correspond to different damping ratios ฮถ = c/(2ยทโ(mยทk)).
- RLC electrical circuits: series RLC circuits obey LยทQโณ + RยทQโฒ + Q/C = V(t) โ identical structure, different symbols.
- Pendulum (small-angle): ฮธโณ + (g/L)ยทฮธ = 0 gives simple harmonic motion; adding air resistance gives damped oscillation.
- Building response to earthquakes: single-degree-of-freedom structure with base acceleration as the forcing term.
- PID-controlled servo systems: closed-loop error dynamics reduce to a second-order ODE whose damping ratio governs overshoot.
- Population models with inertia: economic growth with capital-accumulation lag, or ecological models with delayed response.
Numerical Method โ Classical Runge-Kutta (RK4) on the 2D System
The tool reduces aยทyโณ + bยทyโฒ + cยทy = g(x) to the first-order system
with u(xโ) = yโ, v(xโ) = yโฒโ. Four-stage Runge-Kutta is then applied to the vector state (u, v). RK4 has local truncation error O(hโต) and global error O(hโด); the default 400 sub-steps in each direction give roughly six-digit accuracy for non-stiff problems.
Frequently Asked Questions
What is a second-order linear ODE with constant coefficients?
A second-order linear ODE with constant coefficients has the form aยทyโณ + bยทyโฒ + cยทy = g(x), where a, b, c are real constants and g(x) is the forcing (non-homogeneous) term. With two initial conditions y(xโ) = yโ and yโฒ(xโ) = yโฒโ the solution is unique. The homogeneous case g(x) = 0 always admits a closed-form solution via the characteristic equation aยทrยฒ + bยทr + c = 0; the non-homogeneous case is solved as y(x) = y_h(x) + y_p(x).
What is the characteristic equation?
For aยทyโณ + bยทyโฒ + cยทy = 0, substituting the ansatz y = e^(rยทx) yields aยทrยฒ + bยทr + c = 0 โ the characteristic or auxiliary equation. Its roots determine the form of the homogeneous solution: two distinct real roots give y_h = Cโยทe^(rโยทx) + Cโยทe^(rโยทx); a repeated root r gives y_h = (Cโ + Cโยทx)ยทe^(rยทx); complex conjugate roots ฮฑ ยฑ ฮฒยทi give y_h = e^(ฮฑยทx)ยท(Cโยทcos(ฮฒยทx) + Cโยทsin(ฮฒยทx)).
What does under-, critically, and overdamped mean?
The terminology comes from the spring-mass-damper model mยทxโณ + cยทxโฒ + kยทx = 0. Overdamped (discriminant > 0, two real roots) means the system returns to equilibrium slowly without oscillation. Critically damped (discriminant = 0, repeated root) is the fastest return without overshoot. Underdamped (discriminant < 0, complex roots) gives decaying oscillation. Undamped (b = 0, c/a > 0) gives pure sinusoidal oscillation forever.
What is the method of undetermined coefficients?
For simple forcing g(x) โ constants, polynomials, exponentials, sines, cosines, and their products โ the particular solution y_p is assumed to have the same form as g with unknown coefficients, which are determined by substituting into the ODE and matching terms. The trial must be multiplied by x (or xยฒ for double roots) when g(x) resonates with a characteristic root.
What is a phase plane?
For a second-order equation reduced to the 2D system (y, yโฒ) the phase plane plots yโฒ versus y as x advances. Solution curves in the phase plane reveal regime at a glance: decaying spirals for underdamped, inward nodes for overdamped, closed ellipses for undamped harmonic motion, and outward spirals for unstable oscillation. It is the geometric counterpart of the characteristic-equation root diagram.
What numerical method does this tool use?
The classical fourth-order Runge-Kutta (RK4) method is applied to the equivalent first-order system u = y, v = yโฒ, with uโฒ = v and vโฒ = (g(x) โ bยทv โ cยทu)/a. RK4 has local truncation error O(hโต) and the default 400 sub-steps per direction give roughly six-digit accuracy for non-stiff equations over the chosen window.
Further Reading
- Linear differential equation โ Wikipedia
- Characteristic equation โ Wikipedia
- Method of undetermined coefficients โ Wikipedia
- Harmonic oscillator โ Wikipedia
- Phase plane โ Wikipedia
- Runge-Kutta methods โ Wikipedia
Reference this content, page, or tool as:
"Second-Order ODE Solver" at https://MiniWebtool.com/second-order-ode-solver/ from MiniWebtool, https://MiniWebtool.com/
by miniwebtool team. Updated: Apr 22, 2026
You can also try our AI Math Solver GPT to solve your math problems through natural language question and answer.
Calculus:
- Convolution Calculator Featured
- Derivative Calculator
- Directional Derivative Calculator
- Double Integral Calculator
- Implicit Derivative Calculator
- Integral Calculator
- Inverse Laplace Transform Calculator
- Laplace Transform Calculator
- Limit Calculator
- Partial Derivative Calculator
- Single Variable Derivative Calculator
- Taylor Series Calculator
- Triple Integral Calculator
- Radius of Convergence Calculator
- Curvature Calculator
- Wronskian Calculator
- Runge-Kutta (RK4) Method Calculator
- Fourier Series Coefficients Calculator
- Volume of Revolution Calculator New
- Surface of Revolution Calculator New
- Riemann Sum Calculator New
- Trapezoidal Rule Calculator New
- Simpson's Rule Calculator New
- Improper Integral Calculator New
- L'Hรดpital's Rule Calculator New
- Maclaurin Series Calculator New
- Power Series Calculator New
- Series Convergence Test Calculator New
- Infinite Series Sum Calculator New
- Average Rate of Change Calculator New
- Instantaneous Rate of Change Calculator New
- Related Rates Solver New
- Optimization Calculator (Calculus) New
- Gradient Calculator (Multivariable) New
- Divergence Calculator New
- Curl Calculator New
- Line Integral Calculator New
- Surface Integral Calculator New
- Newton's Method Calculator New
- First-Order ODE Solver New
- Second-Order ODE Solver New
- Direction Field / Slope Field Plotter New
- Euler's Method Calculator New
- Bernoulli ODE Solver New
- System of ODEs Solver New
- Fast Fourier Transform (FFT) Calculator New
- Z-Transform Calculator New
- Numerical Integration Calculator New