# What happens to a function when it is undefined?

If I have the function

$$f(x) = {x^2 - 2 \over x + \sqrt 2}$$

this is undefined for $x = -\sqrt 2$, am I correct? Since the denominator would be zero.

But the numerator is a difference of squares $x^2-2=(x - \sqrt 2)(x+\sqrt 2)$.

Now the second factor is equal to my denominator, so those cancel and I am left with $(x - \sqrt 2)$, and this is defined at $x=-\sqrt 2$, is it not? If I put $x = -\sqrt 2$, the result is simply $-\sqrt 2 - \sqrt 2=-2\sqrt 2$. What am I doing wrong here?

-
The two functions agree except at $-\sqrt{2}$, where one is defined and the other is not. So technically they are not (exactly) the same. However, for certain purposes they may be regarded as being the same, it is a matter of convention. For example in "trig identities" we by convention shut our eyes to such subtleties. –  André Nicolas Aug 26 at 20:28
what would be intresting is if you find the limit as $x\to-\sqrt{2}$ –  Gobabis Aug 26 at 20:44
@Gobabis it's not clear that the op knows what a limit is. He/she appears only to be asking about questions of well-definition/deciding what the domain is. –  Adam Hughes Aug 26 at 20:50
@ Adam yep I see what you are saying –  Gobabis Aug 26 at 20:53
as I understand it you are trying to determine continuity? –  Gobabis Aug 26 at 21:23

When you cancel a factor from the numerator with one in the denominator, you are saying that the ratio of the two is the same as the number one. This is true unless the two factors you happen to be cancelling are both zero. In this case the ratio is not one, it is undefined. So technically the ratio you obtain is $x-\sqrt{2}$ if $x \ne -\sqrt{2}$.

-
So if I plotted my function, would it matter in which "form" I wrote it? Also, would it be undefined at x = -sqrt(2), and how would it behave around that point? I am a bit unsure because sqrt(2) is an irrational number, so it's not a specific point, is it? –  Daniel Aug 26 at 20:33
@Jona If you plot your original function, it would be the same everywhere except at $x=-\sqrt{2}$. Since it is not technically defined there, you just draw a little hole in your graph--which looks like a line everywhere else. –  Adam Hughes Aug 26 at 20:51
All right, I seem to be getting it now. One more question; if I had an approximation of the square root of 2, as opposed to the square root of two itself, then the point at which my graph would be undefined would be the negative of that approximation, right? So if I replace squareroot of 2 with 1.4142, then my function would be undefined if x = -1.4142.... but what I notice is that the function behaves really odd just around this point, much like the graph of 1/x...but this wasn't the case when I had the squareroot of two in the function. Why is there a difference between these two? –  Daniel Aug 26 at 21:03
Is it because squareroot of two is an irrational, "infinite" number, so you can't really get "close enough" to it for the graph of the function to "jump" off in two directions just around the undefined point like it does if I replace squareroot of two with a (finite) approximation? That's at least what I intuitively reasoned. –  Daniel Aug 26 at 21:04
Mathematically, there's not really much difference between $f(x)=\frac{x-\sqrt{2}}{x-\sqrt{2}}$ (whose domain is $\mathbb{R} \setminus \{ \sqrt{2} \}$) and $f(x)=\frac{x-1}{x-1}$ (whose domain is $\mathbb{R} \setminus \{ 1 \}$). Both are functions which are $1$ everywhere they are defined, and are defined at all but one real number. Depending on how you try to plot these with a computer or calculator, you may get different results, because $\sqrt{2}$ can't be represented exactly as a floating point number, whereas $1$ can. –  Ian Aug 26 at 21:11

It is important to realise what you are doing when we say that a common factor "cancels" from the numerator and denominator. We are actually dividing both the numerator and denominator by that common factor. As you have already pointed out: you can't divide by zero.

It is true that $$\frac{x^2-2}{x+\sqrt{2}} \equiv \frac{(x-\sqrt{2})(x+\sqrt{2})}{x+\sqrt{2}}$$

Neither the left hand side, nor the right hand side are defined when $x=-\sqrt{2}$. Both are indeterminate forms. However, if we assume that $x\neq -\sqrt{2}$ then we may divide both the numerator and the denominator by $x+\sqrt{2}$ to give $$\frac{x^2-2}{x+\sqrt{2}} = \frac{(x-\sqrt{2})(x+\sqrt{2})}{x+\sqrt{2}} = x-\sqrt{2}$$

The next step to understand this is the idea of the limit. If we take the limit as $x$ tends to $-\sqrt{2}$, we assume that $x \neq-\sqrt{2}$, but that it gets closer and closer. Even though the original function is not defined when $x = -\sqrt{2}$, we can look what happens to its value as $x \to -\sqrt{2}$. In that case we have $$\lim_{x \to -\sqrt{2}}\left(\frac{x^2-2}{x+\sqrt{2}}\right) = \lim_{x \to -\sqrt{2}}\left(\frac{(x-\sqrt{2})(x+\sqrt{2})}{x+\sqrt{2}}\right) = \lim_{x \to -\sqrt{2}}\left(x-\sqrt{2}\right) = -2\sqrt{2}$$

-

The first answer: functions are never undefined. It's kind of a loaded word: don't talk about something undefined, because, then what are we talking about? What is undefined is an expression in $x$'s and $y$'s that tell you about a function; an expression that doesn't know how to define a function everywhere.

So we need to talk about how to go from an expression like $\frac{xy^2}{3xy}$ to a function.

And the actual, honest answer is there's a couple ways to do that. Mathematics educators picked one, and that's the one you're learning, but congratulate yourself: you got confused exactly where they were brushing something under the rug. That actually makes you pretty sharp, it's like knowing what you don't know better than anyone else.

