Second order differential equations

Introduction

Take the second order differential equation

$$ a\frac{d^{2}y}{dx^{2}}+b\frac{dy}{dx}+cy = 0 $$

Where $a,b,c$ are constants. Then suppose that $y=u$ and $y=v$ are distinct solutions of the differential equation. In other words

$$ a\frac{d^{2}u}{dx^{2}}+b\frac{du}{dx}+cu = 0 ~\textrm{ and }~ a\frac{d^{2}v}{dx^{2}}+b\frac{dv}{dx}+cv = 0 $$

The general solution to the differential equation is then

$$ y = Au + Bv $$

Where $A$ and $B$ are arbitrary constants. Many distinct solutions to a differential equations can be added up to form a general solution.

Proof (click to expand)

If $y = Au + Bv$ then $$ \frac{dy}{dx} = A \frac{du}{dx} + B \frac{dv}{dx} ~\textrm{ and }~ \frac{d^{2}y}{dx^{2}} = A \frac{d^{2}u}{dx^{2}} + B \frac{d^{2}v}{dx^{2}} $$ Going back to the original differential equation at the beginning $$ a\frac{d^{2}y}{dx^{2}}+b\frac{dy}{dx}+cy = 0 $$ becomes $$ a\left(A \frac{d^{2}u}{dx^{2}} + B \frac{d^{2}v}{dx^{2}}\right) + b \left(A \frac{du}{dx} + B \frac{dv}{dx} \right) +c\left(Au + Bv \right)$$ $$ = A\left(a\frac{d^{2}u}{dx^{2}}+b\frac{du}{dx}+cu\right) + B\left(a\frac{d^{2}v}{dx^{2}}+b\frac{dv}{dx}+cv \right) $$ $$ = A(0)+B(0) = 0 $$ Which confirms that $y=Au+Bv$ is a general solution of the differential equation.

Now to find the solutions. Let $y=e^{\lambda x}$ be some solution where $\lambda$ is a constant. Then

$$ \begin{align} y&=e^{\lambda x} \\ \frac{dy}{dx} &= \lambda e^{\lambda x} \\ \frac{d^{2}y}{dx^{2}} &= \lambda^{2} e^{\lambda x} \end{align} $$

The differential equation becomes

$$ a\lambda^{2} e^{\lambda x} + b\lambda e^{\lambda x} + c e^{\lambda x} = 0 $$

$$ \Rightarrow \left(a\lambda^{2} + b\lambda + c\right)e^{\lambda x} = 0 $$

But $e^{\lambda x} \ne 0$, which implies that

$$ a\lambda^{2} + b\lambda + c = 0 $$

The solutions of the above auxiliary quadratic equation form distinct solutions to the second order differential equation.

You can then apply any boundary conditions in the problem to get the particular solution.

The auxiliary quadratic equation has real distinct roots if $b^{2}-4ac \gt 0$, it has real repeated roots if $b^{2}-4ac = 0$, and it has complex roots if $b^{2}-4ac \lt 0$.

The nature of these roots tells you about the behaviour of the solutions. You need to remember what the solutions look like for different pairs of roots.

Real distinct roots

If a second order differential equation's auxiliary equation has two real distinct roots $\lambda_1$ and $\lambda_2$ then the general solution is

$$ y=Ae^{\lambda_1 x} + Be^{\lambda_2 x} $$

Where $A$ and $B$ are arbitrary constants.

Example

Q) Solve $\frac{d^{2}y}{dx^{2}}+\frac{dy}{dx}-2y = 0$.

A) Letting $y=e^{\lambda x}$ the auxiliary equation is

$$ \lambda^2+\lambda-2 = 0$$

$$ \Rightarrow (\lambda-1)(\lambda+2) = 0 $$

The auxiliary equation has two real distinct solutions $\lambda=-2,1$, and two distinct solutions. Therefore the general solution is

$$ y = Ae^{-2 x}+Be^{ x} $$

Where $A$ and $B$ are arbitrary constants.

Real repeated roots

If a second order differential equation's auxiliary equation has a real root $\lambda$ repeated twice then the general solution is

$$ y=\left(A+Bx\right)e^{\lambda x} $$

Where $A$ and $B$ are arbitrary constants.

Example

Q) Solve $\frac{d^{2}y}{dx^{2}}+10\frac{dy}{dx}+25y = 0$.

A) Letting $y=e^{\lambda x}$ the auxiliary equation is

$$ \lambda^{2}+10\lambda+25 = 0$$

$$ \Rightarrow (\lambda+5)^{2} = 0 $$

The auxiliary equation has one root $\lambda=-5$ repeated twice. Therefore the general solution is

$$ y=\left(A+Bx\right)e^{-5 x} $$

Where $A$ and $B$ are arbitrary constants.

Pure imaginary roots

If a second order differential equation is in the form

$$ \frac{d^{2}y}{dx^{2}} + k^{2}y = 0 $$

Then the auxiliary equation has pure imaginary roots $\pm a i$ where $a$ is a real number, and the general solution is

$$ y=A\cos(kx)+B\sin(kx) $$

Where $A$ and $B$ are arbitrary constants.

Example

Q) Solve $\frac{d^{2}y}{dx^{2}}+4y = 0$.

A) Letting $y=e^{\lambda x}$ the auxiliary equation is

$$ \lambda^{2}+4 = 0 $$

$$ \Rightarrow \lambda = \pm 2i $$

The auxiliary equation has pure imaginary roots $\lambda=\pm2i$. Therefore the general solution is

$$ y = A\cos(2x)+B\sin(2x) $$

Where $A$ and $B$ are arbitrary constants.

Complex conjugate roots

If a second order differential equation's auxiliary equation has complex conjugate roots $a\pm bi$ where $a$ and $b$ are real numbers then the general solution is

$$ y = e^{ax} \left(A \cos(bx)+B\sin(bx)\right) $$

Where $A$ and $B$ are arbitrary constants. This product arises from the fact that $e^{(a+bi)x}=e^{ax}e^{ibx}$.

Example

Q) Solve $\frac{d^{2}y}{dx^{2}}-2\frac{dy}{dx}+2y = 0$.

A) Letting $y=e^{\lambda x}$ the auxiliary equation is

$$ \lambda^2-2\lambda+2 = 0 $$

$$ \Rightarrow \lambda = 1 \pm i $$

The auxiliary equation has complex conjugate roots $1\pm i$. Therefore the general solution is

$$ y = e^{x} \left(A \cos x +B\sin x \right) $$

Where $A$ and $B$ are arbitrary constants.

Non-homogeneous second order differential equations

The differential equations in the previous section all had 0 on the right hand side, so they're called homogeneous. In this section I will show you non-homogeneous differential equations, with some expression $f(x)$ on the right hand side.

Given the second order differential equation

$$ a\frac{d^{2}y}{dx^{2}}+b\frac{dy}{dx}+cy = f(x) $$

We first find the general solution of the differential equation

$$ a\frac{d^{2}y}{dx^{2}}+b\frac{dy}{dx}+cy = 0 $$

This is called the complementary function. Then we find a solution of the full differential equation including the $f(x)$ on the right hand side.

We try different solutions $y$ depending on the nature of $f(x)$

Differentiate your trial function twice and then sub these derivatives back into the differential equation to be solved. Find the constants in your trial function by comparing both sides of the equation.

This solution is called the particular integral. The general solution is then

$$ y = \textrm{complementary function} + \textrm{particular integral} $$

You can then apply any boundary conditions in the problem to get the particular solution.

Example

Q) Solve $\frac{d^{2}y}{dx^{2}}+9y=e^{2x}$ given that $y(0)=0$ and $y'(0)=2$.

A) Start off by finding the complementary function. Letting $y=e^{\lambda x}$ the auxiliary quadratic equation is

$$ \lambda^{2}+9 = 0 $$

$$ \Rightarrow \lambda = \pm 3i $$

The auxiliary quadratic equation has pure imaginary roots $\pm 3i$. Therefore the complementary function is

