# Need help computing $(f \circ g)(x)$

$$f(x) = \frac{1}{x^2} + 1$$

$$g(x) = \frac{1}{x - 1}$$

Do I just insert the $g(x)$ function into the $f(x)$ function giving me this terrible looking thing?:

$$\frac{1}{\frac{1}{x^2}+1-1}$$

Thanks for any help, I really just need confirmation I'm going in the right direction.

• What you have written is $(g \circ f)(x)$. You need to do the opposite to get $f \circ g$.
– bzc
Commented Oct 18, 2011 at 16:06
• BTW, that terrible looking thing is not so terrible since it simplifies to $x^2$. Commented Oct 18, 2011 at 16:14
• @JavierBadia: Careful! The function $g\circ f$ is undefined at $x=0$, but the function $x^2$ is defined at $0$. So really you need to write $g\circ f(x) = x^2,\ x\neq 0$ to get a true equality of functions. Commented Oct 18, 2011 at 16:29

Actually, it would be the other way around. $(f \circ g)(x) = f(g(x))$, and $f(g(x)) = \frac{1}{g(x)^2}+1 = \frac{1}{\frac{1}{(x-1)^2}}+1$. This last expression is almost equal to $(x-1)^2+1$. The difference is that in the former, $f \circ g$ is undefined at $x = 1$, while in the latter, it is. The correct function would be $(f \circ g )(x) = (x-1)^2 + 1, \forall x \neq 1$.
What you did is actually $(g\circ f)(x) = g(f(x)) = \frac{1}{f(x)-1} = \frac{1}{\frac{1}{x^2}+1-1} = \frac{1}{\frac{1}{x^2}}$. The same note about the function not existing at $x = 0$ applies; therefore, $(g \circ f)(x) = x^2, \forall x \neq 0$.
• See my comment above: $g\circ f$ is undefined at $0$, but $y=x^2$ is defined everywhere. You need to be careful with the domains when you "simplify" an expression, given the convention that a function given by a formula is given its natural domain unless otherwise specified. Commented Oct 18, 2011 at 16:30
$g(x)=1/(x-1)$ => $x=1+1/g(x)$ => $f(x)=1/(1+1/g(x))^2+1=1/(1+2/g(x)+1/g^2(x))+1=g^2(x)/(g(x)+1)^2+1$