You want to find a $\delta>0$ such that $(x-\delta,x+\delta)\subseteq(1,2)$. To do that, you must choose $\delta$ so that $x-\delta\ge 1$ and $x+\delta\le 2$. Solve those inequalities for $\delta$, and you find that need to have $\delta\le x-1$ and $\delta\le 2-x$. The easiest way to make both of these things happen is to choose $\delta$ to be the smaller of the two numbers $x-1$ and $2-x$.
If you’re visually oriented, a picture may help:
1 x 2 ---------|---------|---------------------|-------- |<- x-1 ->|<------- 2-x ------->|
You need to choose $\delta$ so that $x-\delta$ doesn’t reach to the left past $1$, and $x+\delta$ doesn’t reach to the right past $2$. The distance from $x$ to $1$ is $x-1$, so $\delta$ has to be at most this distance. Similarly, it has to be at most $2-x$, the distance from $x$ to $2$.
In general the details of choosing a $\delta$ that ‘works’ depend very much on the specific problem. Here it’s easy, because we can write down very simple necessary and sufficient requirements that $\delta$ must meet.