Function notation to relate Domain and Range I was solving some functions problems and those exercises asked for stating the domain and range of the functions. In this process, I had my doubts about the function notation. I would like something to relate the Domain and Range. Considering the function $f$ I've seen notations like $\text{Dom}(f)$ and $\text{Ran}(f)$, but I would like an alternative to this.
Take the example
$$f(x)=\frac{4-t^2}{2-t}=\frac{(2-t)(2+t)}{2-t}=2+t$$
Once $t\neq2$, the domain is $(-\infty, 2)\cup(2, \infty)$. The range is $t\neq4$, which is the point $(2, 4)$, where the function is undefined. Therefore, $\text{Dom}(f)=\mathbb{R}-\{2\}$ and $\text{Ran}(f)=\mathbb{R}-\{4\}$. The example given is $f:\mathbb{R}-\{2\}\to \mathbb{R}$, and here is my doubt.
Once $f:A\to B$, where the domain is A and codomain B. I know that the difference between Codomain and Range is that Codomain contains elements that might be the imagens, and Range is exactly the images produced. Therefore, $\text{Range}\subseteq \text{Codomain}$.
Taking the example again, I can say $f(\mathbb{R}-\{2\})=\mathbb{R}-\{4\}$, but are there something wrong with $f:\mathbb{R}-\{2\}\to \mathbb{R}-\{4\}$? I can't use this that way? I found that way very straight. I would like to know/undertand better and improve my math notation, so recommendations and corrections are welcome.
 A: Let $A$ and $B$ be sets. The notation $f:A\to B$ says precisely that $f$ is a function whose domain is $A$ and whose codomain is B. This, so far, says nothing about the range (or image) of $f$. It is common to refer to the range of $f$ as the image of $f$, and denote it by $\text{im}(f)$. As you said, the image of $f$ is a subset of the codomain of $f$. Now, if you let $S\subset A$ be some subset, then we define
$$
f(S)=\{f(s)\in B:s\in S\}.
$$
In other words, $f(S)$ is the set of all outputs of $f$ when applying $f$ to every element of $S$. Note that $f(S)$ is a set. So if you say $f(S)=R$ for some $S\subset A$ and some $R\subset B$, then this means that when you apply $f$ to every element of $S$, you obtain the set $R$. Note that this is not the same thing as saying that $f$ is a function from $S$ to $R$. I hope this helps.
A: It depends on context.
When you are first learning to find the range of an expression like $(4-t^2)/(2-t)$, then it is likely that no one is focused on the codomain. In that case, then you could write something like "We may consider $f$ as a function $f:\mathbb R-\{2\}\to\mathbb R-\{4\}$."
But if you are discussing the codomain, or care about whether the function is surjective/onto (全射的), then you shouldn't change the codomain. If you are told "the codomain of $f(t)=(4-t^2)/(2-t)$ is $\mathbb R$" or "the codomain of all functions under discussion is $\mathbb R$", then all you are allowed to say are things like "The range/image of $f$ is $\mathbb R-\{4\}$" and "we can define a new function $g:\mathbb R-\{2\}\to\mathbb R-\{4\}$ given by $g(t)=f(t)$.".
