Tag Archives: differential equations

Differential Equations: Worked Examples Using Integrating Factor

$$\frac{dy}{dx} – 2y = 3x + 1$$
$$e^{ \int \! -2 \ dx } = e^{-2x}$$
$$e^{-2x} \frac{dy}{dx} – 2 e^{-2x} y = e^{-2x} \left( 3x + 1 \right)$$
$$\frac{d}{dx} \left( e^{-2x} y \right) = 3 x e^{-2x} + e^{-2x}$$
$$e^{-2x} y + C = \int \! 3 x e^{-2x} \ dx + \int \! e^{-2x} \ dx$$
$$e^{-2x} y = \int \! 3 x e^{-2x} \ dx – \frac{1}{2}e^{-2x} + K \ \ where \ \ K = \left( C_0 – C \right)$$

\( \int \! 3 x e^{-2x} \ dx \)

\( u = 3x \)

\( du = 3 \ dx \)

\( dv = e^{-2x} \ dx \)

\( v = – \frac{1}{2}e^{-2x}\)

\( \int \! 3 x e^{-2x} \ dx = – \frac{3}{2}xe^{-2x} + \int \! \frac{3}{2}e^{-2x} \ dx \)

\( \int \! 3 x e^{-2x} \ dx = – \frac{3}{2}xe^{-2x} – \frac{3}{4}e^{-2x} + C_1 \)

$$e^{-2x} y = – \frac{3}{2}xe^{-2x} – \frac{5}{4}e^{-2x} + C_2 \ \ where \ \ C_2 = \left( K + C_1 \right)$$
$$y \left( x \right) = – \frac{3}{2}x – \frac{5}{4} + C_2e^{2x}$$

 

$$\frac{dy}{dx} + \cos \left(x \right) y = \cos x$$
$$\mu = e^{ \int \! \cos x \ dx } = e^{ \sin x }$$
$$e^{ \sin x } \frac{dy}{dx} + e^{ \sin x } \cos \left(x \right) y = e^{ \sin x } \cos x$$
$$\frac{d}{dx} \left( e^{ \sin x } y \right) = e^{ \sin x } \cos x$$
$$\left( e^{ \sin x } y \right) = \int \! e^{ \sin x } \cos x \ dx + C$$

\( v = \sin x \)

\( dv = \cos x \ dx \)

\( \int \! e^v \ dv = e^v + K = e^{ \sin x } + C_1\)

$$\left( e^{ \sin x } y \right) = e^{ \sin x } + C_1 + C = e^{ \sin x } + C_2$$
$$y \left( x \right) = 1 + C_2 e^{ – \sin x }$$

Using the Integrating Factor

Let \( g \) and \( h \) be continuous functions. The form of the following first order linear differential equation is solvable using an integrating factor.

$$\frac{dy}{dx} + g y = h$$

The left side of the equation almost looks like the result of the product rule. For example, if \(j\left(x \right) = \mu \left(x \right) y\left(x \right)\) then

$$\frac{dj}{dx} = \mu \frac{dy}{dx} + \frac{d \mu }{dx} y$$

Comparing

\( \frac{dy}{dx} + g y \)         to         \( \mu \frac{dy}{dx} + \frac{d \mu }{dx} y \)

suggests that if there exists a function \( \mu \left(x \right) \) such that

$$\frac{d \mu}{dx} = \mu g$$

then multiplying both sides of the original differential equation by \( \mu \left(x \right) \) yields

$$\mu \frac{dy}{dx} + \mu g y = \mu h$$

and since \(\frac{d \mu}{dx} = \mu g \)

$$\mu \frac{dy}{dx} + \mu g y = \frac{d \mu}{dx} y + \mu \frac{dy}{dx} = \frac{d}{dx} \left( \mu y \right)$$

which yields the integrable equation

$$\frac{d}{dx} \left( \mu y \right) = \mu h$$

Integrating yields a formula the for the solution to the differential equation in question

