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$. – Brandon Carter Oct 18 '11 at 16:06
BTW, that terrible looking thing is not so terrible since it simplifies to $x^2$. – Javier Oct 18 '11 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. – Arturo Magidin Oct 18 '11 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. – Arturo Magidin Oct 18 '11 at 16:30
@Arturo: You're right, I'll add that in the answer. – Javier Oct 18 '11 at 16:39
Great, thanks for the explanation. Using the correct problem sure does make a difference. – erimar77 Oct 18 '11 at 18:42
@erimar77: If the answer was what you wanted, you can mark it as accepted. – Javier Oct 18 '11 at 18:58

When you compute (f o g)(x) you take f(g(x)). In other words, g(x) becomes the variable x in f(x). So, with your example, f(g(x))=((1/(g(x)^2)+1). I think you can do the rest.

-

$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$

-