DSolve
DSolve[eqn,u,x]
solves a differential equation for the function u, with independent variable x.
DSolve[eqn,u,{x,x_{min},x_{max}}]
solves a differential equation for x between x_{min} and x_{max}.
DSolve[{eqn_{1},eqn_{2},…},{u_{1},u_{2},…},…]
solves a list of differential equations.
DSolve[eqn,u,{x_{1},x_{2},…}]
solves a partial differential equation.
DSolve[eqn,u,{x_{1},x_{2},…}∈Ω]
solves the partial differential equation eqn over the region Ω.
Details and Options
 DSolve can solve ordinary differential equations (ODEs), partial differential equations (PDEs), differential algebraic equations (DAEs), delay differential equations (DDEs), integral equations, integrodifferential equations, and hybrid differential equations.
 The output from DSolve is controlled by the form of the dependent function u or u[x]:

DSolve[eqn,u,x] {{uf},…} where f is a pure function DSolve[eqn,u[x],x] {{u[x]f[x]},…} where f[x] is an expression in x  With a pure function output, eqn/.{{uf},…} can be used to verify the solution. »
 DSolve can give implicit solutions in terms of Solve. »
 DSolve can give solutions that include Inactive sums and integrals that cannot be carried out explicitly. Variables K[1], K[2], … are used in such cases.
 Different classes of equations solvable by DSolve include:

u'[x]f[x,u[x]] ordinary differential equation a ∂_{x}u[x,y]+b ∂_{y}u[x,y]f partial differential equation f[u'[x],u[x],x]0 differential algebraic equation u'[x]f[x,u[xx_{1}]] delay differential equation u'[x]+k[x,t]u[t]tf integrodifferential equation {…,WhenEvent[cond,u[x]g]} hybrid differential equation  Boundary conditions for ODEs and DAEs can be specified by giving equations at specific points such as u[x_{1}]a, u'[x_{2}]b, etc.
 Boundary conditions for PDEs can be given as equations u[x,y_{1}]a, Derivative[1,0][u][x,y_{1}]b, etc. or as DirichletCondition[u[x,y]g[x,y],cond].
 Initial conditions for DDEs can be given as a history function g[x] in the form u[x/;x<x_{0}]g[x].
 WhenEvent[event,action] may be included in the equations eqn to specify an action that occurs when event becomes True.
 The region Ω can be anything for which RegionQ[Ω] is True.
 N[DSolve[…]] calls NDSolve or ParametricNDSolve for differential equations that cannot be solved symbolically.
 The following options can be given:

Assumptions $Assumptions assumptions on parameters DiscreteVariables {} discrete variables for hybrid equations GeneratedParameters C how to name generated parameters Method Automatic what method to use  GeneratedParameters controls the form of generated parameters; for ODEs and DAEs these are by default constants C[n] and for PDEs they are arbitrary functions C[n][…]. »
Examples
open allclose allBasic Examples (2)
Scope (100)
Basic Uses (13)
Compute the general solution of a firstorder differential equation:
Obtain a particular solution by adding an initial condition:
Plot the general solution of a differential equation:
Plot the solution curves for two different values of the arbitrary constant C[1]:
Plot the solution of a boundary value problem:
Verify the solution of a firstorder differential equation by using y in the second argument:
Obtain the general solution of a higherorder differential equation:
Solve a system of differential equations:
Solve a system of differentialalgebraic equations:
Solve a partial differential equation:
Use different names for the arbitrary constants in the general solution:
Solve a delay differential equation:
Plot the solution for different values of the parameter:
Solve a hybrid differential equation:
This system models a bouncing ball:
Apply N[DSolve[...]] to invoke NDSolve if symbolic solution fails:
Linear Differential Equations (4)
Nonlinear Differential Equations (6)
Implicit solution for an Abel equation:
Solution in terms of WeierstrassP:
Systems of Differential Equations (4)
DifferentialAlgebraic Equations (3)
Delay Differential Equations (2)
Piecewise Differential Equations (4)
Using a piecewise forcing function:
A differential equation with a piecewise coefficient:
A nonlinear piecewisedefined differential equation:
Differential equations involving generalized functions:
A simple impulse response or Green's function:
Solve a piecewise differential equation on the interval {0,1}:
Hybrid Differential Equations (8)
Solve a firstorder differential equation with a timedependent event:
Solve a secondorder differential equation with a timedependent event:
Solve a system of differential equations with a statedependent event:
Stop the integration when an event occurs:
Remove an event after it has occurred once:
Specify that a variable maintains its value between events:
SturmLiouville Problems (6)
Solve an eigenvalue problem with Dirichlet conditions:
Make a table of the first 5 eigenfunctions:
Solve an eigenvalue problem with Neumann conditions:
Make a table of the first 5 eigenfunctions:
Solve an eigenvalue problem with mixed boundary conditions:
Make a table of the first 5 eigenfunctions:
Solve an eigenvalue problem with a Robin condition at the left end of the interval:
Locate the roots of the transcendental eigenvalue equation in the range 10<λ<80:
Obtain the eigenfunctions within this range by using Assumptions:
Solve an eigenvalue problem with Robin boundary conditions at both ends:
Solve an eigenvalue problem for the Airy operator:
Integral Equations (6)
Solve a Volterra integral equation:
Solve a Fredholm integral equation:
Solve an integrodifferential equation:
Specify an initial condition to obtain a particular solution:
Solve a singular Abel integral equation:
Solve a weakly singular Volterra integral equation:
FirstOrder Partial Differential Equations (7)
General solution for a linear firstorder partial differential equation:
The solution with a particular choice of the arbitrary function C[1]:
Initial value problem for a linear firstorder partial differential equation:
Initialboundary value problem for a linear firstorder partial differential equation:
General solution for the transport equation:
Plot the traveling wave with speed c1:
General solution for a quasilinear firstorder partial differential equation:
Initial value problem for a scalar conservation law:
Complete integral for a nonlinear firstorder Clairaut equation:
Hyperbolic Partial Differential Equations (11)
Initial value problem for the wave equation:
The wave propagates along a pair of characteristic directions:
Initial value problem for the wave equation with piecewise initial data:
Discontinuities in the initial data are propagated along the characteristic directions:
Initial value problem with a pair of decaying exponential functions as initial data:
Initial value problem for an inhomogeneous wave equation:
Visualize the solution for different values of m:
Initial value problem for the wave equation with a Dirichlet condition on the halfline:
The wave bifurcates starting from the initial data:
Initial value problem for the wave equation with a Neumann condition on the halfline:
In this example, the wave evolves to a nonoscillating function:
Dirichlet problem for the wave equation on a finite interval:
The solution is an infinite trigonometric series:
Extract the first three terms from the Inactive sum:
The wave executes periodic motion in the vertical direction:
Dirichlet problem for the wave equation in a rectangle:
The solution is a doubly infinite trigonometric series:
Extract a few terms from the Inactive sum:
The twodimensional wave executes periodic motion in the vertical direction:
Dirichlet problem for the wave equation in a circular disk:
The solution is an infinite Bessel series:
Extract the first three terms from the Inactive sum:
General solution for a secondorder hyperbolic partial differential equation:
Hyperbolic partial differential equation with nonrational coefficients:
Inhomogeneous hyperbolic partial differential equation with constant coefficients:
Initial value problem for an inhomogeneous linear hyperbolic system with constant coefficients:
Parabolic Partial Differential Equations (8)
Initial value problem for the heat equation:
Visualize the diffusion of heat with the passage of time:
Initial value problem for the heat equation with piecewise initial data:
The solution is given in terms of the error function Erf:
Discontinuities in the initial data are smoothed instantly:
Initial value problem for an inhomogeneous heat equation:
Visualize the growth of the solution for different values of the parameter m:
Dirichlet problem for the heat equation on a finite interval:
The solution is a Fourier sine series:
Extract three terms from the Inactive sum:
Neumann problem for the heat equation on a finite interval:
The solution is a Fourier cosine series:
Extract a few terms from the Inactive sum:
Visualize the evolution of the solution to its steady state:
Dirichlet problem for the heat equation in a disk:
The solution is an infinite Bessel series:
Extract a few terms from the Inactive sum:
Visualize the individual terms of the solution at time t=0.1:
Elliptic Partial Differential Equations (9)
Dirichlet problem for the Laplace equation in the upper halfplane:
Discontinuities in the boundary data are smoothed out:
Dirichlet problem for the Laplace equation in the right halfplane:
Dirichlet problem for the Laplace equation in the first quadrant:
Neumann problem for the Laplace equation in the upper halfplane:
Dirichlet problem for the Laplace equation in a rectangle:
The solution is an infinite trigonometric series:
Extract a few terms from the Inactive sum:
Dirichlet problem for the Laplace equation in a disk:
Dirichlet problem for the Laplace equation in an annulus:
Dirichlet problem for the Poisson equation in a rectangle:
Dirichlet problem for the Helmholtz equation in a rectangle:
Extract a finite number of terms from the Inactive sum:
General Partial Differential Equations (6)
A potentialfree Schrödinger equation with Dirichlet boundary conditions:
Extract the first four terms in the solution:
For any choice of the four constants C[k], ψ obeys the equation and boundary conditions:
Initial value problem for a Schrödinger equation with Dirichlet boundary conditions:
Define a family of partial sums of the solution:
For each k, u_{k} satisfies the differential equation:
The boundary conditions are also satisfied:
The initial condition is only satisfied for u_{∞}, but there is rapid convergence at t==2:
Solve a Schrödinger equation with potential over the reals:
Extract the first two terms in the solution:
For any values of the constants C[0] and C[1], the equation is satisfied:
The conditions at infinity are also satisfied:
Although the function is time dependent, its norm is constant:
Initial value problem for Burgers' equation with viscosity ν:
Plot the solution at different times for ν=1/40:
Plot the solution for different values of ν:
Boundary value problem for the Tricomi equation:
Traveling wave solution for the Korteweg–de Vries (KdV) equation:
Obtain a particular solution for a fixed choice of arbitrary constants:
Partial Differential Equations over Regions (3)
Dirichlet problem for the Laplace equation in a rectangle:
Extract the first 100 terms from the Inactive sum:
Visualize the solution on the rectangle:
Dirichlet problem for the Laplace equation in a disk:
Visualize the solution in the disk:
Dirichlet problem for the Laplace equation in a right halfplane:
Generalizations & Extensions (1)
Options (6)
Assumptions (2)
Solve an eigenvalue problem for a linear secondorder differential equation:
Use Assumptions to specify a range for the parameter λ:
Specify that the independent variable x is real:
Obtain the same result using an interval specification for x:
GeneratedParameters (2)
Use differently named constants:
Generate uniquely named constants of integration:
The constants of integration are unique across different invocations of DSolve:
Method (1)
Solve a linear ordinary differential equation:
Obtain a solution in terms of DifferentialRoot:
Applications (30)
Ordinary Differential Equations (6)
Solve a logistic (Riccati) equation:
Plot the solution for different initial values:
Solve a linear pendulum equation:
Displacement of a linear, damped pendulum:
Study the phase portrait of a dynamical system:
Find a power series solution when the exact solution is known:
Verify that y=0 and y=1 are equilibrium solutions of the logistic equation:
Hybrid Differential Equations (8)
Model a damped oscillator that gets a kick at regular time intervals:
Model a ball bouncing down steps:
In a square box, model a ball that changes direction upon impact with the side walls:
Simulate the system stabilized with a discretetime controller :
Control a double integrator using a deadbeat, discretetime controller:
Use a deadbeat digital feedback controller :
Model the position of a moving body with 1 kg mass:
Use a sampled proportionalderivative (PD) controller to keep the position constant:
Set the physical variable a to 0 whenever it becomes negative:
Delay Differential Equations (2)
Integral Equations (4)
The tautochrone problem requires finding the curve down which a bead placed anywhere will fall to the bottom in the same amount of time. Expressing the total fall time in terms of the arc length of the curve and the speed v yields the Abel integral equation . Defining the unknown function by the relationship and using the conservation of energy equation yields the explicit equation:
Use DSolve to solve the integral equation:
Using the relationship , solve for :
Starting the curve from the origin and integrating—with assumptions that ensure the integrand is realvalued—yields as a function of :
Substituting values for and , use ParametricPlot to display the maximal tautochrone curve:
Making the change of variables gives a simple, nonsingular parametrization of the curve with :
Combining the conservation of energy equation and the chain rule produces the following differential equation for as a function of :
This equation can be solved numerically for different starting points:
Plotting the solutions shows that all reach the bottom, , at the twosecond mark:
Visualize the motion along the tautochrone:
A springmass system, with an attached mass of
, has a spring constant of and a damping coefficient of . At time , the mass is pushed down and then released with a velocity 28 cm/s downward. A force of acts downward on the mass for . Find the velocity of the system as a function of time. The integral equation for the velocity is given by the following:Initial value of the velocity:
Solve the integrodifferential equation using DSolve:
Plot the velocity as a function of time:
Visualize the motion of the physical springmass system:
An LRC circuit has a voltage source given by . The resistance in the circuit is 0.2 , the inductance is
, and the capacitance is . Initially, the current in the resistor is . Find the current as a function of time:The integral equation for the current is given by:
Solve the integrodifferential equation using DSolve:
Plot the current as a function of time:
A linear Volterra integral equation is equivalent to an initial value problem for a linear differential equation. Verify this relationship for the following Volterra equation:
Solve the integral equation using DSolve:
Set up the corresponding differential equation:
Add two initial conditions since the differential equation is of second order:
The solution of the initial value problem agrees with that of the integral equation:
Classical Partial Differential Equations (5)
Model the vibrations of a string with fixed length, say π, using the wave equation:
Specify that the ends of the string remain fixed during the vibrations:
Obtain the fundamental and higher harmonic modes of oscillation:
Visualize the vibrations of the string for these modes:
In general, the solution is composed of an infinite number of harmonics:
Extract four terms from the Inactive sum:
Visualize the vibration of the string:
Model the oscillations of a circular membrane of radius 1 using the wave equation in 2D:
Specify that the boundary of the membrane remain fixed:
Initial condition for the problem:
Obtain a solution in terms of Bessel functions:
Extract a finite number of terms from the Inactive sum:
Visualize the oscillations of the membrane:
Model the flow of heat in a bar of length 1 using the heat equation:
Specify the fixed temperature at both ends of the bar:
Solve the heat equation subject to these conditions:
Extract a few terms from the Inactive sum:
Visualize the evolution of the temperature to a steady state:
Obtain the steadystate solution v[x], which is independent of time:
The steadystate solution is a linear function of x:
Model the flow of heat in a bar of length 1 that is insulated at both ends:
Specify that no heat flow through the ends of the bar:
Solve the heat equation subject to these conditions:
Extract a few terms from the Inactive sum:
Visualize the evolution of the temperature to the steadystate value of 60°:
Construct a complex analytic function, starting from the values of its real and imaginary parts on the axis. The real and imaginary parts u and v satisfy the Cauchy–Riemann equations:
Prescribe the values of u and v on the axis:
Solve the Cauchy–Riemann equations:
Verify that the solutions are harmonic functions:
Visualize the streamlines and equipotentials generated by the solution:
General Partial Differential Equations (5)
Study the evolution of a smooth solution for Burgers' equation to a shock wave in the limit when the viscosity parameter becomes infinitely small:
The solution is smooth for any positive value of ϵ:
The solution develops a shock discontinuity in the limit when ϵ approaches 0:
An electron constrained to move in a onedimensional box of length d is governed by the free Schrödinger equation with Dirichlet conditions at the endpoints:
The general solution to this equation is a sum of trigonometricexponential terms:
Each term in the sum is called a stationary state, as using the sine as initial conditions leads to the positional probability density being time independent. For example:
The resulting probability distribution is independent of time:
The normalization of the initial data was chosen so that the integral of the density (the total probability of finding the particle somewhere) is 1:
Using any other initial condition, even one as simple as a sum of two stationary states, will lead to a complicated, timedependent density:
This density is not stationary, as t appears in the second and third cosines:
Although the probability density is time dependent, its integral is still the constant 1:
Entering the mass of the electron and the value of in SI units and setting d to a typical interatomic distance of 1 nm results in the following density function:
Visualize the function over the spatial domain and one period in time:
Viewing the graph as a movie of probability densities, it can be seen that "center" of the electron moves from side to side of the box:
Find the value of a European vanilla call option if the underlying asset price and the strike price are both $100, the riskfree rate is 5%, the volatility of the underlying asset is 20%, and the maturity period is 1 year, using the Black–Scholes model:
Solve the boundary value problem:
Compute the value of the European vanilla option:
Compare with the value given by FinancialDerivative:
Recover a function from its gradient vector:
The solution represents a family of parallel surfaces:
Properties & Relations (9)
Solutions satisfy the differential equation and boundary conditions:
Differential equation corresponding to Integrate:
Use NDSolve to find a numerical solution:
Use DEigensystem to find eigenvalues and eigenfunctions:
Find the complete eigensystem:
Find eigenvalues and eigenfunctions:
Compute an impulse response using DSolve:
The same computation using InverseLaplaceTransform:
DSolve returns a rule for the solution:
DSolveValue returns an expression for the solution:
Apply N[DSolve[...]] to invoke NDSolve if symbolic solution fails:
Solve the Laplace equation in a rectangle:
Obtain the same result using the region notation:
Use system modeling for numerical solutions to larger hierarchical models:
Possible Issues (4)
Results may contain symbolic integrals:
Inverse functions may be required to find the solution:
Definitions for an unknown function may affect the evaluation:
Clearing the definition for the unknown function fixes the issue:
Here DSolve gives an error message because is not included in the second argument:
Include in the second argument to obtain a solution:
Alternatively, use DSolveValue to obtain the solution for alone: