Need help choosing delta to prove continuity for $f(x)=\frac1x$ at $x=\frac12$ in a piecewise function. I am trying to prove continuity of the function
$$\text{Let } f(x)=\begin{cases} 
      f_1(x) = \frac{1}{x} & \text{if }x\in (0,\frac{1}{2}] \\
      f_2(x) = 2 & \text{if }x\in(\frac{1}{2},1)
    \end{cases}$$
I have proved the continuity of $f_1$ and $f_2$ over their respective intervals but I am now stuck at the left continuity of $f$ at point $c=\frac12$.
So far I have, where for $x<\frac12$ for all $\epsilon>0$ there exists a $\delta>0$ such that $\vert x-\frac12\vert<\delta$ implies:
$$\vert f(x)-f(\frac12)\vert=\vert\frac1x-2\vert$$
from here I am pretty sure this is wrong but I tried doing:
$$\vert\frac1x-2\vert=\vert\frac{2}{2x}-\frac{4x}{2x}\vert=\frac{2}{x}\vert\frac12-x\vert=\frac{2}{x}\vert x-\frac12\vert$$
and if this somehow worked, I don't really know what I should choose my $\delta$ to be.
Thanks in advance.

This is like most $\delta$-$\epsilon$ proofs with nonlinear functions. You need to make a preliminary stipulation/supposition to give an upper bound on $1/x$. (You also want to write your proof so that given $\epsilon>0$, you will provide a $\delta>0$ that works.)
So we have
$$\left|\frac1x-2\right| = \left|\frac{1-2x}x\right| = \frac 2x\left|\frac12-x\right|.$$
Let's now stipulate that $\dfrac 38<x<\dfrac12$, so that $\dfrac 1x<\dfrac83$.
This will mean that
$$\left|\frac1x-2\right|=\frac 2x\left|\frac12-x\right|<2\cdot \frac83\left|\frac12-x\right|.$$
Let's now set $\delta = \min\left(\frac18,\frac{3\epsilon}{16}\right)$. I leave it to you to finish the argument that if $0<\frac12-x<\delta$, then $\left|\frac1x-2\right|<\epsilon$. Just turn the scratchwork above into a one-line final estimate.
