What is a function?
A popular definition, which can be directly mapped to set theory, is that a function is a set of input / output pairs. E.g.:
$f(x) = \frac{x + 1}{x + 2}$
could represent the set of pairs:
- (-1, 0)
- (0, 1/2)
- (1, 2/3)
But it could also represent the set of pairs:
- (0, 1/2)
- (1, 2/3)
- (2, 3/4)
Both of these are two completely different functions.
Morale: a formula like $f(x) = \frac{x + 1}{x + 2}$ is not a function.
A formula + a domain ($\mathbb{R}-\{2\}$ here) may represent a function if the formula is well defined over the domain.
But what a function really is, is the a set of pairs. You just have to come up with method that clearly describes that set of pairs.
For your specific case, you could take the domain as $\mathbb{R}-\{2\}$ and the set of points is specified.
Furthermore, you could also add a new pair (-2, 1234)
to the function, and you'd have a function defined over $\mathbb{R}$.
Also worth noting: in this case we cannot make the function continuous by choosing any value at -2
, but in some cases we can. E.g.:
$f(x) = \frac{x}{x}$
can be made continuous at 0 by adding the pair (0, 1).
The big advantage of such a set theoretical definition is that it can be used easily in formal proof systems: What does "formal" mean?