# Differential equations (DEQ): Important basics + 4 solving methods

## Content of the lesson

- What is a differential equation? Here you will learn how to identify a differential equation and which problems involve DEQ's.
- Different notations of a differential equation Here you will learn the Leibniz, Newton and Lagrange notations of a differential equation.
- What should I do with a differential equation? Here you will learn what it means to solve a DEQ and whether it is always possible.
- How to identify a differential equation? What characterizes a DEQ and how do I know if I have a DEQ in front of me? This is the first question you have to answer before solving a DEQ!
- Classification: Which DEQ types are there? Here you will learn how to recognize when a DEQ is ordinary, partial, linear, homogeneous, inhomogeneous, and of what order it is.
- Constraints: Boundary and initial conditions Here you will learn why constraints to a DEQ are important and what the difference is between boundary and initial conditions.
- Solving method #1: Separation of variables Here you will learn a method to solve ordinary homogeneous linear DEQ of 1st order. Or you can directly use the derived formula.
- Lösungsmethode #2: Variation der Konstanten (VdK) Hier lernst du eine Methode, mit der du gewöhnliche inhomogene lineare DGL 1. Ordnung lösen kannst. Hier wird auch die dazugehörige Lösungsformel hergeleitet.
- Solving method #3: Exponential ansatz Here you will learn a method to solve linear DGL of any order.
- Solving method #4: Product ansatz (separation ansatz) With this ansatz you can convert partial differential equations into ordinary differential equations and then solve them with other methods.

For example, if you plan to deal with...

the atomic world,

the movement of the planets,

chemical processes,

electrical circuits,

weather forecasts

or with the spread of a virus

then you will eventually encounter so-called **differential equations**.

Once you understand how differential equations work and how to solve them, you will be able to see into the past and into the future. In this lesson you will learn the basics for it.

## What is a differential equation?

Let's look at Hooke's Law as a simple example:

**Hooke's Law**

This law describes the restoring force \(F\) on a mass attached to a spring. The mass experiences this force when you displace it by the distance \(y\) from the equilibrium position. \(D\) is a constant coefficient that describes how hard it is to stretch or compress the spring.

The mass \(m\) is hidden in the force. We can write the force according to Newton's second law as \(m \, a \):

**Newton axiom equal to Hooke's law**

Here \(a\) is the acceleration that the mass experiences when it is displaced by the distance \(y\) from its rest position. As soon as you pull on the mass and release it, the spring will start swinging back and forth. Without friction, as in this case, it will never stop swinging.

While the mass oscillates, the displacement \(y\) changes. The displacement is therefore dependent on the time \(t\). Thus also the acceleration \(a\) depends on the time \(t\). The mass of course remains the same at any time, no matter how much the spring is displaced. This is also true in good approximation for the spring constant \(D\):

**Newton axiom equal to Hooke's law with time dependence**

If we now bring \(m\) to the other side, we can use this equation to calculate the acceleration experienced by the mass at each displacement \(y\):

**Acceleration using Newton's axiom and Hooke's law**

But what if we are interested in the question:

*At which displacement \(y\) will the spring be after 24 seconds?*

To be able to answer such a future question, we must know how exactly \(y\) depends on the time \(t\). We only know that \(y\) DOES depend on time, but not HOW.

And exactly when dealing with such future questions differential equations come into play. We can easily show that the acceleration \(a\) is the second time derivative of the distance traveled, so in our case it is the second derivative of \(y\) with respect to time \(t\):

**Second time derivative of the deflection - differential equation for the spring law**

Now we have set up a differential equation for the displacement \(y\)! You can recognize a differential equation (in short: *DEQ*) by the fact that *in addition to the searched function* \(y(t)\) it also contains *derivatives of this function*. Like in this case the second derivative of \(y\) with respect to time \(t\).

## Different notations of a differential equation

You will certainly encounter many notations of a differential equation. We have written down our differential equation 1.4

in the so-called Leibniz notation:

**Leibniz notation**

You will often encounter this notation in physics. We can also write it down a bit more compactly without mentioning the time dependence:

If the function \(y\) depends only on the time \(t\), then we can write down the time derivative even more compactly with the so-called Newton notation. One time derivative of \(y\) corresponds to one point above \(y\). So if there is a second time derivative as in our case, there will be two points:

**Newton notation**

