Initial Value Problem Calculator
Solve first and second order linear ODEs with constant coefficients — find the general solution, then apply initial conditions to get the particular solution satisfying your IVP, with complete step-by-step working.
General Solution
Particular Solution (IVP)
Characteristic Equation
Distinct Real
r₁≠r₂
Repeated Root
r₁=r₂
Complex Pair
p±qi
General Solution
Particular Solution (IVP)
Particular Solution y_p (Undetermined Coefficients)
General Solution y = y_h + y_p
Particular Solution (IVP — with initial conditions)
For non-homogeneous ODEs with non-constant forcing functions (e.g. sin(t), eˢ, step functions), or to solve the same IVPs using the transform method: ℒ → solve in s-domain → ℒ⁻¹.
When discriminant Δ = a²−4b > 0, the characteristic equation r²+ar+b=0 has two distinct real roots r₁ and r₂. The general solution is:
y = C₁·e^(r₁t) + C₂·e^(r₂t)
Apply ICs: y(0)=y₀ gives C₁+C₂=y₀; y′(0)=y′₀ gives r₁C₁+r₂C₂=y′₀. Solve the 2×2 linear system.
When Δ = a²−4b = 0, there is one repeated root r = −a/2. The general solution is:
y = (C₁ + C₂·t)·e^(rt)
ICs: y(0)=y₀ gives C₁=y₀; y′(0)=y′₀ gives C₂+r·C₁=y′₀, so C₂=y′₀−r·y₀.
When Δ = a²−4b < 0, roots are complex: r = p ± qi where p = −a/2 and q = √(4b−a²)/2. Via Euler's formula:
y = e^(pt)·(C₁·cos(qt) + C₂·sin(qt))
ICs: y(0)=y₀ gives C₁=y₀; y′(0)=y′₀ gives p·C₁+q·C₂=y′₀, so C₂=(y′₀−p·y₀)/q.
If p=0 (pure imaginary roots): pure oscillation (no damping). If p<0: damped oscillation. If p>0: growing oscillation (unstable).
For y″+ay′+by=c with constant c: try a particular solution y_p = K (constant). Substituting: 0+0+bK=c → K=c/b (requires b≠0).
If b=0 but a≠0: try y_p=Kt. If b=0 and a=0: try y_p=Kt²/2.
General solution: y = y_h + y_p, where y_h is the homogeneous solution. Apply ICs to the full general solution.
What Is an Initial Value Problem?
This initial value problem calculator solves linear ODEs with constant coefficients using the characteristic equation method — finding the general solution, then applying your initial conditions to determine the unique particular solution satisfying the IVP. The IVP calculator handles three types: first order y′+ay=b, second order homogeneous y″+ay′+by=0, and second order non-homogeneous y″+ay′+by=c.
An initial value problem (IVP) consists of a differential equation together with enough initial conditions to uniquely determine the solution. For a first-order ODE, one initial condition is required — typically y(0) = y₀. For a second-order ODE, two initial conditions are required — y(0) = y₀ and y′(0) = y′₀. These initial conditions eliminate the arbitrary constants in the general solution to produce one unique particular solution.
Why Initial Conditions Matter
A second-order ODE like y″+4y=0 has infinitely many solutions — the general solution y = C₁cos(2t) + C₂sin(2t) represents a two-parameter family. Only the initial conditions y(0) = y₀ and y′(0) = y′₀ pin down C₁ and C₂ to give one particular solution. Without initial conditions, the problem is underdetermined.
Existence and Uniqueness: For linear ODEs with constant coefficients, the Existence and Uniqueness Theorem guarantees that given any initial conditions y(0) and y′(0), there is exactly one solution. This is why the characteristic equation method always works for this class of equations.
General Solution vs Particular Solution
Understanding the distinction between a general solution and a particular solution is essential for working with initial value problems and this particular solution calculator.
General Solution
The general solution of an ODE contains all arbitrary constants and represents the complete family of solutions. For a second-order linear ODE, the general solution has two arbitrary constants C₁ and C₂. Every solution to the ODE belongs to this family for some values of C₁ and C₂.
- First order: y = C·e^(−at) + b/a (one constant C)
- Second order: y = C₁·e^(r₁t) + C₂·e^(r₂t) (two constants C₁, C₂)
Particular Solution
The particular solution is obtained by applying the initial conditions (the IVP data) to the general solution and solving for every arbitrary constant. The result is a unique function with no free parameters — it satisfies both the ODE and all initial conditions simultaneously.
Example: General → Particular
- ODE: y″+5y′+6y=0. General solution: y = C₁e^(−2t) + C₂e^(−3t)
- Apply y(0)=2: C₁ + C₂ = 2
- Apply y′(0)=−1: −2C₁ − 3C₂ = −1
- Solve: from first equation C₁ = 2−C₂. Substitute: −2(2−C₂)−3C₂=−1 → −4+2C₂−3C₂=−1 → C₂=3... wait: −C₂=3 → C₂=−1, C₁=3
- Particular solution: y = 3e^(−2t) − e^(−3t)
How to Solve a Linear ODE with Constant Coefficients — Step-by-Step
The characteristic equation method is the standard technique for second-order linear ODEs with constant coefficients y″+ay′+by=0. The method works by assuming a solution of the form y = e^(rt) and determining which values of r make this a valid solution.
The Characteristic Equation
Substituting y = e^(rt) into y″+ay′+by=0 gives r²e^(rt)+are^(rt)+be^(rt)=0, so e^(rt)(r²+ar+b)=0. Since e^(rt)≠0, we need:
Case 1 — Two Distinct Real Roots (Δ > 0)
Example: y″+5y′+6y=0, y(0)=2, y′(0)=−1
- Characteristic equation: r²+5r+6=0
- Factor: (r+2)(r+3)=0 → r₁=−2, r₂=−3 (Δ=25−24=1>0 ✓)
- General solution: y = C₁e^(−2t) + C₂e^(−3t)
- y(0)=2: C₁+C₂=2; y′(t)=−2C₁e^(−2t)−3C₂e^(−3t); y′(0)=−1: −2C₁−3C₂=−1
- Solve: C₁=3, C₂=−1
- Particular solution: y = 3e^(−2t) − e^(−3t)
Case 2 — Repeated Root (Δ = 0)
Example: y″+4y′+4y=0, y(0)=1, y′(0)=0
- Characteristic equation: r²+4r+4=0
- (r+2)²=0 → r=−2 (repeated). Δ=16−16=0 ✓
- General solution: y = (C₁+C₂t)e^(−2t)
- y(0)=1: C₁=1
- y′(t)=C₂e^(−2t)+(C₁+C₂t)(−2)e^(−2t); y′(0)=C₂−2C₁=0 → C₂=2
- Particular solution: y = (1+2t)e^(−2t)
Case 3 — Complex Conjugate Roots (Δ < 0)
Example: y″+4y=0, y(0)=0, y′(0)=2
- Characteristic equation: r²+4=0 → r=±2i. Δ=0−16=−16<0 ✓
- p=0 (real part), q=2 (imaginary part)
- General solution: y = e^(0·t)(C₁cos(2t)+C₂sin(2t)) = C₁cos(2t)+C₂sin(2t)
- y(0)=0: C₁=0
- y′(t)=−2C₁sin(2t)+2C₂cos(2t); y′(0)=2C₂=2 → C₂=1
- Particular solution: y = sin(2t) ✓
Solving First Order Linear ODEs — y′ + ay = b
For the first-order linear ODE y′+ay=b with constant coefficients a and b, the linear differential equation calculator uses the integrating factor method (which reduces to a simple closed-form for constant a).
The solution has two parts: the steady-state (equilibrium) y = b/a (the constant the system tends to as t→∞) and the transient C·e^(−at) (the decay/growth from the initial state). The initial condition y(0)=y₀ determines C = y₀ − b/a.
Example 1: y′+2y=6, y(0)=1
- a=2, b=6. Steady state = 6/2 = 3
- General solution: y = 3 + C·e^(−2t)
- Apply y(0)=1: 3+C=1 → C=−2
- Particular solution: y = 3 − 2e^(−2t)
- As t→∞: y→3 (the steady-state). At t=0: y=3−2=1 ✓
Example 2: y′=4 (a=0), y(0)=2
- a=0, b=4. The equation is y′=4 — simply integrate both sides.
- General solution: y = 4t + C
- Apply y(0)=2: C=2
- Particular solution: y = 4t + 2
Worked Examples — Initial Value Problems
1. y″+y=0, y(0)=0, y′(0)=1 (Simple Harmonic Motion)
- Characteristic equation: r²+1=0 → r=±i (p=0, q=1)
- General solution: y = C₁cos(t)+C₂sin(t)
- y(0)=0: C₁=0; y′(0)=1: C₂=1
- y = sin(t)
2. y″−y=0, y(0)=1, y′(0)=0 (Hyperbolic)
- r²−1=0 → r=±1 (distinct real)
- y = C₁eˢ+C₂e^(−t)
- y(0)=1: C₁+C₂=1; y′(0)=0: C₁−C₂=0 → C₁=C₂=1/2
- y = (1/2)eˢ + (1/2)e^(−t) = cosh(t)
3. y″+2y′+5y=0, y(0)=1, y′(0)=0 (Damped Oscillation)
- r²+2r+5=0. Δ=4−20=−16<0. p=−1, q=2
- y = e^(−t)(C₁cos(2t)+C₂sin(2t))
- y(0)=1: C₁=1
- y′(t)=e^(−t)[(−C₁+2C₂)cos(2t)+(−C₂−2C₁)sin(2t)]; y′(0)=−C₁+2C₂=0 → C₂=1/2
- y = e^(−t)[cos(2t) + (1/2)sin(2t)]
4. y″+3y′+2y=4, y(0)=0, y′(0)=0 (Non-homogeneous)
- Particular solution: y_p = 4/2 = 2 (since b=2≠0)
- Homogeneous: r²+3r+2=0 → (r+1)(r+2)=0 → r₁=−1, r₂=−2
- y_h = C₁e^(−t)+C₂e^(−2t); Full general: y = C₁e^(−t)+C₂e^(−2t)+2
- y(0)=0: C₁+C₂+2=0 → C₁+C₂=−2
- y′(0)=0: −C₁−2C₂=0 → C₁=−2C₂; so −2C₂+C₂=−2 → C₂=2, C₁=−4
- y = −4e^(−t) + 2e^(−2t) + 2
5. y′+3y=9, y(0)=0 (First Order to Equilibrium)
- Steady state = 9/3 = 3; y = 3+Ce^(−3t)
- y(0)=0: C=−3
- y = 3(1−e^(−3t)) — starts at 0, approaches 3 as t→∞
6. y″+2y′+y=3, y(0)=2, y′(0)=1 (Repeated Root + Non-homogeneous)
- y_p = 3/1 = 3 (b=1)
- Homogeneous: r²+2r+1=(r+1)²=0 → r=−1 (repeated)
- y = (C₁+C₂t)e^(−t)+3
- y(0)=2: C₁+3=2 → C₁=−1
- y′(t)=C₂e^(−t)+(C₁+C₂t)(−e^(−t)); y′(0)=C₂−C₁=1 → C₂=1+(−1)=0
- y = −e^(−t) + 3
Frequently Asked Questions
Related Calculators
The Laplace transform converts the ODE into an algebraic equation in s-domain, solves it, then inverts to get y(t) — especially powerful for non-constant forcing functions.
Share This Tool
Share the IVP Calculator!