$$ y= A\cos(3x)+B\sin(3x) $$

Where $A$ and $B$ are arbitrary constants. Now find the particular integral. $f(x)=e^{2x}$ so our trial function is $y=ae^{2x}$. Then

$$ \frac{dy}{dx} = 2ae^{2x} ~\textrm{ and }~ \frac{d^{2}y}{dx^{2}} = 4ae^{2x} $$

Subbing these back into the original differential equation

$$ \left(4ae^{2x}\right) +9\left(ae^{2x}\right) = 4ae^{2x}+9ae^{2x} $$

Compare this with the right hand side of the differential equation $e^{2x}$. Then

$$ 4ae^{2x}+9ae^{2x} = e^{2x} \Rightarrow 4a+9a =1 \Rightarrow a = \frac{1}{13} $$

Therefore the general solution is

$$ y= A\cos(3x)+B\sin(3x)+\frac{1}{13}e^{2x} $$

But the boundary conditions state that $y(0)=0$ and $y'(0)=2$. Using these boundary conditions yields

$$ A\cos(0)+B\sin(0)-2e^{0} = 0 \Rightarrow A-2 = 0 \Rightarrow A=2 $$

And since $y'=-3A\sin(3x)+3B\cos(3x)+\frac{2}{13}e^{2x}$

$$ -3A\sin(0)+3B\cos(0)+\frac{2}{13}e^{0} = 2 \Rightarrow 3B+\frac{2}{13} = 2 \Rightarrow B = \frac{8}{13} $$

Therefore the particular solution is

$$ y= 2\cos(3x)+\frac{8}{13}\sin(3x)+\frac{1}{13}e^{2x} $$

Example

Q) Solve $\frac{d^{2}y}{dx^{2}}-4\frac{dy}{dx}+4y = \sin x $ given that $y(0)=0$ and $y'(0)=0$.

A) Start off by finding the complementary function. Letting $y=e^{\lambda x}$ the auxiliary quadratic equation is

$$ \lambda^2-4\lambda+4 = 0 $$

$$ \Rightarrow \left(\lambda-2\right)^2 $$

The auxiliary quadratic equation has a repeated real root $\lambda = 2$. Therefore the complementary function is

$$ y = \left(A+Bx\right)e^{2x} $$

Where $A$ and $B$ are arbitrary constants. Now find the particular integral. $f(x)=\sin x $ so our trial function is $y=a\cos x +b\sin x $. Then

$$ \frac{dy}{dx} = -a\sin x +b\cos x ~\textrm{ and }~ \frac{d^{2}y}{dx^{2}} = -a\cos x -b\sin x $$

Subbing these back into the original differential equation

$$ \left(-a\cos x -b\sin x \right)-4\left(-a\sin x +b\cos x \right) + 4\left(a\cos x +b\sin x \right) $$

$$ = \left(-a-4b+4a\right)\cos x + \left(-b+4a+4b\right)\sin x $$

$$ = \left(3a-4b\right)\cos x + \left(4a+3b\right)\sin x $$

Compare this with the right hand side of the differential equation $\sin x $. Then we get two simultaneous equations

$$ 3a-4b = 0 $$

$$ 4a+3b = 1 $$

Solving them yields $a=\frac{4}{25}$ and $b=\frac{3}{25}$. Therefore the general solution is

$$ y = \left(A+Bx\right)e^{2x}+ \frac{4}{25}\cos x + \frac{3}{25}\sin x $$

But the boundary conditions state that $y(0)=0$ and $y'(0)=0$. Using these boundary conditions yields two simultaneous equations

$$ \left(A+0\right)e^0 + \frac{4}{25}\cos(0)+\frac{3}{25}\sin(0) \Rightarrow A+\frac{4}{25} = 0 \Rightarrow A=-\frac{4}{25} $$

Find $y'$ using the product rule

