Differential equations are equations containing a function and its derivatives. Many scientific and social situations are solved by modelling them as differential equations.

Solving differential equations includes a wide of range methods starting from simple variable separable method and extending to advanced techniques of solving partial differential equations.

Let us look into some of the methods used for solving first order differential equations.

## Methods for Solving Differential Equations

A first order differential equation can be solved using below mentioned methods:
1. Graphical method of plotting slope fields.
2. Euler's method which provides steps to find numerical approximation to solutions of differential equations.
3. Integration methods used for separable equations and linear equations.

Solving Differential equations using slope fields:

This is a graphical method of solving differential equations of the form $\frac{dy}{dx}$ = F(x, y). This method is based on the fact that the derivative of a function represents the slope of the tangent line at that point. Slopes at various points are calculated using the function F(x, y) and these values are represented at the corresponding points by short line segments. These line segments are called slope fields or direction fields and indicate the direction of the curve at that point. Using direction fields the general shape of a curve can be visualized and sketched.

The graph of slope fields for the function $\frac{dy}{dx}$ = x2 + y2 - 2 is shown below with the curve sketched for a given initial value.

Euler's Method:

Euler's Method uses the idea of direction fields and uses a series of Linearizations to find approximate numerical solutions to differential equations. Suppose y' = F(x, y) with initial value (x0, y0) and we need to find approximate solutions to equally spaced x values like x0,
x1 = x0 + h, x2 = x1 + h, -------------, xn = xn-1 + h.

The step wise approximations are done using,
y1 = y0 + hF(x0, y0)
y2 = y1 + hF(x1, y1)
---------------------------
yn = yn-1 + hF(xn-1, yn-1)
where 'h' is the step value allowed to get the next point. The accuracy of approximation improves by reducing the value of h.

Separable Equations:

A separable first order differential equation is of type $\frac{dy}{dx}$ = f(x).g(y).

If g(y) ≠ 0, we can take h(y) = $\frac{1}{g(y)}$ and the equation can be equivalently written in as

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

Now the functions of each variable can be grouped with the corresponding differentials on either side of the equation.

h(y) dy = f(x) dx          (Variables separated)

The general solution to the differential equation can be got by integrating the variables separated equation in the form

y = p(x) + C. The value for the "C", the constant of integration and hence the the particular solution can be found using the initial value (x0, y0).

Linear first order differential equations:

A first order linear differential equation is of the form $\frac{dy}{dx}$ + P(x).y = Q(x)

where P and Q are continuous functions of x in the given interval.

This equation can be solved by multiplying the equation by the integrating factor = $e^{\int Pdx}$

$e^{\int Pdx}$ ( $\frac{dy}{dx}$ + P(x).y) = Q(x).$e^{\int Pdx}$

On integration the equation will be reduced to
$e^{\int Pdx}$.y = $\int e^{\int Pdx}Q(x)dx$

The integration on the right side can be easily performed which will lead to the general  solution of the given equation.

## Solving Systems of Differential Equations

Predator and Prey models consist of two differential equations one each to represent the growth rates of Predator and Prey populations. These equations are solved simultaneously to get the equilibrium solutions, that is the population of prey just sufficient to support the number of Predators constant. Solving these equations completely to get function models that would represent the general Predator and Prey populations require advanced techniques and hence beyond the scope of this write up. We can now solve one such system to get equilibrium solutions.

Solve the following system of of differential equations to get the equilibrium solution:
$\frac{dA}{dt}$ = 2A - 0.01AL

$\frac{dL}{dt}$ = -0.5L + 0.0001AL Where A and L represent correspondingly the number of Prey and Predator.

The equilibrium solution is got when A and L remain constant, this means $\frac{dA}{dt}$ = 0 and $\frac{dL}{dt}$ = 0

Thus we have a system of equations as
2A - 0.01AL = 0 ---------------------------(1)
-0.5L + 0.0001AL = 0 --------------------(2)

Solving this system algebraically we get two solutions as A = L = 0 and L = 200 and A = 5,000.

ignoring the trivial solution A = L = 0 where no prey nor predator exist, the only equilibrium solution is L = 200 and A = 5,000.

Hence in a population of 200 Predators and 5,000 preys there is no change is experienced in the sizes of both.

## Solving Differential Equations with Laplace Transform

The Laplace and inverse Laplace are defined for a piecewise continuous function f(t) as follows:
Laplace {f(t)} = $\int_{0}^{\infty }e^{-st}f(t)dt$ Laplace Transform

