\(9\left(x^2+1\right)-6\left(x^2+1\right)\)
\(=\left(9-6\right)\left(x^2+1\right)\)
\(=3\left(x^2+1\right)\)
\(9+\left(x^2+1\right)-6\left(x^2+1\right)\)
\(=\left(x^2+1\right)\left(1-6\right)+9\)
\(=\left(x^2+1\right)\left(-5\right)+9\)
\(=9-5\left(x^2+1\right)\)