solve the differential equation by variation of parameters. (y + y=sin^{2}(x))

solve the differential equation by variation of parameters. (y + y=sin^{2}(x))
Answer
Explanation:
Step1: Find the complementary - function
The homogeneous equation is $y'' + y=0$. The characteristic equation is $r^{2}+1 = 0$, which gives $r=\pm i$. So the complementary - function $y_c = C_1\cos x+C_2\sin x$.
Step2: Rewrite the non - homogeneous term
We know that $\sin^{2}x=\frac{1 - \cos(2x)}{2}$.
Step3: Use the method of variation of parameters
Let $y_p = u_1(x)\cos x+u_2(x)\sin x$. We have the following system of equations: $u_1'\cos x+u_2'\sin x = 0$ and $-u_1'\sin x+u_2'\cos x=\frac{1 - \cos(2x)}{2}$ From the first equation $u_2'=-\frac{u_1'\cos x}{\sin x}$. Substitute into the second equation: $-u_1'\sin x-\frac{u_1'\cos^{2}x}{\sin x}=\frac{1 - \cos(2x)}{2}$ $-u_1'\frac{\sin^{2}x+\cos^{2}x}{\sin x}=\frac{1 - \cos(2x)}{2}$ $-u_1'=\frac{\sin x(1 - \cos(2x))}{2}$ $u_1'=-\frac{\sin x(1 - \cos(2x))}{2}$ Integrating $u_1'$: $u_1=\frac{1}{2}\int\sin x(\cos(2x)-1)dx=\frac{1}{2}\int(\sin x\cos(2x)-\sin x)dx$ Using the product - to - sum formula $\sin A\cos B=\frac{\sin(A + B)+\sin(A - B)}{2}$, $\sin x\cos(2x)=\frac{\sin(3x)-\sin x}{2}$ $u_1=\frac{1}{4}\int(\sin(3x)-\sin x)dx+\frac{1}{2}\cos x$ $u_1=\frac{1}{4}(-\frac{1}{3}\cos(3x)+\cos x)+\frac{1}{2}\cos x=-\frac{1}{12}\cos(3x)+\frac{3}{4}\cos x$ From $u_1'\cos x+u_2'\sin x = 0$, we get $u_2=\frac{1}{12}\sin(3x)-\frac{3}{4}\sin x$ The particular solution $y_p=u_1\cos x + u_2\sin x$ $y_p=-\frac{1}{12}\cos(3x)\cos x+\frac{3}{4}\cos^{2}x+\frac{1}{12}\sin(3x)\sin x-\frac{3}{4}\sin^{2}x$ Using the cosine of the difference formula $\cos(A - B)=\cos A\cos B+\sin A\sin B$, $y_p=-\frac{1}{12}\cos(2x)+\frac{3}{4}(\cos^{2}x-\sin^{2}x)=-\frac{1}{12}\cos(2x)+\frac{3}{4}\cos(2x)=\frac{2}{3}\cos(2x)$ The general solution $y = y_c + y_p=C_1\cos x+C_2\sin x-\frac{1}{2}+\frac{1}{6}\cos(2x)$
Answer:
$y = C_1\cos x+C_2\sin x-\frac{1}{2}+\frac{1}{6}\cos(2x)$