Given, $$\frac{dy}{dx} = yx \sin(x), \text{ when }y(0) = 1/4.$$
What I did is first, separate the equation $$ \frac{dy}{y} = x \sin (x) dx. $$ Second, integrate by parts $$ \ln |y| + C1 = -x \cos (x) + \sin (x) + C2 \Rightarrow C3 = C2-C1.$$ Third, left |y| alone $$|y| = e^{-x \cos (x) }+ e^{\sin(x)} + e^{C3}.$$ Fourth, inserted the values $$y(0) = 1/4 \Rightarrow 1/4 = 1 + 1 + e^{C3} \Rightarrow -1.75 = e^{C3} \Rightarrow \ln (-1.75) = \ln e^{C3}. $$ Here, since negative doesn't work inside ln ( ) I think there is something wrong with my solution. Can anyone help me with how I should approach this question?
Thank you!
you can separate as $$\ln(4y) = \ln y - \ln (1/4)=\int_{1/4}^y \frac{dy}{y} = \int_0^x x \sin x \, dx = -x\cos x\big|_0^x + \int_0^x \cos x \, dx = - x\cos x+\sin x$$
so $$y = \frac 1 4e^{\sin x - x\cos x} $$