# Find Function Always at Distance from Another Function

I changed the title to hopefully clarify a bit: What i am trying to do is find a function that is always at a specific distance from another function i.e. a function where a drawn circle with radius $r=1$ with center on the function will always be tangented by another function. Read below for background info and what i started off writing (not necessary to know).

I want to make a circle run on a given function. What i have in mind is having a circle from the implicit function $(a-x)^2+(b-y)^2=r^2$ where i use $r=1$ and $a$ and $b$ are the $x$ and $y$ coordinates of the center of the circle, respectively. I would like to try with the parabola $f(x)=-x^2+2$ and i am mainly focusing on the interval $-5\leq x\leq 5$. I found it working to use the distance formula, $\sqrt{(a-x)^2+(b-f(x))^2}$ to plot how far away the circle center is from the function $f(x)$ at a given $x$. This may seem chaotic, so here is a picture of what i mean

Purple is the distance formula function while grey is the derivative of that

Now i am currently having a hard time wrapping my head around this, but i think i want to find a b-value (height of the circle center) where the distance at minimum is 1 (i.e. the purple function has a minimum of $y=1$ exactly.) So i want to find a b-value where the purple function is 1 while the grey function is 0. How do i do this? Is there a smarter way?

• Your question isn't 100% clear, but are you asking how to construct a parallel curve? – Michael Seifert Nov 7 '17 at 21:18
• No, i would like a function g(x) where the closest point to another function f(x) is always the same distance. Imagine a function on which you draw infinitely many circles. Now create a function that is tangent to all of those circles. I want to create that function based on f(x) being a parabola, – iBoughtWinrar Nov 7 '17 at 21:28
• You just gave an exact description of a parallel curve; take a look at the link in my previous comment. I'll write up a brief answer to show how it's done in your case, but note that in general there isn't a nice answer of the form $y = g(x)$. – Michael Seifert Nov 7 '17 at 21:32
• Ah, my bad, i assumed too much from the word parallel – iBoughtWinrar Nov 7 '17 at 21:36

What you're looking for is a parallel curve. In your case, you would parametrize the parabola as \begin{align} x(t) &= t & y(t) &= -t^2 + 2 \end{align} The parallel curves would then be \begin{align} X(t) &= t - \frac{2rt}{\sqrt{4t^2 + 1}} & Y(t) &= -t^2+2 - \frac{r}{\sqrt{4t^2 + 1}}, \end{align} where $r$ is the desired radius of the circles along the curve. This gives you the parallel curve along one "side" of the original curve; for the other one, flip the sign of $r$ in each of the above equations.
Note that the curve "inside" the parabola can't be possibly be expressed in the form $Y = g(X)$--there are multiple values of the $Y$ coordinate for some values of $X$. The "outside" parallel curve is better-behaved, but I still suspect that it can't be expressed in a nice form $Y(X)$; at best, you might be able to end up with a relation between $X$ and $Y$ where you can show that some polynomial in $X$ and $Y$ must vanish, but you can't solve it for $X$ or $Y$ explicitly.
• If anyone can figure out what the above-mentioned relation between $X$ and $Y$ should be, feel free to edit this answer to include it or post it as a comment below. – Michael Seifert Nov 7 '17 at 21:58