I'm trying to understand why it is that we can say $\frac{x^2-1}{x-1} = \frac{(x-1)(x+1)}{(x-1)} = x+1$ but then have it also be the case that the two functions $f(x) = \frac{x^2-1}{x-1}$ and $g(x)=x+1$ are not equal, since $f$ is undefined when $x=1$.
That is, if it is true that $\frac{x^2-1}{x-1} = x+1$ then why can we not just simplify and say that $f(x)=x+1$ so that $f(1) = (1) + 1 = 2$ ?
A lot of these kinds of issues clear up if we go that extra step by making our assumptions clear. For example:
(Please comment if you do not know what this notation means.)
As you can no doubt see, this is a little messy. A sleek modern way to avoid this messiness is by working syntactically; we view rational expressions, not as functions, but as elements of $\mathbb{Q}(x)$, which consists of equivalence classes of formal expressions, and forms a field in its own right. See also, polynomial ring and field of fractions. If you've never seen these ideas before, the wikipedia articles probably won't make a lot of sense, so maybe try googling for some PDF's, or take a look on youtube. Keep at it till you "get" it! Try to understand the following terms, in this order:
By the way, the "solution" to this messiness mentioned in Rory Daulton's answer could perhaps be made to work, but as its given, it really doesn't. I quote:
The problem is that, for example, $x=x$ is a true under this definition, but $xyy^{-1}=x$ is not, since the left-hand-side is ill-defined for infinitely many points $(x,y)$. Contrast this with what happens in $\mathbb{Q}(x,y)$, where both $x=x$ and $xyy^{-1}=x$ are genuinely true. Nonetheless, I think a variant on this idea could be made to work; please comment, dear reader, if you have any thoughts on the issue.