Answer
To prove the limit, prove that given $\epsilon\gt0$ there exists a $\delta\gt0$ such that for all $x$ $$0\lt|x-(-2)|\lt\delta\Rightarrow|f(x)-4|\lt\epsilon$$
Work Step by Step
$\lim_{x\to-2}f(x)=4$ if $f(x)=x^2$ for $x\ne-2$ and $f(x)=1$ for $x=-2$
Our job is to prove that given $\epsilon\gt0$ there exists a $\delta\gt0$ such that for all $x$ $$0\lt|x-(-2)|\lt\delta\Rightarrow|f(x)-4|\lt\epsilon$$
1) Solve the inequality $|f(x)-4|\lt\epsilon$ to find an open interval containing $x=-2$ on which the inequality holds for all $x\ne-2$ (which also means we would consider only $f(x)=x^2$ here)
$$|f(x)-4|\lt\epsilon$$ $$|x^2-4|\lt\epsilon$$ $$-\epsilon\lt x^2-4\lt\epsilon$$ $$4-\epsilon\lt x^2\lt4+\epsilon$$ $$\sqrt{4-\epsilon}\lt|x|\lt\sqrt{4+\epsilon}$$ (here we need to assume $\epsilon\lt4$)
Also, since we are examining the interval around $x=-2$, we assume that $x\lt0$, meaning $|x|=-x$
$$\sqrt{4-\epsilon}\lt -x\lt\sqrt{4+\epsilon}$$ $$-\sqrt{4-\epsilon}\gt x\gt-\sqrt{4+\epsilon}$$
So the open interval on which the inequality holds is $(-\sqrt{4+\epsilon},- \sqrt{4-\epsilon})$.
2) Find a value of $\delta\gt0$ that places the centered interval $(-2-\delta,-2+\delta)$ inside the interval $(-\sqrt{4+\epsilon},- \sqrt{4-\epsilon})$
Take $\delta$ to be the distance from $-2$ to the nearer endpoint of $(-\sqrt{4+\epsilon},- \sqrt{4-\epsilon})$. In other words, $\delta=\min(-2-(-\sqrt{4+\epsilon}),-\sqrt{4-\epsilon}-(-2))=\min(-2+\sqrt{4+\epsilon},-\sqrt{4-\epsilon}+2)$
So if $\delta$ has this or any smaller positive value, then the constraint $0\lt|x-(-2)|\lt\delta$ will automatically place $x$ between $-\sqrt{4+\epsilon}$ and $-\sqrt{4-\epsilon}$ so that $|f(x)-4|\lt\epsilon$.
That means for all $x$, $$0\lt|x-(-2)|\lt\delta\Rightarrow|f(x)-4|\lt\epsilon$$
This completes our proof for $0\lt\epsilon\lt4$.
- For $\epsilon\ge4$, we take $\delta$ to be the distance from $-2$ to the nearer endpoint of $(-\sqrt{4+\epsilon},0)$. In other words, $\delta=\min(-2+\sqrt{4+\epsilon},2)$
So again, if $\delta$ has this or any smaller positive value, then the constraint $0\lt|x-(-2)|\lt\delta$ will automatically place $x$ between $-\sqrt{4+\epsilon}$ and $0$ so that $|f(x)-4|\lt\epsilon$.
That means for all $x$, $$0\lt|x-(-2)|\lt\delta\Rightarrow|f(x)-4|\lt\epsilon$$
This completes our proof for $\epsilon\ge4$.