Since 2010 · Powering 2M+ tool runs every month
Since 2010
Add to Chrome

My Toolbox

Automatic Mode

No saved tools yet.

Go Premium
Related tools
Second-Order ODE SolverBernoulli ODE SolverSystem of ODEs SolverRunge-Kutta (RK4) Method CalculatorEuler's Method CalculatorDirection Field / Slope Field Plotter
Home Page > Math > Calculus

First-Order ODE Solver

Solve first-order ordinary differential equations symbolically and numerically. Auto-detects separable, linear, exact and autonomous forms, applies the right technique, and draws an interactive slope field with the solution curve.

Free to useNo sign-up requiredInstant Results
First-Order ODE SolverTry it now — free ▼
dy/dx =
Use x, y as variables. Operators: + - * / ^ **. Functions: sin, cos, tan, exp, log, sqrt, abs. Constants: pi, e.
x₀
y₀
x min
x max
Initial condition y(x₀) = y₀. The solver integrates outward from x₀ in both directions to fill the range.

Embed First-Order ODE Solver Widget

About First-Order ODE Solver

The First-Order ODE Solver takes an ordinary differential equation in the form dy/dx = f(x, y), automatically classifies its structure (separable, linear, autonomous, exact, or general), and produces both a symbolic closed-form solution where possible and a high-accuracy numerical solution everywhere. A live slope-field visualization with the solution curve overlaid makes the geometric meaning of the equation immediately obvious — solutions are exactly the curves tangent to every arrow.

What Is a First-Order ODE?

A first-order ordinary differential equation involves an unknown function y(x) and its first derivative y'(x) only. The standard explicit form is:

dy/dx = f(x, y)

Combined with an initial condition y(x₀) = y₀, this defines an initial-value problem (IVP). The Picard-Lindelöf theorem guarantees a unique solution in some neighborhood of x₀ as long as f is Lipschitz continuous in y near (x₀, y₀). Geometrically, the IVP asks for the unique curve passing through (x₀, y₀) whose slope at every point matches f at that point — exactly the curve tangent to the slope field.

Six Classes the Solver Recognizes

Class Form Standard solving technique What this tool does
Pure integration dy/dx = f(x) Direct integration: y = ∫f(x) dx + C Numerical integration (RK4 reduces to Simpson-like quadrature)
Linear (constant coeffs) dy/dx = a·y + b Closed form via integrating factor or characteristic root Full symbolic answer + step-by-step derivation
Autonomous dy/dx = f(y) Separation: ∫dy/f(y) = x + C Numerical solution + slope-field visualization
Separable dy/dx = g(x)·h(y) Separation: ∫dy/h(y) = ∫g(x) dx + C Form detected via cross-product test; numerical solution shown
Linear (variable coeffs) dy/dx + P(x)·y = Q(x) Integrating factor μ(x) = e^∫P(x) dx Form detected via finite-difference linearity test; numerical solution shown
General Any other dy/dx = f(x, y) Numerical methods (RK4, RK45, BDF, …) Classical Runge-Kutta with 600 sub-steps

Closed-Form Method: Linear With Constant Coefficients

When the right-hand side simplifies to dy/dx = a·y + b with constants a and b, the integrating factor μ(x) = e^(-a·x) gives an exact solution. The general solution is:

y(x) = -b/a + C · e^(a·x) (a ≠ 0) y(x) = b·x + C (a = 0)

Applying the initial condition y(x₀) = y₀ pins down the constant C and yields the unique particular solution. This single class covers an enormous number of textbook problems:

Reading a Slope Field

At every grid point (x, y) the tool draws a short line segment whose slope equals f(x, y). Three useful observations:

Numerical Method: Classical Runge-Kutta (RK4)

Given (x_n, y_n), the next value is computed by averaging four slope estimates:

k₁ = f(x_n, y_n) k₂ = f(x_n + h/2, y_n + h·k₁/2) k₃ = f(x_n + h/2, y_n + h·k₂/2) k₄ = f(x_n + h, y_n + h·k₃) y_{n+1} = y_n + (h/6) · (k₁ + 2k₂ + 2k₃ + k₄)

