Home Notes Research CV Projects Outside of Math

← Back to Course Resources

MATH 2410 — Differential Equations

Lecture Notes. This is NOT meant to be a substitute for coming to lecture or consulting the textbook directly, but rather a helpful resource to review for exams/ review what was discussed in lecture.

Section 3.1

Linear Models
↑ Back to top

Growth and Decay Models

Recall from Section 1.3 the basic growth/decay model

\[ \frac{dx}{dt} = kx, \qquad x(t_0) = x_0, \]

where \(k\) is a constant of proportionality. This differential equation is both separable and linear.

Example A substance decays at a rate proportional to the amount present at time \(t\) and has a half-life of \(3.3\) hours. If \(1\) g of the substance is present initially, how long will it take for \(90\%\) of the substance to decay?

We are told \(\dfrac{dx}{dt} = -kx\). Separating variables,

\[ \frac{dx}{x} = -k\,dt \;\Longrightarrow\; \int \frac{dx}{x} = \ln|x| = -kt+C \;\Longrightarrow\; x(t) = Ce^{-kt}. \]

Since \(x(0) = 1\) g, \(C=1\), so \(x(t) = e^{-kt}\). Using the half-life,

\[ x(3.3) = \frac{1}{2}x(0) = \frac{1}{2} \;\Longrightarrow\; e^{-3.3k} = \frac{1}{2} \;\Longrightarrow\; k = -\frac{1}{3.3}\ln\!\left(\frac{1}{2}\right). \]

We want the time at which \(x(t) = 0.1\) (i.e. \(90\%\) has decayed):

\[ 0.1 = e^{-kt} \;\Longrightarrow\; t = -\frac{\ln(0.1)}{k} \approx 10.96. \]

Thus

\[ \boxed{t \approx 11 \text{ hours}.} \]

Newton's Law of Cooling

Definition Newton's Law of Cooling states that the rate of change of the temperature \(T(t)\) of an object is proportional to the difference between the object's temperature and the temperature \(T_m\) of the surrounding medium: \[ \frac{dT}{dt} = k(T-T_m). \]

Solving by separation of variables,

\[ \frac{dT}{T-T_m} = k\,dt \;\Longrightarrow\; \int \frac{dT}{T-T_m} = \int k\,dt \;\Longrightarrow\; \ln|T-T_m| = kt+C \;\Longrightarrow\; T(t) = T_m + Ce^{kt}. \]
Example A thermometer reading \(70^\circ\)F is placed in an oven preheated to a constant temperature. The thermometer reads \(110^\circ\)F after \(1\) minute and \(145^\circ\)F after \(2\) minutes. How hot is the oven?

Let \(T_m\) be the (constant) oven temperature and \(T(t)\) the thermometer reading at time \(t\) (in minutes). Then

\[ T(0) = T_m + Ce^{k(0)} = T_m+C = 70 \;\Longrightarrow\; C = 70-T_m, \]

so \(T(t) = T_m + (70-T_m)e^{kt}\). Using the two given readings,

\[ \begin{aligned} T(1) &= T_m + (70-T_m)e^{k} = 110 \;\Longrightarrow\; e^{k} = \frac{110-T_m}{70-T_m}, \\ T(2) &= T_m + (70-T_m)e^{2k} = 145 \;\Longrightarrow\; e^{2k} = \frac{145-T_m}{70-T_m}. \end{aligned} \]

Since \(e^{2k} = (e^k)^2\),

\[ \frac{145-T_m}{70-T_m} = \left(\frac{110-T_m}{70-T_m}\right)^2 \;\Longrightarrow\; (145-T_m)(70-T_m) = (110-T_m)^2. \]

Expanding both sides,

\[ 10150 - 215T_m + T_m^2 = 12100 - 220T_m + T_m^2 \;\Longrightarrow\; 5T_m = 1950. \]

Thus

\[ \boxed{T_m = 390^\circ\text{F}.} \]
Remark All the models we have worked with so far are linear differential equations. We now turn to nonlinear models.
Section 3.2

Nonlinear Models
↑ Back to top

Nonlinear Population Models

Suppose we track a rate of growth that depends on both the amount present and another factor that is itself dependent on the amount present: \(\dfrac{dP}{dt} = P\cdot f(P)\), a nonlinear model.

Suppose an environment has a carrying capacity for a population, so that

\[ \frac{dP}{dt} = P\cdot f(P), \qquad f(K) = 0, \quad f(0) = r, \]

where \(K\) is the carrying capacity. If \(f(P)\) is linear, we obtain

\[ \frac{dP}{dt} = P\left(r - \frac{r}{K}P\right), \]

called the logistic equation.

Definition The logistic equation is the differential equation \[ \frac{dP}{dt} = P(a-bP). \]

Solving the logistic equation. Separating variables,

\[ \frac{dP}{P(a-bP)} = dt. \]

Using partial fractions, \(\dfrac{1}{P(a-bP)} = \dfrac{1/a}{P} + \dfrac{b/a}{a-bP}\), so

\[ \frac{1}{a}\int \frac{dP}{P} + \frac{b}{a}\int \frac{dP}{a-bP} = \int dt \;\Longrightarrow\; \frac{1}{a}\ln\!\left(\frac{P}{a-bP}\right) = t+C. \]

Solving for \(P\),

\[ \frac{P}{a-bP} = ce^{at} \;\Longrightarrow\; P = \frac{ace^{at}}{1-bce^{at}}. \]

If \(P(0) = P_0\) with \(P_0 \ne a/b\), then \(c = P_0/(a-bP_0)\), and the solution can be written as

