Differential Equation Calculator: Solve First & Second-Order Linear ODEs
A differential equation calculator takes an equation that relates a function to its own derivatives and returns the general — or particular — solution without you having to grind through the algebra by hand. This tool focuses on the two forms most students actually encounter first: first-order linear equations with a constant coefficient, and second-order linear homogeneous equations with constant coefficients. Enter your coefficients, and it walks the characteristic-equation method for you and returns a solution in standard form.
What Is a Differential Equation?
A differential equation is any equation that includes a function together with one or more of its derivatives. Instead of solving for a single number, like in algebra, you’re solving for an entire function — one whose rate of change matches whatever the equation describes. They show up constantly in physics (motion, decay, circuits), biology (population growth), and engineering (vibrations, heat flow), because most real systems are defined by how fast something changes, not by a fixed value.
Equations are classified by two things: order (the highest derivative present) and linearity (whether the function and its derivatives appear only to the first power, with no products between them). This calculator handles linear equations of first and second order — by far the most common starting point in an introductory differential equations or calculus course.
Equation Types This Calculator Solves
- First-order linear, constant coefficient: dy/dx + ky = 0. This models simple exponential growth or decay — the rate of change of y is proportional to y itself.
- Second-order linear homogeneous, constant coefficients: ay” + by’ + cy = 0. This is the equation behind undamped and damped oscillation, and it’s usually the first place students meet the characteristic equation method.
How to Use the Calculator
- Choose First-Order or Second-Order Homogeneous from the dropdown.
- For first-order, enter the coefficient k. Add an initial value y(0) if you want a specific (particular) solution instead of the general one.
- For second-order, enter coefficients a, b, and c exactly as they appear in your equation.
- Click Solve Equation. The calculator forms the characteristic equation, finds its roots, and builds the general solution in the correct form for real, repeated, or complex roots.
The Math Behind the Characteristic Equation
For a second-order equation ay” + by’ + cy = 0, you assume a solution of the form y = erx and substitute it in. Because derivatives of erx just multiply it by powers of r, the equation reduces to a quadratic in r — the characteristic equation: ar² + br + c = 0. Solve that with the quadratic formula, and the nature of the roots tells you the shape of the solution:
| Discriminant (b² − 4ac) | Root type | General solution |
|---|---|---|
| Positive | Two distinct real roots r₁, r₂ | y = C₁e^(r₁x) + C₂e^(r₂x) |
| Zero | One repeated real root r | y = (C₁ + C₂x)e^(rx) |
| Negative | Complex conjugate roots α ± βi | y = e^(αx)(C₁cos(βx) + C₂sin(βx)) |
Notice the discriminant here is the exact same b² − 4ac you’d use to solve a plain quadratic equation — the only difference is what the roots then represent. If you haven’t worked with quadratics in a while, our quadratic equation calculator is a good refresher on how the discriminant and the roots relate before tackling the differential version.
The first-order case is simpler: for dy/dx + ky = 0, separating variables and integrating gives y = Ce−kx, where C is fixed by an initial condition if one is given (C = y(0)).
Worked Examples
Example 1: Two distinct real roots
Solve: y” − 3y’ + 2y = 0
Characteristic equation: r² − 3r + 2 = 0 → (r − 1)(r − 2) = 0 → r₁ = 1, r₂ = 2.
General solution: y = C₁eˣ + C₂e²ˣ
Example 2: Repeated root
Solve: y” − 4y’ + 4y = 0
Characteristic equation: r² − 4r + 4 = 0 → (r − 2)² = 0 → r = 2 (repeated).
General solution: y = (C₁ + C₂x)e²ˣ
Example 3: Complex conjugate roots
Solve: y” + 4y = 0
Characteristic equation: r² + 4 = 0 → r = ±2i, so α = 0, β = 2.
General solution: y = C₁cos(2x) + C₂sin(2x) — a pure oscillation, which is exactly what you’d expect from an equation with no y’ term (no damping).
What This Calculator Doesn’t Solve
Being upfront about scope matters more than pretending a simple tool can do everything. This calculator is built for linear equations with constant coefficients — first-order and homogeneous second-order. It does not solve:
- Nonhomogeneous equations (ay” + by’ + cy = f(x), where the right side isn’t zero) — these need undetermined coefficients or variation of parameters on top of the homogeneous solution.
- Nonlinear differential equations, where y or its derivatives appear raised to a power or multiplied together.
- Variable-coefficient equations, where a, b, or c depend on x rather than being constants.
- Systems of differential equations or partial differential equations.
For those cases, a full computer algebra system such as Wolfram Alpha is the more appropriate tool. If your equation fits the constant-coefficient linear form above, though, this calculator will get you the exact same result faster.
Why These Equations Matter in Practice
First and second-order linear equations with constant coefficients aren’t just a textbook exercise — they’re the mathematical skeleton behind a surprising number of real systems, which is part of why they show up so early in any differential equations course.
- Radioactive decay and cooling: dy/dx + ky = 0 describes anything that decreases at a rate proportional to its current amount — radioactive decay, drug concentration leaving the bloodstream, or an object cooling toward room temperature (Newton’s Law of Cooling).
- Population growth: The same first-order form, with the sign flipped, models simple exponential population growth when resources aren’t limiting — the rate of growth is proportional to the current population size.
- Spring-mass systems: ay” + by’ + cy = 0 is the equation for a mass on a spring. The coefficient a relates to mass, b to damping (friction or resistance), and c to the spring’s stiffness. Real roots with no oscillation describe overdamped motion (think a screen door closer); complex roots describe the back-and-forth motion of a lightly damped spring.
- RLC electrical circuits: The same second-order form governs current in a circuit containing a resistor, inductor, and capacitor — resistance plays the role of damping, exactly as it does in the mechanical spring analogy.
Seeing the equation this way helps explain why the three root cases matter physically, not just algebraically: distinct real roots mean the system settles down without oscillating, a repeated root sits right on the boundary between oscillating and not, and complex roots mean the system genuinely swings back and forth before (if the real part is negative) eventually settling.
Common Mistakes When Solving by Hand
- Dropping the second arbitrary constant. A second-order equation always needs two independent constants (C₁ and C₂) in the general solution — forgetting one is the most frequent error.
- Mixing up the repeated-root form. It’s (C₁ + C₂x)e^(rx), not C₁e^(rx) + C₂e^(rx) — the second term needs the extra factor of x, or it isn’t linearly independent from the first.
- Sign errors in the discriminant. b² − 4ac is easy to get wrong when b or c is negative — double-check before deciding which case applies.
- Forgetting units/context when an initial condition is given. A particular solution needs both C₁ and C₂ pinned down, which usually requires two conditions — y(0) and y'(0) — not just one.
Frequently Asked Questions
For the equation types on this page, you form the characteristic equation by assuming a solution of the form e^(rx), solve the resulting polynomial for r, and then write the general solution based on whether the roots are real and distinct, repeated, or complex. Applying an initial condition afterward turns the general solution into a specific one.
Select your equation type, enter the coefficients, and leave any initial-value fields blank. The result will include the arbitrary constants (C₁, C₂, or C) rather than specific numbers, which is the general solution.
The first-order equation this calculator solves (dy/dx + ky = 0) is separable — you can rearrange it to dy/y = −k dx and integrate both sides directly. The second-order homogeneous case is solved with the characteristic-equation method instead, since separation doesn’t apply once a second derivative is involved.
No — it’s built for homogeneous equations (where the right-hand side is zero). Nonhomogeneous equations need an additional particular-solution step, usually undetermined coefficients or variation of parameters.
Complex roots (α ± βi) mean the solution oscillates rather than grows or decays purely exponentially. The real part α controls whether the oscillation grows, shrinks, or stays constant, and the imaginary part β sets the frequency.
No — you just need the coefficients from your equation. Understanding the underlying calculus helps you interpret the result, but the calculator does the derivative and algebra work for you.
Related Calculators
- Equation Solver Calculator — solve linear and quadratic algebraic equations.
- Scientific Calculator — for general calculation needs alongside your equation work.
- Grade Average Calculator — track your course average while working through a differential equations class.
- All Math Calculators — browse the full math tools collection.
The Differential Equation Calculator is built to give students and self-learners a fast, accurate way to check first-order and second-order homogeneous linear equations — showing the same characteristic-equation reasoning you’d use on paper, without the arithmetic slowing you down.