$$y = \frac{1}{\mu} \left( \int \! \mu h \ dx + C \right)$$

If this formula is to be of any practical use \( \mu \) must be determined. Recall that

$$\frac{d \mu}{dx} = \mu g$$

which is a separable differential equation. Therefore,

$$\mu = e^{ \int \! g\left(x \right) \ dx + K} = A e^{ \int \! g\left(x \right) \ dx}$$

Since the arbitrary constant will not affect the final answer it is convention to let \( A = 1 \). \( \mu \) is called the integrating factor. Substituting \( \mu \) into the general solution yields

$$y\left(x \right) = e^{ -\int \! g\left(x \right) \ dx} \left( \int \! e^{ \int \! g\left(x \right) \ dx} h\left(x \right) \ dx + C \right)$$

Logistic Differential Equation

general solution

$$\frac{dy}{dt} = ky \left( M – y \right)$$
$$\frac{dy}{y \left( M – y \right)} = k \ dt$$
$$\int \! \frac{dy}{y \left( M – y \right)} = \int \! k \ dt = kt + C_0$$

In order to integrate the right side of the equation the integrand must be decomposed and integrated by the technique commonly known as “integration by partial fractions.”

$$\frac{1}{y \left( M – y \right)} = \frac{A}{y} + \frac{B}{ \left( M – y \right)}$$
$$1 = A \left( M – y \right) + By = \left( B – A \right)y + AM$$

or

$$0y + 1 = \left( B – A \right)y + AM$$

For this equation to be true the coefficients must be equal. Therefore,

$$B – A = 0$$ and $$AM=1$$

$$A=B$$
$$A = \frac{1}{M}$$

Therefore, the decomposition is

$$\frac{1}{y \left( M – y \right)} = \frac{1}{My} + \frac{1}{ M\left( M – y \right)}$$

Replacing the integrand with its decomposition and splitting the integral yields

$$\int \! \frac{dy}{y \left( M – y \right)} = \frac{1}{M} \left( \int \! \frac{dy}{y} + \int \! \frac{dy}{M – y} \right)$$

From above it follows

$$\frac{1}{M} \left( \int \! \frac{dy}{y} + \int \! \frac{dy}{M – y} \right) = kt + C_0$$

Now integrating and solving for \( y \)

$$\frac{1}{M} \left( \ln \left| y \right| – \ln \left| M – y \right| + C_1 \right) = kt + C_0$$
$$\ln \left|y \right| – \ln \left| M – y \right| = Mkt + C_2$$
$$\ln \left| \frac{y}{M-y} \right| = Mkt + C_2$$

exponentiate both sides

$$\left| \frac{y}{M-y} \right| = e^{Mkt + C_2} = C_3 e^{Mkt}$$

The absolute value yields two cases.

$$\left| \frac{y}{M-y} \right| = \begin{cases} \ \ \frac{y}{M-y}, & \frac{y}{M-y} \ge 0 \\ -\left( \frac{y}{M-y} \right), & \frac{y}{M-y} < 0 \end{cases}$$

Solving the case for \(y \ge 0\) and assuming that \(y \left( 0 \right) = y_0\)

$$\frac{y_0}{M-y_0} = C_3 e^0 = C_3$$
$$\frac{y}{M-y} = \frac{y_0 e^{Mkt}}{M-y_0}$$
$$y = \frac{y_0 e^{Mkt}}{M-y_0} \left( M – y \right)$$
$$y \left( 1 + \frac{y_0 e^{Mkt}}{M-y_0} \right) = \frac{y_0 M e^{Mkt}}{M-y_0}$$
$$y \left( \frac{M – y_0 + y_0 e^{Mkt}}{M-y_0} \right) = \frac{y_0 M e^{Mkt}}{M-y_0}$$
$$y = \frac{y_0 M e^{Mkt}}{M – y_0 + y_0 e^{Mkt}}$$
$$y = \frac{y_0 M}{ y_0 + \left( M – y_0 \right) e^{-Mkt}}$$