Codomain and image of the sum and product of two functions

I was just thinking about the basic definitions of functions and this question popped into my mind. Let's say we have two functions, $f\!:A\to B\,$ and $g\!:X\to Y$. It is clear that the natural choice for the domain of both of the functions $f+g\,$ and $fg\,$ is $A\cap X$. But what about the codomain? I realize this is not uniquely defined, but I am interested in the most "natural" choice. It is clearly not just $B\cup Y$, as it is possible for the sum or product of two elements of $A\cap X\,$ to lie outside of both $B$ and $Y$. It seems to me that the codomain for $f+g\,$ should be $B+Y=\{b+y:b\in B \wedge y\in Y\}$, and the codomain for $fg\,$ should be $BY=\{by:b\in B \wedge y\in Y\}$, as these would satisfy all possibilities. I'm not sure about this though, which is why I asked this question.

Furthermore, what can we say about the image of these two functions? I've thought about it for a while and it seems impossible to specify the image of either function in the general case, as it could be any subset of the codomain, depending on the elements of the domain. I may be missing something though. Any insight would be appreciated.

• You need a sum and a product defined in a set that contains $B\cup Y$. – ajotatxe Jul 12 '17 at 23:32
• @ajotatxe I'm sorry, could you please clarify? I'm not quite sure what you mean. – Christian Serio Jul 13 '17 at 0:33

The codomain of $f+g$ should be the set defined by $$\alpha\in C_+ \iff \exists x\in A\cap X: f(x)+g(x)=\alpha$$ Your attempt is incorrect, unfortunately, because it also includes values like $f(x)+g(y)$, even when $x\ne y$. Yours does indeed include all possibilities, but it also includes a few too many. Similarly, for $f\times g$, we have the set defined by $$\alpha\in C_\times \iff \exists x\in A\cap X: f(x)g(x)=\alpha$$ as the codomain. Your attempt barely fails, for the same reason as before. Using your set builder notation, you would define the codomains like this: $$C_+=\{f(x)+g(x):x\in A \cap X\}$$ $$C_\times=\{f(x)g(x):x\in A \cap X\}$$