Differential Equation

Table of Contents

1 Introduction

1.1 Motivation

When we are given a derivative like \(\frac{dy}{dx} = x^2\), we can easily find the original function \(y\) as the indefinite integral of \(x^2\) : \(y = \int x^2 dx = \frac{x^3}{3} + C\).

However, if the derivative is not a simple function of only \(x\), for example, if \(\frac{dy}{dx} = x^2 e^y\),

  • how can we represent \(y\) as an explicit function of \(x\) (find a function \(f(x)\) such that \(y = f(x)\))?
  • if we can't find such \(f\), to what extent can we simplify the relationship between \(x\) and \(y\)? For example, can we represent the relationship between \(x\) and \(y\) without using derivative?

In this section, we will partly answer this question.

1.2 General Solution and Particular Solution

As we saw above, from \(\frac{dy}{dx} = x^2\) we get \(y = \int x^2 dx = \frac{x^3}{3} + C\), which contains an arbitrary constant \(C\). It is a family of solutions, rather than a single solution, so it is called the General Solution.

However, if we are given particular initial values of \(x\) and \(y\), ie, \((x,y) = (x_0, y_0)\), then we can calculate a unique value of \(C\) by replacing \(x\) and \(y\) with \(x_0\) and \(y_0\) respectively in the general solution. In the above example, if the initial values are \((x,y)=(1,2)\), then by replacing \(x\) and \(y\) with \(1\) and \(2\) in the general solution \(y = \int x^2 dx = \frac{x^3}{3} + C\), we get \(2 = \frac{1^3}{3} + C \implies C = \frac{5}{3}\). Put \(C = \frac{5}{3}\) into the general solution, and we get \(y = \frac{x^3}{3} + \frac{5}{3}\). This is just a single solution, and it is called the particular solution corresponding to initial values \((x,y)=(1,2)\).

2 Elementary Differential Equations

2.1 Formula

The general solution of the differential equation \(\frac{dy}{dx} = g(x)\) is \(y = \int g(x) dx\).

2.2 Example

Find \(y\) if \(\frac{dy}{dx} - 3x^2 - e^{2x} = \frac{5}{x}\). Find a particular solution for initial value \(x = 1, y = 2\).

  • General Solution

    From \(\frac{dy}{dx} - 3x^2 - e^{2x} = \frac{5}{x}\) we get \(\frac{dy}{dx} = 3x^2 + e^{2x} + \frac{5}{x} = g(x)\).

    Hence, by formula, the general solution is

    \(y = \int g(x) dx = \int \left( 3x^2 + e^{2x} + \frac{5}{x} \right) dx\)

    \(= \int 3x^2 dx + \int e^{2x} dx + \int \frac{5}{x} dx\)

    \(= x^3 + \frac{e^{2x}}{2} + 5ln|x| + C\)

  • Particular Solution

    Putting \(x = 1, y = 2\) into the general solution, we have \(2 = 1^3 + \frac{e^{2 \cdot 1}}{2} + 5ln|1| + C\) and thus \(C = 1 - \frac{e^2}{2}\).

    Putting \(C = 1 - \frac{e^2}{2}\) into the general solution, we get the particular solution for \(x = 1, y = 2\) :

    \(y = x^3 + \frac{e^{2x}}{2} + 5ln|x| + 1 - \frac{e^2}{2}\)

3 Separable Differential Equations

3.1 Formula

The general solution of the separable differential equation \(\frac{dy}{dx} = \frac{p(x)}{q(y)}\) is \(\int q(y) dy = \int p(x) dx\).

3.2 Remark

3.2.1 Why is it called separable?

The differential equation is called "separable" because the right hand side \(\frac{p(x)}{q(y)}\) is a fraction between \(p(x)\) and \(q(y)\), where

  • \(p(x)\) is a function of ONLY \(x\)
  • \(q(y)\) is a function of ONLY \(y\)

That means, the two variables \(x\) and \(y\) are separated into two individual functions.

3.2.2 A Common Mistake

Find \(\frac{dy}{dx}=\frac{1}{xy}\).

Wrong Solution:

let \(p(x) = 1\) and \(q(y)=xy\).

Then the general solution is

\(\int q(y) dy = \int p(x) dx\)

\(\implies \int xy dy = \int 1 dx\)

