# Inner circle of a function

23-Sep-2023

I came across an interesting challenge from a tweet:

Hiring our first employee today. Gave this insanely hard problem for round 1, try it out if you’re free: https://t.co/gRxG2jl9xt

— sir MIT, PhD in Vast Demented Atrophy (@iwontoffendyou) Sep 21, 2023

It is a simple problem, but can be tricky depending on how you see it.

I made a GeoGebra snippet that describes the same problem, but the $x$ and $y$ axis is swapped, because it is easier to write and understand if $y=x^2$ instead of $y=\sqrt{x}$.

Feel free to play around with the snippet. You can drag point $A$ left and right until the outer circle has radius 1. Then you can see the radius of inner circle being questioned, by checking the height of point $C$.

# GeoGebra

## Things to try

You can drag around point $A$ and the construction will follow around, according to the constraint of the original problem.

As you may have noticed, the line that stretches from origin to $C$ and to the outer circle $R$ is actually a single line. It is easy to see now that the distance to $C$ plus the radius of the inner circle $CC$, $r$ actualy sums up as the radius of $R$.

Thus, if we make $R$ equal to 1, we see that $r$ is around $0.21$.

The tools we are using: GeoGebra, make it easy for us to construct the problem and then just “experiment” to get the feel of how the solution might be.

When I tried to solve the original problem, I went directly to try to solve it algebraically (more on that later).

In this section, I just want to focus on how to “play around” and having fun.

If you click the left panel called **Algebra**, you can see all the rules and constraints I already input in the GeoGebra notebook.

These rules can be read from top to bottom and it will be sorted in a dependency manner. So, first item is evaluated/solved first.

The notebook can be edited. So you can try type all sort of rules. It won’t be saved, though. So when you refresh, it will return to the original state.

You can try to change $f(x)$ function into something else, like $f(x) := e^x$. The entire notebook then adapt accordingly to the new constraints.

## Constructions

To build the constraints presented here, we go to the **Algebra** calculator view

- Define the $f(x)$ function placeholder. To follow original problem, I used $x^2$ instead of $\sqrt{x}$
- We want a point in the x axis to be used as a slider. So we create point $A$
- We want to place a point (the first constraint) in the function $f(x)$, so this point $B$ is $(x, f(x))$
- The inner circle must be tangent with $f(x)$, so we have the second constraint. This means the derivative of both the function and inner circle equation must be the same.
- As a shortcut, define an angle theta $\theta$. From the relation that function derivative is $f^\prime=\tan\left(\theta\right)$
- From the height of Point $B$, we know that $f(x)=r(1+\cos(\theta))$, so we can calculate $r(x)$
- Make a circle $CC$ using Point $B$ and radius $r$
- Calculate distance from center of the circle $C$ to origin, name it $a$
- Make a circle $R$ for the outer circle with radius $a+r$.

# Solution using Algebra

This section used a more analytical approach as compared with just declaring the construction using GeoGebra. Some variable have different meaning here.

I modified the original problem by swapping $x$ with $y$. This way, I used the function $y=x^2$ instead of using square root.

First constraint comes from the function itself, which is

I ignored the outer circle for now. So, the second constraint comes from the inner circle equation. Let’s say that the center is a point $(a,b)$. But the height $b$ is equal to $r$ because the circle is tangent from x axis. Thus we can simplify:

From $E1$, taking the derivative, we know the rate of change should be:

From the definition of $\tan\theta$, we should be able to find relation to $\cos{(\theta)}$ and $\sin{(\theta)}$

We can now use $E2$ to retrieve $r$ by using the fact that $y-r=r\cos{(\theta)}$

Now, the key connection is to realize that the rate of change of the function has to be the same with the inner circle. Because the circle has to be always connected with the function as $x$ increases. Alternatively, by the tangent rule, the circle is always tangent to the function. So, if we variate $x$, the center of the circle will move as constrained by above rules.

We now want to see the behaviour of the center of the inner circle, from the origin.

Notice that the distance $p$ of the center of the inner circle to the origin, can be calculated using Pythagorean theorem. If the point is $(a,b)$, then basically $p^2=a^2+b^2$. But $b=r$. Also, from $E2$, $a=x+r\sin{(\theta)}$

Now, the last constraints. We take into account the outer circle.

Since by the problem statement, it was stated that the outer circle be intersected with the inner circle, then the tangent at the point of intersection has the same direction. We can then conclude the outer radius $R$ is equal to $p+r$. But $R=1$. Which brings us the to the final constraint:

Backtracking and solving it one by one, you will have:

Combine $E6$ with $E5$

Use $E2$ with $E1$, then $E7$

We have an equation with variable $x$ and $a$. We need one more equation that has these two variables. But at this point, I found some interesting shortcuts from the constraint.

If you observe the polynomials, $x$ has degree 4. But the graph of $y=x^2$ is only mirrored by $y$ axis. So there is only two possible $x$ that will have the same $a$.

Since the roots might be duplicated, we can try finding the discriminant of the polynomials and set it to zero (means some roots appears more than once).

But, uh… calculating a determinant of a polynomial with degree 4 is exhausting, so I used Wolfram Alpha to do that

The result is:

From the discriminant, we entirely isolate value of $a$.

For $16a^4$ and $E7$ it means $r=\frac{1}{2}$ and $a=0$. Which is the solution if the inner circle is located above the origin $(0,0)$. But this is not what we want to find.

So, the other factors must contain the solution: $(-27 + 52 a^2 - 9 a^4 + a^6)=0$. Notice although $a$ has degree six, if we replace $a^2=(1-2r)$ we will have polynomial of $r$ with degree 3. This is solveable and must contains at least 1 root, since the polynomial has odd degree.

But again, I’m too lazy to do that. So, I let Wolfram Alpha solve it again

With the equation rearranged into $-27 + 52 (1-2r) - 9 (1-2r)^2 + (1-2r)^3=0$, we got direct result into $r$, which is approximately $0.21$.