# Given the composition of function $f(g(x))$ and $g(x)$, what is the domain of $f(x)$?

Suppose that I have $$g(x)=\frac{1}{x}$$ we know that the domain is all real numbers except 0 and $$f(g(x))=\frac{2}{x}+5$$. we know the domain is also all real numbers except 0 We know that to find $$f(x)$$, what we have to do is find the inverse function of $$g(x)$$, which is $$g^{-1}(x)=\frac{1}{x}$$. Then we substitute it and get $$f(g(g^{-1}(x)))=2x+5$$, so that $$f(x)=2x+5$$.

Does it affect the domain of $$f(x)$$? I mean, when you substitute $$x$$ with $$g^{-1}(x)$$ to $$f(g(x))$$, then the domain of $$f(x)$$ must be the domain of $$g^{-1}(x)$$, right (that is the domain of $$f(x)$$ is $$x$$ not $$0$$ which is same as the domain of $$g^{-1}(x)$$)? Please correct me if I am wrong.

• Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
– Community Bot
Commented Jan 29, 2022 at 15:46
• If you want to find the domain of $f$, then I think it is quite important to specify the domains and ranges of $g$ and the composition $fg$. For example, is it $g:(0,\infty)\to(0,\infty)$ and $fg:(0,\infty)\to(0,\infty)$ ? Your question is not very clear. Commented Jan 29, 2022 at 15:51

Usually, the domain of a function is part of its definition and cannot be obtained from its formula. You can ask questions like: What is the largest/smallest set on which $$f$$ can be defined s.t. it fulfills the requirements? But asking for the domain of a function does not have a mathematical meaning.

Having said that, in school there are often questions of that type, which are supposed to ask for the largest set on which some expression is defined. This is, in your case, trivial: $$f(x)=2x+5$$ can clearly be defined everywhere.

A slightly more interesting question, and what you probably intended to ask, is: What is the smallest possible domain on which $$f$$ has to be defined so that $$f(g(x))=\frac2x+5$$ holds for every $$x\in\operatorname{dom}(g)=\mathbb R\setminus\{0\}$$? Here, $$\operatorname{dom}$$ stands for the domain of a function and the statement $$\operatorname{dom}(g)=\mathbb R\setminus\{0\}$$ should be part of the definition of $$g$$. For $$f(g(x))$$ to be defined, $$f$$ must be defined for every $$x$$ in the image of $$g$$, that is it has to hold that$$\operatorname{im}(g):=\{g(x)\mid x\in\operatorname{dom}(g)\}\subseteq\operatorname{dom}(f).$$ To find the image of $$g$$, you can use the inverse function: One finds $$\operatorname{im}(g)=\operatorname{dom}(g^{-1})\overset{g^{-1}=g}=\operatorname{dom}(g)=\mathbb R\setminus\{0\}.$$ This means that $$f$$ has to befined everywhere except at $$0$$ for your conditions to hold for all $$x\in\operatorname{dom}(g)$$. (But could of course also be defined at $$0$$.)

• i am actually little bit concerned about the composition functions problems like for example given f(g(x)) and g(x) what is f(x).But the problem is does it affect the domain of f(x)?For instance in my questions you will obtain $f(x)=2x+5$ but how do we know that? first you need to find $g^{-1}(x)$ the domain is same with the domain of $g(x)$ that is all real numbers except $0$ .Recall $g(g^{-1}(x))=x$ where x is the domain of $g^{-1}(x)$.Then you subtitute x with $g^{-1}(x)$ to $f(g(x))$ .when you do that you will get $f(x)=2x+5$. Then the domain of $f(x)$ must be same with $g^{-1}$? Commented Jan 30, 2022 at 4:45
• As I said in my answer, the domain of $f$ has to include the domain of $g^{-1}$, but could also be bigger. Basically, since $g^{-1}$ is not defined at $0$, $f$ can do whatever you want at $0$; it can be defined to be any real value or not defined at all. Commented Jan 30, 2022 at 9:00
• why is that so?$f$ can do whatever you want at $0$?i need more explanation Commented Jan 31, 2022 at 4:31
• The point is that $\frac 1x$ is never $0$, so $f(\frac1x)$ does not impose any restrictions on the value of $f(0)$. Consider the three functions $$f_1:\mathbb R\to\mathbb R,\ x\mapsto 2x+5$$ $$f_2:\mathbb R\setminus\{0\}\to\mathbb R,\ x\mapsto 2x+5$$ $$f_3:\mathbb R\to\mathbb R, x\mapsto\begin{cases}2x+5&\text{if }x\neq0,\\\sqrt{\frac\pi2}&\text{if }x=0\end{cases}$$ In all three cases, you can easily verify that $f_i(g(x))=\frac2x+5$ is true for all $x\neq0$, but $f_2$ is not defined at $0$, whereas $f_3$ and $f_1$ are, but take different values there. Commented Jan 31, 2022 at 14:02

Let's frame it as follows: Define $$g,h:(0,\infty)\to(0,\infty)$$ by $$g(x):=\frac{1}{x}$$ and $$h(x):=\frac{2}{x}+5$$. We want to investigate the possible domains of a function $$f$$ satisfying $$fg=h$$.

Evaluating $$fg=h$$ at $$x>0$$ gives that $$f(\frac{1}{x})=2(\frac{1}{x})+5$$, so that $$f(y)=2y+5$$ for all $$y>0$$. Now let $$(0,\infty)\subseteq A\subseteq\mathbb{R}$$ and define $$f:A\to\mathbb{R}$$ by $$f(x):=2x+5$$.

Then $$(fg)(x)=h(x)$$ for all $$x>0$$. So this works for any domain containing $$(0,\infty)$$. In fact, it doesn't matter what values $$f$$ takes for $$x\leq 0$$, since $$g$$ maps only into $$(0,\infty)$$.

But this depends on the domain of $$g$$ and $$h$$, which are defined for all non-zero $$x$$. In short, there is no definitive answer to your question as stated. The domain of a function is almost always included as part of the definition. You might be able to work out where it needs to be defined for some particular purpose, but very often you could tack on some extra elements to the domain, and assign arbitrary values to those extra elements, without affecting anything all that much.

• so for $f(x)$ the domain cannot be 0?i mean like f(0) Commented Jan 29, 2022 at 16:18
• Are you asking if the domain of $f$ can be the set $\{0\}$? In that case, $g(x)$ would always be outside the domain of $f$ and the composition $fg$ would not be defined at all. In a composition $fg$, $g(x)$ must always be included in the domain of $f$. Commented Jan 29, 2022 at 16:21
• Actually i little bit concerned about this . In Precalculus or algebra course we often see the composition function problems. Like given f(g(x)) and g(x) what is g(x)?and when we want to find f(x) of course we need to find the $g^{-1}(x)$ then we obtain f(x) ..but when we do that the domain of f(x) will be same with the domain of $g^{-1}(x)$ right? Commented Jan 29, 2022 at 16:35
• For example in my quetions you will get $f(x)=2x+5$ but the domain of f(x) must be same with the domain of $g^{-1}(x)$ that is all real numbers except $0$? correct me if i wrong Commented Jan 29, 2022 at 16:38
• @WoxFrime No, the domain must contain specific points, and take specific values at those points, for the composition to work. That is all that can be deduced from the given information. You could define $f(0)$ to be anything you like and it will not affect the composition because $g(x)$ is never zero. Therefore nothing changes when you include $0$ in the domain of $f$. Commented Jan 29, 2022 at 16:40