Why does continuity of the composite function $f\circ g$ at $c$ require continuity of the function $g$ at $c$? I'll state a question from my textbook below:

Given $f(x) = \frac 1 {x-1}$. Find the points of discontinuity of the composite function $y = f[f(x)]$.

Clearly, $f(x)$ is not defined at $x=1$. But that is not the case with $y = \frac {x-1}{2-x}$. Calculating the limit and the value of $y$ at $x=1$ we even find that it is continuous at this point. The graph of $y$ gives the same idea.

But my textbook says that it is discontinuous at $x=1$. I know this is because the continuity of the composite function $f\circ g$ at $c$ requires the continuity of $g$ at $c$. That is exactly what I can't understand. Why? I don't understand what does $f\circ g$ have to do with the continuity of $g$ at any point, say $c$? It only needs $g$ to be defined at $c$, right? Do you have an example that illustrates the importance of continuity of a function $g$ at $c$ for the continuity of the composite function $f\circ g$ at $c$?
 A: The answer is that the function
$$
f(f(x)) = \frac{1}{\frac{1}{x - 1} - 1}
$$
is not the same as
$$
\frac{x - 1}{2 - x}.
$$
They give the same outputs for all $x$ in the domain of $f(f(x))$, but the second function has $1$ in its domain.  The reason is that the limit of $f(f(x))$ exists at $1$, but it does not have a value.  The second function just fills in the value with the limit.  When you manipulate $f(f(x))$ to reduce it to the second function, you probably multiplied by $x - 1$ or something.  You were making the implicit assumption that $x - 1 \neq 0$.  But, it could be.  So, you changed the function at that point in your work.
Then $f(f(x))$ is not continuous at $x = 1$, because there is a division by $0$ error when you attempt to calculate it.  But, in order to be continuous it needs both the limit and no computation error. 
A: Technically, if $f(x) = \frac{1}{x-1}$, then $$f\circ f(x) = \frac{1}{\left(\frac{1}{x-1}\right)-1} = \frac{1}{\left(\frac{2-x}{x-1}\right)}$$ This is not the same as $$g(x) = \frac{x-1}{2-x}$$ They are the same almost everywhere, where the only point they differ is $x=1$ ($f\circ f$ is not defined there whereas $g$ is). In general, a fraction $1/(a/b) = b/a$ if you can assume $b\not=0$. Otherwise, such an operation is not defined. 
