# Ngô Quốc Anh

## February 12, 2010

### ODE: The variation of constants method

Filed under: PDEs — Ngô Quốc Anh @ 18:34

$\displaystyle y'+p(t)y=0$.

To solve this, we simply divide by $y$,

$\displaystyle \frac{y'}{y}+p(t)=0$,

and then integrate

$\displaystyle \ln|y|+\int p(t)dt=K$,

where $K$ is an integration constant. We take the exponential on both sides

$\displaystyle |y|e^{\int p(t)dt}=e^K$.

This yields

$\displaystyle y=\pm e^K e^{-\int p(t)dt}$.

We define a new constant $C=\pm e^K$, so we can put the solution in the form

$\displaystyle y=Ce^{-\int p(t)dt}$.

Now we look at an inhomogeneous equation

$\displaystyle y'+p(t)y=g(t)$.

The idea of the variation of constants method is to look for a solution in a form similar to the solution of homogeneous case. Obviously, something has to change since the equation has changed. The change is that the constant $C$ is replaced by a function $C(t)$. So we set

$\displaystyle y=C(t) e^{-\int p(t)dt}$.

We differentiate using the product and chain rules to find

$\displaystyle y' = C'(t){e^{ - \int {p(t)dt} }} - C(t)p(t){e^{ - \int {p(t)dt} }}$.

and

$\displaystyle y' + p(t)y = C'(t){e^{ - \int {p(t)dt} }}$.

Thus our differential equation becomes

$\displaystyle C'(t){e^{ - \int {p(t)dt} }} = g(t)$

so that

$\displaystyle C'(t) = g(t){e^{\int {p(t)dt} }}$.

We can then find $C(t)$ by integrating this equation.

Let us consider the following situation. If we want to find the general solution of the form

$\displaystyle y=C e^{-\int p(t)dt} + C(t)$

then

$\displaystyle y' = - C{e^{ - \int {p(t)dt} }}{\left( {\int {p(t)dt} } \right)^\prime } + C'(t) = - Cp(t){e^{ - \int {p(t)dt} }} + C'(t)$

Consequently,

$\displaystyle y' + p(x)y = C'(t) + p(t)C(t)$.

This leads us to an equivalent ODE

$\displaystyle C'(t) + p(t)C(t) = g(t)$

of variable $C(t)$ instead of $y(t)$. Based on this observation, one can easily see that the general solution to the non-homogeneous problem has a common factor

$\displaystyle {e^{ - \int {p(t)dt} }}$.

This is why we need to find the general solution of the form

$\displaystyle {\rm something} \times {e^{ - \int {p(t)dt} }}$.

For further information, we refer the reader to the method of separation of variables in PDEs.

The result is evidently the same as what we found using the integrating factor method (see also here), but the ideas leading to the result were different. While for first order linear equations the integrating factor method and the variation of constants method are the same, the difference is in how they can be generalized. The integrating factor method can be generalized to some nonlinear equations of first order. The variation of constants method, on the other hand, can be generalized to linear equations of higher order and to linear systems.