What is the domain of $f(x) = x$?

I understand that the domain is typically defined as the set of objects for which a function is defined. So, given a function $f(x) = x$, how can I figure out its domain? Is $bananas$ part of the domain, given that the function seems to defined for $bananas$ in that $f(bananas) = bananas$? Indeed, is the domain simply everything for this function?

EDIT

I am told that I should specify the domain and codomain as part of the definition of a function, and use something like $f: A \to B : x \mapsto f(x)$. So is $A$ here the domain and $B$ the codomain?

Also, can I say $f : \mathbb{R}\setminus{\{0,1\}} \to \mathbb{R} : x \mapsto \frac{1}{x}$?

• A function comes equipped with a domain, so if $bananas$ is an element of that domain, then sure. – Nick D. Mar 13 '17 at 17:44
• If you only know the formula $f(x) = x$, then you do not have the full definition of the function, which must also include the domain and codomain. So without further context, your question is unanswerable. – Bungo Mar 13 '17 at 17:45
• Nitpicking: $f(x)=x$ isn't even a function, it's an equality. If you get rid of the notational abuse, does the question remain? – Git Gud Mar 13 '17 at 19:48
• – Git Gud Mar 13 '17 at 20:02

When a person is to talk about a function "legally" then he should specify the domain, the codomain, and the corresponding rule of the function. From example, it is sloppy to write "the function $f(x) = x^{2}$" (though of course it would be okay if the context is clear enough); ideally the author might try to say instead "the function $f(x) = x^{2}$ from $\mathbb{R}$ to $\mathbb{R}$" or "the function $f: x \mapsto x^{2}: \mathbb{R} \to \mathbb{R}$". What we are given is merely the corresponding rule "$f(x) = x$" of a mysterious function $f$, so there is nothing much to say from there on.
• I've never seen the notation “$f : x \mapsto x^2 : \mathbb{R} \to \mathbb{R}$” before. Maybe “$f\colon \mathbb{R} \to \mathbb{R}$, $x\mapsto x^2$” is more conventional. – Matthew Leingang Mar 13 '17 at 17:54
• @Bram28, Oh that would be a problem because $1/0$ is meaningless :). So at most $f: x \mapsto \frac{1}{x}: \mathbb{R}\setminus \{ 0 \} \to \mathbb{R}$. We have to get rid of $0$ in order we be consistent. – Megadeth Mar 13 '17 at 18:17