# Failure to correctly apply the method of Variation of Parameters

I use the Method of Variation of Parameters to find a particular solution to a given linear inhomogeneous ODE. Subsequently, I insert that particular solution and its derivatives into the inhomogeneous ODE. I find that, contradictorily, the particular solution is infact no solution. If there is somebody to tell me where there is an error in either my arithmetic or my logic, then I will thank you very much.

$$y'' + y = \frac{1}{\cos x +1}$$ $$y = y_p + y_h$$ $$y_h = \, c_1 \cos x + c_2 \sin x$$ $$y_p = \int_{x_0}^x \frac{\mathrm W_1 (t)}{\mathrm{W} (t)} \, \mathrm d t \, \cos x + \int_{x_0}^x \frac{\mathrm W_2 (t)}{\mathrm{W} (t)} \, \mathrm d t \, \sin x$$

$$\mathrm W (t) = \left | \begin{matrix} \cos t & \sin t \\ - \sin t & \cos t \end{matrix} \right | = 1$$

$$\mathrm W_1 (t) = \left | \begin{matrix} 0 & \sin t \\ (1 + \cos t)^{-1} & \cos t \end{matrix} \right | = \frac{-\sin t}{1+\cos t} \\$$

$$\mathrm W_2 (t) = \left | \begin{matrix} \cos t & 0 \\ - \sin t & (1 + \cos t)^{-1} \end{matrix} \right | = \frac{\cos t}{1+\cos t}$$

$$\int_{x_0}^x \frac{-\sin t}{1+\cos t} \, \mathrm d t \, = \ln {\left | 1 + \cos x \right |}$$

$$\int_{x_0}^x \frac{\cos t}{1+\cos t} \, \mathrm d t \, = x - \tan \frac {x}{2}$$

\begin{align*} y_p =& \cos x \ln |1 + \cos x| + \sin x \left( x - \tan \frac x 2 \right) \\ =& \cos x \ln |1 + \cos x| + x \sin x - (1 - \cos x) \end{align*}

\begin{align*} y'_p =& - \sin x \ln \left | 1 + \cos x \right | - \cos x (1 + \cos x)^{-1} \sin x + \sin x + x \cos x - \sin x \\ =& - \sin x \ln \left | 1 + \cos x \right | - \cos x (1 - \cos x) \sin^{-1} x + x \cos x \\ =& - \sin x \ln \left | 1 + \cos x \right | - \cot x + \cos^2 x \sin^{-1} x + x \cos x \\ \end{align*}

\begin{align*} y''_p =& -\cos x \ln |1 + \cos x| + \sin^2 x (1+ \cos x)^{-1} + \sin^{-2} x - 2 \cot x \sin x \\ & \,\,\,\, -\cot^2 x \cos x + \cos x - x \sin x \end{align*}

Note that $\sin^2 x (1+ \cos x)^{-1} = 1-\cos x$

$$y''_p = -\cos x \ln |1 + \cos x | + 1 + \sin^{-2} x - 2 \cos x -\cot^2 x \cos x - x \sin x$$

\begin{align*} y''_p + y_p =& \sin^{-2} x -\cos x -\cot^2 x \cos x \\ =& - \cos x + \sin^{-2} x \, (1- \cos^3 x) \\ =& - \cos x + \sin^{-2} x \, (1- \frac{1}{4} \cos 3x + \frac{3}{4} \cos x) \\ =& - \cos x + \sin^{-2} x \, (1- \frac{1}{4} (\cos 2x \cos x - \sin 2x \sin x) + \frac{3}{4} \cos x) \\ =& - \cos x + \sin^{-2} x - \frac{1}{4} \cot x \sin^{-1} x \cos 2x + \frac{1}{4} \sin^{-1} x \sin 2x + \frac{3}{4} \cot x \sin^{-1} x \\ =& - \cos x + \sin^{-2} x + \frac{1}{4} \sin^{-1} x \sin 2x + \frac{1}{4} \sin^{-1} x \cot x (3 - \cos 2x) \\ \end{align*}

