TeX source:
\dfrac{b^2-9a^2}{b^2+6ba+9a^2} = \dfrac{\left(b-3a\right)\left(b+3a\right)}{\left(b+3a\right)^2} = \dfrac{b-3a}{b+3a}