Let II be an interval and p,q,g:I→Rp,q,g:I\rightarrow\mathbb{R} be continuous. A second-order linear ordinary differential equation in normal form and its associated homogeneous equation are

y′′+p(x) y′+q(x) y=g(x),y′′+p(x) y′+q(x) y=0.y''+p(x)\,y'+q(x)\,y=g(x),\qquad y''+p(x)\,y'+q(x)\,y=0.

Every initial value problem y(x0)=y0,y\left(x_0\right)=y_0, y′(x0)=y1y'\left(x_0\right)=y_1 with x0∈Ix_0\in I has exactly one solution, which exists on all of I.I. Let LL be the differential operator L[y]:=y′′+p y′+q y,L[y]:=y''+p\,y'+q\,y, which is a linear transformation on the vector space C2(I).C^2(I). The superposition principle states that linear combinations of solutions of the homogeneous equation are solutions, so the solutions of the homogeneous equation form the kernel of L,L, a vector space, and that the difference of two solutions of the inhomogeneous equation solves the homogeneous equation. The general solution of the inhomogeneous equation is therefore the sum of any particular solution ypy_p and the general solution yhy_h of the homogeneous equation.

y=yh+ypy=y_h+y_p

Let y1,y2y_1,y_2 be differentiable on I.I. Their Wronskian is the determinant

W(y1,y2)(x):=det⁡[y1(x)y2(x)y1′(x)y2′(x)]=y1(x) y2′(x)−y1′(x) y2(x).W\left(y_1,y_2\right)(x):=\det\begin{bmatrix}y_1(x) & y_2(x) \\ y_1'(x) & y_2'(x)\end{bmatrix}=y_1(x)\,y_2'(x)-y_1'(x)\,y_2(x).

If y1,y2y_1,y_2 are solutions of the homogeneous equation then Abel’s identity states that W′=−p W,W'=-p\,W, so

W(x)=W(x0)exp⁡(−∫x0xp(s) ds)W(x)=W\left(x_0\right)\exp\left(-\int_{x_0}^{x}p(s)\,ds\right)

