Solve Differential E95788
1. **State the problem:** Solve the differential equation $$y(x \tan x + \ln y) \, dx + \tan x \, dy = 0.$$\n\n2. **Rewrite the equation:** The given equation is $$y(x \tan x + \ln y) \, dx + \tan x \, dy = 0.$$\nWe can write it as $$M(x,y) \, dx + N(x,y) \, dy = 0$$ where $$M = y(x \tan x + \ln y)$$ and $$N = \tan x.$$\n\n3. **Check if the equation is exact:** Compute partial derivatives:\n$$\frac{\partial M}{\partial y} = x \tan x + \ln y + 1$$\n$$\frac{\partial N}{\partial x} = \sec^2 x.$$\nSince $$\frac{\partial M}{\partial y} \neq \frac{\partial N}{\partial x},$$ the equation is not exact.\n\n4. **Try to find an integrating factor:** Notice that $$\frac{\partial M}{\partial y} - \frac{\partial N}{\partial x} = (x \tan x + \ln y + 1) - \sec^2 x.$$\nThis is complicated, so try an integrating factor depending on $$y$$: $$\mu(y) = \frac{1}{y}.$$\nMultiply entire equation by $$\frac{1}{y}$$:\n$$\frac{1}{y} y(x \tan x + \ln y) \, dx + \frac{1}{y} \tan x \, dy = (x \tan x + \ln y) \, dx + \frac{\tan x}{y} \, dy = 0.$$\n\n5. **Check exactness again:** Now, $$M = x \tan x + \ln y,$$ $$N = \frac{\tan x}{y}.$$\nCompute partial derivatives:\n$$\frac{\partial M}{\partial y} = \frac{1}{y},$$\n$$\frac{\partial N}{\partial x} = \frac{\sec^2 x}{y}.$$\nThey are not equal, so not exact yet.\n\n6. **Try integrating factor depending on $$x$$:** Let $$\mu(x) = \frac{1}{\tan x}.$$ Multiply original equation by $$\frac{1}{\tan x}$$:\n$$\frac{y(x \tan x + \ln y)}{\tan x} \, dx + dy = 0.$$\nRewrite $$M = y \left(x + \frac{\ln y}{\tan x}\right),$$ $$N = 1.$$\n\n7. **Check exactness:**\n$$\frac{\partial M}{\partial y} = x + \frac{\ln y}{\tan x} + \frac{1}{\tan x},$$\n$$\frac{\partial N}{\partial x} = 0.$$\nNot exact.\n\n8. **Try substitution:** Let $$z = \ln y \Rightarrow y = e^z,$$ then $$dy = y dz = e^z dz.$$\nRewrite original equation in terms of $$z$$:\n$$y(x \tan x + \ln y) \, dx + \tan x \, dy = e^z (x \tan x + z) \, dx + \tan x e^z \, dz = 0.$$\nDivide both sides by $$e^z$$:\n$$(x \tan x + z) \, dx + \tan x \, dz = 0.$$\n\n9. **Rewrite:** $$ (x \tan x + z) \, dx + \tan x \, dz = 0.$$\nThis is a linear differential equation in variables $$x$$ and $$z$$.\n\n10. **Express $$dz/dx$$:**\n$$\tan x \, dz = - (x \tan x + z) \, dx \Rightarrow \frac{dz}{dx} = -x - \frac{z}{\tan x}.$$\n\n11. **Rewrite as:** $$\frac{dz}{dx} + \frac{z}{\tan x} = -x.$$\nThis is a linear first-order ODE in standard form $$\frac{dz}{dx} + P(x) z = Q(x)$$ with $$P(x) = \frac{1}{\tan x}$$ and $$Q(x) = -x.$$\n\n12. **Find integrating factor:**\n$$\mu(x) = e^{\int P(x) dx} = e^{\int \frac{1}{\tan x} dx} = e^{\int \cot x dx} = e^{\ln |\sin x|} = |\sin x|.$$\n\n13. **Multiply both sides by $$\sin x$$:**\n$$\sin x \frac{dz}{dx} + z \cos x = -x \sin x.$$\nLeft side is derivative of $$z \sin x$$:\n$$\frac{d}{dx} (z \sin x) = -x \sin x.$$\n\n14. **Integrate both sides:**\n$$z \sin x = - \int x \sin x \, dx + C.$$\n\n15. **Integrate $$\int x \sin x \, dx$$ by parts:**\nLet $$u = x, dv = \sin x dx,$$ then $$du = dx, v = -\cos x.$$\n$$\int x \sin x dx = -x \cos x + \int \cos x dx = -x \cos x + \sin x + C.$$\n\n16. **Substitute back:**\n$$z \sin x = -(-x \cos x + \sin x) + C = x \cos x - \sin x + C.$$\n\n17. **Solve for $$z$$:**\n$$z = \frac{x \cos x - \sin x + C}{\sin x}.$$\n\n18. **Recall $$z = \ln y$$:**\n$$\ln y = \frac{x \cos x - \sin x + C}{\sin x}.$$\n\n19. **Final solution:**\n$$y = e^{\frac{x \cos x - \sin x + C}{\sin x}} = Ae^{\frac{x \cos x - \sin x}{\sin x}}$$ where $$A = e^{\frac{C}{\sin x}}$$ is an arbitrary constant (can be absorbed into $$C$$).