Video - How to Solve 1st Order Inhomogeneous Differential Equations (with Variation of Constants)

The method of variation of constants is well suited for:

ordinary DGL of first order

which are linear

and inhomogeneous.

The homogeneous DEQ is a special case of the inhomogeneous DEQ, therefore the variation of constants method is also suitable for homogeneous DEQ. You have this type of differential equation if you can put your differential equation into the following form:

Form of a first order inhomogeneous differential equation

Formula anchor$$ \begin{align} y' ~+~ K(x)\,y ~=~ S(x) \end{align} $$

The inhomogeneous version 1 differs from the homogeneous one only in the single coefficient, that is the perturbation function \(S(x)\) is not zero. Thus, this type of differential equation is somewhat more difficult to solve.

In this solving method, you make the ansatz that the general solution \(y(x)\) is given by a coefficient \(C(x)\) that depends on \(x\), multiplied by a homogeneous solution that we denote as \( y_{\text h}(x) \):

Variation of constants - solution ansatz

Formula anchor$$ \begin{align} y ~=~ C(x) \, y_{\text h} \end{align} $$

You have already learned how to find the homogeneous solution \( y_{\text h} \). All you have to do is to set the perturbation function to zero: \( S(x) = 0 \). Then you have the homogeneous differential equation. You solve it with separation of variables or directly by using the corresponding solution formula:

Solution formula for ordinary homogeneous DEQ of 1st order

