# Solve the given differential equation by variation of parameters.

y” –  y =  cos hx

This article aims to solve the differential equation. There are two main methods to solve the differential equation, the general solution of  homogenous equation and the particular solution of non-homogeneous equation.

The given differential equation is

y” –  y =  cos hx

Let’s find a solution to the related homogeneous equation $y ^{”} -y = 0$. The auxiliary equation is $m ^{2} -1=0$ and its solutions are $m _{1} =-1$ and $m_ {2} = 1$. The complementary solution is

$y _{c} (x) = c_{ 1 } e ^ { -x } + c_{2} e ^ { x }$

The function $y _{1} (x) = c_{1} e^{-x}$ and $y_{2} (x) = c_{2} e^{x}$ form a fundamental set

$W( y_{1}, y_{2}) = \begin{vmatrix} y_{1} & y_{2} \\ y’_{1}& y’_{2} \end{vmatrix}= \begin{vmatrix} e ^{-x} & e^{x} \\ e^{-x} & e^{x} \end{vmatrix} = 1+1 = 2$

Let’s assume that a particular solution has the form $y_{p} = u_{1}y_{1} + u_{2}y_{2}$ where $u_{1}$ and $u_{2}$ are the solutions of the systems of equations.

$y_{1}u’_{1}+ y_{2} u’_{2} = 0$

$y_{1}u’_{1} + y_{2} u’_{2} = f (x)$

$f(x) = \cos hx$ is the input function, using Cramer rule we have

$u’_{1} = – \dfrac {y_{2} f(x) }{W}$

and

$u’_{2}= \dfrac {y_{1} f(x) }{W}$

Where $W$ is Wronskian.

Therefore,

$u’_{1}(x) = -\dfrac { e^{x} .\cos hx }{2} = – \dfrac {1}{4} e^{2x} – \dfrac {1}{4}$

$u’_{2}(x) = -\dfrac { e^{-x} .\cos hx }{2} = \dfrac {1}{4} + \dfrac {1}{4} e^{-2x}$

After integrating both the equations,

$u_{1}(x) = -\dfrac {1}{8} e^{2x} -\dfrac{1}{4}x$

$u_{2}(x) = \dfrac {1}{4} x -\dfrac{1}{8} e^{-2x}$

The particular solution is $y_{p} = u_{1} y_{1} + u_{2}y_{2}$.

## Numerical Result

The particular solution of differential equation $y_{p} = u_{1} y_{1} + u_{2}y_{2}$ where

$u_{1}(x) = -\dfrac {1}{8} e^{2x} -\dfrac{1}{4}x$

$u_{2}(x) = \dfrac {1}{4} x -\dfrac{1}{8} e^{-2x}$

## Example

Solve the given differential equation.

$y” – 6y’ +9y = \dfrac {1}{x}$

Solution

The given differential equation is

$y” – 6y’ +9y = \dfrac {1}{x}$

Let’s find a solution to the characteristic equation $r^{2} – 6r+ 9 =0$. The solutions of the equation is $r = 3$. The general solution is

$y = Ae^{3x} + Bx e^{3x}$

The fundamental solution and its derivative is

$y_{1} (x) = e^{3x}$

$y’_{1} (x) = 3e^{3x}$

$y_{2} (x) = xe^{3x}$

$y’_{2} (x) = (3x+1) e^{3x}$

The Wronskian is

$W(y_{1}, y_{2}) = y_{1}y’_{2} − y_{2} y’_{1} = e^{6x}$

The general solution is given by

$y_{p}(x) = -y_{1}(x) \int \dfrac{y_{2}(x) f(x)}{W(y_{1},y_{2})}dx + y_{2}(x) \int \dfrac{y_{1}(x) f(x)}{W(y_{1},y_{2})}dx$

By solving the integral $\int \dfrac{y_{2}(x) f(x)}{W(y_{1},y_{2})}$

$= \dfrac{1}{3} e^{-3x}$

So,

$-y_{1}(x) \int \dfrac{y_{2}(x) f(x)}{W(y_{1},y_{2})} = \dfrac {1}{3}$

By solving the integral $\int \dfrac{y_{1}(x) f(x)}{W(y_{1},y_{2})}$

$= \int e^{-3x} x^{-6} dx$

So,

$y_{2}(x) \int \dfrac{y_{1}(x) f(x)}{W(y_{1},y_{2})} = x e^{3x} \int e^{-3x} x^{-6} dx$

Finally, the solution of the differential equation is

$y_{p}(x) = \dfrac {1}{3} +x e^{3x} \int e^{-3x} x^{-6} dx$