Obviously, this notation is rather unsuitable if you want to consider the tenth derivative...

Another notation you are more likely to encounter in mathematics is the Lagrange notation. Here we use primes for the derivatives. So for the second derivative, two primes:

**Lagrange notation**

In Lagrange notation, it should be clear from the context, with respect to which variable the function is differentiated. If it is not clear, then you should write out explicitly on which variables \(y\) depends:

**Spring law-DEQ in Lagrange notation**

Each notation has its advantages and disadvantages. However, remember that these are just different ways of writing down the same physics. Even rearranging and renaming does not change the physics under the hood of this differential equation. We could call the deflection \(y\) for example also as \(x\):

**Spring law-DGL in Lagrange notation all moved to one side**

## What should I do with a differential equation?

To answer our previous question:

*At which displacement \(y\) will the spring be after 24 seconds?*

we must solve the posed **differential equation**. Solving a differential equation means that you have to find out *how* the function \(y\) you are looking for exactly depends on the variable \(t\):

**Searched function in a DGL**

For simple differential equations, like the one of the oscillating mass, there are solving methods you can use to find the function \(y(t)\). Keep in mind, however, that there is no general recipe for how you can solve an *arbitrary* differential equation. For some differential equations there is not even an *analytic solution*! Here the expression '*not analytic*' means that you cannot write down a concrete equation for the function \(y(t)\):

**No solution of the DGL**

The only possibility in this case is to solve the differential equation on the computer *numerically*. Then the computer does not spit out a concrete formula, but data points, which you can represent in a diagram and then analyze the behavior of the differential equation.

## How to identify a differential equation?

Once you encounter a differential equation, the first thing you need to figure out is

which one is

*the function you are looking for*and

*which variables it depends on*.

In our differential equation 5

of the oscillating mass, the function we are looking for is called \(y\) and it depends on the variable \(t\):

**Hooke Law-DEQ**

As another example, look at the wave equation that describes the electric field of an electromagnetic wave propagating at the speed of light \(c\):

**Wave equation-DEQ for the E-field**

What is the function you are looking for in this differential equation? It is the function \(E\), because its derivatives occur here. On which variables does the function \(E\) depend? The dependence is not explicitly given here but from the derivatives you can immediately see that \(E\) must depend on \(x\), \(y\), \(z\) and on \(t\). That is, on a total of four variables: \(E(t,x,y,z)\).

Let's look at a slightly more complex example. This system of differential equations describes how a mass moves in a three dimensional gravitational field:

**DEQ for the motion of a mass point in the gravitational field**

\frac{\text{d}^2\class{green}{y}}{\text{d}\class{gray}{t}^2} &~=~ G \, \frac{m}{\sqrt{\class{red}{x}^2 + \class{green}{y}^2 + \class{blue}{z}^2}} \\\\

\frac{\text{d}^2\class{blue}{z}}{\text{d}\class{gray}{t}^2} &~=~ G \, \frac{m}{\sqrt{\class{red}{x}^2 + \class{green}{y}^2 + \class{blue}{z}^2}} \end{align} $$

Here you have a so-called **coupled differential equation system**. In this case *a single* differential equation is not sufficient to describe the motion of a mass in the gravitational field. In fact, three functions are searched here, namely the trajectories \(x(t)\), \(y(t)\) and \(z(t)\), which determine a position of the mass in three-dimensional space. Each function describes the motion in one of the three spatial directions. And all three trajectories depend only on the time \(t\).

What does it even mean, if we have *coupled* differential equations? The word 'coupled' means that, for example, in the first differential equation for the function \(x\), there is also the function \(y\). So we cannot simply solve the first differential equation independently of the second one, because the second equation tells us how \(y\) behaves in the first equation. In all three differential equations, all of the searched functions \(x\), \(y\) and \(z\) occur, which means that we have to solve all three differential equations simultaneously.

## Classification: Which DEQ types are there?

There are various types of differential equations out there. However, if you look closely, you will notice that some differential equations have similarities between them.

After you have found out what function you are searching for and which variables it depends on, you should answer some more basic questions to get to know the differential equation better:

**Is the differential equation ordinary or partial?**

Partial differential equations describe multidimensional problems and are significantly more complex.**Of which order is the differential equation?**

