Find the general solution of the differential equation \[ x \frac{dy}{dx} + 2y = x^2 \,\,\, \text{where} \,\,\, (x \neq 0). \]
Step 1: Write the equation in standard form.
The given equation is:
\[
x \frac{dy}{dx} + 2y = x^2.
\]
We divide the entire equation by \( x \) to simplify it:
\[
\frac{dy}{dx} + \frac{2}{x} y = x.
\]
This is a linear first-order differential equation of the form:
\[
\frac{dy}{dx} + P(x) y = Q(x),
\]
where \( P(x) = \frac{2}{x} \) and \( Q(x) = x \).
Step 2: Find the integrating factor.
The integrating factor \( \mu(x) \) is given by:
\[
\mu(x) = e^{\int P(x) dx} = e^{\int \frac{2}{x} dx} = e^{2 \ln|x|} = |x|^2.
\]
Step 3: Multiply through by the integrating factor.
Multiplying the entire equation by \( |x|^2 \), we get:
\[
x^2 \frac{dy}{dx} + 2x y = x^3.
\]
Step 4: Simplify the equation.
The left-hand side is the derivative of \( x^2 y \), so we have:
\[
\frac{d}{dx} (x^2 y) = x^3.
\]
Step 5: Integrate both sides.
Integrating both sides with respect to \( x \), we get:
\[
x^2 y = \int x^3 dx = \frac{x^4}{4} + C,
\]
where \( C \) is the constant of integration.
Step 6: Solve for \( y \).
Thus, the general solution is:
\[
y = \frac{x^4}{4x^2} + \frac{C}{x^2} = \frac{x^2}{4} + \frac{C}{x^2}.
\]
Step 7: Conclusion.
The general solution to the differential equation is:
\[
y = \frac{x^2}{4} + \frac{C}{x^2}.
\]