\(x.f'\left(x\right)-f\left(x\right)=x^2\)
\(\Leftrightarrow\frac{1}{x}f'\left(x\right)-\frac{1}{x^2}f\left(x\right)=1\)
\(\Leftrightarrow\left(\frac{f\left(x\right)}{x}\right)'=1\Rightarrow\frac{f\left(x\right)}{x}=x+C\)
Thay \(x=1\Rightarrow\frac{f\left(1\right)}{1}=1+C\Rightarrow0=1+C\Rightarrow C=-1\)
\(\Rightarrow\frac{f\left(x\right)}{x}=x-1\Rightarrow f\left(x\right)=x^2-x\Rightarrow f\left(-2\right)=6\)