# Mathematical Methods in Physics/Introduction to 2nd order differential equations
## Introduction

What are differential equations? Why are they so important in physics? The answer to these questions will become more apparent as the course goes on, but to provide motivation, for now we will say that a differential equation is an equation where derivatives of a function appear (we will provide a more formal definition in the following section), and from which we'd like to know what this function is. Finding a function such that the differential equation is satisfied is known as finding a solution to the differential equation.
Why should physical scientists study differential equations? The answer to this question is rather easy if the student has taken any more or less advanced physics course. It will become apparent to them that the basic laws of nature can be expressed in the language of differential equations, both ordinary as well as partial differential equations.
As canonical examples, we consider the equation of the harmonic oscillator (ordinary),
    ${\frac {d^{2}x}{dt^{2}}}=-\omega ^{2}x$
the wave equation (partial),
    ${\frac {\partial ^{2}u}{\partial t^{2}}}=c^{2}\left({\frac {\partial ^{2}u}{\partial x^{2}}}+{\frac {\partial ^{2}u}{\partial y^{2}}}+{\frac {\partial ^{2}u}{\partial z^{2}}}\right)$
the equation of an RLC circuit (ordinary),
    $L{\frac {d^{2}I}{dt^{2}}}+R{\frac {dI}{dt}}+{\frac {I}{C}}={\frac {dV}{dt}}$
and finally, Laguerre's equation (ordinary),
    $x{\frac {d^{2}y}{dx^{2}}}+(1-x){\frac {dy}{dx}}+ny=0$
an equation that shows up in quantum mechanics.
There are many alternative notations for the derivative; we may use primes (Lagrange's notation) ($y'$, $y''$, etc.), numbers enclosed within parentheses ($y^{(1)}$, $y^{(5)}$, etc.), Leibniz's notation (${\frac {d^{3}y}{dx^{3}}}$), or Newton's dot notation, when we discuss derivatives with respect to time (${\frac {dx}{dt}}={\dot {x}},{\frac {d^{2}x}{dt^{2}}}={\ddot {x}}$). In what follows, we will try to use consistent notation, but the reader should be aware that notation is mostly a matter of preference and one notation is as good as any other.

## Basic definitions

A differential equation is an equation that relates a function with its derivative. Given a function $f$, independent variable $x$ and dependent variable $y$, an (ordinary) differential equation's most general expression is
    $f\left(x,y,y'',\ldots ,y^{(n)}\right)=0$
A solution to this differential equation is a function $y=g(x)$ such that
    $f\left(x,g(x),g''(x),\ldots ,g^{(n)}(x)\right)=0$
We say that a differential equation is of order $n$ if the highest derivative that appears in the differential equation is the $n$-th derivative.
An autonomous differential equation is one where there is no explicit dependence on the independent variable $x$:
    $f\left(y,y'',\ldots ,y^{(n)}\right)=0$