$$ \begin{align} y' &= Be^{2x}+2e^{2x}\left(A+Bx\right)-\frac{4}{25}\sin x +\frac{3}{25}\cos x \\ &= e^{2x}\left(B+2A+2Bx\right) -\frac{4}{25}\sin x +\frac{3}{25}\cos x \\ &= e^{2x}\left[2A+B\left(1+2x\right)\right] -\frac{4}{25}\sin x +\frac{3}{25}\cos x \end{align} $$

Now we can apply the boundary condition $y'(0)=0$

$$ e^{0}\left[2A+B\left(1+0\right)\right] -\frac{4}{25}\sin(0)+\frac{3}{25}\cos(0) = 0 $$

$$ \Rightarrow 2\left(-\frac{4}{25}\right)+B + \frac{3}{25} = 0 \Rightarrow B = \frac{1}{5} $$

Therefore the particular solution is

$$ y = \left(\frac{1}{5}x-\frac{4}{25}\right)e^{2x}+ \frac{4}{25}\cos x + \frac{3}{25}\sin x $$

Example

Q) (Hard) Solve $2\frac{d^{2}y}{dx^{2}}-3\frac{dy}{dx}-14y = 2x^{2}+1$ given that $y(0)=0$ and $y'(0)=0$.

A) Start off by finding the complementary function. Letting $y=e^{\lambda x}$ the auxiliary quadratic equation is

$$ 2\lambda^{2}-3\lambda-14 = 0 $$

$$ \Rightarrow \left(\lambda+2\right)\left(2\lambda-7\right) $$

The auxiliary quadratic equation has distinct real roots $\lambda = -2,\frac{7}{2}$. Therefore the complementary function is

$$ y = Ae^{-2 x} + Be^{\frac{7}{2} x} $$

Where $A$ and $B$ are arbitrary constants. Now find the particular integral. $f(x)=2x^{2}+1$ so our trial function is $y=ax^{2}+bx+c$. Then

$$ \frac{dy}{dx} = 2ax + b ~\textrm{ and }~ \frac{d^{2}y}{dx^{2}} = 2a $$

Subbing these back into the original differential equation

$$ 2\left(2a\right) -3\left(2ax+b\right) -14\left(ax^{2}+bx+c\right) = 4a - 6ax-3b -14ax^{2}-14bx-14c $$

$$ = -14ax^{2} -x \left(6a+14b\right) +4a-3b-14c $$

Compare this with the right hand side of the differential equation $2x^{2}+1$. Then

$$ -14a = 2 \Rightarrow a = -\frac{1}{7} $$

And

$$ 6a+14b = 6\times\left(-\frac{1}{7}\right)+14b = 0 \Rightarrow b = \frac{3}{49} $$

And finally

$$ 4a-3b-14c = 4\times \left(-\frac{1}{7}\right) - 3\times\left(\frac{3}{49}\right)-14c = 1 \Rightarrow c = -\frac{43}{343} $$

We have all the required constants so the particular integral is

$$ -\frac{1}{7}x^{2} + \frac{3}{49}x -\frac{43}{343} $$

Therefore the general solution is

$$ y = Ae^{-2 x} + Be^{\frac{7}{2} x}-\frac{1}{7}x^{2} + \frac{3}{49}x -\frac{43}{343} $$

But the boundary conditions state that $y(0)=0$ and $y'(0)=0$. Using these boundary conditions yields two simultaneous equations

$$ Ae^{0}+Be^{0}-0+0-\frac{43}{343}=0 \Rightarrow A + B = \frac{43}{343} $$

And since $y' = -2Ae^{-2 x} + \frac{7}{2}Be^{\frac{7}{2} x}-\frac{2}{7}x + \frac{3}{49}$

$$ -2Ae^{0}+\frac{7}{2}Be^{0}+0+\frac{3}{49}=0 \Rightarrow -2A+\frac{7}{2}B = -\frac{3}{49} $$

Solving these yields $A=\frac{1}{11}$ and $B=\frac{130}{3773}$ so the particular solution is

$$ y = \frac{1}{11}e^{-2 x} + \frac{130}{3773}e^{\frac{7}{2} x}-\frac{1}{7}x^{2} + \frac{3}{49}x -\frac{43}{343} $$

More study materials