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.
For convenience later, assign the first argument of DSolve to eqn:
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:
Use /. (the short form for ReplaceAll) to substitute the solution back into the equation:
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.
Use Simplify to verify the solution:
If the equation involves special functions, it may be necessary to use FullSimplify to verify the solution.
Using Simplify does not verify the solution:
Using FullSimplify does:
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.