We also want to replace the derivative \(y'\) with our ansatz. To do this, we must first differentiate \(y\) with respect to \(x\). Since both \(C(x)\) and \( y_{\text h}(x) \) depend on \(x\), we need to apply the product rule. You do this by differentiating \(C(x)\) once, leaving \( y_{\text h} \), and then leaving \(C(x)\) and differentiate \( y_{\text h} \). The result is the derivative of our ansatz:

Differentiation of the variation of constants ansatz

The homogeneous differential equation is given in the parenthesis. Of course it is zero. This is the definition of a homogeneous DEQ. So we can omit this term completely:

You can now rearrange the equation for the unknown coefficient \(C'(x)\):

Rearrange for the derivative of the constant C

Formula anchor$$ \begin{align} C'(x) ~=~ \frac{S(x)}{y_{\text h}} \end{align} $$

Now, to eliminate the derivative \(C'(x)\), we have to integrate both sides over \(x\). You know, the integration is the inverse, so to speak, of a derivative:

We cannot integrate the right side concretely, because\(S(x)\) is different depending on the problem. Therefore we leave the right side unchanged. The left side, on the other hand, can be integrated and additionally yields an integration constant, let's call it \( B \):

Integration result

Formula anchor$$ \begin{align} C(x) + B ~=~ \int \frac{S(x)}{y_{\text h}} \, \text{d}x \end{align} $$

We bring it directly to the right side and define it for example as a constant \(A := -B\):

Combine constant in the result of integration

Formula anchor$$ \begin{align} C(x) ~=~ \int \frac{S(x)}{y_{\text h}} \, \text{d}x ~+~ A \end{align} $$

If you now just substitute the found coefficient \(C(x)\) into the original ansatz 2, then you get the general solution of an ordinary inhomogeneous linear differential equation of 1st order:

Solution formula for ordinary inhomogeneous DEQ of 1st order

Formula anchor$$ \begin{align} y ~=~ \left( \int \frac{S(x)}{y_{\text h}} \, \text{d}x ~+~ A \right) \, y_{\text h} \end{align} $$

Example: Apply variation of constants to RL circuit

Consider a circuit consisting of a coil characterized by the inductance \(L\) and a resistor \(R\) connected in series. Then we take a voltage source which provides a voltage \(U_0\) as soon as we close the circuit with a switch. Then a time dependent current \(I(t)\) flows through the coil and the resistor. The current does not have its maximum value immediately, but increases slowly due to Lenz law. Using Kirchoff's laws, we can set up the following differential equation for the current \(I\):

Homogeneous first order DEQ for the RL circuit

Formula anchor$$ \begin{align} L \, \dot{I} ~+~ R\, I ~-~ U_0 ~=~ 0 \end{align} $$

Remember that the point above the \(I\) means the first time derivative. This is an inhomogeneous linear differential equation of 1st order. You can see this best if you put this equation into a more familiar form 1. Divide both sides by \(L\). Thereby you eliminate the \(L\) in front of the derivative:

Putting homogeneous first-order DEQ for the RL circuit into the correct form

Formula anchor$$ \begin{align} \dot{I} ~+~ \frac{R}{L}\, I ~-~ \frac{U_0}{L} ~=~ 0 \end{align} $$

Bring the single coefficient to the other side:

Rearrange for the coefficient ins the DEQ for the RL circuit

Formula anchor$$ \begin{align} \dot{I} ~+~ \frac{R}{L}\, I ~=~ \frac{U_0}{L} \end{align} $$

And we already have the familiar form. The searched function \(y\) corresponds here to the current \(I\). The perturbation function \(S(t)\) corresponds to \(\frac{U_0}{L}\) and is time independent in this case: \( S = \frac{U_0}{L} \). The coefficient \(K(t)\) in front of the searched function \(I\) corresponds to \(\frac{R}{L}\) and is also time independent in this case: \(K = \frac{R}{L} \).

So far so good. Let's use the just derived solution formula 12 for the inhomogeneous differential equation of 1st order. We denote the homogeneous solution by \(I_{\text h}\):

Solution formula of the variation of constants applied to RL circuit

Formula anchor$$ \begin{align} I ~=~ \left( \int \frac{U_0}{L \, I_{\text h}} \, \text{d}t ~+~ A \right) \, I_{\text h} \end{align} $$

First, we need to determine the homogeneous solution \(I_{\text h}\). We can quickly calculate this using the solution formula 3 for the homogeneous version of the differential equation:

Solution formula for homogeneous DEQ of RL circuit

We may omit the constant \(C\) in the solution formula here, because we consider it later anyway in the constant \(A\), which we find in the other solution formula 12.

The coefficient \(\frac{R}{L}\) is constant and integrating a constant only introduces a \(t\). Thus, the homogeneous solution is:

Solution of the homogeneous DEQ for the RL circuit

Note that '1 over the exponential function' containing a minus in the exponent is simply equivalent to the exponential function without the minus sign.

Now we have to calculate the integral in 19. Here \(\frac{U_0}{L}\) is a constant and can be placed in front of the integral. And when integrating the exponential function, the exponential function is preserved. Only \(\frac{L}{R}\) is added as a factor in front of the exponential function. Finally we hide the constant of integration in the constant \(A\):

Calculate integral of the inhomogeneous solution formula of VoC

And we already have the general solution. We can simplify it a bit more by multiplying out the parentheses. Two exponential functions simplify to one:

General solution of the inhomogeneous DEQ of the RL circuit

Formula anchor$$ \begin{align} I(t) ~=~ \frac{U_0}{R} ~+~ A \, \mathrm{e}^{ - \frac{R}{L}\,t } \end{align} $$

To get a solution specific to the problem, we need to determine the unknown constant \(A\). For that we need an initial condition. If we say that the time \( t = 0 \) is the time when the current \(I\) was zero because we have not yet closed the switch, then our initial condition is: \( I(0) = 0 \). Insert it into the general solution:

Insert initial conditions into general solution

Formula anchor$$ \begin{align} I(0) &~=~ 0 \\\\
&~=~ \frac{U_0}{R} ~+~ A \, \mathrm{e}^{ - \frac{R}{L} \cdot 0} \\\\
&~=~ \frac{U_0}{R} ~+~ A \end{align} $$

and solve for \(A\):

Determine constant with the help of the initial condition

Formula anchor$$ \begin{align} A ~=~ -\frac{U_0}{R} \end{align} $$

Thus, we have successfully determined the specific general solution:

Specific solution of the inhomogeneous DEQ of the RL circuit

Now you know how to solve 1st order linear inhomogeneous differential equations. In the next lesson, we will look at how to handle even more complicated differential equations using the so-called exponential ansatz.

+ Perfect for high school and undergraduate physics students + Contains over 500 illustrated formulas on just 140 pages + Contains tables with examples and measured constants + Easy for everyone because without vectors and integrals