# Equality of functions

How a function which is not defined for some value can be equal to a function which is defined for the same value? How is $f(x) = \frac{(x-2)(x-3)}{(x-2)(x-4)}$ equal to $g(x) = \frac{(x-3)}{(x-4)}$ when their domains are different?

• I would agree that they are not equal. Although they are equal at any value where they are both defined. Dec 16 '14 at 18:08
• You need to be precise what you mean. In some contexts they are equal in other contexts they are not equal. Sometimes people also are just sloppy.
– quid
Dec 16 '14 at 18:10
• When I put them into wolfram alpha to test for equality it says that they are equal. Also, I know that simplifying yields to an equivalent fraction. Dec 16 '14 at 18:10

The actual problem is that what you wrote there are not the functions, but just two terms varying by a certain parameter.

In order to call those a function, you have to define the domain, which would look like this:

$$f: \mathbb{R}\setminus\{2, 4\}\rightarrow \mathbb{R}, x \mapsto f(x) := \frac{(x-2)(x-3)}{(x-2)(x-4)}\\ g: \mathbb{R}\rightarrow \mathbb{R}, x \mapsto g(x) := \frac{(x-3)}{(x-4)}\\$$ Now, $f\ne g$, but it equals the restriction of g to the domain of f: $f = g|_{\mathbb{R}\setminus \{2, 4\}}$

EDIT: Let me explain a bit more about how to compare terms and functions regarding equality.

• Functions are defined as relations with certain properties (uniqueness & definedness of the argument): $f: A\rightarrow B, x\mapsto f(x) :\Leftrightarrow f := \{(x, y)\in A\times B|y = f(x)\}$, which has to hold $\forall x\in A\exists!y\in B: (x, y)\in f$ as the defining property of a function.

• If two functions are equal is therefore just a question of comparing two sets. It holds if both contain exactly the same elements $(x, f(x))$. Thus, they must have the same domain.

• When comparing two expressions regarding equality, one has to be careful as well: Let $f(x), g(x)$ be expressions. $f(x) = g(x)$ would not be a logical statement, because We do not know what x is — therefore, we have to give an explicit x or quantorize it: $$\forall x: f(x) = g(x)$$ Because a quantorization without limiting x to a certain set (let's say $\mathbb{R}$) would only make sense if we would concern f(x) = g(x) = x, which would allow x to be something else than a number, you have to give a domain in some way as well. For instance, let $f(x) := \frac{x-1}{x-1}, g(x) := 1$: $\forall x\in M: f(x)=g(x)$ would hold true for M = $\mathbb{R}\setminus \{1\}$, but not for $\mathbb{R}$, because there is no $f(x)$ at $x=1$.

• What do I need in order to compare the two functions? I mean which things(domain,codomain, etc) Dec 16 '14 at 18:26
• What do you mean by compare? Dec 16 '14 at 18:27
• To compare for equality. Dec 16 '14 at 18:28
• Well, a function is actually just a relation (a set of 2-tuples) with certain properties, more explicitly $f = \{x, f(x)\}$, which makes it just the comparison of two sets. Dec 16 '14 at 18:30
• The domain of the first function is R/{2}. When we do transformations on the first function to get the second we are dividing by (x-2) and "define" a new function g(x) equal to the previous but we restrict it's domain to R/{2}? Because if we let the domain to be R then they are not equal functions? Am I right? Dec 16 '14 at 18:33

They are not. You can only say they assume the same values in the intersection of their domains, that is: $$f|_{D(f) \cap D(g)} = g|_{D(f) \cap D(g)}.$$

This answer assumes the definition: two functions $$f:A \to B$$ and $$g:C \to D$$ are equal if: $$A = C$$, $$B = D$$ and $$f(x) = g(x)$$ for all $$x \in A = C$$.

• What is $D(f)$?
– quid
Dec 16 '14 at 18:11
• Here I meant the domain of $f$. Could be ${\rm dom} (f)$, too :) Dec 16 '14 at 18:12
• How is that defined?
– quid
Dec 16 '14 at 18:12
• The Domain of f. For $f: A\rightarrow B$, $D(f) = A$. Dec 16 '14 at 18:12
• The problem is that OP didn't specify the exact domains in the problem. So we just assume that it's the largest domain possible for each function. I added in my answer the definition of equality of functions I'm assuming. Dec 16 '14 at 18:16

The reason we can't check functions for equality is because: 1. It reduces to The Halting Problem 2. Functions tend to have an infinite set of inputs, and as others have mentioned, checking functions for equality is a question of comparing two sets.

But we could try to force both expressions to have the same format, then check symbol by symbol, I suppose.

• Welcome to Stack Exchange! It's true that equality of functions is not generally decidable, but I don't see how that's related to the question. Oct 16 '19 at 0:53