a)
\(2x\left(9-x\right)+\left(2x+5\right)\left(x+1\right)\\ =18x-2x^2+2x^2+5x+2x+5\\ =25x+5\\ =5\left(5x+1\right)\)
b)
\(\left(x-3\right)^2+\left(x+3\right)^2+2\left(3-x\right)\left(3+x\right)\\ =\left(3-x\right)^2+2\left(3-x\right)\left(3+x\right)+\left(3+x\right)^2\\ =\left[\left(3-x\right)+\left(3+x\right)\right]^2\\ =6^2=36\)