\(\implies x \int y dy = \int 1 dx\)

\(\implies x \cdot \frac{y^2}{2} + C_1 = x + C_2\)

\(\implies \frac{xy^2}{2} - x = C\)

What is wrong with the following solution?

  • First, as mentioned above, \(p(x)\) should be a function of ONLY \(x\), and \(q(y)\) should be a function of ONLY \(y\). However, \(q(y)=xy\) in the above wrong solution was defined as a function of both \(x\) and \(y\). That means, \(x\) and \(y\) were not separated. The correct way is \(\frac{dy}{dx}\) \(= \frac{1}{xy}\) \(= \frac{1}{x} \cdot \frac{1}{y}\) \(= \frac{\frac{1}{x}}{y}\) \(= frac{p(x)}{q(y)}\), ie, let \(p=\frac{1}{x}\) and let \(q(y) = y\).
  • Second, remember that here \(\int xy dy \neq x \int y dy\)! Why? We did have \(\int xy dy = x \int y dy\) in the multivariate calculus chapter! Yes, in the multivariate calculus, we had \(\int xy dy = x \int y dy\) because we regard \(x\) as a constant when \(y\) is regarded as the variable. Why are we allowed to do so (regarding \(x\) as a constant)? The reason is, in a multivariate function \(z=f(x,y)\), \(x\) and \(y\) are independent of each other. That is, \(x\) doesn't change as \(y\) changes, so \(x\) is "constant".

    However, when saying "differential equation", we mean \(y = f(x)\) is a univariate function of \(x\), rather than any multivariate function \(z=f(x,y)\)! That is, \(x\) and \(y\) are not indpendent! Suppose \(y\) is actually independent of \(x\). Then \(y\) can be regarded as a constant when \(x\) is regarded as the variable, and thus always \(\frac{dy}{dx} = \frac{d(constant)}{dx} = 0\), which makes the diffrential equation meaningless!

    To summarize,

    • If we are talking about the multivariate function \(z = f(x,y)\), in which \(z\) is a function of both \(x\) and \(y\) and \(x\) and \(y\) are independent, then we can regard \(x\) as a constant when \(y\) is treated as the variable. Also, we can regard \(y\) as a constant when \(x\) is treated as the variable.
    • If we are talking about (ordinary) differential equations, then we mean \(y\) is a univariate function of \(x\), ie, \(y=f(x)\), and thus \(x\) and \(y\) are not independent of each other. In this case, we can NOT regard \(x\) as a constant when \(y\) is treated as the variable. Also, we can NOT regard \(y\) as a constant when \(x\) is treated as the variable.

    Let's look at the following example to get an illustration.

    • Case 1 : multivariate \(z = f(x,y) = xy\). Then \(x\) and \(y\) are independent, so \(y\) can be regarded as a constant when \(x\) is regarded as the variable. In this case, we have \(\int xy dx = y \int x dx = y \left( \frac{x^2}{2} + C \right) = \frac{x^2 y}{2} + Cy\)
    • Case 2 : univariate \(y = f(x) = x^3\). Then \(y\) depends on \(x\), and can NOT be regarded as a constant. In this case, we have \(\int xy dx = \int x \cdot x^3 dx = \int x^4 dx = \frac{x^5}{5} + C = \frac{x^2 \cdot x^3}{5} + C = \frac{x^2 y}{5} + C\).
    • Look, for Case 1 and Case 2, the answers to \(\int xy dx\) are not the same, because they are based on different assumptions!

3.3 Example 1