A linear ordinary differential equation only involves the dependent variable and its derivatives in a linear fashion (multiplied by a non-zero function of $x$, which may or may not be constant). For example,
    $\cos(y')+\sin x+y=0$
    $e^{y}+y'^{2}+3x=0$
are examples of nonlinear differential equations, whereas
    $3y''+2y-y=\cos x$
    $y^{(4)}-5y''+y=x^{2}$
    $x^{2}y''-3xy'+y=\sin x$
are linear differential equations.
We say that a linear differential equation is homogeneous if any potential term(s) involving solely the independent variable $x$ are identically vanishing. Thus,
    $3y''+y'-5y=0$
is homogeneous, whereas
    $y'''-5y''+y'+2y=x^{2}+\cos x$
is inhomogeneous or nonhomogeneous, due to the $x^{2}+\cos x$ term that depends solely on $x$.
It is customary, but by no means necessary, to move all the nonhomogeneous terms to the right-hand side of the differential equation; this practice is done to clearly distinguish these inhomogeneous terms as well as make some solutions method easier to implement.

## Linear ordinary differential equations

We focus now on linear ordinary differential equations, as these appear pervasively in the physical sciences, in particular those of second-order.
A linear ordinary differential equation is an equation of the form
    $a_{n}(x)y^{(n)}+a_{n-1}(x)y^{(n-1)}+\ldots +a_{1}(x)y'+a_{0}(x)y=f(x)$
As we have seen before, if $f(x)\neq 0$ the equation is nonhomogeneous or inhomogeneous, and if all the coefficients, that is, all the $a_{i}(x)$ factors are constant and not functions of $x$, we say that the equation is of constant coefficients.

### Linear dependence of functions
#### Vectors

From linear algebra, we intuitively know what it means for two vectors to be linearly independent. The vectors $\mathbf {u} =-3\mathbf {i} +5\mathbf {j}$ and $\mathbf {v} =-6\mathbf {i} +10\mathbf {j}$ are linearly dependent because $\mathbf {u}$ can be expressed as a linear combination of $\mathbf {v}$, or vice versa: $\mathbf {v} =2\mathbf {u}$ or equivalently, $\mathbf {u} ={\frac {1}{2}}\mathbf {v}$.
More formally, given the set of vectors $S=\{\mathbf {v} _{1},\mathbf {v} _{2},\dots ,\mathbf {v} _{n}\}$, we say that these vectors are linearly dependent if the equation
    $a_{1}\mathbf {v} _{1}+a_{2}\mathbf {v} _{2}+\cdots +a_{k}\mathbf {v} _{k}=\mathbf {0} ,$
has a nontrivial (nonzero) solution in the scalar coefficients $a_{i}$ ($a_{1}$, $a_{2}$, etc.), that is to say, that at least one of the coefficients doesn't vanish, and where $k\leq n$. If, for example, $a_{1}\neq 0$, then
    $\mathbf {v} _{1}=-{\frac {a_{2}}{a_{1}}}\mathbf {v} _{2}-\cdots -{\frac {a_{k}}{a_{1}}}\mathbf {v} _{k},$
and we can see that $\mathbf {v} _{1}$ is a linear combination of the rest of the vectors.
This means that the vectors of the set $S=\{\mathbf {v} _{1},\mathbf {v} _{2},\dots ,\mathbf {v} _{n}\}$ are linearly independent if the equation
    $a_{1}\mathbf {v} _{1}+a_{2}\mathbf {v} _{2}+\cdots +a_{n}\mathbf {v} _{n}=\mathbf {0} ,$
can only be satisfied if the scalar coefficients $a_{i}$ are all $0$.

#### Functions

We can now extend our definition of linear independence to functions.
We say that the functions $g_{1}(x)$, $g_{2}(x),\ldots ,g_{n}(x)$ are linearly independent in an interval $I$ if the equation
    $a_{1}g_{1}(x)+a_{2}g_{2}(x)+\cdots +a_{n}g_{n}(x)=0$
can only be satisfied if all the coefficients $a_{i}$ are vanishing, for all $x$ in the interval $I$. If the equation can be satisfied without all the coefficients being $0$, as before, we say that the functions are linearly dependent.
We now define the Wronskian of the $n-1$ times differentiable functions $g_{1}(x)$, $g_{2}(x),\ldots ,g_{n}(x)$:
    $W(x)={\begin{vmatrix}g_{1}(x)&g_{2}(x)&\cdots &g_{n}(x)\\g'_{1}(x)&g'_{2}(x)&\cdots &g'_{n}(x)\\g''_{1}(x)&g''_{2}(x)&\cdots &g''_{n}(x)\\\vdots &\vdots &\ddots &\vdots \\g_{1}^{(n-1)}(x)&g_{2}^{(n-1)}(x)&\cdots &g_{n}^{(n-1)}(x)\\\end{vmatrix}}$
This functional determinant is important to study the linear independence of a given set of functions. We will make this more explicit in the next section.

### Theorems for linear differential equations
#### Principle of superposition

    If $y_{1}$ and $y_{2}$ are two solutions of a linear homogeneous ordinary differential equation, then so is $ay_{1}+by_{2}$, where $a$ and $b$ are any two real numbers.

#### A theorem for complex solutions

    If $y(x)=u(x)+iv(x)$ is the complex solution to a linear homogeneous differential equation with continuous coefficients, then $u(x)$ and $v(x)$ are also solutions to the differential equation.

#### Number of general solutions for linear homogeneous differential equation

    The maximum number of linearly independent solutions to a linear homogeneous differential equation is equal to its order.

#### Linear independence and the Wronskian

We now make use of the Wronskian determinant (defined earlier) to give a sufficient, but not necessary, condition of linear independence of the $n-1$ times differentiable functions $g_{1}(x)$, $g_{2}(x),\ldots ,g_{n}(x)$.
    If the Wronskian of the $n-1$ times differentiable functions $g_{1}(x)$, $g_{2}(x),\ldots ,g_{n}(x)$ does not vanish over an open interval $I$, then the functions are linearly independent. That is,
    $W\neq 0\Rightarrow {\text{linearly independent functions}}$
It is important to note that this is a sufficient but not necessary condition. It is not true that if the Wronskian does vanish, then the functions are linearly dependent.
For example, the functions $x$, $x^{2}$ and $x^{3}$ are linearly independent in any closed interval of the reals, as their Wronskian doesn't vanish identically (for all $x$) in any such closed interval.
However, if we consider the functions $|x^{3}|$ and $x^{3}$ on the interval $I=(-1,1)$, we can see that $W=0$ for all $x$ in the interval $I$. But these functions are not linearly dependent on the whole interval $I$.

#### The Ostrogradski-Liouville formula

If we solve for the $n$-th derivative in a linear differential equation, we have
    $y^{(n)}=-p_{1}(x)y^{(n-1)}(x)-\ldots -p_{n-1}(x)y'(x)-p_{n}(x)y(x)$
The following equality then holds:
    $W(x)=W(x_{0})e^{\displaystyle -\int _{x_{0}}^{x}p_{1}(t)dt}$
where $x_{0}$ is any point belonging to any closed interval $[a,b]$ where the coefficients of the differential equation are continuous.

### Second-order ordinary linear differential equations

We now turn to arguably the most important topic of this part of the course.
A second-order ordinary linear differential equation is an equation of the form
    $a_{2}(x)y''(x)+a_{1}(x)y'(x)+a_{0}(x)y(x)=f(x)$
Why are these equations so important in the physical sciences? There are at least three reasons.
First of all, in many occasions, Newton's second law, when applied to a specific system, yields such an equation. Canonical examples of this include the damped and driven oscillator:
    ${\frac {d^{2}x}{dt^{2}}}+2\zeta \omega _{0}{\frac {dx}{dt}}+\omega _{0}^{2}x={\frac {F(t)}{m}},$
and a particle under uniform gravitational acceleration,
    ${\frac {d^{2}x}{dt^{2}}}=-g.$
Secondly, when applying certain methods of solution to linear partial differential equations, we obtain as intermediate steps these sorts of second-order linear ordinary differential equations. An example is the aforementioned Laguerre equation. Another example is the Cauchy-Euler equation,
    $a_{n}x^{n}y^{(n)}(x)+a_{n-1}x^{n-1}y^{(n-1)}(x)+\cdots +a_{0}y(x)=0$
where all the $a_{i}$ terms are constants.
Lastly, the importance of linear equations lies in the fact that, most of the time, a nonlinear equation can be approximated by a linear one in the vicinity of a specific point (called the equilibrium point). For example, the equation that governs the dynamics of a pendulum can be written as
    ${\frac {d^{2}\theta }{dt^{2}}}+{\frac {g}{\ell }}\sin \theta =0$
If $\theta =0$ is taken as the equilibrium point, we expand $\sin \theta$ using its Taylor series
    $\sin \theta =\theta -{\frac {\theta ^{3}}{3!}}+\cdots$
and if all terms except the first one are considered negligible ($\theta \ll 1$), then the equation of the pendulum is now
    ${\frac {d^{2}\theta }{dt^{2}}}+{\frac {g}{\ell }}\theta =0$
and the equation is now linear. It should be noted that, thus, the solution obtained from this linear equation will only be valid under the hypothesis the linearization was done in the first place, namely $\theta \ll 1$.

## See Also

* Differential Equations
* Wikipedia: Differential equation
* Wikibooks: Ordinary Differential Equations/Second Order