First order ODEs

Selecting a method to solve first order ODEs (flowchart)

When one encounters an ODE in the wild, a plan of attack is necessary. We’ve met lots of methods that can be used to solve first order ODEs (detailed below and more thoroughly in your lecture notes). You may find the following flowchart useful as a guide for the kind of thought processes that will lead you to pick the appropriate method.

First order ODEs flowchart

Simple first order, first degree ODEs

An ODE of the form

\[ \frac{\mathrm{d}y}{\mathrm{d}x}=f(x), \]

where \(f(x)\) is a known function, can be solved directly by integrating both sides with respect to \(x\). Remember to include an arbitrary constant!

Also note (strongly) that this method of direct integration works ONLY for ODEs of this form. Other types require more sophisticated treatments.

Boundary conditions

Solutions to ODEs which contain arbitrary constants are called general solutions. Boundary conditions can then be applied to general solutions in order to find specific values for these constants; after doing so the solution is referred to as a particular solution.

Boundary conditions usually specify the value of the dependent variable \(y(x)\) (i.e. the function we’re usually trying to find) for some specific value of \(x\). For instance, a boundary condition \(y(2)=15\) tells us that when \(x\) takes the value 2, \(y\) should take the value 15.

After applying boundary conditions (provided there are as many boundary conditions as the order of the equation), the particular solution should contain no arbitrary constants.

Implicit and explicit solutions

Solutions that directly express the dependent variable as a function of the independent variable (i.e. expressions of the form \(y=y(x)\)) are known as explicit solutions. For instance, the ODE \(\frac{\mathrm{d}y}{\mathrm{d}x}=3x^2-x+1\) has an explicit general solution given by

\[ y=x^3-\frac{x^2}{2}+x+A, \]

where \(A\) is an arbitrary constant.

It is not always possible or straightforward to express solutions in such a form. Instead, some less straightforward releationship between \(x\) and \(y\) (without any derivative terms) may result; such solutions are known as implicit solutions. Examples include solutions like \(y^2=4(x+1),\) or \(\left|\frac{y+1}{x-1}\right|=1.\)

Separation of variables

If one can re-arrange an ODE into the following standard form:

\[ \frac{\mathrm{d}y}{\mathrm{d}x}=f(x)g(y), \]

then the solution may be found by the method of separable variables:

\[ \int\frac{1}{g(y)}\mathrm{d}y=\int f(x)\mathrm{d}x+\text{constant}. \]

This result is obtained by dividing the standard form by \(g(y)\) and then integrating both sides with respect to \(x\).

Homogeneous functions and ODEs

A function \(f(x,y)\) is said to be homogeous of degree \(n\) if \(f(kx,ky)=k^n f(x,y)\) for any number \(k\neq0\).

Any function that is homogeneous of degree \(n\) can be written in the form \(f(x,y)=x^n\phi\left(\frac{y}{x}\right)\) for some function \(\phi\) of a single variable.

An ordinary differential equation (ODE) of the form:

\[ \frac{\mathrm{d}y}{\mathrm{d}x}=F(x,y), \]

where \(F(x,y)\) is homogeneous of degree zero, is said to be a homogeneous ODE.

Solving Homogeneous ODEs

Suppose we have a first order homogeneous ODE

\[ \frac{\mathrm{d}y}{\mathrm{d}x}=F(x,y). \]

If we make the substitution \(y=vx\) then by the product rule, we have that \(\frac{\mathrm{d}y}{\mathrm{d}x}=v+x\frac{\mathrm{d}v}{\mathrm{d}x}.\) Moreover, by our earlier observation regarding being able to write a homogeneous function of \(x\) and \(y\) as a function of one variable, we can write \(F(x,y)=\phi(v).\) Substituting these observations into the original ODE gives that

\[ v+x\frac{\mathrm{d}v}{\mathrm{d}x}=\phi(v). \]

This is now an ODE with dependent variable \(v\) and independent variable \(x\).

We can solve this by separable variable techniques, since rearranging yields

\[ \frac{\mathrm{d}v}{\mathrm{d}x}=\frac{1}{x}(\phi(v)-v), \]

whose right hand side is the product of a function of the dependent variable \(v\) and a function of the independent variable \(x\). Therefore

\[ \int\frac{1}{\phi(v)-v}\mathrm{d}v=\int\frac{1}{x}\mathrm{d}x+c, \]

where \(c\) is an arbitrary constant.

Reduction to 1st order homogeneous form

Consider ODEs of the form

\[ \frac{\mathrm{d}y}{\mathrm{d}x}=\frac{ax+by+c}{lx+my+n}, \]

where \(a,b,c,l,m,n\) are constants. This is not a homogeneous ODE but it can be made homogeneous via the change of variables

\[ x=x_0+u,\qquad y=y_0+v, \]

where \(x_0,y_0\) are constants. Then

\[ \frac{\mathrm{d}v}{\mathrm{d}u}=\frac{\frac{\mathrm{d}v}{\mathrm{d}x}}{\frac{\mathrm{d}u}{\mathrm{d}x}}=\frac{\mathrm{d}y}{\mathrm{d}x}=\frac{au+bv+\{ax_0+by_0+c\}}{lu+mv+\{lx_0+my_0+n\}}. \]

We can then choose \(x_0\) and \(y_0\) (by solving a system of two simultaneous equations) in such a way that both expressions in curly brackets are equal to zero. Consequently the ODE becomes

\[ \frac{\mathrm{d}v}{\mathrm{d}u}=\frac{au+bv}{lu+mv}, \]

which is homogeneous. This equation can now be solved by our usual method for homogeneous first order ODEs to give a solution in terms of \(u\) and \(v\). Finally, everything can be put back in terms of the original variables \(x\) and \(y\) to complete the problem.

Solving 1st order linear ODEs: Integrating factor

A first order linear ordinary differential equation can always be written in the form (note: some rearranging may be required first)

\[ \frac{\mathrm{d}y}{\mathrm{d}x}+P(x)y=Q(x). \]

Such differential equations can be solved by multiplying both sides by a so-called “integrating factor” \(R(x)\), which we choose as

\[ R(x)=\exp\left(\int P(x)\mathrm{d}x\right). \]

By doing so, the original ODE becomes

\[ R(x)\frac{\mathrm{d}y}{\mathrm{d}x}+R(x)P(x)y=R(x)Q(x). \]

We can then notice that the left hand side is the derivative with respect to \(x\) of \(R(x)y\) (this can be verified by differentiating \(R(x)y\) using the product rule), giving

\[ \frac{\mathrm{d}}{\mathrm{d}x}\left\{R(x)y\right\}=R(x)Q(x). \]

Integrating both sides with respect to \(x\) yields \(R(x)y=\int R(x)Q(x)\mathrm{d}x+c,\) where \(c\) is an arbitrary constant, and so rearranging gives the explicit solution

\[ y=\frac{1}{R(x)}\left(\int R(x)Q(x)\mathrm{d}x+c\right) \]

Bernoulli’s equation

A differential equation of the form

\[ \frac{\mathrm{d}y}{\mathrm{d}x}+P(x)y=Q(x)y^n, \]

where \(n\) is a constant, is called Bernoulli’s equation. If \(n=0\) or \(n=1\) then it is linear; otherwise it is non-linear.

Such an equation can be reduced to a linear first order ODE by making the substitution \(z=y^{1-n}.\) After some simplification and manipulation (as we’ve seen in the lectures), the equation reduces to a first order linear ODE that can be solved by using an integrating factor.