Differential Equation Solver

Identify common ODE forms, show the relevant solution method, and draw a direction field with a draggable initial point.

Results are calculated automatically as you enter data.

Steps and assumptions
Solution Enter an ODE.

▼ See explanations and tips below ▼

What Is Solving an Ordinary Differential Equation Initial Value Problem?

An ordinary differential equation, or ODE, is an equation that connects an unknown function with one or more of its derivatives. Instead of asking for a single number, an ODE asks for a function. For example, a first-order equation may describe how the value of \(y\) changes as \(x\) changes:

$$ \frac{dy}{dx} = f(x,y) $$

An initial value problem adds a starting point. For a first-order equation, that usually means a value such as \(y(x_0)=y_0\). The differential equation gives the local rule for change, while the initial condition chooses the specific curve that follows that rule.

For a second-order equation, a starting value alone is usually not enough. A second-order initial value problem also needs an initial slope, such as:

$$ y(x_0)=y_0, \qquad y'(x_0)=y'_0 $$

Solving the problem means finding the particular function that satisfies both the equation and the initial condition. When an exact formula can be found, the result is called a closed-form or analytical solution. When an exact formula is not available or not detected, a numerical method can approximate the solution at many points and trace the solution curve.


Why Initial Value Problems Matter

Initial value problems are common because many real systems are described by a present state and a rule for how that state changes. A population model may start with today’s population. A cooling model may start with the current temperature. A motion problem may start with an initial position and velocity.

For students, initial value problems connect derivatives, functions, graphs, and real-world interpretation. For instructors, they are useful for showing the difference between a family of possible solutions and one particular solution. For practical modeling, they help answer questions such as “What happens next if the system starts here?”

A graph can be especially helpful because the equation describes slopes, not just points. A direction field shows the slope that the solution would have at many points, and the solution curve is the path that follows those slopes through the chosen initial point.


