Let $f:\mathbb{R} \rightarrow\mathbb{R}$ defined by $f(x)=x^2$.

Let's, for instance, say that we want to know the deriviative of function $f$ at $x=2$, which is the limit of the function $g(h)=\dfrac{f(2+h)-f(2)}{h}$ as $h$ approches $0$.

I would like to know: formally - and in general, not only in the example of $f(x)=x^2$ - what is the domain and codomain of the function $g$?

Thanks.

-
Domain: the reals $\ne 0$, since you explicitly mentioned the reals. Codomain: Don't know, is that like cosine? –  André Nicolas May 15 '12 at 23:26
The range is $\mathbb{R}\setminus \{4\}$. –  copper.hat May 15 '12 at 23:35
@AndréNicolas: Codomain is a common word for the target of a map. I'm curious as to the term you use for it. –  Zev Chonoles May 15 '12 at 23:37
@ZevChonoles: Do not need a name. –  André Nicolas May 15 '12 at 23:45
@AndréNicolas: One has to know the codomain in order to determine if a function is surjective, for example. If $f:X\to Y$ with $f(X)=Z\subsetneq Y$, and you want to make a restriction in such a way that you get a surjection, how would you describe that? Or, perhaps more to the point, what are you restricting? –  Cameron Buie May 16 '12 at 0:45

Hint: $g(h)=\frac{h^2+4h}{h}=h+4$ (for $h\ne 0$)

-

For functions in general it depends on how picky you want to be. Certainly, Andre Nicolas mentioned it is undefined at $h=0$. It could also be that for some values of $h$, the quantity $f(2+h)$ is undefined, so those would not be in the domain of $g$ either.

The codomain is clearly going to be $\mathbb{R}$, if $f$ is a function with real outputs, and $h$ is constrained to be real.

If you mean "range" and not codomain, then that will vary based on $f$.

For your specific example, the only place where $g$ can be undefined is where $h=0$, since $x^2$ is defined everywhere else. The range, of $g$ in your case is all of $\mathbb{R}$ without $-4$.

-
Thanks for clarifying the difference between codomain and range, I did actually meant codomain in the sense you pointed out. –  Anonymous May 15 '12 at 23:49
The simplest way to think about it is that the domain of $g$ is everywhere where the expression is defined. Of course, if $f$ is defined on all of $\mathbb{R}$ then the only way the expression can become undefined is when $h = 0$, so the largest possible domain is $\mathbb{R} - \{0\}$. However, you don't actually need $g$ to be defined on such a large set; any deleted neighborhood of 0 (i.e. an open set $U$ with $0 \not\in U$ and $U \cup \{0\}$ also open) will suffice.
As for the codomain, it is $\mathbb{R}$. The range is a bit harder to compute, but it turns out to be $\mathbb{R} - \{4\}$ if we make $g$ defined on $\mathbb{R} - \{0\}$.
This is the answer I was looking for, thanks; Could you please explain why I could chose open set $U$ with $0 \not\in U$ and $U \cup \{0\}$(what does this mean?) as $g's$ domain? –  Anonymous May 15 '12 at 23:44
What I meant was that both $U$ and $U \cup \{0 \}$ should be open. Another way of saying this is $U = V - \{0\}$ for some open set $V$ containing $0$. To define the derivative of $f$ at 2, all you need is for $g$ to have a limit at $0$. But limits are a local property, so if all you want to do is define $f'(2)$, it doesn't matter whether $g$ is defined on $\mathbb{R} - \{0\}$ or, say, $(-\varepsilon,\varepsilon) - \{0\}$ for $\varepsilon >0$. –  Logan Maingi May 16 '12 at 0:01