\[ \boxed{P(t) = \frac{aP_0}{bP_0+(a-bP_0)e^{-at}}.} \]
Example A student carrying the flu virus returns to an isolated school of \(1000\) students. Suppose the rate of spread is proportional to both the number of students infected and the number not infected. Determine the number of students infected after \(6\) days if \(x(4)=50\).

The model is \(\dfrac{dx}{dt} = kx(1000-x)\), \(x(0)=1\), matching the logistic equation with \(a=1000k\), \(b=k\). Then

\[ x(t) = \frac{1000k}{k+999ke^{-1000kt}} = \frac{1000}{1+999e^{-1000kt}}. \]

Using \(x(4)=50\):

\[ 50 = \frac{1000}{1+999e^{-4000k}} \;\Longrightarrow\; e^{-4000k} = \frac{19}{999} \;\Longrightarrow\; k = -\frac{1}{4000}\ln\!\left(\frac{19}{999}\right). \]

Then

\[ \boxed{x(6) \approx 276 \text{ students}.} \]

Adjusting Population Models

Recall the logistic model can be written in terms of the carrying capacity \(K\) and intrinsic growth rate \(r\) by setting \(a=r\), \(b=r/K\):

\[ \frac{dP}{dt} = P\left(r-\frac{r}{K}P\right). \]

How can we make the model more realistic? Suppose a constant number \(h\) of the population is removed (harvested) per unit time. Then

\[ \frac{dP}{dt} = P\left(r-\frac{r}{K}P\right) - h, \qquad h>0, \]

which is still separable and autonomous.

Remark The critical points of the harvested model are different from those of the unharvested model! Setting \(\dfrac{dP}{dt}=0\) gives the quadratic equation \[ -\frac{r}{K}P^2 + rP - h = 0, \] so \[ P = \frac{-r \pm \sqrt{r^2 - 4rh/K}}{-2r/K}. \] If \(h>0\), these critical points shift away from \(P=0\) and \(P=K\).
Section 3.3

Modeling with Systems of Differential Equations
↑ Back to top

Systems of First-Order Differential Equations

Definition A system \[ \begin{aligned} \frac{dx}{dt} &= g_1(t,x,y) \\ \frac{dy}{dt} &= g_2(t,x,y) \end{aligned} \] is a linear system if both \(g_1\) and \(g_2\) are linear in the variables \(x\) and \(y\), i.e. \[ g_1(t,x,y) = c_1x+c_2y+f_1(t), \qquad g_2(t,x,y) = c_3x+c_4y+f_2(t). \] If the system is not linear, it is said to be nonlinear.
Remark Systems of differential equations are used to understand two or more interacting quantities, such as predator-prey populations, multi-tank mixing problems, and multi-step radioactive decay.
Example Radioactive decay series. Suppose element \(X\) decays into element \(Y\) at rate \(\lambda_1\), which in turn decays into a stable element \(Z\) at rate \(\lambda_2\): \[ X \xrightarrow{\ \lambda_1\ } Y \xrightarrow{\ \lambda_2\ } Z. \] If all elements decay at a rate proportional to the amount present, the system is \[ \begin{aligned} \frac{dx}{dt} &= -\lambda_1x, \\ \frac{dy}{dt} &= -\lambda_2y+\lambda_1x, \\ \frac{dz}{dt} &= \lambda_2y. \end{aligned} \]
Example Multi-tank mixing. Tank A receives fresh water at \(3\) gal/min and also receives mixed inflow from Tank B at \(1\) gal/min. Tank A's outflow is pumped into Tank B at \(4\) gal/min, and Tank B's outflow leaves the system at \(3\) gal/min. Initially, Tank A holds \(50\) gal of water with \(25\) lb of dissolved salt, and Tank B holds \(50\) gal of pure water.

Let \(x_1(t)\) and \(x_2(t)\) denote the amount of salt (in lb) in Tanks A and B, respectively. Since each tank maintains a constant volume of \(50\) gal, the concentration in Tank A is \(x_1/50\) and in Tank B is \(x_2/50\). Then

\[ \begin{aligned} \frac{dx_1}{dt} &= \underbrace{(3)(0)}_{\text{fresh water in}} + \underbrace{(1)\frac{x_2}{50}}_{\text{from Tank B}} - \underbrace{(4)\frac{x_1}{50}}_{\text{out to Tank B}} = -\frac{2}{25}x_1 + \frac{1}{50}x_2, \\[4pt] \frac{dx_2}{dt} &= \underbrace{(4)\frac{x_1}{50}}_{\text{from Tank A}} - \underbrace{(3)\frac{x_2}{50}}_{\text{leaves system}} - \underbrace{(1)\frac{x_2}{50}}_{\text{to Tank A}} = \frac{2}{25}x_1 - \frac{2}{25}x_2, \end{aligned} \]

with initial conditions \(x_1(0)=25\), \(x_2(0)=0\).

Section 4.1

Preliminary Theory — Linear Equations
↑ Back to top

Homogeneous Linear Equations and Superposition

Definition A linear \(n\)th-order differential equation of the form \[ a_n(x)y^{(n)} + a_{n-1}(x)y^{(n-1)} + \cdots + a_1(x)y' + a_0(x)y = 0 \] is said to be homogeneous. If instead \[ a_n(x)y^{(n)} + \cdots + a_1(x)y' + a_0(x)y = g(x) \] with \(g(x)\ne 0\), the equation is said to be nonhomogeneous.

Throughout, we assume the coefficients \(a_i(x)\) are continuous and \(a_n(x)\) is nonzero on the interval under consideration.