Find the general solution for \(\frac{dy}{dx} - (2y - 1)^2 = 0\) and find the particular solution for initial value \(x = 3, y = 1\).

  • General Solution

    The equation can be rewritten as \(\frac{dy}{dx} = (2y - 1)^2 = \frac{1}{(2y - 1)^{-2}} = \frac{p(x)}{q(y)}\) where

    • \(p(x) = 1\)
    • \(q(y) = (2y - 1)^{-2}\)

    so the general solution is \(\int q(y) dy = \int p(x) dx\).

    First, we need find \(\int q(y) dy\).

    According to our experience, integration by substitution should be used. Let \(u = u(y) = 2y - 1\). Then we have \(du = u' dy = 2 dy\) and thus

    \(\int q(y) dy = \int (2y - 1)^{-2} dy\)

    \(= \int (2y - 1)^{-2} \cdot \frac{2}{2} dy\)

    \(= \frac{1}{2} \int u^{-2} du\)

    \(= \frac{1}{2} \cdot \frac{u^{-2+1}}{-2+1} + C_1\)

    \(= \frac{u^{-1}}{-2} + C_1\)

    \(= \frac{1}{-2u} + C_1\)

    \(= \frac{1}{-2(2y - 1)} + C_1\)

    Second, we find \(\int p(x) dx = \int 1 dx = x + C_2\).

    Finally, the general solution is \(\frac{1}{-2(2y - 1)} + C_1 = x + C_2 \implies \frac{1}{-2(2y - 1)} - x + C = 0\).

    Optionally (not required for your homework, quiz or exam), we can simplify the answer and write \(y\) as an explicit function of \(x\) :

    \(\frac{1}{-2(2y - 1)} + C_1 = x + C_2\)

    \(\implies \frac{1}{-2(2y - 1)} = x + C\)

    \(\implies -2(2y - 1) = \frac{1}{x+C}\)

    \(\implies 2y - 1 = \frac{1}{-2(x+C)}\)

    \(\implies 2y = \frac{1}{-2(x+C)} + 1\)

    \(\implies y = \frac{1}{-4(x+C)} + \frac{1}{2}\)

  • Particular Solution

    Putting \(x = 3, y = 1\) into the general solution, we have \(1 = \frac{1}{-4(3+C)} + \frac{1}{2}\) and thus \(C = \frac{-7}{2}\).

    Putting \(C = \frac{-7}{2}\) into the general solution, we get the particular solution for \(x = 3, y = 1\) :

    \(y = \frac{1}{-4(x-\frac{7}{2})} + \frac{1}{2}\)

3.4 Example 2

Find the general solution for \(\frac{dy}{dx} = \frac{y(2x^2 + 3x + 1)}{(3y^3 + 4y)x}\) and find the particular solution for initial value \(x = 1, y = 1\).

  • General Solution

    The equation can be rewritten as

    \(\frac{dy}{dx} = \frac{y(2x^2 + 3x + 1)}{(3y^3 + 4)x}\) \(= \frac{2x^2 + 3x + 1}{x} \cdot \frac{y}{3y^3 + 4}\) \(= \frac{\frac{2x^2 + 3x + 1}{x}}{\frac{3y^3 + 4}{y}}\) \(= \frac {2x + 3 + \frac{1}{x}} {3y^2 + \frac{4}{y}}\) \(= \frac {p(x)}{q(y)}\)

    where

    • \(p(x) = 2x + 3 + \frac{1}{x}\)
    • \(q(y) = 3y^2 + \frac{4}{y}\)

    so the general solution is \(\int q(y) dy = \int p(x) dx\).

    First, we find

    \(\int q(y) dy = \int 3y^2 + \frac{4}{y} dy\)

    \(= \int 3y^2 dy + \int \frac{4}{y} dy\)

    \(= y^3 + 4ln|y| + C_1\)

    Second, we find

    \(\int p(x) dx = \int 2x + 3 + \frac{1}{x} dx\)

    \(= \int 2x dx + \int 3 dx + \int \frac{1}{x} dx\)

    \(= x^2 + 3x + ln|x| + C_2\)

    Finally, the general solution is \(y^3 + 4ln|y| + C_1 = x^2 + 3x + ln|x| + C_2\), or equivalently

    \(y^3 + 4ln|y| - x^2 - 3x - ln|x| + C = 0\)

    In this example, it is quite hard (if not impossible) for us to represent \(y\) as an explicit function of \(x\).

  • Particular Solution

    Putting \(x = 1, y = 1\) into the general solution, we have \(1^3 + 4ln|1| - 1^2 - 3 \cdot 1 - ln|1| + C = 0\) and thus \(C = 3\).

    Putting \(C = 3\) into the general solution, we get the particular solution for \(x = 1, y = 1\) :

    \(y^3 + 4ln|y| - x^2 - 3x - ln|x| + 3 = 0\).

3.5 Example 3

Find the general solution for \(\frac{dy}{dx} = \frac{x(y^3+1)^4}{y^2 e^x}\) and find the particular solution for initial value \(x = 1, y = 1\).

  • General Solution

    The equation can be rewritten as

    \(\frac{dy}{dx} = \frac{x(y^3+1)^4}{y^2 e^x}\) \(= \frac{x}{e^x} \cdot \frac{(y^3+1)^4}{y^2}\) \(= x e^{-x} \cdot \frac{1}{\frac{y^2}{(y^3+1)^4}}\) \(= \frac{x e^{-x}}{\frac{y^2}{(y^3+1)^4}}\) \(= \frac {p(x)}{q(y)}\)

    where

    • \(p(x) = x e^{-x}\)
    • \(q(y) = \frac{y^2}{(y^3+1)^4}\)

    so the general solution is \(\int q(y) dy = \int p(x) dx\).

    First, we find \(\int q(y) dy = \int \frac{y^2}{(y^3+1)^4} dy\) by substitution.

    Let \(u=y^3+1\). Then \(du = u'dy = 3y^2 dy\) and

    \(\int q(y) dy = \int \frac{y^2}{(y^3+1)^4} dy\)

    \(= \int \frac{3y^2}{3(y^3+1)^4} dy\)

    \(= \frac{1}{3}\int \frac{1}{(y^3+1)^4} \cdot 3y^2dy\)

    \(= \frac{1}{3}\int \frac{1}{u^4} du\)

    \(= \frac{1}{3}\int u^{-4} du\)

    \(= \frac{1}{3} \left( \frac{u^{-4+1}}{-4+1} + C \right)\)

    \(= \frac{1}{3} \left( \frac{u^{-3}}{-3} + C \right)\)

    \(= \frac{u^{-3}}{-9} + C_1\)

    \(= \frac{(y^3+1)^{-3}}{-9} + C_1\)

    Second, we find \(\int p(x) dx = \int x e^{-x} dx\) by integration by parts.

    Let \(u = x\) and \(v' = e^{-x}\). Then \(u' = 1\), \(v = \int e^{-x} dx = \frac{e^{-x}}{-1} + C = -e^{-x} + C\). Without loss of generality, let \(C=0\) and then \(v = -e^{-x}\) and

    \(\int p(x) dx = \int x e^{-x} dx = \int u v' dx\)

    \(= uv - \int u'v dx\)

    \(= x \cdot (- e^{-x}) - \int 1 \cdot (- e^{-x}) dx\)

    \(= - xe^{-x} + \int e^{-x} dx\)

    \(= - xe^{-x} + \frac{e^{-x}}{-1} + C_2\)

    \(= - xe^{-x} - e^{-x} + C_2\)

    Finally, the general solution is \(\frac{(y^3+1)^{-3}}{-9} + C_1 = - xe^{-x} - e^{-x} + C_2\), or equivalently

    \(\frac{(y^3+1)^{-3}}{-9} + xe^{-x} + e^{-x} + C = 0\)

    In this example, \(y\) can be written as an explicit function of \(x\). Do it by yourself (not required, though).

  • Particular Solution

    Putting \(x = 1, y = 1\) into the general solution, we have \(\frac{(1^3+1)^{-3}}{-9} + 1 \cdot e^{-1} + e^{-1} + C = 0\) and thus \(C = \frac{1}{72} - \frac{2}{e}\).

    Putting \(C = \frac{1}{72} - \frac{2}{e}\) into the general solution, we get the particular solution for \(x = 1, y = 1\) :

    \(\frac{(y^3+1)^{-3}}{-9} + xe^{-x} + e^{-x} + \frac{1}{72} - \frac{2}{e} = 0\).

4 Linear First-Order Differential Equations

4.1 Definition

A linear first-order differential equation is an equation of the form \(\frac{dy}{dx} + P(x) \cdot y = Q(x)\)

Remark:

  • "Linear" : If we move the term \(P(x) \cdot y\) to the RHS of the equation, then we get \(\frac{dy}{dx} = Q(x) - P(x) \cdot y\), ie, the derivative \(\frac{dy}{dx}\) is a linear function of \(y\) if we regard \(x\) as a constant.
  • "First-Order" : only the first order derivative exists in the equation, no second derivative or higher-order derivative.

4.2 Integrating Factor

The function \(I(x) = e^{\int P(x) dx}\) is called an integrating factor for the linear first-order differential equation \(\frac{dy}{dx} + P(x) \cdot y = Q(x)\).

Remark: \(\int P(x) dx\), as an indefinite integral, is a family of antiderivatives indexed by an arbitrary constant \(C\). For example, if \(P(x) = 2x\), then \(\int P(x) dx = \int 2x dx = x^2 + C\). However, for finding the solution to a linear first-order differential equation, one special antiderivative of \(P(x)\) is enough. For example, for \(P(x) = 2x\) and thus \(\int P(x) dx = x^2 + C\), we can choose the special antiderivative \(x^2\) corresponding to \(C=0\), and then get \(I(x) = e^{x^2}\), instead of the full version \(I(x) = e^{x^2 + C}\). Why is it enough to use just \(I(x) = e^{x^2}\) rather than the full version \(I(x) = e^{x^2 + C}\)? Actually, you can try both \(I(x) = e^{x^2}\) and \(I(x) = e^{x^2 + C}\) in the following procedure for solving linear first-order differential equations, and you will eventually find that these two different versions of \(I(x)\) yield exactly the same final solution. Therefore, for convenience, we can just ignore the constant \(C\) in \(\int P(x) dx\).

4.3 Solving The Equation

  1. Write the equation in the standard form \(\frac{dy}{dx} + P(x) \cdot y = Q(x)\).
  2. Find the integrating factor \(I(x) = e^{\int P(x) dx}\). One special antiderivative is enough, so we can drop the arbitrary constant \(C\).
  3. Calculate \(\int Q(x) \cdot I(x) dx\), which is a family of antiderivatives of \(Q(x)I(x)\)
  4. The general solution is \(y = \frac{\int Q(x) \cdot I(x) dx}{I(x)}\)

Remark: You are not required to know the derivation of the solution. You can verify the solution by yourself : replace \(y\) with \(\frac{\int Q(x) \cdot I(x) dx}{I(x)}\) in the original different equation, and you will find the LHS and RHS are equal, which means it is truely a solution to the equation.

4.4 Examples

4.4.1 Example 1

Find the particular solution for \(\frac{dy}{dx} = 2x - 3y\) satisfying \(x=0\) and \(y=1\).

  1. The equation can be rewritten as

    \(\frac{dy}{dx} = 2x - 3y\)

    \(\implies \frac{dy}{dx} + 3y = 2x\)

    \(\implies \frac{dy}{dx} + P(x) \cdot y = Q(x)\)

    where \(P(x) = 3\) and \(Q(x) = 2x\)

  2. Then the integrating factor is \(I(x) = e^{\int P(x) dx} = e^{3x}\).
  3. Calculate \(\int Q(x) \cdot I(x) dx = \int 2x e^{3x} dx = \int 2x e^{3x} dx\).

    Clearly this integral should be calculated via integration by parts.

    Let \(u=2x\) and \(v' = e^{3x}\). Then \(u'=2\) and \(v = \frac{e^{3x}}{3}\).

    Then \(\int 2x \cdot e^{3x} dx = \int uv' dx = uv - \int u'vdx\)

    \(= 2x \cdot \frac{e^{3x}}{3} - \int 2 \cdot \frac{e^{3x}}{3} dx\)

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

    \(= \frac{2xe^{3x}}{3} - \frac{2}{3} \cdot \frac{e^{3x}}{3} + C\)

    \(= \frac{2xe^{3x}}{3} - \frac{2e^{3x}}{9} + C\)

  4. The general solution is

    \(y = \frac{\int Q(x) \cdot I(x) dx}{I(x)}\)

    \(= \frac{\frac{2xe^{3x}}{3} - \frac{2e^{3x}}{9} + C}{e^{3x}}\)

    \(= \frac{2x}{3} - \frac{2}{9} + \frac{C}{e^{3x}}\)

  5. To find the particular solution for \(x=0, y=1\), we replace \(x\) and \(y\) with \(0\) and \(1\) respectively in the general solution, and get

    \(1 = \frac{2 \cdot 0}{3} - \frac{2}{9} + \frac{C}{e^{3 \cdot 0}}\)

    \(\implies 1 = - \frac{2}{9} + C\)

    \(\implies C = \frac{11}{9}\).

    Replace \(C\) with \(\frac{11}{9}\), and we get the particular solution for \(x=0, y=1\):

    \(y = \frac{2x}{3} - \frac{2}{9} + \frac{\frac{11}{9}}{e^{3x}} = \frac{2x}{3} - \frac{2}{9} + \frac{11}{9e^{3x}}\).

4.4.2 Example 2

Find the general solution for \(x^2 \frac{dy}{dx} + 3x = xy + x^4 e^{2x+1}\).

  1. The equation can be rewirtten as

    \(x^2 \frac{dy}{dx} + 3x = xy + x^4 e^{2x + 1}\)

    \(\implies x^2 \frac{dy}{dx} = -3x + xy + x^4 e^{2x + 1}\)

    \(\implies \frac{dy}{dx} = \frac{-3x + xy + x^4 e^{2x + 1}}{x^2}\)

    \(\implies \frac{dy}{dx} = \frac{-3}{x} + \frac{y}{x} + x^2 e^{2x + 1}\)

    \(\implies \frac{dy}{dx} - \frac{y}{x} = \frac{-3}{x} + x^2 e^{2x + 1}\)

    \(\implies \frac{dy}{dx} + P(x) \cdot y = Q(x)\)

    where \(P(x) = \frac{-1}{x}\) and \(Q(x) = \frac{-3}{x} + x^2 e^{2x + 1}\)

  2. The integrating factor is \(I(x) = e^{\int P(x) dx} = e^{\int \frac{-1}{x} dx} = e^{- \int \frac{1}{x} dx} = e^{-ln|x|}\).

    We have the formula \(e^{ln(f(x))} = f(x)\) because the natural log and the exponential operations are inverse to each other and thus can be offset. Can we simplify \(I(x) = e^{-ln|x|}\) using the formula? Yes, but we need first get rid of the negative sign before \(ln|x|\). By the property \(a lnb = ln(b^a)\), we have \(I(x) = e^{-ln|x|} = e^{ln(|x|^{-1})} = |x|^{-1} = \frac{1}{|x|}\).

    OK, it seems better, but there is an absolute value symbol in \(I(x)\), which may cause problems in Step 3 because we don't know how to integrate \(\int Q(x) I(x) dx\) if \(I(x)\) has an absolute value. For finding the solution to a linear first-order differential equation, we can directly remove the absolute value symbol in this kind of \(I(x)\). The reason is as follows. We know \(|x| = x\) if \(x>0\) and \(|x| = -x\) if \(x<0\), so \(I(x) = \frac{1}{x}\) if \(x>0\) and \(I(x) = \frac{1}{-x}\) if \(x<0\). If we discuss it case by case, then

    • For \(x>0\), you can find a general solution to the differential equation via Step 3 and Step 4 by using \(I(x) = \frac{1}{x}\);
    • For \(x<0\), you can find another general solution to the differential equation via Step 3 and Step 4 by using \(I(x) = \frac{1}{-x}\).

    You will see that these two solutions are exactly the same in form. That means, we can consider just the case \(x>0\) and let \(I(x) = \frac{1}{x}\).

    Hence, finally, we have removed the absolute value symbol and the integrating factor becomes \(I(x) = \frac{1}{x}\).

  3. Calculate \(\int Q(x) \cdot I(x) dx\).

    \(\int Q(x) \cdot I(x) dx = \int \left( \frac{-3}{x} + x^2 e^{2x + 1} \right) \cdot \frac{1}{x} dx\)

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

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

    \(= A + B\)

    where \(A = \int \frac{-3}{x^2} dx\) and \(B = \int x e^{2x + 1} dx\).

    Calculate \(A\):

    \(A = \int \frac{-3}{x^2} dx = (-3) \cdot \frac{x^{-2+1}}{-2+1} + C_1 = 3x^{-1} + C_1\)

    Calculate \(B\) by integration by parts:

    Let \(u = x\) and \(v' = e^{2x + 1}\). Then \(u' = 1\) and \(v = \frac{e^{2x + 1}}{2}\).

    \(B = \int x e^{2x + 1} dx\)

    \(= uv - \int u'v dx\)

    \(= x \cdot \frac{e^{2x + 1}}{2} - \int 1 \cdot \frac{e^{2x + 1}}{2} dx\)

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

    \(= \frac{xe^{2x + 1}}{2} - \frac{1}{2} \cdot \frac{e^{2x + 1}}{2} + C_2\)

    \(= \frac{xe^{2x + 1}}{2} - \frac{e^{2x + 1}}{4} + C_2\)

    Therefore, \(\int Q(x) \cdot I(x) dx = A + B = 3x^{-1} + \frac{xe^{2x + 1}}{2} - \frac{e^{2x + 1}}{4} + C\)

  4. The general solution is

    \(y = \frac{\int Q(x) \cdot I(x) dx}{I(x)}\)

    \(= \frac{3x^{-1} + \frac{xe^{2x + 1}}{2} - \frac{e^{2x + 1}}{4} + C}{\frac{1}{x}}\)

    \(= \left( 3x^{-1} + \frac{xe^{2x + 1}}{2} - \frac{e^{2x + 1}}{4} + C \right) \cdot x\)

    \(= 3 + \frac{x^2 e^{2x + 1}}{2} - \frac{xe^{2x + 1}}{4} + Cx\)

5 Application : Continuous Deposits

5.1 The equation

Suppose that today you open a new bank account and deposit \(y_0\) dollars (called principal) into it. Denote by \(y=y(x)\) the total amount of money you will have after time \(x\). If \(r\) is the annual interest rate compounded continuously, then the rate of growth of your total money is \[ \frac{dy}{dx} = ry \]

Suppose that after the initial principal \(y_0\) you continue depositing into your account continuous money at a constant rate \(D\) dollars/year. Then the eventual rate of growth of your total money is \[ \boxed{ \frac{dy}{dx} = ry + D } \]

Remark: In the textbook, the symbols \(t\) and \(A\) are used to represent "time" and "total amount" respectively, but here I use \(x\) and \(y\), because many people may regard \(t\) and \(A\) as constants rather than variables.

5.2 General Solution

5.2.1 Formula

The general solution to \(\frac{dy}{dx} = ry + D\) is

\[ \boxed{ y = \frac{C e^{rx} - D}{r} } \]

5.2.2 Derivation of The Formula

The differential equation \(\frac{dy}{dx} = ry + D\)

  • is a separable differential equation because \(\frac{dy}{dx} = ry + D \implies \frac{dy}{dx} = \frac{1}{\frac{1}{ry + D}} = \frac{p(x)}{q(y)}\) where \(p(x) = 1\) and \(q(y) = \frac{1}{ry + D}\);
  • is also a linear first-order differential equation, because \(\frac{dy}{dx} = ry + D \implies \frac{dy}{dx} - ry = D \implies \frac{dy}{dx} + P(x)y = Q(x)\) where \(P(x) = -r\) and \(Q(x) = D\).

Therefore, we can solve it by two different methods and of course they will give us the same answer.

  • Method 1 : Separable Differential Equation

    When we regard \(\frac{dy}{dx} = ry + D\) as a separable differential equation, the general solution is \(\int q(y) dy = \int p(x) dx\). From above discussion, here \(p(x) = 1\) and \(q(y) = \frac{1}{ry+D}\), so the general solution is \(\int \frac{1}{ry + D} dy = \int 1 dx\). Evaluate the two sides, and we get

    • \(LHS = \int \frac{1}{ry + D} dy\)

      Let \(u = ry+D\), so \(du = u'dy = rdy\). Then \(LHS = \int \frac{1}{ry+D} dy\) \(= \int \frac{1}{ry+D} \cdot \frac{r}{r} dy\) \(= \frac{1}{r} \int \frac{1}{ry+D} rdy\) \(= \frac{1}{r} \int \frac{1}{u} du\) \(= \frac{1}{r} \cdot ln|u| + C_1\) \(= \frac{1}{r} \cdot ln|ry+D| + C_1\) \(= \frac{1}{r} \cdot ln(ry+D) + C_1\) because \(ry+D>0\).

    • \(RHS = \int 1 dx = \int 1 dx = x + C_2\).

    Therefore, the general solution to \(\frac{dy}{dx} = ry + D\) is

    \(LHS = RHS\)

    \(\implies \frac{1}{r} \cdot ln(ry+D) + C_1 = x + C_2\)

    \(\implies \frac{1}{r} \cdot ln(ry+D) = x + C\)

    \(\implies ln(ry+D) = r(x + C)\)

    \(\implies ln(ry+D) = rx + C^*\) where \(C^* = rC\)

    \(\implies e^{ln(ry+D)} = e^{rx + C^*}\)

    \(\implies ry+D = e^{rx} \cdot e^{C^*}\)

    \(\implies ry+D = e^{rx} \cdot C^{**}\) where \(C^{**} = e^{C^*}\)

    \(\implies y= \frac{C^{**} e^{rx} - D}{r}\)

    or written as \[ y = \frac{C e^{rx} - D}{r} \]

  • Method 2 : Linear First-Order Differential Equation

    When we regard \(\frac{dy}{dx} = ry + D\) as a linear first-order differential equation, the general solution is \(y = \frac{\int Q(x) I(x) dx }{I(x)}\) where \(I(x)\) is the integrating factor.

    From above discussion, here \(P(x) = -r\) and \(Q(x) = D\), so the general solution is \(y = \frac{\int Q(x) I(x) dx }{I(x)}\).

    • \(I(x) = e^{\int P(x) dx} = e^{-rx}\)
    • \(\int Q(x)I(x) dx = \int D e^{-rx} dx = D \int e^{-rx} dx = D \cdot \frac{e^{-rx}}{-r} + C = \frac{-De^{-rx}}{r} + C\)
    • \(y = \frac{\int Q(x) I(x) dx }{I(x)}\) \(= \frac{\frac{-De^{-rx}}{r} + C}{e^{-rx}}\) \(= \frac{\frac{-De^{-rx}}{r}}{e^{-rx}} + \frac{C}{e^{-rx}}\) \(= \frac{-D}{r} + Ce^{rx}\) \(= \frac{-D}{r} + \frac{rCe^{rx}}{r}\) \(= \frac{-D}{r} + \frac{C^*e^{rx}}{r}\) \(= \frac{C^*e^{rx} - D}{r}\) where \(C^* = rC\)

      or written as \[ y = \frac{C e^{rx} - D}{r} \]

5.3 Particular Solution

The above is a general solution to the differential equation \(\frac{dy}{dx} = ry + D\). The general solution is a class of functions indexed by the arbitrary constant \(C\). Obviously, if \(y_0\), \(r\) and \(D\) are all given as specific numbers, then at a specific time \(x\), the total amount of money you will have should be a determinate number, rather than an arbitrary quantity. That means, we should be able to figure out the value of \(C\). As we did before, if an initial condition is given, then we can find a unique solution to the differential equation, which is call the particular solution.

The initial condition for the continuous deposit problem is \(x=0, y=y_0\), because at the initial time \(x=0\) the total amount of money is \(y=y_0\). Then we can find the corrsponding particular solution:

  • Replace \(x\) and \(y\) with \(0\) and \(y_0\) respectively in the general solution, and we get

    \(y_0 = \frac{C e^{r\cdot 0} - D}{r} \implies y_0 = \frac{C - D}{r} \implies C = ry_0 + D\)

  • Replace \(C\) with \(ry_0+D\) in the general solution, and we get the particular solution for \(x=0, y=y_0\):

    \[ \boxed{y = \frac{(ry_0+D)e^{rx} - D}{r} }\]

5.4 Total Amount at a Specific Time

Note that the particular solution \(y = y(x) = \frac{(ry_0+D)e^{rx} - D}{r}\) means that the total amount of money \(y\) is a function of time \(x\). At a specific time \(x=x_t\), your total amount of money \(y\) can be calculated by replacing \(x\) with \(x_t\) in the particular solution, ie,

\[ \boxed{y(x_t) = \frac{(ry_0+D)e^{rx_t} - D}{r} }\]

5.5 Example

Suppose today you deposit \(10000\) dollars in an IRA at \(3\%\) interest compounded continuously. In addition, you make continuous deposit at the rate of \(1200\) dollars per year. How much will you have in total after 10 years?

We identity \(y_0 = 10000\), \(r = 3\% = 0.03\), \(D = 1200\), and \(x_t=10\).

By the formula, after 10 years, you will have \(y(10) = \frac{(ry_0+D)e^{rx_t} - D}{r} = \frac{(0.03\cdot 10000 + 1200)e^{0.03\cdot 10} - 1200}{0.03} = 27492.9\) dollars.

6 References

  1. Lial, M. L., Greenwell, R. N., Ritchey, N. P. (2011). Calculus with Applications (10th Edition). Boston, MA : Pearson.

Yunfei Wang

2015-11-22 Sun 09:08