Skip to main content

Differential Equation Solver

Calculate differential equation instantly with our math tool. Shows detailed work, formulas used, and multiple solution methods.

Share this calculator

Formula

First: dy/dt = ky => y = y0*e^(kt) | Second: ay'' + by' + cy = 0 => characteristic ar^2 + br + c = 0

First-order homogeneous ODEs have exponential solutions. Second-order ODEs are solved via the characteristic equation, producing real distinct roots, repeated roots, or complex conjugate roots, each giving a different solution form.

Worked Examples

Example 1: First-Order Exponential Decay

Problem: Solve dy/dt = -0.5y with y(0) = 100. Find y at t = 2 and the half-life.

Solution: This is a first-order homogeneous ODE with k = -0.5\nGeneral solution: y(t) = y0 * e^(kt) = 100 * e^(-0.5t)\n\nAt t = 2: y(2) = 100 * e^(-1) = 100 * 0.3679 = 36.79\nHalf-life = ln(2) / |k| = 0.6931 / 0.5 = 1.3863\n\nVerification: y(1.3863) = 100 * e^(-0.5 * 1.3863) = 100 * 0.5 = 50

Result: y(2) = 36.79 | Half-life = 1.386 | Solution: y(t) = 100e^(-0.5t)

Example 2: Second-Order Oscillatory (Underdamped)

Problem: Solve y'' + 2y' + 5y = 0 with y(0) = 1, y'(0) = 0.

Solution: Characteristic equation: r^2 + 2r + 5 = 0\nDiscriminant = 4 - 20 = -16 < 0 (complex roots)\nalpha = -2/2 = -1, beta = sqrt(16)/2 = 2\nRoots: -1 +/- 2i\n\nGeneral solution: y = e^(-t)[C1*cos(2t) + C2*sin(2t)]\ny(0) = C1 = 1\ny'(0) = -C1 + 2*C2 = 0, so C2 = 0.5\n\nParticular solution: y = e^(-t)[cos(2t) + 0.5*sin(2t)]\nPeriod = 2*pi/2 = pi = 3.14159\nAt t = 1: y = e^(-1)[cos(2) + 0.5*sin(2)] = 0.3679 * [-0.4161 + 0.4546] = 0.01417

Result: y(1) = 0.01417 | Period = 3.14159 | Decaying oscillation

Frequently Asked Questions

What is a differential equation and why are they important?

A differential equation is a mathematical equation that relates a function to its derivatives, expressing how a quantity changes with respect to one or more variables. They are fundamental because most natural phenomena involve rates of change: population growth depends on current population, heat flow depends on temperature gradients, and force depends on acceleration (second derivative of position). Newton's second law F = ma is itself a differential equation relating force to the second derivative of position. Differential equations appear in every branch of science and engineering, from quantum mechanics to economics. Solving them reveals how systems evolve over time, making them essential tools for prediction and understanding of dynamic systems.

What is the characteristic equation for a second-order linear ODE?

For the second-order ODE ay'' + by' + cy = 0, the characteristic equation is ar^2 + br + c = 0, obtained by substituting y = e^(rt) into the ODE. The roots r1 and r2 of this quadratic determine the form of the solution. If the discriminant b^2 - 4ac > 0, there are two distinct real roots, giving y = C1*e^(r1*t) + C2*e^(r2*t). If the discriminant equals zero, there is a repeated root r, giving y = (C1 + C2*t)*e^(rt). If the discriminant is negative, the roots are complex conjugates alpha +/- beta*i, giving y = e^(alpha*t)*(C1*cos(beta*t) + C2*sin(beta*t)). This method reduces solving a differential equation to solving an algebraic equation.

How are differential equations used in population dynamics and ecology?

In ecology, the simplest model is exponential growth dP/dt = rP, giving P(t) = P0*e^(rt). The logistic equation dP/dt = rP(1 - P/K) adds a carrying capacity K, preventing unlimited growth. Predator-prey models like the Lotka-Volterra equations use coupled first-order ODEs: dx/dt = ax - bxy (prey) and dy/dt = -cy + dxy (predator), producing oscillating populations. Epidemic models (SIR) use three coupled equations for susceptible, infected, and recovered populations. These models, while simplified, capture essential dynamics and guide conservation decisions, disease control strategies, and resource management. The key insight from differential equations is that population behavior emerges from instantaneous rates of change.

What is the role of initial conditions in solving differential equations?

Initial conditions specify the state of the system at a particular time (usually t = 0) and are necessary to determine a unique solution from the family of general solutions. A first-order ODE has one arbitrary constant, so one initial condition y(0) = y0 is needed. A second-order ODE has two constants, requiring both y(0) and y'(0). Without initial conditions, you get a general solution representing infinitely many possible curves. With initial conditions, you get the particular solution describing the specific physical situation. For example, the same spring equation produces very different motions depending on whether you release it from rest (y'(0) = 0) or give it an initial velocity. Initial conditions bridge the gap between abstract mathematics and specific physical scenarios.

What numerical methods exist for solving differential equations?

When analytical solutions are not available (which is most real-world cases), numerical methods approximate the solution step by step. Euler's method is the simplest: y(t + h) = y(t) + h*f(t, y(t)), stepping forward by small increments h. It is easy to implement but has large errors. The Runge-Kutta methods (especially RK4) evaluate the derivative at multiple points within each step, achieving much higher accuracy: y(t+h) uses a weighted average of four slope estimates. Adaptive methods like Dormand-Prince automatically adjust step size for efficiency. For stiff equations (multiple time scales), implicit methods like backward Euler or BDF methods are needed. Modern scientific computing uses sophisticated ODE solvers that combine adaptive stepping, error control, and event detection.

How are differential equations applied in electrical circuit analysis?

Electrical circuits containing inductors (L), capacitors (C), and resistors (R) are naturally described by differential equations. An RLC series circuit satisfies L*d^2q/dt^2 + R*dq/dt + q/C = V(t), a second-order ODE for charge q. The characteristic equation Lr^2 + Rr + 1/C = 0 has discriminant R^2 - 4L/C. Underdamped (R^2 < 4L/C) circuits oscillate, forming the basis of radio tuners and oscillators. Overdamped circuits dissipate energy without oscillation. Critically damped circuits are used in measurement instruments for fastest response without ringing. RC circuits (first-order) model signal filtering, with the time constant RC determining the cutoff frequency. These models are essential for designing everything from power supplies to communication systems.

References