To be rigorous, since mathematicians like making everything rigorous:

• recall from a seemingly irrelevant chapter in your algebra textbook that a relation is a set of points $(x,y)$ where $x$ and $y$ are real numbers (they can be anything, and $x$ and $y$ don't even have to be the same kind of thing, but in high school algebra or calculus you probably mean real numbers). We say $\mathbb{R}^2$ to mean ordered pairs of real numbers. For instance, the set containing $(1,2)$ is a relation, and the set of all points $\{(x,y) \in \mathbb{R}^2: y = 2x\}$ is a relation (The colon may be read "where", "such that", "having", "with", etc. $\in$ means "in").
• A function is a relation where if $(x, y_0)$ and $(x, y_1)$ are two points in the relation (with the same $x$!), then $y_0 = y_1$. This is the vertical line test. So if you draw a graph, it's a relation since it specifies a set of points. It's a function if it satisfies the vertical line test.
• So now if we have a relation that happens to be a function, that relation will have a domain $D$ defined as the set $\{t: \exists(x,y) \in R$ where $x=t\}$. If you draw line segment from left to right on a graph, the domain will be all the values from the leftmost point to the rightmost point.
• Given a relation $R$ that is a function, and a point $x$ in its domain, we can write $R(x)$ to mean "the unique $y$ value in the relation with that $x$ value".

So this is all a bunch of mathematical garble, but it's really relevant to this. So my question is: What does a function like $f(x) = 2x$ have to do with the above explanation?

When you write $$f(x) = 2x$$

You are saying:

1. there is a relation where each $y$ value is $x$. Or $\{(x,y): y = 2x\}$. The domain is then all of $\mathbb{R}$, since for every $x \in \mathbb{R}$, there is a point $y$ that puts $(x,y)$ smack in that relation.
2. You're also saying that that relation is a function. But you believe that if $a = b$ then $2a = 2b$, so it's pretty obvious that it is.

Yes, that is a lot of mumbo jumbo for one short equation, but in math sometimes if you get confused you have to think about what is figuratively going on here.

If you write

$$f(x) = \pm \sqrt{x}$$

Then you have just defined a relation that is $not$ a function. $f(4) = \pm 2$, which we read as "or". Since $f(4)$ can give you one thing or the other thing, you're talking about a relation that fails the vertical line test, not a function.

Now for your example: what about something like $$f(x) = 1/x$$ This would mean $\{(x,y): y = 1/x\}$. If you have a $y$ where $y = 1/x$, in particular you may multiply each side by $x$ to determine that $xy = 1$. So $x$ is definitely $not$ zero, because $1 \neq 0$. That means the domain of this function does $not$ include 0.

Next up: $f(x) = x/x$. This is a little trickier, because there's actually two perfectly valid things you could do here, and the mathematics where you just cancel first is the mathematics of $\mathbb{R}[x]$, which many mathematicians find very interesting.

In your class we do something backwards:

1. See an expression like $f(x)/g(x)$.
2. Admit it's actually rude to write something down like $x/y$ on paper, without even talking when we plan to do that division, since $y$ might be zero.
3. Try to backpedal out of our offensiveness, and say you only meant that when $g(x) \neq 0$.
4. Agree that is the function we are talking about.

So when you try to cancel in a function like $x/x$, Figure out the function you meant first, because that's the rule. I sort of hate this because I think it's confusing to talk about "defining" something then figuring out where it's "defined". That's why I'm encouraging you to think of starting with an expression (To be rigorous? A rational polynomial, $\in \mathbb{R}(x)$) and figuring out what function we have, by convention, decided that expression refers to.

I can think of at least four other options.

1. Cancel everything first, then figure out the domain. This is what you are proposing. It is much more similar to what an algebraic geometer would do. It's perfectly valid mathematically. It's just a different convention than you use. I will tell you though: the reason this works is very deep and relies on the fact you can factor polynomials uniquely much like you can factor numbers like $70=2*5*7$ uniquely.
2. The calculus perspective: do it the long way above, then replace any replaceable discontinuities. For deep reasons this is the same as (1).
3. The projective geometry perspective: just admit that dividing by zero is totally reasonable, and it gives you $\infty$. ($\pm \infty$ are the same things of course, because the world lives on a sphere, to a projective geometer.)
4. All of these methods yield a function. Why not just define the mostly equivalent relation $\{(x,y) : x*g(x) = f(x)\}$? In particular $f(x) = x/x$ would turn to $\{(x,y): xy=x\}$, where if $x = 0$, $y$ throws a party. (Exercise: graph this relation. See that it fails the vertical line test).

After studying algebra in college, I actually think worrying about the domain first is stupid. To me, the numerator and denominators are both polynomials and can be multiplied and divided as freely as numbers can. I would prefer to cancel then see where it makes sense to talk about a function. In other words I would like to do it your way. But it's wrong to argue about with your teacher which way to do it, and right to learn both ways and stick to the way you're taught while in the classroom or taking an AP exam. When you get to a graduate algebra course, be prepared to switch gears.

-
Although this answer is mostly correct, you neglected to mention that there is a perfectly valid and systematic way to interpret expressions like $x/x$ that give the "correct" domain, in this case $\Bbb R\setminus\{0\}$, which is quite similar to the algebraic approach. Treat atoms like $3$ and $x$ as functions on $\Bbb R$, and the operations $+,-,\cdot$ are operations on functions which intersect the domains of the constituents, and $/$ is an operation on functions such that the domain of $f(x)/g(x)$ is the set of points in the domain of both functions such that $g(x)\ne0$. –  Mario Carneiro Sep 25 at 23:12