Remark Homogeneous linear differential equations always admit the constant solution \(y=0\).
Theorem (Superposition Principle) Let \(y_1,\dots,y_n\) be solutions of a homogeneous linear \(n\)th-order differential equation \[ a_n(x)y^{(n)} + \cdots + a_1(x)y' + a_0(x)y = 0 \] on an interval \(I\). Then for any constants \(c_1,\dots,c_n\), \[ y = c_1y_1 + c_2y_2 + \cdots + c_ny_n \] is also a solution of the equation on \(I\).

To see why, suppose \(y_1\) and \(y_2\) are solutions. Then for any constant \(c_1\),

\[ a_n(x)\frac{d^n}{dx^n}(c_1y_1) + \cdots + a_1(x)\frac{d}{dx}(c_1y_1) + a_0(x)(c_1y_1) = c_1\Big(a_n(x)y_1^{(n)} + \cdots + a_1(x)y_1' + a_0(x)y_1\Big) = c_1(0) = 0, \]

so \(c_1y_1\) is also a solution. Likewise,

\[ a_n(x)\frac{d^n}{dx^n}(y_1+y_2) + \cdots + a_1(x)\frac{d}{dx}(y_1+y_2) + a_0(x)(y_1+y_2) = 0 + 0 = 0, \]

so \(y_1+y_2\) is also a solution. Together, these two facts give the superposition principle stated above.

Example Verify that \(y_1=x^2\) and \(y_2=x^2\ln(x)\) are solutions to \(x^3y'''-2xy'+4y=0\) on \((0,\infty)\).

For \(y_1=x^2\): \(y_1'=2x\), \(y_1''=2\), \(y_1'''=0\), so

\[ x^3(0) - 2x(2x) + 4(x^2) = -4x^2+4x^2 = 0. \checkmark \]

For \(y_2=x^2\ln x\): \(y_2' = 2x\ln x + x\), \(y_2'' = 2\ln x+3\), \(y_2''' = 2/x\), so

\[ x^3\left(\frac{2}{x}\right) - 2x(2x\ln x+x) + 4(x^2\ln x) = 2x^2 - 4x^2\ln x - 2x^2 + 4x^2\ln x = 0. \checkmark \]

By the superposition principle,

\[ \boxed{y = c_1x^2+c_2x^2\ln(x)} \]

is also a solution, for any constants \(c_1,c_2\).

Linear Independence and the Wronskian

Definition A set of functions \(f_1(x),\dots,f_n(x)\) is said to be linearly dependent on an interval \(I\) if there exist constants \(c_1,\dots,c_n\), not all zero, such that \[ c_1f_1(x) + \cdots + c_nf_n(x) = 0 \qquad \text{for all } x \in I. \] Otherwise, the set is said to be linearly independent.
Example The set \(f_1(x)=x\), \(f_2(x)=x^2\) is linearly independent on \((-\infty,\infty)\). If \(c_1f_1(x)+c_2f_2(x) = c_1x+c_2x^2 = 0\) for all \(x\), then \(c_2x^2=-c_1x\), i.e. \(-c_1 = c_2x\) for all \(x\) — but the left side is constant while the right side is not (unless \(c_1=c_2=0\)). So the only solution is \(c_1=c_2=0\), and the set is linearly independent.
Example The set \(f_1(x)=x\), \(f_2(x)=x^2\), \(f_3(x)=4x+3x^2\) is linearly dependent, since \[ -4f_1(x) - 3f_2(x) + f_3(x) = -4x-3x^2+4x+3x^2 = 0. \checkmark \]
Example The set \(f_1(x)=5\), \(f_2(x)=\cos^2x\), \(f_3(x)=\sin^2x\) is linearly dependent on \((-\infty,\infty)\), since \[ f_1(x) - 5f_2(x) - 5f_3(x) = 5 - 5(\cos^2x+\sin^2x) = 5-5 = 0. \]
Definition For functions \(f_1,\dots,f_n\) that are each \((n-1)\)-times differentiable, the Wronskian is \[ W(f_1,\dots,f_n) = \det\begin{pmatrix} f_1 & f_2 & \cdots & f_n \\ f_1' & f_2' & \cdots & f_n' \\ \vdots & \vdots & \ddots & \vdots \\ f_1^{(n-1)} & f_2^{(n-1)} & \cdots & f_n^{(n-1)} \end{pmatrix}. \]
Theorem A set of functions \(f_1,\dots,f_n\) is linearly independent on \(I\) if and only if \(W(f_1,\dots,f_n) \ne 0\) for all \(x \in I\).
Remark Recall that for a \(2\times 2\) matrix, \(\det\begin{pmatrix} a&b\\c&d \end{pmatrix} = ad-bc\).
Example Let \(f_1(x)=e^x\), \(f_2(x)=e^{-x}\). Then \[ W(f_1,f_2) = \begin{vmatrix} e^x & e^{-x} \\ e^x & -e^{-x} \end{vmatrix} = e^x(-e^{-x}) - e^{-x}(e^x) = -1-1 = -2 \ne 0, \] so \(f_1\) and \(f_2\) are linearly independent on \((-\infty,\infty)\).

Fundamental Sets and General Solutions

Definition Any set of \(n\) linearly independent solutions \(f_1,\dots,f_n\) of a homogeneous linear \(n\)th-order differential equation on an interval \(I\) is said to be a fundamental set of solutions on \(I\).
Theorem Let \(f_1,\dots,f_n\) be a fundamental set of solutions of a homogeneous linear \(n\)th-order differential equation on \(I\). Then the general solution of the equation on \(I\) is \[ y = c_1f_1+c_2f_2+\cdots+c_nf_n, \] where \(c_1,\dots,c_n\) are arbitrary constants.
Example The functions \(y_1=e^{3x}\), \(y_2=e^{-3x}\) are solutions of \(y''-9y=0\) on \((-\infty,\infty)\). Since \[ W(e^{3x},e^{-3x}) = \begin{vmatrix} e^{3x} & e^{-3x} \\ 3e^{3x} & -3e^{-3x} \end{vmatrix} = -3-3 = -6 \ne 0, \] \(\{y_1,y_2\}\) is a fundamental set of solutions, so the general solution is \[ \boxed{y = c_1e^{3x}+c_2e^{-3x}.} \]

Now consider the nonhomogeneous case.

Theorem Let \(y_p\) be a particular solution of the nonhomogeneous linear \(n\)th-order equation, and let \(y_1,\dots,y_n\) be a fundamental set of solutions of the corresponding homogeneous equation. Then \[ y = c_1y_1+\cdots+c_ny_n+y_p \] is a general solution of the nonhomogeneous equation.
Example Since \(y_p=\sin(x)\) is a solution of \(y''-y=-2\sin(x)\), and \(y_1=e^x\), \(y_2=e^{-x}\) are solutions of the corresponding homogeneous equation \(y''-y=0\), the general solution of \(y''-y=-2\sin(x)\) is \[ \boxed{y = c_1e^x+c_2e^{-x}+\sin(x).} \]
Section 4.2

Reduction of Order
↑ Back to top

Reduction of Order

Given a homogeneous linear differential equation, how do we locate more than one solution? Consider a second-order linear homogeneous DE

\[ y'' + P(x)y' + Q(x)y = 0, \]

with \(P(x),Q(x)\) continuous on the interval we consider, and suppose we already know one solution \(y_1(x)\). We want to locate a second, linearly independent solution \(y_2(x)\).

Since \(y_1,y_2\) must be linearly independent, the ratio \(u(x) = y_2(x)/y_1(x)\) is nonconstant. Write \(y_2(x) = u(x)y_1(x)\), so

\[ y_2' = u'y_1+uy_1', \qquad y_2'' = u''y_1+2u'y_1'+uy_1''. \]

Substituting into the differential equation,

\[ \begin{aligned} y_2''+Py_2'+Qy_2 &= u''y_1+2u'y_1'+uy_1'' + P(u'y_1+uy_1') + Quy_1 \\ &= u''y_1 + 2u'y_1' + Pu'y_1 + u\underbrace{(y_1''+Py_1'+Qy_1)}_{0} \\ &= y_1u'' + (2y_1'+Py_1)u'. \end{aligned} \]

We need this to equal zero, so letting \(w=u'\),

\[ y_1w' + (2y_1'+Py_1)w = 0, \]

which is a first-order linear DE in \(w\). Its integrating factor is

\[ \mu(x) = e^{\int \frac{2y_1'+Py_1}{y_1}dx} = e^{\int \left(\frac{2y_1'}{y_1}+P\right)dx} = e^{2\ln|y_1|}e^{\int P\,dx} = y_1^2\,e^{\int P\,dx}. \]

Since \(\dfrac{d}{dx}(\mu(x)w)=0\), we get \(\mu(x)w=c\), so

\[ w = \frac{c}{y_1^2\,e^{\int P\,dx}} = c\cdot\frac{e^{-\int P\,dx}}{y_1^2}. \]

Choosing \(c=1\) and integrating,

\[ u = \int \frac{e^{-\int P\,dx}}{y_1^2}\,dx. \]
Theorem If \(y_1(x)\) is a known solution of \(y''+P(x)y'+Q(x)y=0\) on an interval \(I\), then a second, linearly independent solution is \[ y_2(x) = y_1(x)\int \frac{e^{-\int P(x)\,dx}}{y_1(x)^2}\,dx. \] One can check that \(W(y_1,y_2) = e^{-\int P(x)\,dx} \ne 0\), so \(\{y_1,y_2\}\) is a fundamental set of solutions and the general solution is \(y=c_1y_1+c_2y_2\).
Method of Solving
  1. Write the DE in standard form \(y''+P(x)y'+Q(x)y=0\) and identify the known solution \(y_1(x)\).
  2. Set \(y_2 = u(x)y_1(x)\) and substitute into the DE.
  3. The \(u\) terms will cancel, leaving a first-order linear DE in \(w=u'\).
  4. Solve for \(w\) using an integrating factor, then integrate to find \(u\).
  5. Form \(y_2 = u(x)y_1(x)\), and write the general solution \(y=c_1y_1+c_2y_2\).
Example Given that \(y_1=e^x\) is a solution to \(y''-y=0\) on \((-\infty,\infty)\), find the general solution.

Let \(y_2=u(x)e^x\). Then

\[ y_2' = e^x(u+u'), \qquad y_2'' = e^x(u''+2u'+u). \]

Substituting,

\[ y_2''-y_2 = e^x(u''+2u'+u) - ue^x = e^x(u''+2u'). \]

We want \(u''+2u'=0\), so with \(w=u'\): \(w'+2w=0\). The integrating factor is \(\mu(x)=e^{2x}\), so

\[ \frac{d}{dx}\big(e^{2x}w\big)=0 \;\Longrightarrow\; e^{2x}w=c_2 \;\Longrightarrow\; w = c_2e^{-2x}. \]

Integrating, \(u = -\tfrac12c_2e^{-2x}+c_1\). Choosing \(c_2=-2\), \(c_1=0\) gives \(u=e^{-2x}\), so \(y_2 = e^{-2x}e^x = e^{-x}\). Thus

\[ \boxed{y = c_1e^x+c_2e^{-x}.} \]
Example Given that \(y_1=x^2\) is a solution to \(x^2y''-3xy'+4y=0\) on \((0,\infty)\), find the general solution.

Standard form: \(y''-\dfrac3xy'+\dfrac{4}{x^2}y=0\). Let \(y_2=u(x)x^2\). Then

\[ y_2' = u'x^2+2xu, \qquad y_2'' = u''x^2+4xu'+2u. \]

Substituting,

\[ y_2''-\frac3xy_2'+\frac{4}{x^2}y_2 = (u''x^2+4xu'+2u) - \frac3x(u'x^2+2xu)+\frac{4}{x^2}(ux^2) = u''x^2+xu'. \]

We want \(u''x^2+xu'=0\), so with \(w=u'\): \(x^2w'+xw=0\), i.e. \(w'+\dfrac1xw=0\). The integrating factor is \(\mu(x)=e^{\int (1/x)dx}=x\), so

\[ \frac{d}{dx}(xw)=0 \;\Longrightarrow\; xw=c_1 \;\Longrightarrow\; w=\frac{c_1}{x}. \]

Integrating, \(u = c_1\ln(x)+c_2\). Choosing \(c_1=1\), \(c_2=0\) gives \(u=\ln(x)\), so \(y_2=x^2\ln(x)\). Checking,

\[ W(y_1,y_2) = \begin{vmatrix}x^2 & x^2\ln(x)\\ 2x & 2x\ln(x)+x \end{vmatrix} = x^3+2x^3\ln(x)-2x^3\ln(x) = x^3 \ne 0 \]

on \((0,\infty)\), so

\[ \boxed{y = c_1x^2+c_2x^2\ln(x).} \]
Example Given that \(y_1=1\) is a solution to \((1-x^2)y''+2xy'=0\), find the general solution.

Let \(y_2=u\). Then \(y_2'=u'\), \(y_2''=u''\), and substituting,

\[ (1-x^2)u''+2xu'=0 \;\Longrightarrow\; u''+\frac{2x}{1-x^2}u'=0. \]

With \(w=u'\): \(w'+\dfrac{2x}{1-x^2}w=0\). The integrating factor is

\[ \mu(x) = e^{\int \frac{2x}{1-x^2}dx} = e^{-\ln(1-x^2)} = \frac{1}{1-x^2}. \]

Then \(\dfrac{d}{dx}\left(\dfrac{w}{1-x^2}\right)=0\), so \(\dfrac{w}{1-x^2}=c_1\), i.e. \(w=c_1(1-x^2)\). Integrating,

\[ u = c_1\left(x-\frac{x^3}{3}\right)+c_2. \]

Choosing \(c_1=1\), \(c_2=0\) gives \(y_2 = x-\dfrac{x^3}{3}\). Checking,

\[ W(y_1,y_2) = \begin{vmatrix}1 & x-\frac{x^3}{3}\\ 0 & 1-x^2 \end{vmatrix} = 1-x^2 \ne 0 \]

away from \(x=\pm1\), so

\[ \boxed{y = c_1+c_2\left(x-\frac{x^3}{3}\right).} \]
Example Given that \(y_1=\sin x\) is a solution to \(y''+2(\tan x)y'-y=0\), find the general solution.

Let \(y_2=u(x)\sin x\). Then

\[ y_2' = u'\sin x+u\cos x, \qquad y_2'' = u''\sin x+2u'\cos x-u\sin x. \]

Substituting,

\[ \begin{aligned} y_2''+2\tan x\,y_2'-y_2 &= (u''\sin x+2u'\cos x-u\sin x) + 2\tan x(u'\sin x+u\cos x) - u\sin x \\ &= u''\sin x + 2u'\left(\cos x+\tan x\sin x\right) + u\left(-2\sin x+2\tan x\cos x\right). \end{aligned} \]

Since \(\cos x+\tan x\sin x = \dfrac{\cos^2x+\sin^2x}{\cos x} = \sec x\) and \(-2\sin x+2\tan x\cos x = -2\sin x+2\sin x = 0\), this simplifies to

\[ u''\sin x + 2\sec x\,u' = 0. \]

With \(w=u'\): \(\sin x\,w'+2\sec x\,w=0\), so

\[ \frac{w'}{w} = -\frac{2\sec x}{\sin x} = -\frac{2}{\sin x\cos x} = -4\csc(2x). \]

Integrating, \(\ln|w| = -2\ln|\tan x|+c_1\), so \(w = c_1\cot^2x\). Then

\[ u = c_1\int \cot^2x\,dx = c_1\int(\csc^2x-1)\,dx = c_1(-\cot x - x)+c_2. \]

Choosing \(c_1=-1\), \(c_2=0\) gives \(u = \cot x + x\), so

\[ y_2 = (\cot x+x)\sin x = \cos x + x\sin x. \]

Checking,

\[ W(\sin x,\, \cos x+x\sin x) = \sin x(x\cos x) - (\cos x+x\sin x)\cos x = x\sin x\cos x - \cos^2x - x\sin x\cos x = -\cos^2x \ne 0 \]

away from \(x=\pi/2+k\pi\), so

\[ \boxed{y = c_1\sin x + c_2(\cos x+x\sin x).} \]
Section 4.3

Homogeneous Equations with Constant Coefficients
↑ Back to top

The Auxiliary Equation

We now specialize to homogeneous linear differential equations whose coefficients are all constants. We will focus on the second-order case,

\[ ay'' + by' + cy = 0, \qquad a\ne 0, \]

though the same idea extends to any order.

Since \(y=e^{mx}\) reproduces itself (up to a constant multiple) under differentiation, it is a natural guess for a solution. Substituting \(y=e^{mx}\), \(y'=me^{mx}\), \(y''=m^2e^{mx}\) into the DE,

\[ am^2e^{mx}+bme^{mx}+ce^{mx} = e^{mx}\big(am^2+bm+c\big) = 0. \]

Since \(e^{mx}\ne 0\) for any \(x\), this holds exactly when

\[ am^2+bm+c=0. \]
Definition The equation \(am^2+bm+c=0\) is called the auxiliary equation (or characteristic equation) of \(ay''+by'+cy=0\). Every root \(m\) of the auxiliary equation produces a solution \(y=e^{mx}\) of the differential equation.

Since the auxiliary equation is a quadratic in \(m\), the quadratic formula

\[ m = \frac{-b\pm\sqrt{b^2-4ac}}{2a} \]

gives one of three possible outcomes, depending on the sign of the discriminant \(b^2-4ac\): two distinct real roots, one repeated real root, or a pair of complex conjugate roots. Each case produces a different form for the general solution.

Case 1: Distinct Real Roots

If \(b^2-4ac>0\), the auxiliary equation has two distinct real roots \(m_1\ne m_2\), giving two solutions \(y_1=e^{m_1x}\) and \(y_2=e^{m_2x}\). Since \(y_2/y_1 = e^{(m_2-m_1)x}\) is nonconstant, \(y_1\) and \(y_2\) are linearly independent, so the general solution is

\[ y = c_1e^{m_1x}+c_2e^{m_2x}. \]
Example Find the general solution to \(y''-5y'+6y=0\).

The auxiliary equation is \(m^2-5m+6=0\), which factors as \((m-2)(m-3)=0\), giving roots \(m=2\) and \(m=3\). Thus

\[ \boxed{y = c_1e^{2x}+c_2e^{3x}.} \]

Case 2: Repeated Real Root

If \(b^2-4ac=0\), the auxiliary equation has a single repeated root \(m=-b/(2a)\), giving only one solution \(y_1=e^{mx}\) directly. To find a second, linearly independent solution, we apply reduction of order (Section 4.2) with \(y_1=e^{mx}\): since \(y_1\) solves the DE with \(P(x) = b/a\) constant,

\[ y_2 = y_1\int \frac{e^{-\int (b/a)\,dx}}{y_1^2}\,dx = e^{mx}\int \frac{e^{-(b/a)x}}{e^{2mx}}\,dx. \]

Since \(m=-b/(2a)\), we have \(e^{2mx}=e^{-(b/a)x}\), so the integrand is simply \(1\), giving \(y_2 = e^{mx}\int 1\,dx = xe^{mx}\). Thus the general solution is

\[ y = c_1e^{mx}+c_2xe^{mx}. \]
Example Find the general solution to \(y''-6y'+9y=0\).

The auxiliary equation is \(m^2-6m+9=0\), i.e. \((m-3)^2=0\), giving the repeated root \(m=3\). Thus

\[ \boxed{y = c_1e^{3x}+c_2xe^{3x}.} \]

Case 3: Complex Conjugate Roots

If \(b^2-4ac<0\), the auxiliary equation has a complex conjugate pair of roots \(m = \alpha\pm i\beta\), where \(\alpha = -b/(2a)\) and \(\beta = \sqrt{4ac-b^2}/(2a)\). Formally, this gives solutions \(e^{(\alpha+i\beta)x}\) and \(e^{(\alpha-i\beta)x}\). Using Euler's formula \(e^{i\theta} = \cos\theta+i\sin\theta\),

\[ e^{(\alpha\pm i\beta)x} = e^{\alpha x}\big(\cos(\beta x)\pm i\sin(\beta x)\big). \]

Taking suitable linear combinations of these two (complex) solutions produces two real-valued, linearly independent solutions, \(e^{\alpha x}\cos(\beta x)\) and \(e^{\alpha x}\sin(\beta x)\), so the general solution is

\[ y = e^{\alpha x}\big(c_1\cos(\beta x)+c_2\sin(\beta x)\big). \]
Example Find the general solution to \(y''+4y'+13y=0\).

The auxiliary equation is \(m^2+4m+13=0\), so

\[ m = \frac{-4\pm\sqrt{16-52}}{2} = \frac{-4\pm\sqrt{-36}}{2} = -2\pm 3i. \]

Here \(\alpha=-2\) and \(\beta=3\), so

\[ \boxed{y = e^{-2x}\big(c_1\cos(3x)+c_2\sin(3x)\big).} \]
Method of Solving
  1. Write the auxiliary equation \(am^2+bm+c=0\).
  2. Find its roots using factoring or the quadratic formula.
  3. Distinct real roots \(m_1,m_2\): \(y=c_1e^{m_1x}+c_2e^{m_2x}\).
  4. Repeated real root \(m\): \(y=c_1e^{mx}+c_2xe^{mx}\).
  5. Complex roots \(\alpha\pm i\beta\): \(y=e^{\alpha x}\big(c_1\cos(\beta x)+c_2\sin(\beta x)\big)\).
Remark The same three cases apply to higher-order constant-coefficient homogeneous equations \(a_ny^{(n)}+\cdots+a_1y'+a_0y=0\): form the degree-\(n\) auxiliary equation \(a_nm^n+\cdots+a_1m+a_0=0\), and each real root of multiplicity \(k\) contributes solutions \(e^{mx},xe^{mx},\dots,x^{k-1}e^{mx}\), while each complex conjugate pair \(\alpha\pm i\beta\) of multiplicity \(k\) contributes \(e^{\alpha x}\cos(\beta x),\dots,x^{k-1}e^{\alpha x}\cos(\beta x)\) and the analogous sine terms.
Sections 4.4–4.6

Undetermined Coefficients and Variation of Parameters
↑ Back to top

Undetermined Coefficients

Theorem Given a nonhomogeneous linear differential equation \[ a_ny^{(n)}+\cdots+a_1y'+a_0y = g(x), \qquad g(x)\ne 0, \] the general solution is \(y = c_1y_1+\cdots+c_ny_n+y_p\), where \(c_1y_1+\cdots+c_ny_n\) is the general solution to the associated homogeneous equation and \(y_p\) is any single (particular) solution to the nonhomogeneous equation.

The method of undetermined coefficients is a way to guess the correct form of \(y_p\) directly, and it applies whenever:

  1. the coefficients \(a_i\) are constants, and
  2. \(g(x)\) is a polynomial, an exponential, \(\sin(\beta x)\), \(\cos(\beta x)\), or a sum or product of these.
\(g(x)\) Guess for \(y_p\)
\(k\) (constant) \(A\)
\(mx+b\) \(Ax+B\)
\(ax^2+bx+c\) \(Ax^2+Bx+C\)
\(\sin(\beta x)\) or \(\cos(\beta x)\) \(A\sin(\beta x)+B\cos(\beta x)\)
\(e^{mx}\) \(Ae^{mx}\)
Remark If a term in your guess for \(y_p\) already appears in the homogeneous solution \(y_c\), multiply that guess by \(x\) (or by \(x^2\) if needed) until no term duplicates a solution of the homogeneous equation.
Example Find the general solution to \(y''+5y'-6y=-6x^2-2x+1\).

Homogeneous part. Guess \(y_c=e^{mx}\):

\[ m^2+5m-6 = (m+6)(m-1) = 0 \;\Longrightarrow\; m=-6,\ m=1. \]

So \(y_c = c_1e^{-6x}+c_2e^{x}\).

Particular solution. Guess \(y_p=Ax^2+Bx+C\), so \(y_p'=2Ax+B\) and \(y_p''=2A\). Substituting,

\[ y_p''+5y_p'-6y_p = 2A+5(2Ax+B)-6(Ax^2+Bx+C) = -6Ax^2+(10A-6B)x+(2A+5B-6C). \]

Matching coefficients with \(-6x^2-2x+1\):

\[ -6A=-6 \Rightarrow A=1, \qquad 10A-6B=-2 \Rightarrow B=2, \qquad 2A+5B-6C=1 \Rightarrow C=\tfrac{11}{6}. \]

So \(y_p = x^2+2x+\tfrac{11}{6}\). Thus

\[ \boxed{y = c_1e^{-6x}+c_2e^{x}+x^2+2x+\frac{11}{6}.} \]
Example Find the general solution to \(y''-5y'+4y=\sin(2x)\).

Homogeneous part. Guess \(y_c=e^{mx}\):

\[ m^2-5m+4 = (m-1)(m-4)=0 \;\Longrightarrow\; m=1,\ m=4. \]

So \(y_c=c_1e^{x}+c_2e^{4x}\).

Particular solution. Guess \(y_p=A\cos(2x)+B\sin(2x)\), so \(y_p'=-2A\sin(2x)+2B\cos(2x)\) and \(y_p''=-4A\cos(2x)-4B\sin(2x)\). Substituting,

\[ \begin{aligned} y_p''-5y_p'+4y_p &= -4A\cos(2x)-4B\sin(2x) -10B\cos(2x)+10A\sin(2x) \\ &\qquad +4A\cos(2x)+4B\sin(2x) \\ &= 10A\sin(2x) - 10B\cos(2x). \end{aligned} \]

Matching with \(\sin(2x)\): \(10A=1 \Rightarrow A=\tfrac{1}{10}\), and \(-10B=0 \Rightarrow B=0\). So \(y_p=\tfrac{1}{10}\cos(2x)\). Thus

\[ \boxed{y = c_1e^{x}+c_2e^{4x}+\frac{1}{10}\cos(2x).} \]
Example Solve the initial value problem \(y''+y=10x+e^{6x}\), \(y(0)=1\), \(y'(0)=0\).

Homogeneous part. Guess \(y_c=e^{mx}\): \(m^2+1=0 \Rightarrow m=\pm i\), so \(y_c = c_1\cos x+c_2\sin x\).

Particular solution. Since \(g(x)=10x+e^{6x}\) is a sum, find a particular solution for each piece. For \(10x\), guess \(y_{p_1}=Ax+B\): then \(y_{p_1}''+y_{p_1}=Ax+B=10x \Rightarrow A=10\), \(B=0\). For \(e^{6x}\), guess \(y_{p_2}=Ae^{6x}\): then \(y_{p_2}''=36Ae^{6x}\), so

\[ y_{p_2}''+y_{p_2} = 37Ae^{6x} = e^{6x} \;\Longrightarrow\; A=\frac{1}{37}. \]

So \(y_p = 10x+\dfrac{1}{37}e^{6x}\), and

\[ y = c_1\cos x+c_2\sin x+10x+\frac{1}{37}e^{6x}. \]

Apply initial conditions.

\[ y(0) = c_1+\frac{1}{37} = 1 \;\Longrightarrow\; c_1 = \frac{36}{37}. \]

Since \(y' = -c_1\sin x+c_2\cos x+10+\tfrac{6}{37}e^{6x}\),

\[ y'(0) = c_2+10+\frac{6}{37} = 0 \;\Longrightarrow\; c_2 = -\frac{376}{37}. \]

Thus

\[ \boxed{y = \frac{36}{37}\cos x - \frac{376}{37}\sin x + 10x + \frac{1}{37}e^{6x}.} \]
Example Find the general solution to \(y''+4y'+4y=4-x^2\).

Homogeneous part. The auxiliary equation is \(m^2+4m+4=(m+2)^2=0\), a repeated root \(m=-2\), so (by Section 4.3) \(y_c = c_1e^{-2x}+c_2xe^{-2x}\).

Particular solution. Guess \(y_p=Ax^2+Bx+C\), so \(y_p'=2Ax+B\) and \(y_p''=2A\). Substituting,

\[ y_p''+4y_p'+4y_p = 4Ax^2+(8A+4B)x+(2A+4B+4C) = 4-x^2. \]

Matching coefficients:

\[ 4A=-1 \Rightarrow A=-\tfrac14, \qquad 8A+4B=0 \Rightarrow B=\tfrac12, \qquad 2A+4B+4C=4 \Rightarrow C=\tfrac58. \]

So \(y_p = -\tfrac14x^2+\tfrac12x+\tfrac58\). Thus

\[ \boxed{y = c_1e^{-2x}+c_2xe^{-2x} - \frac14x^2+\frac12x+\frac58.} \]
Example Find the general solution to \(y''-9y=x\sin(x)\).

Homogeneous part. \(m^2-9=0 \Rightarrow m=\pm3\), so \(y_c = c_1e^{3x}+c_2e^{-3x}\).

Particular solution. Since \(g(x)=x\sin(x)\) is a product of a polynomial and \(\sin(x)\), guess \(y_p = (Ax+B)\sin(x)+(Cx+D)\cos(x)\). Carrying out the differentiation twice,

\[ y_p'' = \big(-Ax-B-2C\big)\sin(x) + \big(2A-Cx-D\big)\cos(x). \]

So

\[ y_p''-9y_p = \big(-10Ax-10B-2C\big)\sin(x) + \big(2A-10Cx-10D\big)\cos(x). \]

Matching with \(x\sin(x) + 0\cdot\cos(x)\):

\[ -10A=1 \Rightarrow A=-\tfrac{1}{10}, \qquad -10C=0 \Rightarrow C=0, \] \[ -10B-2C=0 \Rightarrow B=0, \qquad 2A-10D=0 \Rightarrow D=\tfrac{A}{5}=-\tfrac{1}{50}. \]

So \(y_p = -\tfrac{1}{10}x\sin(x)-\tfrac{1}{50}\cos(x)\). Thus

\[ \boxed{y = c_1e^{3x}+c_2e^{-3x} - \frac{1}{10}x\sin(x) - \frac{1}{50}\cos(x).} \]

Variation of Parameters

Undetermined coefficients only works when \(g(x)\) has one of a few special forms. Variation of parameters is a more general method that works for any nonhomogeneous linear DE, once a fundamental set of solutions to the homogeneous equation is known.

Given \(y''+P(x)y'+Q(x)y=f(x)\) with homogeneous general solution \(y_c=c_1y_1+c_2y_2\), look for a particular solution of the form \(y_p = u_1(x)y_1(x)+u_2(x)y_2(x)\).

Method of Solving
  1. Find \(y_c = c_1y_1+c_2y_2\), the general solution to the homogeneous equation.
  2. Compute the Wronskian \(W=W(y_1,y_2)\), along with \[ W_1 = \begin{vmatrix}0 & y_2\\ f(x) & y_2'\end{vmatrix}, \qquad W_2 = \begin{vmatrix}y_1 & 0\\ y_1' & f(x)\end{vmatrix}. \]
  3. Find \(u_1' = W_1/W\) and \(u_2'=W_2/W\).
  4. Integrate to find \(u_1\) and \(u_2\).
  5. The general solution is \(y = y_c+y_p = c_1y_1+c_2y_2+u_1y_1+u_2y_2\).
Example Find the general solution to \(y''+y=\tan(x)\).

Undetermined coefficients does not apply here, since \(\tan(x)\) is not a polynomial, exponential, sine, or cosine. We use variation of parameters instead.

Homogeneous part. \(y_c=c_1\sin x+c_2\cos x\), so \(y_1=\sin x\), \(y_2=\cos x\), and \(f(x)=\tan x\).

Wronskians.

\[ W(y_1,y_2) = \begin{vmatrix}\sin x & \cos x\\ \cos x & -\sin x \end{vmatrix} = -\sin^2x-\cos^2x = -1, \] \[ W_1 = \begin{vmatrix}0 & \cos x\\ \tan x & -\sin x\end{vmatrix} = -\cos x\tan x = -\sin x, \qquad W_2 = \begin{vmatrix}\sin x & 0\\ \cos x & \tan x\end{vmatrix} = \sin x\tan x. \]

Solve for \(u_1',u_2'\).

\[ u_1' = \frac{W_1}{W} = \frac{-\sin x}{-1} = \sin x, \qquad u_2' = \frac{W_2}{W} = \frac{\sin x\tan x}{-1} = -\sin x\tan x. \]

Integrate.

\[ u_1 = \int \sin x\,dx = -\cos x. \]

For \(u_2\), write \(-\sin x\tan x = -\dfrac{\sin^2x}{\cos x} = -\dfrac{1-\cos^2x}{\cos x} = -\sec x+\cos x\), so

\[ u_2 = \int(-\sec x+\cos x)\,dx = -\ln|\sec x+\tan x|+\sin x. \]

Assemble. \(y_p = u_1y_1+u_2y_2 = -\cos x\sin x + \big(-\ln|\sec x+\tan x|+\sin x\big)\cos x\), so

\[ \boxed{y = c_1\sin x+c_2\cos x - \sin x\cos x + \big(\sin x-\ln|\sec x+\tan x|\big)\cos x.} \]