Finding the General Solution
To solve the differential equation \( x \frac{dy}{dx} + y = x^2 \sin x \), we’ll follow a systematic approach to separate the variables and simplify.’
Step 1: Rearranging the Equation
We start by rearranging the given differential equation to isolate \( \frac{dy}{dx} \). First, we can move \( y \) to the right side:
x \frac{dy}{dx} = x^2 \sin x - y
Next, divide both sides by \( x \) (assuming \( x \neq 0 \)):
\frac{dy}{dx} = x \sin x - \frac{y}{x}
Step 2: Identifying the Integrating Factor
This can be recognized as a linear first-order differential equation in the standard form:
\frac{dy}{dx} + P(x)y = Q(x)
where \( P(x) = -\frac{1}{x} \) and \( Q(x) = x \sin x \).
To solve it, we need an integrating factor, which is given by:
\mu(x) = e^{\int P(x)dx} = e^{-\ln |x|} = \frac{1}{x}
Step 3: Applying the Integrating Factor
Multiply both sides of the equation by the integrating factor \( \mu(x) \):
\frac{1}{x} \frac{dy}{dx} - \frac{y}{x^2} = \sin x
Next, this can be written as:
\frac{d}{dx}\left(\frac{y}{x}\right) = \sin x
Step 4: Integrating Both Sides
Now we integrate both sides:
\int \frac{d}{dx}\left(\frac{y}{x}\right)dx = \int \sin x dx
Solving the right-hand side yields:
\frac{y}{x} = -\cos x + C
Step 5: Isolating y
Multiplying everything by \( x \) to isolate \( y \) gives us the general solution:
y = -x \cos x + Cx
Where \( C \) is the constant of integration.
Final Result
The general solution of the differential equation \( x \frac{dy}{dx} + y = x^2 \sin x \) is:
y(x) = -x \cos x + Cx, \quad C \in \mathbb{R}.