and the Wronskian is either identically zero or never zero on I.I. Two solutions are linearly independent if and only if their Wronskian is non-zero, and the solution space of the homogeneous equation has dimension two, since the map y↦(y(x0),y′(x0))y\mapsto\left(y\left(x_0\right),y'\left(x_0\right)\right) is an isomorphism onto R2\mathbb{R}^2 by existence and uniqueness. A basis y1,y2y_1,y_2 of the solution space is a fundamental set of solutions and the general solution of the homogeneous equation is yh=c1y1+c2y2y_h=c_1y_1+c_2y_2 for c1,c2∈R.c_1,c_2\in\mathbb{R}. Given one solution y1y_1 with no zeros on I,I, reduction of order finds a second by the substitution y2=v y1,y_2=v\,y_1, which gives a first-order linear equation for v′v' with solution

y2(x)=y1(x)∫1y1(x)2exp⁡(−∫p(x) dx)dx.y_2(x)=y_1(x)\int\frac{1}{y_1(x)^2}\exp\left(-\int p(x)\,dx\right)dx.

These statements extend to a linear equation of order nn with continuous coefficients: the solution space of the homogeneous equation has dimension n,n, the Wronskian of nn solutions is the determinant of the matrix whose rows are the solutions and their first n−1n-1 derivatives, it satisfies W′=−an−1W,W'=-a_{n-1}W, and nn solutions form a fundamental set if and only if it is non-zero.

Let a,b,c∈Ra,b,c\in\mathbb{R} with a≠0.a\neq 0. The homogeneous equation with constant coefficients

a y′′+b y′+c y=0a\,y''+b\,y'+c\,y=0

has the solution y=erxy=e^{rx} if and only if rr is a root of its characteristic equation, a quadratic obtained by substituting erxe^{rx} and dividing by it.

a r2+b r+c=0a\,r^2+b\,r+c=0

The roots are r=−b±b2−4ac2ar=\frac{-b\pm\sqrt{b^2-4ac}}{2a} and the fundamental set depends on the sign of the discriminant b2−4ac:b^2-4ac:

  • if b2−4ac>0b^2-4ac>0 the roots r1≠r2r_1\neq r_2 are real and yh=c1er1x+c2er2x;y_h=c_1e^{r_1x}+c_2e^{r_2x};
  • if b2−4ac=0b^2-4ac=0 the root r=−b2ar=-\frac{b}{2a} is repeated and, by reduction of order, yh=(c1+c2x)erx;y_h=\left(c_1+c_2x\right)e^{rx};
  • if b2−4ac<0b^2-4ac<0 the roots are the complex conjugates α±iβ\alpha\pm i\beta with β>0,\beta>0, the complex solutions e(α±iβ)x=eαx(cos⁡βx±isin⁡βx)e^{\left(\alpha\pm i\beta\right)x}=e^{\alpha x}\left(\cos\beta x\pm i\sin\beta x\right) have real and imaginary parts that are real solutions by Euler’s formula, and yh=eαx(c1cos⁡βx+c2sin⁡βx).y_h=e^{\alpha x}\left(c_1\cos\beta x+c_2\sin\beta x\right).

For an equation of order nn with constant coefficients the characteristic equation is the polynomial equation anrn+⋯+a1r+a0=0,a_nr^n+\cdots+a_1r+a_0=0, a real root rr of multiplicity mm contributes erx,x erx,…,xm−1erxe^{rx},x\,e^{rx},\ldots,x^{m-1}e^{rx} to the fundamental set and a pair of complex roots α±iβ\alpha\pm i\beta of multiplicity mm contributes xkeαxcos⁡βxx^ke^{\alpha x}\cos\beta x and xkeαxsin⁡βxx^ke^{\alpha x}\sin\beta x for k=0,…,m−1.k=0,\ldots,m-1. The Euler–Cauchy equation x2y′′+b x y′+c y=0x^2y''+b\,x\,y'+c\,y=0 on (0,∞)\left(0,\infty\right) has solutions y=xry=x^r where r(r−1)+b r+c=0,r\left(r-1\right)+b\,r+c=0, and the substitution x=etx=e^t turns it into an equation with constant coefficients.

Let L[y]=gL[y]=g have constant coefficients and a forcing function that is a sum of terms of the form P(x) eαxcos⁡βxP(x)\,e^{\alpha x}\cos\beta x or P(x) eαxsin⁡βxP(x)\,e^{\alpha x}\sin\beta x with PP a polynomial of degree k.k. The method of undetermined coefficients finds a particular solution by substituting a trial solution of the same form with unknown coefficients and matching terms. For a term P(x) eαxcos⁡βxP(x)\,e^{\alpha x}\cos\beta x or P(x) eαxsin⁡βxP(x)\,e^{\alpha x}\sin\beta x the trial solution is

xs eαx(Q1(x)cos⁡βx+Q2(x)sin⁡βx)x^s\,e^{\alpha x}\left(Q_1(x)\cos\beta x+Q_2(x)\sin\beta x\right)

with Q1,Q2Q_1,Q_2 polynomials of degree kk and ss the multiplicity of α+iβ\alpha+i\beta as a root of the characteristic equation, with s=0s=0 if it is not a root. The factor xsx^s is needed because the trial solution would otherwise solve the homogeneous equation, a situation called resonance. By superposition the particular solutions for each term of gg are added. For example, y′′+y=cos⁡xy''+y=\cos x has s=1s=1 and particular solution yp=x2sin⁡x,y_p=\frac{x}{2}\sin x, whose amplitude grows without bound.

Let y1,y2y_1,y_2 be a fundamental set of solutions of the homogeneous equation with Wronskian W.W. Variation of parameters finds a particular solution for any continuous forcing function gg by replacing the constants in yhy_h with functions, yp=u1y1+u2y2,y_p=u_1y_1+u_2y_2, subject to u1′y1+u2′y2=0,u_1'y_1+u_2'y_2=0, which leads to the linear system u1′y1′+u2′y2′=gu_1'y_1'+u_2'y_2'=g and the formula

yp(x)=−y1(x)∫y2(x) g(x)W(x) dx+y2(x)∫y1(x) g(x)W(x) dx.y_p(x)=-y_1(x)\int\frac{y_2(x)\,g(x)}{W(x)}\,dx+y_2(x)\int\frac{y_1(x)\,g(x)}{W(x)}\,dx.

The method applies to variable coefficients and to any g,g, whereas undetermined coefficients requires constant coefficients and a forcing function of the special form, but is simpler when it applies. Written as a single integral,

yp(x)=∫x0xy1(s) y2(x)−y1(x) y2(s)W(s) g(s) ds,y_p(x)=\int_{x_0}^{x}\frac{y_1(s)\,y_2(x)-y_1(x)\,y_2(s)}{W(s)}\,g(s)\,ds,

which is the particular solution with yp(x0)=yp′(x0)=0.y_p\left(x_0\right)=y_p'\left(x_0\right)=0.

The harmonic oscillator is the constant-coefficient equation for a displacement y(t)y(t) with natural frequency ω0>0,\omega_0>0, damping ratio ζ≥0\zeta\geq 0 and a periodic forcing of amplitude FF and frequency ω.\omega.

y′′+2ζω0 y′+ω02 y=Fcos⁡ωty''+2\zeta\omega_0\,y'+\omega_0^2\,y=F\cos\omega t

The characteristic roots are ω0(−ζ±ζ2−1).\omega_0\left(-\zeta\pm\sqrt{\zeta^2-1}\right). The unforced oscillator is undamped if ζ=0,\zeta=0, with solutions c1cos⁡ω0t+c2sin⁡ω0tc_1\cos\omega_0t+c_2\sin\omega_0t of period 2πω0,\frac{2\pi}{\omega_0}, underdamped if 0<ζ<1,0<\zeta<1, with oscillations of frequency ω01−ζ2\omega_0\sqrt{1-\zeta^2} whose amplitude decays like e−ζω0t,e^{-\zeta\omega_0t}, critically damped if ζ=1\zeta=1 and overdamped if ζ>1,\zeta>1, in which cases it returns to rest without oscillating. When ζ>0\zeta>0 the homogeneous solution is a transient that decays, and every solution converges to the steady-state particular solution yp=Acos⁡(ωt−ϕ)y_p=A\cos\left(\omega t-\phi\right) with amplitude

A=F(ω02−ω2)2+(2ζω0ω)2,A=\frac{F}{\sqrt{\left(\omega_0^2-\omega^2\right)^2+\left(2\zeta\omega_0\omega\right)^2}},

which for small ζ\zeta is largest when the forcing frequency is near the natural frequency. When ζ=0\zeta=0 and ω=ω0\omega=\omega_0 the forcing is in resonance with the oscillator and the particular solution F2ω0tsin⁡ω0t\frac{F}{2\omega_0}t\sin\omega_0t grows without bound.