Analytical methods: 1st order

Before moving on to numerical methods for the solution of ODEs we begin by revising basic analytical techniques for solving ODEs that you will of seen at undergraduate level.

Separation of variables/separable solutions

If your equation is of the form dydx=f(x)g(y), then it can be reformulated as g(y)dy=f(x)dx+C, where C is a constant of integration. This can be solved by integration, either directly or by substitution, to give a relation between y and x. The following example will show you how to use to use the separation of variables to solve a first-order ODE.

Walkthrough

We wish to solve dydx=xy, subject to y(0)=1. The equation can be reformulated as ydy=xdx+C, which can be solved to give y22=x22+C, which simplifies to y=±x2+A, where A=2C. This is the general solution to the differential equation. We now need to apply the initial condition y(0)=1. 1=y(0)=±A, Therefore A=1, and we take the positive root. The solution is y=x2+1.

Integrating factors

If your equation is of the form dydx+f(x)y=g(x) then it can be reformulated by introducing an integrating factor. The integrating factor for the above equation is defined as φ(x)=ef(x)dx, (Note: that this is not unique as any multiple would also be an integrating factor). In order to solve the original equation we multiply through by the integrating factor to give φ(x)dydx+φ(x)f(x)y(x)=φ(x)g(x), by construction of the integrating factor dφdx=φ(x)f(x). The original equation can be written as ddx(φ(x)y(x))=φ(x)g(x).

This can be solved by integration of the right hand side, either directly or by substitution. The solution is y(x)=φ(x)g(x)dxφ(x) Note: You need to be careful to consider where the solutions exist, that is, you need φ(x)0. Therefore no solutions exist for x such that φ(x)0. The following example will show you how to use integrating factors to solve a first-order ODE.

Walkthrough

We wish to solve dydx+yx=1, subject to y(1)=0. The integrating factor for this equation is given by φ(x)=e1xdx=x. Therefore the original equation may be written as ddx(xy)=x. Integrating the right-hand side gives y(x)=x2+Cx, where C is a constant of integration, and x0. This is the general solution to the differential equation. We now need to apply the initial condition y(1)=0. 0=12+C1. Therefore C=12, and the solution is y(x)=x212x, valid for x>0.