How to | Check the Results of DSolve
While DSolve usually returns the correct solution to a differential equation it is given, it is common practice to verify the solution returned by any differential equation solver. The solution given by DSolve can be verified using various methods. The easiest method involves substituting the solution back into the equation. If the result is True, the solution is valid.
In this example, the solution is verified by substitution.
For convenience later, assign the first argument of DSolve to eqn:

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-nyxrnp
When the second argument to DSolve is specified as instead of
, the solution is returned as a pure function. This form is useful both for verifying the solution and using it in further work:

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-l2ehnd

Use /. (the short form for ReplaceAll) to substitute the solution back into the equation:

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-f7oxu5

Here, the same method is used to verify that the solution satisfies the equation and an initial condition:

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-g3cx29

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-oxdura


https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-eatoqo

Sometimes the result of the substitution is too complicated to give an immediate True or False. Such examples can be verified by using Simplify to simplify the result of the substitution. If the simplified result is True, the solution is valid.
Get the solution to a second-order inhomogeneous equation:

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-brsanq

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-7j1x77

Substitute the solution back into the equation:

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-6tlrvy

Use Simplify to verify the solution:

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-hmr34e

Here, the same method is used to verify the solution to a linear PDE:

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-5bmhbh

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-0t66ku


https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-0po84t

If the equation involves special functions, it may be necessary to use FullSimplify to verify the solution.
For example, this solution contains Bessel functions:

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-6phhw

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-hdqb7e

Using Simplify does not verify the solution:

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-tul6g5

Using FullSimplify does:

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-8cgm01

Another important verification technique is to do a numerical check for all the variables and parameters in the problem. It is advisable in such cases to repeat the check with several sets of random values.
Here is an example where numerical verification is useful:

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-c97j17

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-yzl63b


https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-ctbo7d

Although numerical checks cannot verify a solution with certainty, more rigorous checks can be made by using higher precision or by allowing the variables to take complex values.
This verifies the previous solution with higher precision:

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-tvcrt1

This uses complex random values to verify the previous solution:

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-6mk81q

https://wolfram.com/xid/0dni2ujjlggzey75r48lppvxlv2-es9wsf
