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