Maulana's personal blog
Main feedMath/PhysicsSoftware Development

Inner circle of a function


I came across an interesting challenge from a tweet:

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 xx and yy axis is swapped, because it is easier to write and understand if y=x2y=x^2 instead of y=xy=\sqrt{x}.

Feel free to play around with the snippet. You can drag point AA 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 CC.


Things to try

You can drag around point AA 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 CC and to the outer circle RR is actually a single line. It is easy to see now that the distance to CC plus the radius of the inner circle CCCC, rr actualy sums up as the radius of RR.

Thus, if we make RR equal to 1, we see that rr is around 0.210.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)f(x) function into something else, like f(x):=exf(x) := e^x. The entire notebook then adapt accordingly to the new constraints.


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

  1. Define the f(x)f(x) function placeholder. To follow original problem, I used x2x^2 instead of x\sqrt{x}
  2. We want a point in the x axis to be used as a slider. So we create point AA
  3. We want to place a point (the first constraint) in the function f(x)f(x), so this point BB is (x,f(x))(x, f(x))
  4. The inner circle must be tangent with f(x)f(x), so we have the second constraint. This means the derivative of both the function and inner circle equation must be the same.
  5. As a shortcut, define an angle theta θ\theta. From the relation that function derivative is f=tan(θ)f^\prime=\tan\left(\theta\right)
  6. From the height of Point BB, we know that f(x)=r(1+cos(θ))f(x)=r(1+\cos(\theta)), so we can calculate r(x)r(x)
  7. Make a circle CCCC using Point BB and radius rr
  8. Calculate distance from center of the circle CC to origin, name it aa
  9. Make a circle RR for the outer circle with radius a+ra+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 xx with yy. This way, I used the function y=x2y=x^2 instead of using square root.

First constraint comes from the function itself, which is

y=x2(E1)\begin{align*} \tag{E1} y=x^2 \end{align*}

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)(a,b). But the height bb is equal to rr because the circle is tangent from x axis. Thus we can simplify:

r2=(xa)2+(yr)2(E2)\begin{align*} \tag{E2} r^2 = (x-a)^2 + (y-r)^2 \end{align*}

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

y=2x=tan(θ)(E3)\begin{align*} \tag{E3} y^\prime = 2x = \tan{(\theta)} \end{align*}

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

We can now use E2E2 to retrieve rr by using the fact that yr=rcos(θ)y-r=r\cos{(\theta)}

r=y1+cos(θ)(E4)\begin{align*} \tag{E4} r=\frac{y}{1+\cos{(\theta)}} \end{align*}

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 xx increases. Alternatively, by the tangent rule, the circle is always tangent to the function. So, if we variate xx, 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 pp of the center of the inner circle to the origin, can be calculated using Pythagorean theorem. If the point is (a,b)(a,b), then basically p2=a2+b2p^2=a^2+b^2. But b=rb=r. Also, from E2E2, a=x+rsin(θ)a=x+r\sin{(\theta)}

p2=(x+rsin(θ))2+r2(E5)\begin{align*} \tag{E5} p^2=(x+r\sin{(\theta)})^2+r^2 \end{align*}

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 RR is equal to p+rp+r. But R=1R=1. Which brings us the to the final constraint:

p2=(1r)2(E6)\begin{align*} \tag{E6} p^2=(1-r)^2 \end{align*}

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

Combine E6E6 with E5E5

p2=a2+r21+r22r=a2+r2a2=12r(E7)\begin{align*} p^2 = a^2 + r^2 \\ 1+r^2-2r = a^2 + r^2 \\ \tag{E7} a^2 = 1-2r \end{align*}

Use E2E2 with E1E1, then E7E7

r2=(xa)2+(yr)2r2=x2+a22ax+y2+r22ry0=x2+a22ax+x42rx20=x4+(12r)x22ax+a20=x4+a2x22ax+a2(E8)\begin{align*} r^2 = (x-a)^2 + (y-r)^2 \\ r^2 = x^2+a^2-2ax + y^2+r^2-2ry \\ 0 = x^2+a^2 - 2ax + x^4 -2rx^2 \\ 0 = x^4 + (1-2r)x^2 -2ax + a^2 \\ \tag{E8} 0 = x^4 + a^2x^2 -2ax + a^2 \\ \end{align*}

We have an equation with variable xx and aa. 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, xx has degree 4. But the graph of y=x2y=x^2 is only mirrored by yy axis. So there is only two possible xx that will have the same aa.

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:

16a4(27+52a29a4+a6)=016 a^4 (-27 + 52 a^2 - 9 a^4 + a^6)=0

From the discriminant, we entirely isolate value of aa.

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

So, the other factors must contain the solution: (27+52a29a4+a6)=0(-27 + 52 a^2 - 9 a^4 + a^6)=0. Notice although aa has degree six, if we replace a2=(12r)a^2=(1-2r) we will have polynomial of rr 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(12r)9(12r)2+(12r)3=0-27 + 52 (1-2r) - 9 (1-2r)^2 + (1-2r)^3=0, we got direct result into rr, which is approximately 0.210.21.

Rizky Maulana Nugraha

Written by Rizky Maulana Nugraha
Software Developer. Currently remotely working from Indonesia.
Twitter FollowGitHub followers