Differential equations

Analytical solutions to first-order linear ODEs.

Differential equations contain functions as well as their derivatives. The order of the equation corresponds to the order of the highest derivative.

  • An ordinary differential equation (ODE) contains functions of only one independent variable.
  • A partial differential equation (PDE) contains functions of more than one independent variables.

First-order linear ODEs

Standard form: \(y'+p(t)\,y=q(t)\)

Where \(t\) is the independent variable (in models this is often time).

The equation is homogeneous if \(q(t)=0\) , and inhomogeneous otherwise.

Homogeneous first-order linear ODEs

Can always be solved by separation of variables:

\(\cfrac{dy}{dt}+p(t)\,y=0\) becomes \(\cfrac{dy}{y}=-p(t)dt\)

General solution: \(y=c\,e^{-P(t)}\)

Steps: Integrating both sides gives \(\int\cfrac{1}{y}dy=-\int p(t)dt\) , which is \(ln|y|=-P(t) + C\) with \(P(t)=\int p(t)dt\) . Then solve for \(y\) :

\(|y|=e^{-P(t) + C}\) \(y=\pm e^{-P(t) + C}\) \(y=\pm e^{-P(t)}e^{C}\) \(y=c\,e^{-P(t)}\)

Inhomogeneous first-order linear ODEs

Can be solved by variation of parameters.

General solution: \(y=u(t)\,y_h\)

Where \(y_h\) is a non-zero solution to the associated homogeneous ODE, and \(u\) is determined as follows. Substitute \(y=u\,y_h\) into the inhomogeneous equation:

\(\cfrac{d}{dt}(uy_h) + puy_h=q\)

Applying the product rule:

\(u'y_h+uy_h'+puy_h=q\) \(u'y_h+u(y_h'+py_h)=q\)

Note that \(y_h'+py_h=0\) , because \(y_h\) is a solution to the homogeneous ODE. Thus \(u'y_h=q\) . Then integrate \(u'=\cfrac{q}{y_h}\) , in order to solve for \(u\) .

This is equivalent to finding the integrating factor. The idea is to find a factor \(u\) such that when multiplying both sides by it ( \(uy'+puy=qu\) ), the left-hand side corresponds to \((uy)'\) after applying the product rule. This is the case when \(u'=pu\) , which is a homogeneous ODE that can be solved by separation of variables and gives as integrating factor:

$$u=e^{\int p(t)dt}$$

After calculating the integrating factor \(u\) , multiply both sides of the equation by \(u\) , and rewrite the left-hand side as \((uy)'\) . Then integrate.

Linear combinations

A linear combination of functions \(f_1,f_2,...\) are functions of the form \(c_1f_1 + c_2f_2 + ...\) with \(c_1,c_2,...\) any numbers.

Superposition principles: Superposition principles

That is, for linear homogeneous ODEs, all linear combinations of solutions are solutions:

  • 0 is a solution.
  • Multiplying any solution by a scalar gives another solution.
  • Adding any two solutions gives another solution.

Also the general inhomogeneous solution \(y=y_p+y_h\) , where

  • \(y_p\) is a particular inhomogenous solution and
  • \(y_h\) is the general homogeneous solution.

Special cases

If we have an inhomogeneous linear ODE where \(q(t)\) is constant: If there is a constant solution, then \(y'=0\) and the equation simplifies to \(p(t)y=q\) , thus one particular solution is \(y=\frac{q}{p(t)}\) . Using the superposition principle, all solutions take the form:

$$y=\frac{q}{p(t)} + Ce^{p(t)t}$$

Solutions to \(z^n=1\) with \(z\) any complex number are \(e^{i(\frac{2\pi k}{n})}\) for \(k=0,1,...n-1\) .

Solutions to \(x''+x=0\) are all linear combinations of sine and cosine: \(x=c_1\text{cos}(t)+c_2\text{sin}(t)\) with \(c_1,c_2\) any real number.