Is $f(x) = (x + 1)/(x +2)$ a function?
The mapping you specify cannot be a function $\mathbb{R}\rightarrow\mathbb{R}$ since is it not defined for $x=-2$ It is injective on its domain but not onto since the equation $f(x) = 1$ is insoluable. It is, however a bijection from $\mathbb{R}-\{2\}$ to $\mathbb{R}-\{1\}$.
Specification of a function must include a domain and codomain. This example here shows why you must do that.
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?