Key Terms to Know

  • Ordinary differential equation: An equation involving an unknown function of one independent variable and its derivatives.
  • Order: The highest derivative that appears in the equation. For example, \(y'\) is first order and \(y''\) is second order.
  • Initial condition: A starting value such as \(y(x_0)=y_0\), and for second-order problems often an initial slope as well.
  • General solution: A family of solutions containing arbitrary constants, such as \(C\), \(C_1\), or \(C_2\).
  • Particular solution: The specific solution obtained after applying the initial condition.
  • Direction field: A visual map of local slopes for a first-order equation \(y'=f(x,y)\).
  • Closed-form solution: A solution written as a formula using standard functions.
  • Numerical solution: An approximate solution generated step by step, usually as a table or curve rather than a single exact formula.
  • Step size: The spacing used by a numerical method when moving from one approximate point to the next.
  • Equilibrium solution: A constant solution where the derivative is zero, so the value does not change.

How Solving ODE Initial Value Problems Works

A first-order ODE in explicit form is written as:

$$ y' = f(x,y) $$

At any point \((x,y)\), the right-hand side \(f(x,y)\) tells you the slope of the solution curve. The initial condition tells you which curve to follow.

Some common first-order equations have standard analytical methods.

A separable equation can be rearranged so the \(y\) terms and \(x\) terms are integrated separately:

$$ \frac{dy}{dx} = g(x)h(y) $$

A first-order linear equation is often written in standard form as:

$$ y' + P(x)y = Q(x) $$

It can be solved with an integrating factor. A logistic equation has the form:

$$ y' = r y\left(1 - \frac{y}{K}\right) $$

Here, \(r\) is a growth-rate coefficient and \(K\) is the carrying capacity. The term \(1-y/K\) slows growth as \(y\) approaches \(K\).

A direct-integration case has the derivative depending only on \(x\), such as a polynomial:

$$ y' = a_nx^n + \cdots + a_1x + a_0 $$

Then \(y\) is found by integrating the right-hand side:

$$ y = \sum_{k=0}^{n}\frac{a_k}{k+1}x^{k+1} + C $$

For equations that can be evaluated as \(y'=f(x,y)\) but are not matched to a closed-form pattern, a numerical method can approximate the curve. A common fourth-order Runge-Kutta step uses four slope estimates:

$$ \begin{aligned} k_1 &= f(x_n,y_n) \\ k_2 &= f\left(x_n+\frac{h}{2},\,y_n+\frac{h}{2}k_1\right) \\ k_3 &= f\left(x_n+\frac{h}{2},\,y_n+\frac{h}{2}k_2\right) \\ k_4 &= f(x_n+h,\,y_n+hk_3) \end{aligned} $$

Then the next value is approximated by:

$$ y_{n+1}=y_n+\frac{h}{6}\left(k_1+2k_2+2k_3+k_4\right) $$

The idea is to sample the slope at the beginning, middle, middle again, and end of the step, then take a weighted average.

For the supported second-order harmonic form,

$$ y'' + ay = 0 $$

with \(a>0\), the solution is built from sine and cosine functions. If \(\omega=\sqrt{a}\), a solution satisfying \(y(x_0)=y_0\) and \(y'(x_0)=y'_0\) is:

$$ y(x)=y_0\cos\left(\omega(x-x_0)\right)+\frac{y'_0}{\omega}\sin\left(\omega(x-x_0)\right) $$

If \(a=0\), then \(y''=0\), so the slope is constant and the solution is linear:

$$ y(x)=y_0+y'_0(x-x_0) $$

Examples of ODE Initial Value Problems in Practice

Example 1: A Simple Separable Equation

Solve:

$$ y' = xy, \qquad y(0)=1 $$

Separate variables:

$$ \frac{1}{y}\,dy = x\,dx $$

Integrate both sides:

$$ \ln|y| = \frac{x^2}{2}+C $$

Rewrite the solution:

$$ y = Ce^{x^2/2} $$

Apply \(y(0)=1\):

$$ 1 = Ce^0 $$

So \(C=1\), and the particular solution is:

$$ y=e^{x^2/2} $$

For example, at \(x=2\):

$$ y(2)=e^2 \approx 7.3891 $$

The initial condition selects one curve from the family \(y=Ce^{x^2/2}\).


Example 2: Logistic Growth with a Carrying Capacity

A logistic equation can model growth that slows as the value approaches a maximum sustainable level. Consider:

$$ y'=0.6y\left(1-\frac{y}{80}\right), \qquad y(0)=8 $$

Here, \(r=0.6\), \(K=80\), and the initial value is \(8\). The logistic solution is:

$$ y(x)=\frac{80}{1+9e^{-0.6x}} $$

At \(x=10\):

$$ y(10)=\frac{80}{1+9e^{-6}} \approx 78.2542 $$

The result is close to \(80\), but it does not simply grow without limit. The equation itself slows the growth as \(y\) approaches the carrying capacity.


Example 3: A Zero-Acceleration Edge Case

For the second-order equation:

$$ y''+0y=0, \qquad y(0)=2, \qquad y'(0)=-3 $$

The equation reduces to:

$$ y''=0 $$

That means the slope is constant. Since the initial slope is \(-3\), the solution is:

$$ y(x)=2-3x $$

This is not oscillation. It is straight-line motion because the second derivative is zero.


How to Interpret the Result

A displayed solution formula is usually the particular solution after applying the initial condition. This is the curve that passes through the initial point and follows the equation’s slope rule.

A general solution shows the larger family of possible solutions before the initial condition is applied. Arbitrary constants such as \(C\), \(C_1\), or \(C_2\) represent choices that are fixed once the starting value and, when needed, starting slope are known.

A detected method label describes the pattern that was recognized. It should be read as “this is the method used here,” not as a complete classification of every mathematically equivalent way to write the equation.

When the result says the solution is numerical, the graph and table are approximations generated from the differential equation. They are useful for understanding the behavior of the solution, but they are not the same as an exact symbolic formula.

For a first-order graph, the direction field shows local slopes \(f(x,y)\). The highlighted curve is the solution through the chosen initial point. If you move the initial point, a different solution curve may be selected from the same differential equation.

For a supported second-order harmonic equation, \(\omega=\sqrt{a}\) is the angular-frequency parameter in the sine and cosine solution. The initial value sets the starting height, and the initial slope affects how much sine component appears in the particular solution.

The variables \(x\) and \(y\) do not have built-in physical units. If you are using the equation for a real application, the units come from your model, not from the calculator interface.


Common Mistakes and Misconceptions

A common mistake is using variables other than \(x\) and \(y\). Many textbooks use \(t\) for time, but this calculator expects \(x\) as the independent variable and \(y\) as the dependent variable.

Another mistake is expecting every solvable-looking equation to produce a symbolic answer. Some equations have closed forms that are not recognized by a narrow pattern matcher. In those cases, a numerical curve may still be useful if the equation can be evaluated as \(f(x,y)\).

For first-order problems, do not confuse the direction field with the solution. The direction field shows many possible local slopes; the initial condition chooses one curve through that field.

For second-order problems, the supported form is limited. Equations with damping, forcing, nonlinear terms, variable coefficients, or negative coefficients in the simple harmonic pattern require methods beyond this calculator’s supported second-order mode.

For a supported second-order equation, remember to enter a finite initial slope. First-order equations determine their slope from the equation itself, so the initial-slope field may be left blank.

It is also important to set the maximum \(x\) value greater than the initial \(x\). The calculator uses that range to build the displayed solution interval.

Finally, avoid unsupported notation such as Math.sin(x), sec(x), log10(x), or piecewise definitions. Use accepted mathematical functions and keep the equation within the supported forms.


When to Use ODE Initial Value Problem Solving

Use this concept when you need to understand how a quantity changes from a known starting point.

Typical uses include:

  • studying slope fields and solution curves in a differential equations course;
  • checking a separable, linear, logistic, or direct-integration solution;
  • comparing a symbolic solution with a numerical curve;
  • exploring how a different initial condition changes the solution;
  • modeling growth, decay, cooling, motion, or simple oscillation in an introductory setting.

For advanced modeling, treat the result as a starting point. More complex systems may need a dedicated numerical solver, parameter controls, error tolerances, units, or professional review.


Limitations and Things to Keep in Mind

Closed-form detection is limited to specific patterns. A mathematically solvable equation may still fall back to numerical plotting if it is not written in a recognized form.

The numerical fallback is for first-order equations that can be evaluated as \(y'=f(x,y)\). It uses adaptive fourth-order Runge-Kutta with internal absolute and relative error targets. Step sizes shrink or grow automatically, and the calculator reports a warning if it cannot cover the requested interval reliably. There is no user control for tolerance or numerical method.

The supported second-order mode is narrow. It handles equations of the form:

$$ y'' + ay = 0 $$

where \(a\) is a nonnegative numeric coefficient. It does not handle damped equations, forced equations, variable coefficients, nonlinear second-order equations, arbitrary higher-order equations, systems of equations, or complex-valued solutions.

The graph and table are display tools. A sampled table may omit many computed points, and the number of curve points is not a measure of exactness.

Rounding can affect how values appear. Very small values may display as \(0\), very large or very small nonzero values may display in exponential notation, and ordinary numeric values may be shortened by removing trailing zeros.

Because the variables are unitless unless you define units in your model, always interpret the result in the context of your equation. For engineering, safety, scientific, medical, financial, or official decisions, verify the model and solution with appropriate tools or a qualified professional.


How to Use This Calculator

  1. Enter a supported differential equation, such as \(y'=f(x,y)\), \(y' + g(x,y)=h(x,y)\), a bare right-hand side treated as \(y'=f(x,y)\), or the supported second-order form \(y''+ay=0\).
  2. Enter the initial \(x\) value and initial \(y\) value.
  3. For a supported second-order equation, enter a finite initial slope. For a first-order equation, this field may be left blank.
  4. Enter a maximum \(x\) value greater than the initial \(x\) value.
  5. Use the example buttons if you want to load a logistic, separable, linear, or second-order sample problem.
  6. Review the solution, detected method, general solution, step-by-step work, sampled table, and graph.
  7. For first-order equations, drag the highlighted initial point on the graph to explore how a new initial condition changes the solution curve.
  8. Download the graph as a PNG if you need to save the displayed curve.

Frequently Asked Questions

Does this calculator always give an exact solution?

No. It gives a closed-form solution only when the equation matches a supported symbolic pattern. Otherwise, a supported first-order equation may be traced numerically with fourth-order Runge-Kutta.


What does the initial slope mean?

The initial slope is the value of \(y'(x_0)\). It matters for supported second-order equations because a second-order initial value problem needs both a starting value and a starting slope. For first-order equations, the slope already comes from the equation, so the initial-slope input does not change the solution.


Why did a simple-looking equation use a numerical method?

The equation may be algebraically solvable but not written in a pattern the calculator recognizes. Rewriting the equation in a clearer supported form may help, but some equations will still require numerical approximation.


What does the direction field show?

The direction field shows the slope \(f(x,y)\) at many points for a first-order equation. The solution curve is the path that follows those local slopes through the initial point.


Can this solve systems of differential equations?

No. This calculator is designed for a single dependent variable \(y\) as a function of \(x\). Systems of ODEs, arbitrary higher-order equations, and piecewise or complex-valued problems require a different solver.


Sources and References

Books and Open Textbooks

  1. Gilbert Strang and Edwin “Jed” Herman. Calculus Volume 2. OpenStax, 2016. Chapter 4, “Introduction to Differential Equations,” especially Sections 4.1–4.5 on differential equations, initial value problems, direction fields, separable equations, logistic equations, and first-order linear equations. OpenStax Calculus Volume 2
  2. William F. Trench. Elementary Differential Equations with Boundary Value Problems. Trinity University source content, available through Mathematics LibreTexts. Chapters 2–3, especially first-order equations and the Runge-Kutta method. LibreTexts book page
  3. William F. Trench. “3.3: The Runge-Kutta Method.” Mathematics LibreTexts, accessed June 28, 2026. Used for the fourth-order Runge-Kutta formulas and numerical-method interpretation. The Runge-Kutta Method
  4. Russell Herman. A First Course in Differential Equations for Scientists and Engineers. Mathematics LibreTexts, accessed June 28, 2026. Section 2.3, “Simple Harmonic Oscillators,” used for the simple harmonic oscillator form and sine/cosine solution behavior. Simple Harmonic Oscillators