My discrete mathematics book has the following problem:
22. Determine whether each of these functions is a bijection from $\mathbb{R} \to \mathbb{R}.$
c) $f (x) = \frac{x + 1}{x + 2}$
Since one element of the domain doesn't have an image, namely when $x = -2$, is $f(x) = \frac{x + 1}{x + 2}$ even 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.