f(t) = Inverse Laplace {F(s)} Inverse Transform
Laplace transforms and inverse transforms can be found for common functions from Laplace Table.
The Laplace transformation for the nth derivative is given by,
Laplace (fn) = snF(s) -sn-1f(0) -sn-2f1(0) -sf(0) -...........-sfn-2(0) - fn-`1(0). where f, f1,....fn-1 are continuous functions and fn is piecewise continuous.
Thus the equations to be used for solving first order and second order differential equations are
Laplace (y') = sY(s) - y(0)
Laplace (y") = s2Y(s) - sy(0) - y'(0)

### Solved Example

Question: Solve the IVP , y" + y' = x , y(0) = 0 and y'(0) = 0 using Laplace Transforms
Solution:

Applying Laplace transforms for the derivatives and for x

s2Y(s) - sy(0) - y'(0) + sY(s) - y(0) = $\frac{1}{s^{2}}$

Substituting the initial values we get

s2Y(s) + sY(s) = $\frac{1}{s^{2}}$

Solving for Y(s) we get

Y(s) = $\frac{1}{s^{2}(s^{2}+s)}$ = $\frac{1}{s^{3}(s+1)}$

Resolving the right side of the equation into partial fractions,

Y(s) = $\frac{A}{s}+\frac{B}{s^{2}}+\frac{C}{s^{3}}+\frac{D}{(s+1)}$

Solving for the constants A ,B, C and D we get.

Y(s) = $\frac{1}{s}-\frac{1}{s^{2}}+\frac{1}{s^{3}}-\frac{1}{(s+1)}$

Applying inverse transforms from the table we get the solution to the differential equation as

y = 1 - x + $\frac{X^{2}}{2}$ - e-x.

or

y = -e-x + $\frac{X^{2}}{2}$ - x + 1

## Series Solutions of Differential Equations

Often it occurs, that solutions of differential equations cannot be expressed as finite combination of known functions. One way of solving such equations is to assume the solution as a power series and the coefficients are determined using derivatives and equating the coefficients of like terms.

### Solved Example

Question: Solve y" - xy' - y = 0  given y(0) = 1 and y'(0) = 0
Solution:

Let us assume the solution as a power series  y(x) = $\sum_{n=0}^{\infty }c_{n}x^{n}$

And the derivatives in series form are ,

y' = $\sum_{n=1}^{\infty }nc_{n}x^{n-1}$

y" = $\sum_{n=2}^{\infty }n(n-1)c_{n}x^{n-2}$ = $\sum_{n=0}^{\infty }(n+2)(n+1)c_{n+2}x^{n}$

Substituting y' and y" in the differential equation,

$\sum_{n=0}^{\infty }(n+2)(n+1)c_{n+2}x^{n}$ - x$\sum_{n=1}^{\infty }nc_{n}x^{n-1}$ - $\sum_{n=0}^{\infty }c_{n}x^{n}$ = 0

$\sum_{n=0}^{\infty }(n+2)(n+1)c_{n+2}x^{n}$ - $\sum_{n=1}^{\infty }nc_{n}x^{n}$ - $\sum_{n=0}^{\infty }c_{n}x^{n}$ = 0

$\sum_{n=0}^{\infty }[(n+2)(n+1)c_{n+2}-nc_{n}-c_{n}]x^{n}$ = 0

This equation is true when the coefficient of xn = 0

Thus, $(n+2)(n+1)c_{n+2}-nc_{n}-c_{n}$ = 0

This leads to the recursion relation

cn+2 = $\frac{nc_{n}+c_{n}}{(n+2)(n+1)}$ = $\frac{c_{n}}{n+2}$   for n = 0, 1, 2, 3........

Using the initial condition y(0) = 1, we get c0 = 1

Using the recursion relation we get the even coefficients as

c2 = $\frac{1}{2}$ , c4 = $\frac{1}{2.4}$,  c6 = $\frac{1}{2.4.6}$

Using the other initial condition, y'(0) = 0 we will get c1 = 0

The value of c = 0 along with the recursion relation makes all the odd coefficients = 0

c1 = c3 = ....c2n+1 = 0

Thus the solution to the differential equation can be written as an infinite series as,

y(x) = $\sum_{n=0}^{\infty }\frac{x^{2n}}{2^{n}n!}$ = $\frac{(\frac{x^{2}}{2})^{n}}{n!}$ = $e^{\frac{x^{2}}{2}}$