RK4 has local truncation error O(h⁵) and global error O(h⁴), giving roughly six-digit accuracy at the default step count for non-stiff equations. The solver integrates outward from the initial point in both x-directions and stops cleanly if the magnitude of y exceeds 10¹⁵ — typical for solutions that blow up in finite time, like dy/dx = y².

How to Use This Calculator

  1. Enter the right-hand side in the dy/dx = ... field. Use x and y as variables, * for multiplication, ^ or ** for powers, and standard functions like sin, cos, exp, log, sqrt. Constants pi and e are recognized.
  2. Specify the initial condition (x₀, y₀) — the unique solution curve will pass through this point.
  3. Pick the x range over which to plot the slope field and the solution curve. The y range is auto-fit from the integrated solution.
  4. Click Solve & Visualize. The classifier runs first; if your equation matches a closed-form pattern (linear with constant coefficients), you get the symbolic answer. The slope field and solution curve are always rendered.
  5. Toggle the slope field on or off to focus on the solution curve, or replay the curve-drawing animation to see how integration progresses from the initial point.

Worked Example: Newton's Law of Cooling

A cup of coffee at 80 °C cools in a 20 °C room. The heat-transfer rate is proportional to the temperature difference:

dT/dt = -0.1 · (T - 20), T(0) = 80

This is linear with constant coefficients (a = -0.1, b = 2). The closed form is:

T(t) = 20 + 60 · e^(-0.1 t)

After 30 minutes: T(30) = 20 + 60·e⁻³ ≈ 22.99 °C. The slope-field view makes the limiting behavior obvious — every solution curve, regardless of starting temperature, asymptotes to the horizontal line T = 20.

Common Applications

Frequently Asked Questions

What is a first-order ordinary differential equation?

A first-order ordinary differential equation (ODE) is an equation of the form dy/dx = f(x, y) that involves the unknown function y(x) and its first derivative. Solving the ODE means finding the function y(x) whose derivative matches the right-hand side. With an initial condition y(x₀) = y₀ the solution is unique under mild regularity assumptions (Picard-Lindelöf theorem).

What is a slope field?

A slope field (or direction field) plots a small line segment at each grid point (x, y) whose slope equals f(x, y). Solution curves of the ODE are exactly the curves that are tangent to these segments at every point. The slope field gives instant visual intuition for the global behavior of solutions without solving the equation symbolically.

Which classes of first-order ODEs does this tool solve?

The tool auto-classifies the equation into one of: integrable (depends only on x, solved by direct integration), linear with constant coefficients y' = a·y + b (full closed-form provided), autonomous (depends only on y), separable (factors as g(x)·h(y)), linear with variable coefficients (P(x)·y + Q(x)), or general. For every class, a high-accuracy Runge-Kutta numerical solution and slope-field visualization are produced.

What numerical method is used?

The classical fourth-order Runge-Kutta method (RK4) is applied with 300 sub-steps in each direction from the initial point. RK4 has local truncation error O(h⁵) and is the standard workhorse for non-stiff ODEs at this scale. The solver detects divergence (overflow or NaN) and stops integration cleanly so the plot remains valid.

What is the integrating-factor method for linear ODEs?

For a linear first-order ODE y' + P(x)·y = Q(x), multiply both sides by the integrating factor μ(x) = e^∫P(x) dx. The left side becomes the exact derivative d/dx[μ·y], so y(x) = (1/μ(x)) · (∫μ(x)·Q(x) dx + C). When P and Q are constants this collapses to the closed form y = -b/a + C·e^(a·x), which the tool returns automatically.

Can this tool handle stiff equations or systems of ODEs?

This solver is intended for non-stiff first-order scalar ODEs. Very stiff problems (where the solution has multiple time scales differing by many orders of magnitude) may need an implicit method like backward Euler or Rosenbrock; coupled systems require a vector-valued solver. For those cases use a dedicated package such as SciPy's solve_ivp or specialized stiff-ODE solvers.

Further Reading

Reference this content, page, or tool as:

"First-Order ODE Solver" at https://MiniWebtool.com/first-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:

Top & Updated:

Related Rates SolverExponential Equation SolverRecurrence Relation SolverView all →
Home Page > Math > Calculus > First-Order ODE Solver