To find the general solution of the differential equation x dy/dx + y = x^2 sin(x), we start by rearranging the equation:
dy/dx + (y/x) = x sin(x)
This is a first-order linear ordinary differential equation, which can be solved using the integrating factor method.
First, we identify the integrating factor, μ(x), given by:
μ(x) = e^(∫(1/x) dx) = e^(ln|x|) = |x|
We can drop the absolute value for the integrating factor since we are interested in the solution for x > 0:
μ(x) = x
Next, we multiply the entire differential equation by the integrating factor:
x(dy/dx) + y = x^2 sin(x)
Now, using the integrating factor, we can rewrite the left-hand side as:
d/dx (xy) = x^2 sin(x)
Next, we integrate both sides of the equation:
∫d(xy) = ∫x^2 sin(x) dx
Using integration by parts for the right-hand side:
Let u = x^2 and dv = sin(x) dx. Then, we find:
du = 2x dx and v = -cos(x)
Now applying integration by parts:
∫x^2 sin(x) dx = -x^2 cos(x) + ∫2x cos(x) dx
Again, we apply integration by parts to ∫2x cos(x) dx:
Let w = 2x and dz = cos(x) dx. Then:
dw = 2 dx and z = sin(x)
Calculating:
∫2x cos(x) dx = 2x sin(x) – ∫2 sin(x) dx
Integrating ∫2 sin(x) dx, we have:
∫2 sin(x) dx = -2 cos(x)
Putting it all together:
∫x^2 sin(x) dx = -x^2 cos(x) + 2x sin(x) + 2 cos(x) + C
Now substituting back to our earlier equation:
xy = -x^2 cos(x) + 2x sin(x) + 2 cos(x) + C
Finally, we solve for y:
y = -x cos(x) + 2 sin(x) + rac{2}{x} cos(x) + rac{C}{x}
This represents the general solution of the given differential equation.