Variation of Constants and How to Solve Inhomogeneous Differential Equations of 1st Order

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

DEQ types: Ordinary, first order, inhomogeneous
Variation of constants is suitable for ordinary 1st order inhomogeneous differential equations.

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

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

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
Formula anchor

We insert this ansatz 2 into the inhomogeneous equation 1 for \(y\):

Variation of constants ansatz inserted into the inhomogeneous DEQ
Formula anchor

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
Formula anchor

We insert the derivative \(y'\) into the general form of the differential equation 1:

Derivative of VoC inserted into the inhomogeneous DEQ
Formula anchor

If you just factor out \(C(x)\), you might see why this ansatz is so awesome:

Factor out constant C
Formula anchor

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:

Homogeneous DEQ drops out
Formula anchor

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

Rearrange for the derivative of the constant C
Formula anchor

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:

Integrate equation on both sides
Formula anchor

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

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

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

Example: Apply variation of constants to RL circuit

RL circuit - Switch-on process
Hover the image!
A simple 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

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

Bring the single coefficient to the other side:

Rearrange for the coefficient ins the DEQ for the RL circuit
Formula anchor

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

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
Formula anchor

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
Formula anchor

Let's insert it into the inhomogeneous solution formula:

Homogeneous solution inserted into the inhomogeneous solution formula of VoC
Formula anchor

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
Formula anchor

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

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

and solve for \(A\):

Determine constant with the help of the initial condition
Formula anchor

Thus, we have successfully determined the specific general solution:

Specific solution of the inhomogeneous DEQ of the RL circuit
Formula anchor

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

Learn more