Why is $\lim_{x \to c}g(f(x)) = g(\lim_{x \to c}f(x))$ In this theorem (from the continuity section of the first chapter of a calculus textbook)

If $g$ is continuous at $b$, and $\lim_{x \to c}f(x)=b$, then $\lim_{x\to c}g(f(x)) = g(\lim_{x \to c}f(x))=g(b)$.

I would like an explanation (and proof) of $\lim_{x \to c}g(f(x)) = g(\lim_{x \to c}f(x))$.
 A: One usual definition for continuity is this
$f$ continuous at $c$ iff $\lim_{x\to c} f(x) = f(c)$. note that the $\epsilon \delta$ definition is equivalent becaus $\lim_{x \to c} f(x) =f(c) \iff \forall \epsilon > 0 \exists \delta > 0, |x-c|<\delta \Rightarrow  |f(x)-f(c)| < \epsilon$
if $f$ and $g$ are continuous then 
$$\lim_{x\to c}g(f(x)) = \lim_{x\to c}g\circ f(x) = g \circ f\,(c) = g(f(c))$$ since $g\circ f$ is continuous. But $f$ is continuous at $c$ then $b= f(c) = \lim_{x\to c} f(x)$, hence
$\lim_{x \to c} g(f(x)) = g(\lim_{x \to c}f(x))$.
A: The theorem mentioned is one of the most useful in calculating various limits. As an example if we need to calculate the limit of $\{f(x)\}^{g(x)}$ when $x \to a$ then we normally take logs. Say the limit is $L$ then $\log L = \log(\lim_{x \to a}\{f(x)\}^{g(x)})$ and then we exchange $\log$ and the limit operation. This is justified only because of this theorem. When we understand the usefulness and power of some result it makes us more curious to know the proof.
So let's us now understand why the theorem is true. I will avoid use of $\epsilon$ and $\delta$ as they tend to lose the expressive charm of language and ideas. We are provided that $f(x) \to b$ as $x \to c$. This means that we can make the value of $f(x)$ arbitrarily close to $b$ by taking values of $x$ sufficiently close to $c$. Note that $\epsilon$ and $\delta$ are used to quantify the terms mentioned in italics in the last sentence. Next we are given that $g(x)$ is continuous at $b$. This means that we make values of $g(x)$ arbitrarily close to $g(b)$ by taking $x$ sufficiently close $b$.
Next consider that while letting this $x \to b$ so that $g(x) \to g(b)$ we only try to use values of $x$ which form the values of the function $f$. Thus rather than $x$ tending to $b$ in any manner we prefer to have values of $x$ such that $x = f(t)$ (or $x$ takes values from range of $f$). Now we want values of $x$ sufficiently close to $b$ which can be done by taking values of $t$ sufficiently close to $c$. It thus follows that the value of $g(x) = g(f(t))$ can be made arbitrarily close to $g(b)$ by taking values of $t$ sufficiently close to $c$. In symbols $\lim_{t \to c}g(f(t)) = g(b) = g(\lim_{t \to c}f(t))$.
While reading the above the reader may fail to understand why continuity of $g$ at $b$ is necessary. In that case let's assume that $g$ is not continuous at $b$ and ask what happens then? Well then we may have the case that $g(x) \to L$ as $x \to b$, but $L \neq g(b)$ and then we only have $\lim_{t \to c}g(f(t)) = L$. So please understand that in any case we must have $\lim_{t \to c}g(f(t)) = \lim_{x \to b}g(x)$ provided these limits exist. In the special case when $g$ is continuous at $b$ we can write this limit as $g(b)$ and noting that $b = \lim_{t \to c}f(t)$ we can further write $$\lim_{t \to c}g(f(t)) = \lim_{x \to b}g(x) = g(b) = g(\lim_{t \to c}f(t))$$
So in the above identity the first and last equality always holds. It is the middle equality which needs continuity of $g$ at $b$.
Update: After having a look at this question I want to add some detail for the case when function $g$ is not continuous. In this case for the above argument to work it is essential that $f(x) \neq b$ in a certain neighborhood of $c$ (except possibly at $c$).
A: Let $y = f(x)$. The key point is that, as $x \to c$, $y = f(x) \to b$, so we can replace $\lim_{x \to c} g(f(x))$ with $\lim_{y \to b} g(y)$, which is $g(b)$ by continuity of $g$ at $b$.
