\(A=x\left(x-9y+1\right)+3y\left(x+3y-1\right)-2\)
\(=x^2-9xy+x-3xy+9y^2-3y-2\)
\(=x^2-6xy+x+9y^2-3y-2\)
\(=\left(x^2-6xy+9y^2\right)+\left(x-3y\right)-2\)
\(=\left(x-3y\right)^2+\left(x-3y\right)-2\left(1\right)\)
Thay \(x-3y=5\) vào \(\left(1\right)\) ta được:
\(A=5^2+5-2=25+5-2=28\)