Conditions for $\lim_{x \to p} f(x) = q \land \lim_{y \to q} g(y) = Q \implies \lim_{x \to p} g(f(x)) = Q$ Under what conditions do we have the following, when $g$ is not defined at $q$:
$\lim_{x \to p} f(x) = q \land \lim_{y \to q} g(y) = Q \implies \lim_{x \to p} g(f(x)) = Q$
I know it holds when $g$ is continuous at $q$, but I wonder if that could be relaxed.
 A: The fact that $f$ and $g$ have limits at the points means that we can define two functions $\tilde f$ and $\tilde g$ that are continuous at $p$ and $q$ respectively, and otherwise equal to $f$ and $g$. Now assume that

*

*$g$ is defined at some value in the image $f(\omega'_p)$ of all punctured neighborhoods $\omega'_p$ of $p$,

*if $g$ is defined and discontinuous at $q$, then $f(x)\ne q$ for all $x$ close enough to $p$ (i.e. in some punctured neighborhood around $p$).

The first condition means that $g\circ f$ takes values around $p$ (and I included it since you allowed for partially defined functions). The second condition ensures that $g\circ f$ is equal to $\tilde g\circ\tilde f$ close to $p$. But then
$$
\lim_{x\to p}g(f(x)) = \lim_{x\to p}\tilde g(\tilde f(x)) = \tilde g(q) = Q.
$$

Conversely, note that the first condition above is necessary to even define the limit of $g\circ f$ at $p$.
For the second condition, assume that the implication holds, that condition 1 holds, that $g$ is defined at $q$, and that $(x_n)_n$ is a sequence converging to $p$ with $x_n\ne p$ and $f(x_n)=q$ for all $n$. Then
$$ g(q) = \lim_{n\to\infty} g(f(x_n)) = \lim_{x\to p}g(f(x)) = Q,$$
showing that $g$ is continuous at $q$. This shows that the second condition is necessary.

In conclusion, your implication is equivalent to the two conditions.