1st order differential equations are usually easy to solve and describe, for example, exponential behavior such as radioactive decay or the cooling of a liquid. Differential equations of 2nd order, on the other hand, are somewhat more complex and also often occur in nature. Maxwell's equations of electrodynamics, Schrödinger's equation of quantum mechanics - these are all 2nd order differential equations. Only starting from the 2nd order a differential equation can describe an oscillation. And only starting from the third order a differential equation can describe chaos.**Is the differential equation linear or non-linear?**

The superposition principle applies to linear differential equations, which is incredibly useful, for example, in the description of electromagnetic phenomena. Non-linear differential equations are much more complex and occur, for example, in non-linear electronics in the description of superconducting currents. Moreover, chaos can only occur in non-linear differential equations of third order and higher. When you encounter such an equation sometimes the only thing you can do is throw away your pen and paper and solve the equation numerically on the computer. Many non-linear differential equations cannot even be solved analytically!**Is the linear differential equation homogeneous or inhomogeneous?**

Homogeneous linear differential equations are simpler than the inhomogeneous ones and describe, for example, an undisturbed oscillation, while inhomogeneous differential equations are also able to describe externally disturbed oscillations.

After you have classified a differential equation, you can then specifically apply an appropriate method to solve the equation. Even if there is no specific solving method, you will know how complex a differential equation is based on the classification.

### Is a differential equation ordinary or partial?

Our equation for the oscillating mass:

is an **ordinary** differential equation. Ordinary means that the function \(y(t)\) we are looking for only depends *on one* variable. In this case on the time \(t\).

The wave equation, on the other hand:

is a **partial** differential equation. 'Partial' means that the searched function \(E\) depends on at least two variables and derivatives with respect to these variables occur in the equation. In this case \(E\) depends on four variables: \(t\), \(x\), \(y\) and \(z\). And in the differential equation also derivatives with respect to these variables appear.

### Of which order is a differential equation?

Furthermore our equation for the oscillating mass is a **differential equation of 2nd order**. The order of a differential equation is the highest occurring derivative of the searched function:

Since in our equation the second derivative of \(y\) is *the highest one*, this is therefore the 2nd order differential equation.

**Convert higher order DEQ's into 1st order DEQ's**

It is always possible to convert a higher order differential equation into a system of 1st order differential equations. Sometimes this procedure is helpful in solving the differential equations. For example, we can convert this 2nd order differential equation into two coupled 1st order differential equations. For this we just have to introduce a new function, let's call it \(v\) and define it as the first time derivative of \(y\):

**Velocity as time derivative of the displacement is a first order DEQ**

This is already one of the two 1st order DEQ. Now we only have to express the second derivative in the original DEQ with the derivative of \(v\). Then we get the second DEQ of 1st order:

**First order DEQ for Hooke's law**

The two equations are *coupled* differential equations, which we must solve simultaneously. They are coupled because both \(y\) and \(v\) occur in the first DEQ as well as in the second DEQ. You can use this procedure whenever you want to reduce the order of a differential equation. The price you have to pay is additional coupled differential equations.

The differential equation for the radioactive decay law,

on the other hand, is a **first-order differential equation** because the highest occurring derivative of the searched function \(N(t)\) is the first derivative.

### Is a differential equation linear or non-linear?

Moreover, our equation for the oscillating mass is **linear**:

Linear means that the searched function and its derivatives contain *only powers of 1* and there occur *no products of derivatives with the function*, like \(y^2\) or \(y \, \frac{\text{d}^2y}{\text{d}t^2} \). There also occur *no composed* functions, such as \(\sin(y(t))\) or square root of \(y(t)\).

The radioactive decay law is also linear:

What about the wave equation? It is also linear:

The coupled differential equation system for the motion of a mass in the gravitational field, on the other hand, is **non-linear**:

**Example of a non-linear DEQ - mass in the gravitational field**

\frac{\text{d}^2y}{\text{d}t^2} &~=~ G \, \frac{m}{\sqrt{x^{\class{blue}{2}} ~+~ y^{\class{blue}{2}} ~+~ z^{\class{blue}{2}}}} \\\\

\frac{\text{d}^2z}{\text{d}t^2} &~=~ G \, \frac{m}{\sqrt{x^{\class{blue}{2}} ~+~ y^{\class{blue}{2}} ~+~ z^{\class{blue}{2}}}} \end{align} $$

Here the searched functions \(x(t)\), \(y(t)\) and \(z(t)\) occur in quadratic form. But even if the squares were not there, there would still be the square root and the fraction, which make the differential equation system non-linear!

### Is a linear differential equation homogeneous or inhomogeneous?

In the next types of differential equations the *coefficients* multiplied by the searched function and its derivatives are important. In some solving methods it is important to distinguish between...

**constant coefficients**- do NOT depend on the variables on which the searched function also depends.**non-constant coefficients**- do DEPEND on the variables on which the searched function depends.

A coefficient must not necessarily be multiplied with the searched function or its derivative. It can also stand *alone*! In this case we call the single coefficient a **perturbation function**.

In our differential equation for the oscillating mass there is an interesting coefficient which is multiplied by the searched function \(y\), namely \(D/m\). Strictly speaking, there is also a coefficient in front of the second derivative, namely 1, and the single coefficient, i.e. the perturbation function, is 0 here. So it does not exist:

The wave equation is also homogeneous:

Because here there is also no single coefficient, the perturbation function is zero.

The differential equation for a forced oscillation, on the other hand, is inhomogeneous:

**Example of an inhomogeneous DEQ - Forced oscillation**

Here the external force \(F(t)\) corresponds to the perturbation function. As you can see, it stands alone without being multiplied by the function \(y(t)\) or its derivatives. Moreover, the perturbation function \(F(t)\) is time dependent, so it is a non-constant coefficient.

## Constraints: Boundary and initial conditions

A differential equation alone, is not sufficient to describe a physical system *uniquely*. The solution of a differential equation describes quite a few possible systems that have a certain behavior. For example, the solution of the radioactive decay law describes an *exponential* behavior. However, the knowledge about an exponential behavior is not sufficient to be able to say concretely how many atomic nuclei have decayed after 10 seconds.

This is exactly why for every differential equation there are usually given **constraints**. These are additional information, which must be given to a differential equation, in order to specify the solution of the equation. The *number* of necessary constraints depends on the \textit{order} of the differential equation.

For a 1st order differential equation, *a single constraint* is necessary, namely

a function value of the searched function \(y(t)\).

For the radioactive decay law, for example, it should be stated how many not yet decayed atomic nuclei \(N\) were present at the time \(t = 0 \). For example one 1000 atomic nuclei: \(N(0) = 1000 \).

For a 2nd order differential equation *two constraints* are necessary:

a function value of the searched function \(y(t)\) and

