I am studying the simplification of polynomial fractions. My textbook has the example of:

$\displaystyle \dfrac{2x+6}{x^2-9} = \dfrac{2}{x-3}$ : factored out (x+3) from the numerator and denominator

My confusion is over the sense of 'equality' of the 2 expressions. I expected to be able to use either expression interchangeably as the definition for a function. However,

$\displaystyle \ f(x) = \dfrac{2x+6}{x^2-9}$ is undefined for x = { 3, -3 }

$\displaystyle \ f(x) = \dfrac{2}{x-3}$ is undefined for x = { 3 }

The domains of the functions differ. It appears that 'information' was lost in the simplification of the original expression.

Are the 2 expressions not really "equal"? Am I misunderstanding something about the concept of equality with regard to expressions?