# Exponential Ansatz and How to Solve Linear Differential Equations (of 2nd order)

Level 3 requires the basics of vector calculus, differential and integral calculus. Suitable for undergraduates and high school students.
Updated by Alexander Fufaev on

## Video - How to Solve Linear 2nd Order Differential Equation with Characteristic Polynomial ( + Example)

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

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 equation

• and of a particular solution, which we denote by $$y_{\text p}$$.

Sum of homogeneous and special solution
Formula anchor

The homogeneous solution $$y_{\text h}$$ solves the differential equation 1 if you set the perturbation function $$S$$ equal to zero:

Form of a homogeneous DGL of second order
Formula anchor

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

Since the first and second derivatives of $$y_{\text h}$$ occur in the general form 3 of the differential equation, we must differentiate our exponential ansatz twice. The first derivative is:

First derivation of the exponential ansatz
Formula anchor

And the second derivative of the ansatz is:

Second derivative of the exponential ansatz
Formula anchor

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

Derivatives inserted into the exponential ansatz
Formula anchor

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

Factor pulled out of the exponential ansatz with derivatives
Formula anchor

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

Characteristic equation for the exponential ansatz
Formula anchor

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:

Solution of the characteristic equation with quadratic formula
Formula anchor

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 3:

Exponential ansatz of the homogeneous linear DEQ of 2nd order
Formula anchor

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:

Exponential ansatz of the inhomogeneous DEQ of 2nd order with constant perturbation function
Formula anchor

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.

## Example: Solve DEQ for an oscillating mass

The oscillating mass we want to consider is called a harmonic oscillator in physics. This is what the corresponding differential equation looks like:

Differential equation of a harmonic oscillator
Formula anchor

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:

Transformed DEQ of a harmonic oscillator
Formula anchor

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:

Characteristic polynomial for the harmonic oscillator
Formula anchor

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:

Quadratic formula solution for the harmonic oscillator
Formula anchor

and then take the square root:

Solution of the characteristic polynomial for the harmonic oscillator
Formula anchor

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

Solving the characteristic polynomial - split up the root
Formula anchor

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

Complex solution of the characteristic polynomial for the harmonic oscillator
Formula anchor

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$$:

Lambda values inserted into the exponential ansatz
Formula anchor

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$$:

Use constraints
Formula anchor

Rearranging for $$C_1$$ we get:

Find out unknown coefficient C1
Formula anchor

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:

Differentiate exponential ansatz for harmonic oscillator
Formula anchor

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

Determine unknown coefficient C2
Formula anchor

Rearranging for $$C_2$$ we find out that:

Both coefficients are equal
Formula anchor

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:

Find out coefficient C1
Formula anchor

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:

Solution of the harmonic oscillator expressed with exponential functions
Formula anchor

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:

Euler formula
Formula anchor

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$$:

Solution of harmonic oscillator transformed with Euler formula
Formula anchor

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:

Solution of harmonic oscillator with minus sign pulled out
Formula anchor

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:

Solution of the harmonic oscillator expressed with cosine
Formula anchor

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.

Now you know how to solve 2nd order inhomogeneous differential equations using the exponential ansatz. In the next lesson we will deal with the partial differential equations and the product ansatz (Separation of variables for PDE's).