for example a function value of the first derivative \(y'(t)\)

For an oscillating mass, the function value could be \( y(0) = 1\), which sets the initial displacement, and the function value of the first derivative could be \(y'(0) = 0\), which sets the initial velocity of the mass.

For a 3rd order differential equation then *three constraints* would be necessary to describe a system uniquely:

a function value of the searched function \(y(t)\)

a function value for example of its first derivative \(y'(t)\) and

a function value for example of its second derivative \(y''(t)\)

For a 4th order differential equation then *four constraints* would be necessary and so on...

Most of the time you will come across the so-called initial conditions and boundary conditions. These are also just names for constraints that tell you what kind of information you have about the system.

Sometimes, for example, you know in which state the system was at a certain time. This could be the initial time at which you displaced and released a mass on a spring. In such a case we speak of **initial conditions**. You specify *at one certain* point in time, for example at time \(t=0\), wich value the displacement \(y(0)\) had. And since we need two constraints, you also specify which value the derivative \(y'(0)\) (that is the velocity) had at that same point in time \(t = 0\).

Sometimes you are unlucky and do not know the velocity of the oscillating mass at a certain initial time \(t = 0\). So you don't know the derivative of \(y'(0)\) at the time \(t = 0\), at which you also know the displacement \(y(0\). But you really need two constraints, otherwise you can't calculate concrete numbers... But maybe you know that for example after \( t = 6 \, \text{s}\) the oscillating mass was in the maximum displaced state. So you know the displacement \(y(6)\).

If you have constraints, such as \(y(t_1)\) and \(y(t_2)\), given to describe the system at two \textit{different} points in time \(t_1\) and \(t_2\), then we call them **boundary conditions**.

The 'function values at two different points in time' was of course just an example. Instead of time, it could be any variable that fixes the system at the boundaries. At different times, at different positions, at different angles and so on.

So far so good. Now let's look at four methods with which you can solve simple differential equations.

## Solving method #1: Separation of variables

The method of separation of variables is suited for:

*ordinary DEQ of 1st order*,which is linear

and homogeneous.

Remember that if a DEQ is homogeneous, it is also linear. This type of DEQ has the form:

**Form of a homogeneous linear DGL**

Here the coefficient \(K\) must *not necessarily constant*, but can also depend on \(x\)! Also note that before the first derivative \(y'\) the coefficient must be equal to 1. If this is not the case for you, then you simply have to divide the whole equation by the coefficient which is in front of \(y'\). Then you have the right form.

In this solving method, \(y\) and \(x\) are considered as two variables and separated from each other by bringing \(y\) to one side and \(x\) to the other side of the equation. The Leibniz notation of the differential equation is best suited for this purpose:

**Form of a homogeneous linear DEQ in Leibniz notation**

Bring \(K(x)\,y\) to the right hand side:

Multiply the equation by \( \text{d}x \) and then divide the equation by \(y\). This way you have only \(y\) dependence on the left side and only \(x\) dependence on the right side:

Now you can integrate over \(y\) on the left hand side and over \(x\) on the right hand side:

Integrating \( 1 / y \) gives the natural logarithm of \(y\). It's best to know this by heart, because you will often encounter such an integral. Also, don't forget the integration constant! Let's call it \(A\) for example:

Now you have to solve for the function \(y\). Use the exponential function \(\mathrm{e}^{...}\) on both sides:

You can split the sum in the exponential term on the left into a product, where \(\mathrm{e}^{\ln(y)}\) is simply \(y\):

Bring the constant \(\mathrm{e}^{A}\) to the right side:

and rename the coefficient to a new constant \(C\).

As a result, you get a general solution formula that you can always use to solve homogeneous linear differential equations. You don't have to apply the separation of variables method again and again, but you can use the solution formula directly:

**Solution formula for ordinary homogeneous DEQ of 1st order**

## Lösungsmethode #2: Variation der Konstanten (VdK)

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:

The inhomogeneous version 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) \):

You have already learned how to find the homogeneous solution \( y_{\text h} \) with the previous method. 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 39

.

We put this ansatz 45

into the inhomogeneous equation 44

for \(y\):

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:

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

:

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

In parenthesis is the homogeneous differential equation 30

, which is zero. So we can omit this term completely:

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

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 \):

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

If you now just substitute the found coefficient \(C(x)\) into the original ansatz, 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**

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\):

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 45

. Divide both sides by \(L\). Thereby you eliminate the \(L\) in front of the derivative:

Bring the single coefficient to the other side:

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 55

for the inhomogeneous differential equation of 1st order. We denote the homogeneous solution by \(I_{\text h}\):

First, we need to determine the homogeneous solution \(I_{\text h}\). We can quickly calculate this using the solution formula 39

for the homogeneous version of the differential equation that you learned before:

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 55

.

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

Let's insert it into the inhomogeneous solution formula:

&~=~ \left( \int \frac{U_0}{L \, \mathrm{e}^{ - \frac{R}{L}\,t }} \, \text{d}t ~+~ A \right) \, \mathrm{e}^{ - \frac{R}{L}\,t } \\\\

&~=~ \left( \int \frac{U_0}{L} \, \mathrm{e}^{ \frac{R}{L}\,t } \, \text{d}t ~+~ A \right) \, \mathrm{e}^{ - \frac{R}{L}\,t } \end{align} $$

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 62

. 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\):

&~=~ \left(\frac{U_0}{L} \, \int \mathrm{e}^{\frac{R}{L}\,t } \, \text{d}t ~+~ A \right) \, \mathrm{e}^{ - \frac{R}{L}\,t } \\\\

&~=~ \left( \frac{U_0}{L} \, \frac{L}{R} \, \mathrm{e}^{\frac{R}{L}\,t} ~+~ A \right) \, \mathrm{e}^{ - \frac{R}{L}\,t } \\\\

&~=~ \left( \frac{U_0}{R} \, \mathrm{e}^{\frac{R}{L}\,t } ~+~ A \right) \, \mathrm{e}^{ - \frac{R}{L}\,t } \end{align} $$

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:

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:

&~=~ \frac{U_0}{R} ~+~ A \, \mathrm{e}^{ - \frac{R}{L} \cdot 0} \\\\

&~=~ \frac{U_0}{R} ~+~ A \end{align} $$

and solving for \(A\) results in:

