Why does limit not exist?

It's true that $\lim_{x\to-2}g(x)=0$, but as $g(x)$ goes to $0$, it gets there from two directions. Namely, from above and from below. It goes through values like $-0.1$, $-0.001$, $-0.0001$, etc. from below and through values like $0.1$, $0.001$, $0.0001$, etc. from above. That's equivalent to evaluating $\lim_{x\to 0}h(x)$ which, according to the theory of limits, is really two one-sided limits under the hood. And what does the function $h(x)$ approach as you go to $0$ from the right and from the left?

$$\lim_{x\to 0^-}h(x)=1$$ and $$\lim_{x\to 0^+}h(x)=-1.$$

Those two limits don't agree and thus the limit itself does not exist.


For the limit to exist the following must hold: $$\lim_{x\uparrow-2}h(g(x))=\lim_{x\downarrow-2}h(g(x))=h(g(0)),$$ Looking at the picture we can see that the left limit $$\lim_{x\uparrow-2}h(g(x))=\lim_{x\uparrow0}h(x)=1$$ the right limit $$\lim_{x\downarrow-2}h(g(x))=\lim_{x\downarrow0}h(x)=-1$$ and $h(g(-2))=h(3)=1$.


The limit exists if every point near $-2$ in the domain maps to a points near to one another in the image.

If $x$ is slightly greater than $-2$ then $g(x)$ is slighty greater than $0$, and $(h\circ g)(x)$ is slightly greater than $-1$

but if $x$ is slightly less than $-2$ then $g(x)<0$ and $(h\circ g)(x) > 1$