Finding the distance between a unit circle and a line analytically Let $A = \{(x, y) \in \mathbb{R}^2\mid x^2 + y^2 = 1\}$ and $B = \{(x, y) \in \mathbb{R}^2 \mid y = 3 - x\}$. I am currently taking my analysis/metric spaces class and would like to find the distance between these two sets in a more "analytical" way. That is, using only the definition $\mathrm{dist}(A, B) = \inf \{d_{\mathbb{R}^2}(a, b) \mid a \in A, b \in B\}$. I know this might sound like heresy, but I would prefer for the proof to not contain any argumentation by pictures etc. Just by the tools of analysis. The issue is that I honestly do not even know where to start. Sure, $d_{\mathbb{R}^2}(a, b) = \sqrt{(a_1 - b_1)^2 + (a_2 - b_2)^2}$ and points in $A$ and $B$ satisfy the properties of a circle and a line. But by using only the tools of analysis, how can you derive the distance between the sets?
I do know that this problem is trivial with the use of the formula $\frac{\left|ax_0 + by_0 + c\right|}{\sqrt{a^2 + b^2}} - r$, where $(x - x_0)^2 + (y - y_0)^2 = r^2$ is a circle and $ax + by + c  = 0$ is a line. But so far (through HS) I have only ever used these ready made tools and argumentation by e.g. geometry to find the answers. Therefore I do not know how to approach this problem in the "analysis" way.
 A: A point on the line has coordinates $P(t,3-t)$
The squared distance from the center of the circle $O(0,0)$ is
$$OP^2=f(t)=t^2+(3-t)^2=2t^2-6t+9$$
This is minimum when $f'(t)=0$ and $f''(t)>0$
$f'(t)=4t-6=0\to t=\frac32$
$f''(t)=4$ so $P^*\left(\frac{3}{2},\frac{3}{2}\right)$ is the point of the line closest to the circle.
$OP^*=\frac{3}{\sqrt{2}}$
So the distance between the line and the circle is $OP^*-r=\frac{3}{\sqrt{2}}-1$
A: Edit: Apologies to @Raffaele
I took too long writing this and by the time I'd finished you'd already posted the answer. Leaving mine up in case it's useful, but please don't award me points that should go elsewhere!
Points on the line are given by $(x, f(x))$ where $f(x) = 3-x$.
If we have some other point $(a, b)$, we can find the distance from this point to the line by finding $x$ which minimizes
$$d(x) = \sqrt{(x-a)^2 + (3-x - b)^2}$$
We can simplify things by minimizing $[d(x)]^2$ instead:
$$[d(x)]^2 = (x-a)^2 + (3-x-b)^2$$
In the case of a line and a circle, we can find the point on the line that minimizes the distance to the center point of the circle. We can then use this to find the minimum distance.
A calculus solution is below.
Here we want to minimize
$$d(x) = \sqrt{x^2 + (3-x)^2}$$
The $x$ that minimizes this will also minimize the square of the distance, which we can call $D(x)$
$$D(x) = x^2 + (3-x)^2$$
Differentiating we have
$$D'(x) = 2x + 2(3-x)(-1)$$
$$D'(x) = 4x - 6$$
So we see there's a critical point at
$$0 = 4x - 6$$
$$x = 3/2$$
We can see $D' < 0$ for $x < 3/2$ and $D' > 0$ for $x > 3/2$, i.e. $3/2$ is indeed a minimum point for $D$.
Plugging this point back into $f(x)$ we find that the point on the line that's closest to the origin (the center of the circle) is $(3/2,3/2)$
The distance from the line to the origin is
$$d_{center} = \sqrt{(3/2)^2 + (3/2)^2} = \frac{3}{2}\sqrt{2}$$
The distance from the line to the circle is
$$d_{center} - 1 = \frac{3}{2}\sqrt{2} - 1 = \frac{3\sqrt{2}-2}{2}$$
Edit also, sorry of this isn't quite what you're looking for. I'm not super versed in formal analysis.
A: If you can accept the result in post as a lemma, then there we is an easy proof for how to get the shortest distance between a curve and a circle. I plan on using some 'uncommon' results simply to make this post 'fun'
I will center my circle at point $(h,k)$ and it's equation will be denoted as $C(x,y)=0$, now my second curve I will denote at $S(x,y)$, now from the result on page-92 of Joseph Edward's calculus book see here(*), we get the tangent line equation of S at $(x,y)$ as:
$$\frac{X-x}{S_x} = \frac{Y-y}{S_y} ---- (**)$$
We can think of $(X,Y)$ as the free variable of tangent equation after we plug in point on curve as $(x,y)$ , now for shortest length, it must be that the normal line passes through the centre. So, plug in $(X,Y)$ as $(h,k)$:
$$ \frac{h-x}{S_x} = \frac{k-y}{S_y} \tag{2}$$
Now from (2) and $S(x,y)=0$(***), we can solve for the point $(x,y)$ such that distance is minimized, after that, simply take the distance from circle's center for this point and substract the radius Q.E.D.

*:You can find how he got result by reading few pages back , requires only some knowledge on partials and eulers theorem (also simple)
**: $ S_x = \frac{\partial S}{\partial x}$
***: Ideally you want to parameterize the curve $S(x,y)$ from the algebraic equation that will make solving much much easier since that'll directly reduce equation (2) into one variable.
