# Operations on functions

TL;DR Summary
Why in combining functions to form other functions do we restrict the domain to the intersections of their domains?
For example:
h(x)=f(x)+g(x)
If f(x) and g(x) are real numbers and real numbers can be added, subtracted, multiplied and divided (except by 0). why do we insist that the x in f(x) and g(x) be {x: x∈ dom f ∩ dom g}?
My thoughts:
The equality of two functions requires two criteria:
1) They operate on the same domain
2) Images be the same, element for element
Criteria 1) is not satisfied if x does not belong to the intersection of the two sets
then f(x1)+g(x2)=h(x3, x2 or x1)
h is mapping a different element in the domain to that of f or g yielding the same image resulting from any operation we perform on f and g.

Homework Helper
Gold Member
2022 Award
If ##f(x)## is not defined at some point ##x_0##, then ##f(x) + g(x)## is not defined either. In other words, ##f(x) + g(x)## can only be defined on the intersection of the domains of ##f(x)## and ##g(x)##.

Yes I get that but I am discussing something else. Let f(x1)=y1 and g(x2)=y2. y1 and y2 are two real numbers which can be added, subtracted, multiplied and divided. f(x1)+g(x2)=y1+y2 can't we equate that to another function which maps some element in its domain to y1+y2 because h is mapping a different element in the domain to that of f or g yielding the same image resulting from any operation we perform on f and g.

Homework Helper
Gold Member
2022 Award
Yes I get that but I am discussing something else. Let f(x1)=y1 and g(x2)=y2. y1 and y2 are two real numbers which can be added, subtracted, multiplied and divided. f(x1)+g(x2)=y1+y2 can't we equate that to another function which maps some element in its domain to y1+y2 because h is mapping a different element in the domain to that of f or g yielding the same image resulting from any operation we perform on f and g.
You can define a function on the Cartesian product of the domains of ##f## and ##g##:
$$h: Dom(f) \times Dom(g) \rightarrow \mathbb R$$$$h(x_1, x_2) = f(x_1) + g(x_2)$$

What about the composition of two functions?
Let f:A->B and g:B->C be given. Then by the composition of f and g we mean the function h:A->C such that for each a∈A, h(a)=g(f(a))
1) The domain of h is A whereas the domain of g is B. To form the composition above, f(a) must belong to B because g cannot map an element which is not part of its domain.
2) Should f(a)=a for equality to hold? Namely h and g operate on the same domain A=B and they map the same element to the same image.

Homework Helper
Gold Member
2022 Award
The composition ##g(f(x))## is fine as long as the range of ##f(x)## is a subset of the domain of ##g(x)##. If not, then it's not always easy to work out what is the domain of ##g \circ f##. In fact, we get homework problems posted on here for this.

Staff Emeritus
Gold Member
2) Should f(a)=a for equality to hold? Namely h and g operate on the same domain A=B and they map the same element to the same image.

It sometimes helps to remember that functions can operate on any set (not just numbers), and these statements have to hold for all sets. Sometimes when everything is numbers it's harder to figure out what fits together.

Here's a dumb example. Let ##\mathbb{N}## be the natural numbers, and ##\mathbb{A}## be the English alphabet (letters a,b,c,...,z). Let ##\mathbb{V}## be the set of vowels (a,e,i,o,u) and ##\mathbb{C}## the set of consonants (this is not standard notation! Usually it's the complex numbers)

##f:\mathbb{N} \to \mathbb{A}## takes a number and maps it to "o" if it's odd, "e" if it's even.

So for example f(2)="e", f(7)="o".

We will consider three functions to compose this with.

##g_1:\mathbb{N}\to \mathbb{N}## defined by ##g(n)=n^2##. Is ##g_1 \circ f## well defined?

##g_2: \mathbb{A} \to \mathbb{N}## that takes a letter and maps it to which position it is in the alphabet. So ##g_2("b")=2##, ##g_2(z)= 26##. Is ##g_2\circ f## well defined?

##g_3: \mathbb{C}\to \mathbb{A}## that maps each consonant to itself. So ##g_3('c') = 'c'##. Is ##g_3 \circ f## well defined?

Last edited by a moderator: