# y''+y=tan(x), 0 < x< (PI/2) Dtermine a particular solution of the nonhomogeneous DE using the method of variation of parameter.Answer is y=C1cos(x) +C2sin(x)-(cos(x))ln(tan(x) + sec(x))

sciencesolve | Certified Educator

You need to determine the general solution of homogeneous equation `y" + y = 0` .

You should come up with the substitution `y" = t^2` , such that:

`t^2 +1 = 0 =gt t^2 = -1 =gt t_(1,2) = +-sqrt(-1)`

`t_(1,2) = +-i ` (complex numbers theory)

Hence, the general solution of homogeneous equation `y" + y = 0`  is

`y_h = c_1*sin x + c_2*cos x`

You need to substitute function `v_1(x)`  for constant `c_1`  and function `v_2(x)`  for constant `c_2`  to find the particular solution `y_p`  to the nonhomogeneous equation such that:

`y_p =v_1(x)*sin x + v_2(x)*cos x`

Since you need to determine two unknown functions, hence you need to use two equations.

Differentiating `y_p`  with respect to x yields:

`y_p' = v_1'*sin x + v_1*cos x + v_2'*cos x- v_2*sin x`

You need to impose the following condition such that:

`v_1'*sin x + v_2'*cos x = 0 `

Substituting 0 for `v_1'*sin x + v_2'*cos x`  in equation of `y_p' ` yields:

`y_p' = v_1*cos x- v_2*sin x`

You need to differentiate `y_p'`  such that:

`y_p'' = v_1'*cos x - v_1*sin x - v_2'*sin x - v_2*cos x`

You need to substitute `y_p`  and `y_p''`  in nonhomogeneous equation yields:

`v_1'*cos x - v_1*sin x - v_2'*sin x - v_2*cos x + v_1*sin x + v_2*cos x = tan x`

Reducing like terms yields:

`v_1'*cos x - v_2'*sin x = tan x`

You need to solve for `v_1'`  and `v_2'`  the equations `v_1'*cos x - v_2'*sin x = tan x`  and `v_1'*sin x + v_2'*cos x = 0 ` such that:

You need to multiply the equation `v_1'*sin x + v_2'*cos x = 0`  by `sin x`  such that:

`v_1'*sin^2 x+ v_2'*sin x*cos x = 0`

You need to multiply the equation `v_1'*cos x - v_2'*sin x = tan x ` by `cos x`  such that:

`v_1'*cos^2 x - v_2'*sin x*cos x= sin x`

Adding `v_1'*cos^2 x - v_2'*sinx*cos x = sin x`  to equation `v_1'*sin^2 x + v_2'*sin x*cos x = 0`  yields:

`v_1'*sin^2 x + v_2'*sin x*cos x +v_1'*cos^2 x - v_2'*sin x*cos x = sin x`

Reducing like terms yields:

`v_1'(sin^2 x + cos^2 x) = sin x`

You need to use the basic formula of trigonometry such that:

`sin^2 x + cos^2 x = 1`

`v_1' = sin x`

You need to integrate both sides such that:

`v_1 = int sin x dx =gt v_1 = -cos x`

You need to find `v_2'`  such that:

`sin x*sin^2 x= -v_2'*sin x*cos x =gt v_2' = tan x* sin x`

You need to integrate both sides such that:

`v_2 = -int (sin^2 x dx)/cos x`

`v_2 = -int ((1 - cos^2 x)dx)/cos x`

`v_2 =- int (dx)/cos x+ int cos x dx`

`v_2 = sin x - ln|sec x + tan x|`

Hence, the particular solution to nonhomogeneous equation is :

`y_p = y_p = v_1(x)*sin x + v_2(x)*cos x`

Substituting `v_1`  by `-cos x`  and `v_2`  by `sin x - ln|sec x + tan x|`  yields:

`y_p = -sin x*cos x+ sin x*cos x -cos x*ln|sec x + tan x|`

`y_p = - cos x*ln|sec x + tan x|`

Collecting both solutions `y_h ` and `y_p`  yields the general solution of nonhomogeneous differential equation such that:

`y =c_1*sin x + c_2*cos x- cos x*ln|sec x + tan x|`