Note that $3 - \cos 2x = 2+1 - \cos 2x = 2 + 2 \sin^2 x = 2 (1 + \sin^2 x)$

And that $\sin 2x = 2 \sin x \cos x \Longrightarrow \frac{1}{4} \sin^{-1} x \sin 2x = \frac{1}{2} \cos x$

\begin{align*} y''_p + y_p =& - \cos x + \sin^{-2} x + \frac{1}{2} \cos x + \frac{1}{2} \cot x \sin^{-1} x (1 + \sin^2 x) \\ =& - \frac{1}{2} \cos x + \sin^{-2} x + \frac{1}{2} \cos x \sin^{-2} x + \frac{1}{2} \cos x \\ =& \sin^{-2} x (1+\frac{1}{2} \cos x) \\ \neq& \sin^{-2} x (1- \cos x) \\ =& \frac{1}{\cos x +1} \end{align*}

If the arithmetic that I have shown here is correct, then the function $y_p$ that I obtained by Variation of Parameters is not a solution to the given inhomogeneous ODE.

• I checked the particular solution and it seems correct to me... – LostInSpace May 7 '18 at 1:01
• Why is it that the particular solution plus its second derivative does not equal $\frac{1}{\cos x +1}$ ? – EricVonB May 7 '18 at 1:54
• I dont know Eric I only checked the value of $y_p$ and find your result correct...I guess you maybe made a mistake when differentiating $y_p$ – LostInSpace May 7 '18 at 2:02
• If somebody would indicate precisely where there exists that error, then I would mark this thread as solved. – EricVonB May 7 '18 at 2:17
• You made a little sign mistakle here Note that $$cos^3(x)=\cos(3x)/4+3\cos(x)/4$$ – LostInSpace May 7 '18 at 5:55

$$y'' + y = \frac{1}{\cos x +1}$$ $$\sin(x) y'' + y\sin(x) = \frac{\sin(x)}{\cos x +1}$$ $$\sin(x) y'' +y'\cos(x)-y'\cos(x)+ y\sin(x) = \frac{\sin(x)}{\cos x +1}$$ $$(\sin(x) y')'+(-y\cos(x))' = \frac{\sin(x)}{\cos x +1}$$ Integrate $$\sin(x) y'+(-y\cos(x)) = \int \frac{\sin(x)}{\cos x +1}dx$$ $$\sin(x) y'-y\cos(x)= -\ln|\cos x +1|+K_1$$ Which is of first order $$\frac y {\sin(x)}=-K_1 \cot(x) -\int \frac {\ln|\cos x +1|}{\sin^2(x)}dx$$ $$\frac y {\sin(x)}= -K_1 \cot(x) + \cot(x){\ln|\cos x +1|} +\int \frac {\cos(x)}{\cos x +1|}dx$$ $$y = C_1 \cos(x) +\cos(x){\ln|\cos x +1|} +\sin(x)\int \frac {\cos(x)}{\cos x +1|}dx+K_2\sin(x)$$ $$\boxed{y = C_1 \cos(x) + K_2\sin(x)+\cos(x){\ln|\cos x +1|} +\sin(x) ( x-\tan(x/2))}$$
You made a sign mistake when you linearised $\cos^3(x)$ $$cos^3(x)=\cos(3x)/4+3\cos(x)/4$$ You wrote this \begin{align*} y''_p + y_p =& \sin^{-2} x -\cos x -\cot^2 x \cos x \\ =& - \cos x + \sin^{-2} x \, (1- \cos^3 x) \\ =& - \cos x + \sin^{-2} x \, (1- \frac{1}{4} \cos 3x \color{red}{+ \frac{3}{4} \cos x)} \\ \end{align*} It should be $$y''_p + y_p = - \cos x + \sin^{-2} x \, (1- \frac{1}{4} \cos 3x \color{blue}{- \frac{3}{4} \cos x)}$$