\(\frac{x^4+6x^3+9x^2-1}{x^4+6x^3+7x^2-6x+1}=\frac{\left(x^2\right)^2+2.x^2.3x+\left(3x\right)^2-1}{\left(x^2\right)^2+2.x^2.3x+\left(3x\right)^2-2x^2-6x+1}\)
\(=\frac{\left(x^2+3x\right)^2-1}{\left(x^2+3x\right)^2-2\left(x^2+3x\right)+1}\)
\(=\frac{\left(x^2+3x-1\right)\left(x^2+3x+1\right)}{\left(x^2+3x-1\right)^2}=\frac{x^2+3x+1}{x^2+3x-1}\)