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

• In order to find the value of the composite function $f \circ f$ at $1$, you first calculate $f(1)$ and then $f(f(1))$. The first value is not defined, so the composite function is not defined. – Eivind Apr 17 '18 at 13:54
• A bad habit of your textbook: as $f$ isn't defined in $x=1$ it can't be neither continuous nor discontinuous. – Michael Hoppe Apr 17 '18 at 14:02
• @MichaelHoppe I thought a function is always discontinuous at a point where it is not defined. – SamInuyasha ANMF Apr 17 '18 at 15:29
• @SamInuyashaANMF Of course not, see math.stackexchange.com/questions/1482787/… – Michael Hoppe Apr 17 '18 at 21:53
• @MichaelHoppe I thought there's a difference between $f(x) = \frac 1x$ and $g(x) = \frac 1x, x \ne 0$. $0$ is in the domain of $f$, whereas it is not in the domain of $g$. So, $f$ is discontinuous at $x = 0$, whereas there's no point in discussing continuity of $g$ at $x = 0$ since the point is not even in its domain. – SamInuyasha ANMF Apr 18 '18 at 6:59

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.
• It doesn't only need those limits, but a defined value of $f(1)$ as well. Continuity at $x= isn't a question at all. – Michael Hoppe Apr 17 '18 at 14:06 • Supposing a random function$g$defined, but not continuous, at$c$, will$f \circ g$be continous at$c$for another random function$f$[which is continuous at$g(c)$], such that$f[g(c)] = \lim \limits_{x \to g(c)} f(x)$? – SamInuyasha ANMF Apr 17 '18 at 15:26 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. • This is a good answer, and teaches a general rule at the same time. I will use this in the fall when I teach Calculus.$+1$– Joe Johnson 126 Apr 17 '18 at 14:01 • Supposing a random function$g$defined, but not continuous, at$c$, will$f \circ g$be continous at$c$for another random function$f$[which is continuous at$g(c)$], such that$f[g(c)] = \lim \limits_{x \to g(c)} f(x)$? – SamInuyasha ANMF Apr 17 '18 at 15:26 • @SamInuyashaANMF I don't know what you mean about "random" but here is a counter example I think that works. Let$g(x)$be the Dirchlet function, that is$g(x) =1$if$x$is rational and$=0$if$x$is irrational. Obviously$g$is not continuous anywhere. Then let$f(x) = x$. Clearly this is continuous at any$g(c)$but$f\circ g$is certainly not continuous. – welshman500 Apr 17 '18 at 16:40 • @welshman500 I get your point. Suppose$g(x) = x$, if$x \ne 1$and$g(x) = 0$, if$x = 1$. Let$f(x) = \frac {x-1}{x-1}$. Here,$g$is discontinuous at$x = 1$but$f \circ g$is continuous. So continuity of$g$at$c$is not always necessary, right? But yes, you gave the right example to show the importance of the continuity of$g\$. Thanks! – SamInuyasha ANMF Apr 18 '18 at 6:54