$$ xy'-3y=x^2 $$
$$ xy_H'-3y_H=0 $$
$$ xy_H'=3y_H $$
$$ \frac{ 1 }{ y_H } y_H'=3 \frac{ 1 }{ x } $$
$$ \int \, \frac{ 1 }{ y_H } dy =3 \int \frac{ 1 }{ x } dx$$
$$ \ln \, y_H =3 \ln{ x } +C^{**}$$
$$ \ln \, y_H = \ln{ x^3 } +C^{**}$$
$$ y_H = x^3 \cdot C^{*}$$
---
$$ y_P = x^3 \cdot C(x)$$
$$ y'_P = 3 x^2 \cdot C(x)+x^3 \cdot C'(x)$$
---
$$ xy'-3y=x^2 $$
$$ x( 3 x^2 \cdot C(x)+x^3 \cdot C'(x))-3( x^3 \cdot C(x))=x^2 $$
$$ 3 x^3 \cdot C(x)+x^4 \cdot C'(x)-3 x^3 \cdot C(x)=x^2 $$
$$ x^4 \cdot C'(x)=x^2 $$
$$ C'(x)=x^{-2} $$
$$ C(x)=-x^{-1} $$
$$ y_P = x^3 \cdot C(x)$$
$$ y_P = x^3 \cdot (-x^{-1})$$
$$ y_P = -x^2$$
---
$$y(x)=y_H+y_P$$
$$y(x)=x^3 \cdot C -x^2$$