Thus, we have successfully determined the specific general solution:

&~=~ \left( 1 ~-~ \mathrm{e}^{ - \frac{R}{L}\,t } \right) \, \frac{U_0}{R} \end{align} $$

## Solving method #3: Exponential ansatz

The exponential ansatz is suitable for

*differential equations of arbitrary order with constant coefficients*and which are linear.

Of course, the method quickly becomes complex for higher orders. The method is best suited *for second order* differential equations. The general form of a 2nd order linear differential equation looks like this:

**Form of a linear DEQ of second order**

Here we assume that the coefficients \(K_1\) and \(K_0\), as well as the perturbation function are independent of \(x\). They are constant.

If the perturbation function is not zero, then you must first ask a mathematician. Then he will tell you that a general solution \(y\) of an inhomogeneous linear differential equation is composed of two parts:

a

**homogeneous solution**\( y_{\text h} \) of the homogeneous differential equationand of a

**particular solution**, which we denote by \( y_{\text p} \).

**Sum of homogeneous and special solution**

The homogeneous solution \(y_{\text h}\) solves the differential equation 9

if you set the perturbation function \(S\) equal to zero:

In the method of the exponential ansatz, as the name suggests, we make the guess that the homogeneous solution \(y_{\text h}\) has the form of an exponential function:

**Homogeneous solution with exponential approach**

Since the first and second derivatives of \(y_{\text h}\) occur in the general form 70

of the differential equation, we must differentiate our exponential ansatz twice. The first derivative is:

And the second derivative is:

Now we can insert the exponential ansatz and the corresponding derivatives into the homogeneous differential equation 70

:

Let us factor out \(C \, \mathrm{e}^{\lambda \, x} \):

If we divide by this factor \(C \, \mathrm{e}^{\lambda \, x} \), then we get the so-called **characteristic equation** for \(\lambda\):

When we solve this equation, we find the unknown \(\lambda\). Since it is a quadratic equation for \(\lambda\), we get two solutions \(\lambda_1\) and \(\lambda_2\). We have to consider both of them.

Basically, you can set up the characteristic equation directly by looking at your differential equation without having to do all these steps. Compare the homogeneous differential equation with the characteristic equation. The coefficient in front of \(\lambda^2\) is in front of the second derivative of \(y\). In this case the coefficient is 1. The coefficient of \(\lambda\) is in front of the first derivative of \(y\), in this case \(K_1\). And the coefficient \(K_0\) in front of the function \(y\) itself stands alone in the characteristic equation. By the way, if you had a homogeneous 3rd order differential equation, then the characteristic equation would start with the cubic term \(\lambda^3\) and so on.

A quadratic equation has two solutions \(\lambda_1\) and \(\lambda_2\) and you can determine these for example with the quadratic formula:

Since you get two \(\lambda\) values, we have to consider both. To do this, you have to extend the exponential ansatz by another term in which the second \(\lambda\) value is in the exponent. With the corresponding \(\lambda\)-values this is the solution of the homogeneous 2nd order differential equation 70

:

**Solution ansatz of the homogeneous linear DGL of 2nd order**

Depending on the values of the coefficients \(K_1\) and \(K_0\), the solutions may show different behavior. Because, if \(K_0\) is greater than \(\frac{{K_1}^2}{4}\), then you are taking the root of a negative number. In this case you get a solution that describes oscillations. I will show you this in an example.

On the other hand, if the differential equation to be solved is inhomogeneous, that is the perturbation function is not zero, then we still have to add the particular solution \( y_{\text p} \) to the homogeneous one to find a general solution.

For the particular solution we have to choose an appropriate approach depending on what form the perturbation function \(S\) has. Here we look at the simplest possible form, namely, when the perturbation function \(S\) is constant. Then the particular solution is given by perturbation function divided by the coefficient \(K_0\): \( y_{\text p} = \frac{S}{K_0} \). Now, to get a general solution of such an inhomogeneous differential equation, we have to add the homogeneous solution and the particular solution:

**Solution ansatz of the inhomogeneous DEQ of 2nd order with constant perturbation function**

&~~\text{mit}~~ \lambda_1, \lambda_2 ~=~ -\frac{K_1}{2} ~\pm~ \sqrt{\frac{{K_1}^2}{4} - K_0 } \end{align} $$

