# Domain and the codomain of a composite function

• B
So, I'm a bit confused. The thing is, basically, all elementary functions are of the form ƒ:ℝ→ℝ. So the domain is ℝ and so is the codomain. However, if we have a function ƒ:ℝ→ℝ, given with f(x) = √x, it's domain is now x≥0. So, is the domain of this function ℝ or [0,+∞>?
Also, let's say we have two functions ƒ, and g, with f:A→B and g:C→D. Let's say that the image of the function f is f(A) ⊆ C. That way, we made sure that gof is defined. So, do we write gof: A → D, that is, is the domain of gof A, and the codomain D, or is the codomain of gof the image of f(A), because gof: A→f(A)⊆C→g(f(A)), that is, it starts in A and ends up in g(f(A)).
Thank you.

Mark44
Mentor
So, I'm a bit confused. The thing is, basically, all elementary functions are of the form ƒ:ℝ→ℝ. So the domain is ℝ and so is the codomain. However, if we have a function ƒ:ℝ→ℝ, given with f(x) = √x, it's domain is now x≥0. So, is the domain of this function ℝ or [0,+∞>?
The notation ƒ:ℝ→ℝ means only that the domain is ##\mathbb R## or possibly some subset of it. Same with the codomain. The domain of the real-valued square root function is [0, ∞), and so is the codomain of this function
Danijel said:
Also, let's say we have two functions ƒ, and g, with f:A→B and g:C→D. Let's say that the image of the function f is f(A) ⊆ C. That way, we made sure that gof is defined. So, do we write gof: A → D, that is, is the domain of gof A, and the codomain D, or is the codomain of gof the image of f(A), because gof: A→f(A)⊆C→g(f(A)), that is, it starts in A and ends up in g(f(A)).
Since f(A) isn't necessarily all of C, the domain of ##f \circ g## is f(A). Try this out with some simple functions, such as ##f(x) = x^2## and ##g(x) = \sqrt x##, and the composition ##f \circ g##.
The domain and codomain of the square root function is only nonnegative numbers. So even though the domain of f is all reals, because we're taking the square root first, only nonnegative numbers are inputs to f.

The notation ƒ:ℝ→ℝ means only that the domain is ##\mathbb R## or possibly some subset of it. Same with the codomain. The domain of the real-valued square root function is [0, ∞), and so is the codomain of this function
Since f(A) isn't necessarily all of C, the domain of ##f \circ g## is f(A). Try this out with some simple functions, such as ##f(x) = x^2## and ##g(x) = \sqrt x##. You should see that although the domain of f is all real numbers, the codomain of g is only nonnegative numbers, so not all of the domain of f gets used in the composition ##f \circ g##.
What happens with the codomain? Does it remain the codomain of f?

Mark44
Mentor
What happens with the codomain? Does it remain the codomain of f?
I'm not sure what you're asking. I edited my earlier reply, as what I wrote wasn't very clear. Take a look at that and let me know if it's still not clear.

What I am asking, and sorry for being ambiguous, is, if we have two functions f and g, and if the composition gof is defined (we don't need restrictions), in this case, is the domain of gof the domain of f, and the codomain of gof, the codomain of g. Thanks.

Mark44
Mentor
Actually , the domain of the fog is now the domain of g, right?
Yes, but that's only coincidental. Think about the same composition if ##f(x) = \sqrt{x - 1}##. Now the domain and codomain of f are not exactly the same.

Math_QED
Homework Helper
2019 Award
The notation ƒ:ℝ→ℝ means only that the domain is ##\mathbb R## or possibly some subset of it. Same with the codomain. The domain of the real-valued square root function is [0, ∞), and so is the codomain of this function
Since f(A) isn't necessarily all of C, the domain of ##f \circ g## is f(A). Try this out with some simple functions, such as ##f(x) = x^2## and ##g(x) = \sqrt x##, and the composition ##f \circ g##.
The domain and codomain of the square root function is only nonnegative numbers. So even though the domain of f is all reals, because we're taking the square root first, only nonnegative numbers are inputs to f.
Strictly speaking this means the domain is ##\mathbb {R} ##. Nothing more, nothing less.

Stephen Tashi
So, I'm a bit confused. The thing is, basically, all elementary functions are of the form ƒ:ℝ→ℝ.
That depends on your definition of "elementary function" and some conventions of notation.

For example, is ##f(x) = 1/x## an "elementary function"?

If we adopt the convention that "##f:A \rightarrow B##" designates ##A## as the domain of ##f## and declare that the domain of ##A## is exactly set of numbers that appear as first elements in the ordered pairs ##f## then (speaking of real valued functions of the reals) the domain of ##f(x) = 1/x## is not all of ##\mathbb{R}##

However, as @Mark44 indicates, sometimes the notation "##f:A \rightarrow B##" is used merely to indicate the that the domain of ##f## is a subset of ##A##. This is especially true when authors are expressing the idea that their remarks apply only to real valued functions of 1 real variable. They might write "##f:\mathbb{R}\rightarrow\mathbb{R}##" when what should be written is "##f:A\rightarrow B, A \subset \mathbb{R}, B \subset\mathbb{R}##"

According to the current Wikipedia article https://en.wikipedia.org/wiki/Codomain, the "codomain" of a function is distinct from the "image" of a function. So, as @Mark44 indicated, the notation "##g(f(x))##" refers to a function whose domain is the image of ##f##.

However, if we have a function ƒ:ℝ→ℝ, given with f(x) = √x, it's domain is now x≥0. So, is the domain of this function ℝ or [0,+∞>?
With the understanding that we are speaking of real valued functions of one real variable, the domain of ##f## is ##[0,+\infty)##.

Also, let's say we have two functions ƒ, and g, with f:A→B and g:C→D. Let's say that the image of the function f is f(A) ⊆ C. That way, we made sure that gof is defined. So, do we write gof: A → D, that is, is the domain of gof A, and the codomain D, or is the codomain of gof the image of f(A), because gof: A→f(A)⊆C→g(f(A)), that is, it starts in A and ends up in g(f(A)).
The Wikipedia article mentions several different definitions of "function" It takes, what I think is the standard view that the "codomain" of a function is a somewhat arbitrary set. For example, one could define a function ##f(x) = sin(x)## and specify its codomain as [-1,1] and define a (technically) different function as ##f(x) = sin(x)## with codomain [-3,17] or some other arbitrary set containing the image of f(x) = sin(x). Taking the viewpoint that the codomain has this arbitrary aspect to it, the codomain of the composition of two functions is not uniquely determined unless an author has specified some rule for how it is determined.

Some authors might define the notation ##g \circ f## to mean a function whose codomain is exactly ##g(f(A))## where ##f(A)## is the image of ##f##. Other authors might take the viewpoint that "I'm talking about real valued functions in this book, so the codomain of all functions that I mention will be ##\mathbb{R}##".

Unfortunately, mathematical notation can be ambiguous.

That depends on your definition of "elementary function" and some conventions of notation.

For example, is ##f(x) = 1/x## an "elementary function"?

If we adopt the convention that "##f:A \rightarrow B##" designates ##A## as the domain of ##f## and declare that the domain of ##A## is exactly set of numbers that appear as first elements in the ordered pairs ##f## then (speaking of real valued functions of the reals) the domain of ##f(x) = 1/x## is not all of ##\mathbb{R}##

However, as @Mark44 indicates, sometimes the notation "##f:A \rightarrow B##" is used merely to indicate the that the domain of ##f## is a subset of ##A##. This is especially true when authors are expressing the idea that their remarks apply only to real valued functions of 1 real variable. They might write "##f:\mathbb{R}\rightarrow\mathbb{R}##" when what should be written is "##f:A\rightarrow B, A \subset \mathbb{R}, B \subset\mathbb{R}##"

According to the current Wikipedia article https://en.wikipedia.org/wiki/Codomain, the "codomain" of a function is distinct from the "image" of a function. So, as @Mark44 indicated, the notation "##g(f(x))##" refers to a function whose domain is the image of ##f##.

With the understanding that we are speaking of real valued functions of one real variable, the domain of ##f## is ##[0,+\infty)##.

The Wikipedia article mentions several different definitions of "function" It takes, what I think is the standard view that the "codomain" of a function is a somewhat arbitrary set. For example, one could define a function ##f(x) = sin(x)## and specify its codomain as [-1,1] and define a (technically) different function as ##f(x) = sin(x)## with codomain [-3,17] or some other arbitrary set containing the image of f(x) = sin(x). Taking the viewpoint that the codomain has this arbitrary aspect to it, the codomain of the composition of two functions is not uniquely determined unless an author has specified some rule for how it is determined.

Some authors might define the notation ##g \circ f## to mean a function whose codomain is exactly ##g(f(A))## where ##f(A)## is the image of ##f##. Other authors might take the viewpoint that "I'm talking about real valued functions in this book, so the codomain of all functions that I mention will be ##\mathbb{R}##".

Unfortunately, mathematical notation can be ambiguous.
Thank you, I understand now.