# Is it always valid to cancel something like (x-2) in the numerator and denominator of a rational function?

What is the difference between $f(x) = \dfrac{(x + 2)(x - 2)}{x (x - 2)}$ and $g(x) = \dfrac{x + 2}{x}$? Can you always cancel the (x - 2) factor? Isn't an asymptote lost when that is done? When I evaluate it at $x=2$ with a computer, like Wolfram Alpha or something, the software always seems to cancel and then evaluate. That's why I'm confused. I would think it should be undefined.

Edit: Actually, I should have used the term "undefined point" rather than "asymptote". What I'm actually interested in is the derivative. Does the derivative have to preserve this undefined point or not? It seems to me that I should preserve the $(x-2)$ when calculating the derivative in order to preserve the undefined point, but the computer invariably cancels it.

-
Re edit: yes, removable singularities in a function can be inherited by a derivative. Have your favorite computing environment compute the derivative of $\frac{(x+2)(x-a)}{x(x-b)}$ and then replace $b$ with $a$ (or vice-versa) for instance, to trick your environment into not cancelling the common factors. – J. M. Jul 28 '11 at 15:00

The function $f(x)$ is indeed undefined when $x = 2$.

However, $f(x)=g(x)$ when $x \ne 2$. So except at the point $x=2$, the curves $y=f(x)$ and $y=g(x)$ are geometrically identical. In particular, no asymptote is lost in going from $f(x)$ to $g(x)$.

The only difference between $y=f(x)$ and $y=g(x)$ is that the curve $y=f(x)$ has a "hole" of $0$ width at $x=2$. If you plot the two curves, the difference will be invisible, whatever the magnification.

A reasonable argument can be made that software should quietly forget about the fact that $f(x)$ has a singularity at $x=2$, and give $f(2)$ the value $g(2)$. I cannot imagine any real situation where this would cause a problem. Indeed, treating $f$ as undefined at $x=2$ in this case could cause a perfectly valid computation to hang when it shouldn't. (I am not counting a high school test as a real situation.)

-
Small typo in your answer. ($f$ is undefined when $x=2$) – Manos Jul 28 '11 at 14:41
To add: the singularity in the OP's $f(x)$ is what would be termed a removable singularity, since a new function $h(x)$ can be defined that is the same as $f(x)$ if $x\neq 2$ and is equal to $2$ if $x=2$, which is now continuous (and in fact with this, $h(x)=g(x)$). A nontrivial example of a function with a removable singularity would be the "sine cardinal", $\mathrm{sinc}(x)=\sin(x)/x$. – J. M. Jul 28 '11 at 14:43
@Manos: Typo fixed – TonyK Jul 28 '11 at 14:45
@TonyK: Thanks for the fix. Although the typo was small, the difference in meaning was very large. – André Nicolas Jul 28 '11 at 14:54
So would you say that this is kind of a pathological use of mathematical notation to express that the domain of the function is $x \neq 2$? – Matt Gregory Jul 28 '11 at 15:27

The answer depends on what kind of mathematical objects $f$ and $g$ are:

1. Formal rational functions, that is $f$ and $g$ are elements of the field of fractions of the polynomial ring in the variable $x$ over some field -- here the real numbers I guess. In this case $f$ and $g$ are equal.

2. Functions on some set -- here a subset of the reals I guess. Then $f$ and $g$ are different functions because $f$ is not defined at $2$, hence the domains of definition of the two functions do not coincide. However there is a unique extension of $f$ that is defined at $2$ and is a rational function. This extension is $g$.

-

This question has been well answered. I thought it might help, however, to graph both functions and compare the graphs:

$f(x) = \displaystyle\frac{(x+2)(x-2)}{x(x-2)}$ looks like:

Note the hole in the graph of $f(x)$ at $x = 2$. On the other hand, $g(x) = \displaystyle\frac{x+2}{x}$ looks like:

.

-