In this section we’ll consider an example of how to deal with initial value problem (or Cauchy problem) for non-homogeneous second order differential equation with constant coefficients.

Initial value problem usually arises in the analysis of processes for which we know differential evolution law and the initial state. For example, consider the problem of counting human population. After years of observation and data processing scientists came up with some differential equations with which we can describe number of human beings on Earth. This is called a population model, and actually there are several various approaches concerning this problem. Suppose we want to find out how many people will be there up to 2120 year. And here comes initial value problem. We know current population (our initial value) and have a differential equation, so to find future number of humans we’re to solve a Cauchy problem.

Ok, back to math. We’re to solve the following:

$$y” + y’ + y = sin^2x,$$

$$y(0)=1, y'(0)= -\frac{9}{2}$$

This is initial value problem, because we’re given differential equation @$y” + y’ + y = sin^2x@$ with initial conditions @$y(0)=y(x=0)=1, y'(0)=y’(x=0)= -\frac{9}{2}@$.

Firstly we need to solve differential equation and then apply initial conditions @$y(0)=1, y'(0)= -\frac{9}{2}@$ in order to find unknown arbitrary constants.

Find video version of this tutorial on our youtube channel:

So let’s start solving our differential equation. We’re dealing with non-homogeneous second order differential equation with constant coefficients:

$$y” + y’ + y = sin^2x$$

We’re looking for solution of the given equation in the form @$y=y_0+y^*@$ where @$y_0@$ is the solution of the corresponding homogeneous equation @$y” + y’ + y =0@$, @$y^*@$ – particular solution of the given equation. Later you’ll understand why we use exactly this representation. Let’s start solving step by step.

**STEP 1. General solution** @$y_0@$

Let’s find general solution of the corresponding homogeneous equation:

$$y” + y’ + y =0$$

For that we need to write down the so called characteristic equation:

$$r^2+r+1=0$$

As you can see, when constructing characteristic equation we simply replace each derivative by new variable $r$ raised to the power same as the order of derivative (@$y” \Rightarrow r^2, y’ \Rightarrow r, y \Rightarrow 1@$). Note that coefficients of the equation are the same (in our case we have @$1, 1, 1@$ beside @$y”, y’, y@$ and thus, we obtain characteristic equation written above)

*Note, that in fact characteristic equation is obtained by Euler’s substitution @$y=e^{rx}@$. **So @$y’’=r^2\cdot e^{rx}, y’=re^{rx}@$ . Then, after substitution, we drop off the factor 2@$e^{rx}@$ and obtain characteristic equation.*

As you could notice, actually we’ve obtained a quadratic equation for $r$. Its solutions are the following:

$$r_{1,2}=\frac{-1\pm\sqrt{1-4}}{2}=\frac{-1\pm\sqrt{-3}}{2}=\frac{-1\pm i \sqrt{3}}{2}=-\frac{1}{2}\pm i\frac{\sqrt{3}}{2}$$

where @$i=\sqrt{-1}@$ is imaginary unit. Recall complex numbers if this sounds unfamiliar to you.

Thus, we have two complex roots. In this case general solution is written in the form:

$$y=C_1 e^{-\frac{1}{2} x} \cos({\frac{\sqrt{3}}{2} x})+C_2 e^{-\frac{1}{2} x} \sin({\frac{\sqrt{3}}{2} x}) $$

**STEP 2. Particular solution** @$y^*@$

Now we move on to finding particular solution of initial non-homogeneous equation. Return to our initial non-homogeneous equation. Let’s consider its right part: we have here @$sin^2x=\frac{1}{2}-\frac{1}{2}cos{2x}@$. At the right part there’s trigonometric function, therefore we can use method of undetermined coefficients.

In general case, if right part is given in the form (i.e. some polynomials, trigonometric functions sin,cos or their combination):

@$g(x)=P_n(x)e^{\alpha x}\cos(\beta x)@$ or @$g(x)=P_n(x)e^{\alpha x}\sin(\beta x)@$

where @$P_n(x)@$ is a polynomial function of degree @$n@$. Then a particular solution @$y^*@$ is given by the formula:

$$y^*=x^s(T_n(x)e^{\alpha x}\cos(\beta x)+R_n(x)e^{\alpha x}\sin(\beta x)$$

where @$T_n=A_0+A_1x+A_2x^2+…+A_nx^n@$ and @$R_n=B_0+B_1x+B_2x^2+…+B_nx^n@$

Note, that if @$\alpha+i\beta@$ is not one of the characteristic roots @$r_{1,2}@$ (we’ve found them above) then set @$s=0@$.

In case @$\alpha+i\beta@$ equals single root set @$s=1@$.

Also it’s important to know how to deal with situations when @$g(x)@$ is a sum of some functions. If non-homogeneous term @$g(x)@$ satisfies the following:

$$g(x)=\sum_{i=1}^{i=N}g_i(x)$$

where @$g_i(x)@$ are of the forms mentioned above, then we can split the initial equation into @$N@$ equations

$$ay”+by’+cy=g_i(x), i=1,2,…,N$$

then find a particular solution @$y_i@$ for each of them and construct the particular solution for initial equation as

$$y^*(x)=\sum_{i=1}^{i=N}y_i$$

Let’s have a closer look at our equation. In our case non-homogeneous term is @$g(x)=\frac{1}{2}-\frac{1}{2} \cos{2x}@$. So we can split this non-homogeneous equation into two equations:

$$y” + y’ + y =\frac{1}{2}$$ and $$y” + y’ + y =-\frac{1}{2} \cos{2x}$$

We need to find particular solutions of these equations and then add them up to obtain particular solution of our initial equation.

Consider the first equation @$y” + y’ + y =\frac{1}{2}@$

In this case @$\alpha=\beta=0@$

Therefore, the particular solution is @$y=C@$

Substitute it into equation under consideration:

@$C’’+C’+C=\frac{1}{2}@$ => @$C=\frac{1}{2}@$.

Thus, the particular solution of this equation is @$y=\frac{1}{2}@$.

Move on to the second @$y” + y’ + y =-\frac{1}{2}\cos{2x}@$

In this case @$\alpha=0, \beta=2i@$ and characteristic roots are @$r_{1,2}=\frac{1}{2}\pm\frac{\sqrt{3}}{2}i@$. So we write particular solution in the form:

$$y^*=A \sin {2x} + B \cos {2x}$$

Now we need to find undetermined coefficients @$A,B@$. To do it we substitute our particular solution into initial differential equation. But first we need to find the derivatives of @$y^*@$:

$$y’=2A\cos{2x}-2B\sin{2x}$$

$$y”=-4A\sin{2x}-4B\cos{2x}$$

Now substitute them into the equation:

$$y” + y’ + y = -\frac{1}{2}\cos{2x}$$

$$-4A\sin{2x}-4B\cos{2x}+2A\cos{2x}-2B\sin{2x}+A\sin{2x}+B\cos{2x}=-\frac{1}{2}\cos{2x}$$

In front of @$\sin{2x}@$ we have : @$-4A-2B+A=0@$

Beside @$\cos{2x}@$: @$ -4B+2A+B=-\frac{1}{2}@$

We have the system of two linear equations to find undetermined coefficients @$A,B@$:

$$ \left\{ \begin{aligned}-4A-2B+A=0\\-4B+2A+B=-\frac{1}{2}\end{aligned}\right.$$

$$\left\{ \begin{aligned}A=-\frac{2}{3}B\\-3B-\frac{4}{3}B=-\frac{1}{2}\end{aligned}\right.$$

$$\left\{ \begin{aligned}A=-\frac{2}{3}B=-\frac{1}{13}\\B=\frac{3}{26}\end{aligned}\right.$$

Therefore, particular solution for the second equation is @$y=-\frac{1}{13}\sin {2x}+\frac{3}{26} \cos{2x}@$

We’ve found particular solutions for both equations, so now we can construct the particular solution for the whole initial equation as a sum of two obtained:

$$y^*=\frac{1}{2}-\frac{1}{1}3 \cos{2x}+\frac{3}{26}\sin{2x}$$

**STEP 3. The whole solution**

As we know, the whole solution @$y@$ is constructed as a sum of particular solution and general solution of corresponding homogeneous equation. Now we have all the needed stuff to write it down:

$$y=y_0+y^*=C_1 e^{-\frac{1}{2} x} \cos({\frac{\sqrt{3}}{2} x})+C_2 e^{-\frac{1}{2} x} \sin({\frac{\sqrt{3}}{2} x}) +\frac{1}{2}-\frac{1}{1}3 \cos{2x}+\frac{3}{26}\sin{2x}$$

**STEP 4. Initial conditions**

We’ve found a solution with arbitrary constants. Basically, this is not a single solution, but a bunch. However, applying initial conditions we can fix the values of those constants.

W’re given the following initial conditions: @$y(0)=1, y'(0)= -\frac{9}{2}@$:

Starting with the first:

$$\begin{aligned} y(0)=C_1 e^{-\frac{1}{2}\cdot 0} \cos({\frac{\sqrt{3}\cdot 0}{2}})+C_2 e^{-\frac{1}{2}\cdot 0} \sin({\frac{\sqrt{3}\cdot 0}{2}}) +\frac{1}{2}-\frac{1}{13}\sin ({2\cdot 0})+\frac{3}{26} \cos(2\cdot 0)=&\\C_1\cdot 1+C_2\cdot 0+\frac{1}{2}–\frac{1}{13}\cdot0+\frac{3}{26}\cdot1=C_1+\frac{1}{2}+\frac{3}{26}=1\end{aligned}$$

whence

$$C_1=1-\frac{1}{2}-\frac{3}{26}=\frac{26-13-3}{26}=\frac{10}{26}=\frac{5}{13}$$

To apply the second condition we at first have to find derivative @$y'(x)@$:

$$\begin{aligned} y’=-\frac{1}{2}C_1 e^{-\frac{1}{2} x} \cos(\frac{\sqrt{3}x}{2})-\frac{\sqrt{3}}{2} C_1 e^{-\frac{1}{2}x} \sin(\frac{\sqrt{3} x}{2})-\frac{1}{2} C_2 e^{-\frac{1}{2} x} \sin(\frac{\sqrt{3} x}{2})+&\\\frac{\sqrt{3} x}{2}C_2 e^{-\frac{1}{2} x} \cos(\frac{\sqrt{3} x}{2})-\frac{2}{13} \cos{2x}-\frac{3}{13} \sin{2x}\end{aligned}$$

Applying the second condition @$y'(0)= -\frac{9}{2}@$ we get:

$$\begin{aligned}y'(0)=-\frac{1}{2} C_1 e^{-\frac{1}{2}\cdot 0} \cos(\frac{\sqrt{3}\cdot 0}{2})-\frac{\sqrt{3}}{2} C_1 e^{-\frac{1}{2}\cdot 0} \sin(\frac{\sqrt{3}\cdot 0}{2})-\frac{1}{2}C_2 e^{-\frac{1}{2} \cdot 0}\sin(\frac{\sqrt{3}\cdot 0}{2})+&\\\frac{\sqrt{3}}{2}C_2 e^{-\frac{1}{2}\cdot 0} \cos(\frac{\sqrt{3}\cdot 0}{2})-\frac{2}{13} \cos(2\cdot 0)-\frac{3}{13} \sin(2\cdot 0)=-\frac{1}{2}C_1+\frac{\sqrt{3}}{2}C_2-\frac{2}{13}=-\frac{9}{2}\end{aligned}$$

whence

$$\frac{\sqrt{3}}{2}C_2=-\frac{9}{2}+\frac{1}{2} C_1+\frac{2}{13}=-\frac{9}{2}+\frac{5}{26}+\frac{2}{13}=\frac{-9\cdot 13+5+4}{26}=-\frac{108}{26}=-\frac{54}{13}$$

Finally, we can find the value of the second constant @$C_2@$:

$$C_2=-\frac{54}{13}\cdot \frac{2}{\sqrt{3} }=-\frac{108}{13\sqrt{3}}$$

**STEP 5. The required solution**

We’ve found values of constants @$C_1,C_2@$ for the given initial conditions and now we can construct the solution:

$$y(x)=\frac{5}{13} e^{-\frac{1}{2} x} \cos(\frac{\sqrt{3}x}{2})-\frac{108}{13\sqrt{3}}e^{-\frac{1}{2} x} \sin(\frac{\sqrt{3}x}{2})+\frac{1}{2}-\frac{1}{13}\sin{2x}+\frac{3}{26} \cos{2x}$$

and that’s our answer.

Summing up.

If you’re asked to solve Cauchy problem for a differential equation, then these are the main steps:

1. Solve the differential equation and obtain general solution.

2. Apply initial conditions to fix the values of constants.

Ok, now a bit more details on item 1. First check if your equation is homogeneous. If not, then look at the non-homogeneous term. Remember that the method described above only works for non-homogeneity of a special kind. The allowed forms of @$g(x)@$ are listed above. If it’s the case, then you can proceed.

Step 1. Find general solution for corresponding homogeneous equation.

Step 2. Find particular solution, using method of undetermined coefficients.

Step 3. Find the whole solution, adding up results of step 1 and step 2.

Step 4. Apply initial conditions, fix the values of constants.

Step 5. Substitute all required stuff and get the solution of Cauchy problem.

When you’re finished, check your answers. For that substitute your result into the initial equation and conditions. Also you can use online math calculators.

Keep in mind, that if non-homogeneous part of your equation is not in the required form and you can’t apply undetermined coefficients, there are still other options. For example, you can use variations of parameters method (sometimes referred to as variations of constants method) which is general and applicable for any form of non-homogeneity.