Solution to the $\displaystyle \phi'' + 4\phi' + 3\phi = x \cos {3x}.$

I came across the following differential equation while practicing $$\displaystyle \phi'' + 4\phi' + 3\phi = x \cos {3x} .$$

Now, I used VARIATION OF PARAMETERS to solve it. I found general solution the equation $$\displaystyle \phi'' + 4\phi' + 3\phi = 0$$ to be $$\displaystyle C_1 e^{-3x} + C_2 e^{-x}.$$

Now we need to find two functions $$\lambda \ \text{and} \ \nu$$ such that $$\displaystyle \lambda'e^{-3x} + \nu'e^{-x} = 0$$ and $$\displaystyle -3\lambda'e^{-3x} - \nu'e^{-x} = x \cos {3x} .$$

Then the general solution would be : $$\displaystyle \lambda e^{-3x} + \nu e^{-x} .$$

On solving I got : $$\displaystyle \lambda = -\frac {1}{2} \int x \cdot \cos{3x} \cdot e^{3x} \mathrm {d}x \\ \nu = \frac {1}{2} \int x \cdot \cos{3x} \cdot e^{x} \mathrm {d}x$$

These integrals took me a long time to solve. I used the traditional DI method to solve for it.

Finally getting the answer as : $$\displaystyle C_1 e^{-3x} + C_2 e^{-x} + \frac {x}{30} ( 2 \sin {3x} - \cos {3x} ) + \frac {47}{1800}\cos {3x} +\frac {19}{200}\sin {3x} .$$

I want my answer to get verified and am open to some good way to the integral quickly.

• Oh yes let me try that. Aug 6, 2021 at 17:17
• Still i would like to know a better way to solve for integrals. Aug 6, 2021 at 17:18
• @Moo let me check for the x independent terms again. I may be wrong. Thanks for the effort. Aug 6, 2021 at 17:21
• $cos 3x$ could be written as $\frac{e^{i3x}+e^{-i3x}}{2}$ Aug 6, 2021 at 17:23
• @Orpheus Yes, that should reduce the load. Let me try it. Aug 6, 2021 at 17:44

Why don't you try the Laplace transform? It gives

$$s^2\Phi(s)-s\phi(0)-\phi'(0) + 4(s\Phi(s)-\phi(0))+3\Phi(s) = \frac{s^2-9}{\left(s^2+9\right)^2}$$

and then

$$\Phi(s) = \frac{1}{s^2-4s+3}\frac{s^2-9}{\left(s^2+9\right)^2}+\frac{1}{s^2-4s+3}\left((s-4)\phi(0)+\phi'(0)\right)$$

The first part corresponds to a particular solution and the second to the homogeneous solution. Thus

$$\cases{ \Phi_p(s) = \frac{1}{s^2-4s+3}\frac{s^2-9}{\left(s^2+9\right)^2}\\ \Phi_h(s) = \frac{1}{s^2-4s+3}\left((s-4)\phi(0)+\phi'(0)\right) }$$

and

$$\phi_p(x) = \frac{1}{450} \left(18 e^x-30 x \sin (3 x)-\sin (3 x)-15 x \cos (3 x)-18 \cos(3 x)\right)$$

etc. all using calculated tables.

• I did not know about the Laplace transform. Will check it out definitely. Aug 6, 2021 at 17:58

HINT

Here it is another way to solve it for the sake of curiosity:

\begin{align*} y'' + 4y' + 3y = x\cos(3x) & \Longleftrightarrow (y'' + y') + (3y' + 3y) = x\cos(3x)\\\\ & \Longleftrightarrow (y' + y)' + 3(y' + y) = x\cos(3x)\\\\ & \Longleftrightarrow u' + 3u = x\cos(3x)\\\\ & \Longleftrightarrow \exp(3x)u' + 3\exp(3x)u = x\cos(3x)\exp(3x)\\\\ & \Longleftrightarrow (\exp(3x)u)' = x\cos(3x)\exp(3x)\\\\ & \Longleftrightarrow \exp(3x)u = \int x\cos(3x)\exp(3x)\mathrm{d}x + k\\\\ & \Longleftrightarrow y' + y = \exp(-3x)\int x\cos(3x)\exp(3x)\mathrm{d}x + k\exp(-3x) \end{align*}

Can you take it from here?

• Yes, thanks. This is an interesting way to solve for the equation. Will be trying this method too. Aug 6, 2021 at 17:43

You can also apply the method of undetermined coefficients to find the particular solution. The solution to the complementary differential equation $$\phi'' + 4\phi' + 3\phi=0$$ is

$$\phi_c(x) =c_1e^{-3x}+c_2e^{-x}.$$

Thus to find the particular solution to $$\phi'' + 4\phi' + 3\phi = x \cos {3x}$$ we try a particular solution of the form $$\phi_p(x)=(Ax+B)\cos(3x)+(Cx+D)\sin(3x).$$ Hence $$\phi_p'(x)=(A + 3Cx + 3D)\cos(3 x)+(-3 A x - 3 B + C) \sin(3 x),$$ $$\phi_p''(x)= (-9 A x - 9 B + 6 C)\cos(3 x) + (-6 A -9Cx-9D)\sin(3 x).$$ Plugging these into the differential equation gives $$$$\begin{split} (-6A+12C)x\cos(3x) +(-6C-12A)x\sin(3x)+(4A-6B+6C+12D)\cos(3x)\\ +(-6A-12B+4C-6D)\sin(3x)=x\cos(3x). \end{split}$$$$ Therefore by relating coefficients $$-6C-12A =0 \implies C=-2A,$$ $$-6A+12C=1 \implies \boxed{A=-\frac{1}{30}}, \quad \boxed{C=\frac{1}{15}},$$ $$4A-6B+6C+12D=0 \implies -6B+12D = -\frac{4}{15}\implies D = \frac{B}{2} -\frac{1}{45},$$ $$-6A-12B+4C-6D=0 \implies -15B+\frac{2}{15}=-\frac{7}{15}\implies \boxed{B=\frac{1}{25}}, \quad \boxed{D= -\frac{1}{450}}.$$ So the particular solution becomes $$\phi_p(x)=\left(-\frac{1}{30}x+\frac{1}{25}\right)\cos(3x)+\left(\frac{1}{15}x-\frac{1}{450}\right)\sin(3x).$$

• This method though very interesting needs a lot of practice. Cause I would not have guessed that function directly. Thank you for your efforts. This way is a lot easier. Aug 7, 2021 at 8:59
• @NikolaAlfredi: It does take a bit of practice to get used to this method. I will give three examples and guesses for a particular solution. The first example is $$\phi'' + 4\phi' + 3\phi = x.$$ Here we would guess a particular solution of $$\phi_p(x)=Ax+B.$$ Next, we can change the differential equation to $$\phi'' + 4\phi' + 3\phi = \cos(3x).$$ We would make the following guess for the particular solution $$\phi_p(x)=A\cos(3x)+B\sin(3x).$$ Aug 7, 2021 at 18:17
• The third example is your problem $$\phi'' + 4\phi' + 3\phi = x\cos(3x).$$ Notice that we choose the following guess for the particular solution: $$\phi_p(x)=(Ax+B)\cos(3x)+(Cx+D)\sin(3x),$$ which was in effect built upon our previous two guesses in the first two examples. A lot more examples are described here. A limitation of this method is that it is generally only useful for constant coefficient differential equations. The variation of parameters method works on a wider range of differential equations. Aug 7, 2021 at 18:18
• Thank you very much, now I will have it done. Aug 8, 2021 at 7:17