The two unknown constants \(C_1\) and \(C_2\) are determined by the constraints, as you know. Also note that this method of the exponential ansatz is a *guess method*. This is the case if the actual solution of the differential equation is not of exponential form. Therefore, if you use a solving method that contains the word 'ansatz' in its name, be sure to check your solution. You do this by substituting the solution you have found in the differential equation and checking if both sides are equal.

Do you remember the differential equation for the oscillating mass?

This is a 2nd order differential equation with constant coefficients. The perturbation function is zero. That means, we only have to find out the homogeneous solution. And we do that with the exponential ansatz we just learned. Let's first write the differential equation in the more compact Newton notation, with points for the time derivatives:

Let's take the fast way and directly write down the characteristic equation. We expect a quadratic equation, because we have a 2nd order differential equation. The second derivative is preceded by the coefficient 1, so we just write \(\lambda^2\). Then the coefficient in front of the first derivative. Since the first derivative is missing in the differential equation, the \(\lambda\) term is absent as well. Next up is the coefficient \(D/m\) that is in front of the searched function. This coefficient stands alone in the characteristic equation. Altogether the characteristic equation reads:

For this equation we don't even need the quadratic formula. We get the solution directly if we first bring \(D/m\) to the other side:

and then take the square root:

Consider that the inverse of squaring gives two solutions, a positive and a negative square root. Also, we have an interesting case here when the square root of a negative number is taken. Square root of a negative number is not a real number, but an imaginary number. Do you remember what that means? We expect that the system must *oscillate*!

Even if you don't know imaginary or complex numbers yet, you can split the term inside the square root into a product of -1 and \(D/m\). According to the square root laws you can split this product into two square roots:

Root of -1 is defined as the imaginary unit, a number which we denote by \(i\). That's all you need to know about imaginary numbers:

If we simply insert the \(\lambda\) values we have just found into the exponential ansatz, we get the general solution for the considered differential equation. Let us denote \(\sqrt{\frac{D}{m}}\) shortly as \(\omega\):

This solution seems very abstract. But I will show you that this solution corresponds to an oscillation. Before that let us determine the unknown constants \(C_1\) and \(C_2\) with initial conditions for our problem.

For example we could have ovserved that at the time \(t=0\) the displacement of the spring was 1. The spring was displaced to the maximum: \(y(0) = 1\). Insert this condition into the solution to determine \(C_1\):

&~=~ C_1 \, \mathrm{e}^{\mathrm{i} \, \omega \cdot 0} ~+~ C_2 \, \mathrm{e}^{-\mathrm{i} \, \omega \cdot 0} \\\\

&~=~ C_1 ~+~ C_2 \end{align} $$

Rearranging for \(C_1\) we get:

Next step is to determine the unknown constant \(C_2\) using the second initial condition. For this we use the fact that at \(t = 0\) the velocity of the mass was 0. In physics you learn that velocity corresponds to the first time derivative of the displacement. So our second initial condition is given by: \(y'(0) = 0 \).

So lets differentiate our general solution with respect to time \(t\). I hope you know how to differentiate an exponential function. The factor in front of \(t\) becomes a factor in front the exponential function:

And then we insert the second initial condition into the derivative. The exponential functions become 1 and the factor \(i \, \omega\) cancels out:

&~=~ i \, \omega \, C_1 \, \mathrm{e}^{\mathrm{i} \, \omega \cdot 0} ~-~ \mathrm{i} \, \omega \, C_2 \, \mathrm{e}^{-\mathrm{i} \, \omega \cdot 0} \\\\

&~=~ C_1 ~-~ C_2 \end{align} $$

Rearranging for \(C_2\) we find out that:

So we know that \(C_2\) must be equal to \(C_1\). Nice. Lets replace \(C_2 \) in \(C_1 ~=~ 1 ~-~ C_2\) with \(C_1\) to determine concrete value for the constants:

The equation results in \(C_1 = \frac{1}{2}\). Since \(C_1\) and \(C_2\) are equal, \(C_2\) must be also equal to \(\frac{1}{2}\). Insert \(\frac{1}{2}\) into our general solution:

Now lets find out what this abstract solution has to do with oscillations! For this we get our friend Euler to help us, who tells us his famous Euler formula:

This relation tells us how the complex exponential function \(\mathrm{e}^{i \, \omega \, t}\) is related to cosine and sine functions. So the first complex exponential in our solution becomes cosine and sine with positive \(\omega \, t\) and the second complex exponential becomes cosine and sine with negative \(-\omega \, t\):

&~+~ \frac{1}{2}\, \cos(-\omega \, t) ~+~ \frac{1}{2}\, \mathrm{i}\,\sin(-\omega \, t) \end{align} $$

We can omit the minus sign in the argument of the cosine function because cosine is symmetric. That means: It has the same value for arguments \(x\) and \(-x\): \( \cos(-x) = \cos(x) \). The sine function on the other hand is antisymmetric. Therefore we cannot omit the minus in the argument but rather pull it out in front of the sine function. Because if we swap the sign of the argument the value of the sine function also swaps sign: \( \sin(-x) = -\sin(x) \). Let's use this fact:

&~+~ \frac{1}{2}\, \cos(\omega \, t) ~-~ \frac{1}{2}\, \mathrm{i}\,\sin(\omega \, t) \end{align} $$

Now you see, why this transformation was meaningful. Now the two complex sine functions cancel each other out and with them the imaginary unit disappears. What remains are the real cosine functions, which we can add together:

As you can see: The displacement \(y(t)\) changes periodically with time. The mass attached to the spring oscillates back and forth and the oscillation is described by the cosine function.

## Solving method #4: Product ansatz (separation ansatz)

Let's look at the last solving method, the separation ansatz. This is sometimes called the product ansatz for reasons we will soon understand. This method, however, is suitable:

for

*partial*differential equationsof

*arbitrary*order.

This solution method is mainly used only to transform a partial DEQ into *several ordinary* DEQ's and to solve these then with other methods (e.g. with the exponential ansatz).

Let us illustrate this method directly with an example. The one-dimensional wave equation for an electric field is best suited for this:

The function we are looking for is the electric field \(E(t,x)\). This depends on \(x\) and on \(t\). Since the function depends on two variables and their derivatives appear in the equation, it is a partial differential equation.

Here we make a product ansatz for the searched solution \(E\):

**Product ansatz for searched function**

We assume that the solution \(E\) can be split into a product of two functions that we call \(R(x)\) and \(U(t)\). One function, \(R\), depends only on \(x\). And the other function, \(U\), depends only on \(t\). In the wave equation, we have a second derivative of \(E\) with respect to location \(x\) and a second derivative with respect to time \(t\). So we must first differentiate our product ansatz before we insert it into the wave equation. Differentiating the product ansatz with respect to \(x\) yields \(U(t)\,\frac{\partial^2 R(x)}{\partial x^2}\), since \(U\) is independent of \(x\) and thus acts like a constant. In contrast, in the derivative of the product with respect to time \(t\), the function \(R\) acts like a constant because it does not depend on \(t\):

The goal now is to separate everything that depends on \(x\) from what depends on \(t\). For this we divide this equation by \(R(x) \, U(t)\):

Thus we have achieved that everything that depends on \(x\) is on the left side and everything that depends on \(t\) is on the right side. If you manage to separate a partial differential equation this way, then the separation ansatz was successful.

Now we can vary \(x\) on the left side without changing the right side, because there is no \(x\) on the right side. The same is true for the time \(t\). If we vary the time on the right side, the left side remains unchanged, because there is no time \(t\). Thus both sides must be constant. So let's set the left and the right side equal to a constant \(K\):

\frac{1}{c^2} \, \frac{1}{U(t)}\, \frac{\partial^2 U(t)}{\partial t^2} &~=~ K \end{align} $$

Thus we have transformed a *partial* differential equation into *two ordinary* differential equations. And the good thing is that the two differential equations are not coupled. That is, you can solve them independently and then multiply the solutions like in the product ansatz 100

to get the general solution for the partial differential equation.

You can solve the two ordinary differential equations with the exponantial ansatz you learned before.

So. Now you have learned everything necessary to classify and to solve simple differential equations.

Separation of variables for ordinary homogeneous differential equations of 1st order

Variation of constants for ordinary inhomogeneous differential equations of 1st order

Exponential ansatz for ordinary differential equations of higher order

And separation ansatz for partial differential equations

There are of course more classifications and solving methods. There are entire books devoted to solving differential equations. Some differential equations are so complex that it is better to not even try to solve them by hand, such as the Navier-Stokes differential equations. Numerical solving with the computer is the best approach here. But that's another big topic that you'll learn in another lesson.