In 2021 March, i had to write a paper called the βExtended Essayβ, which was sort of the culminating work for the International Baccalaureate program at my high school. I was one of the 3.2% of candidates to write it under the βMathematicsβ subject and one of 20% to earn an A for it!1 :D
Even though itβs poorly written, i decided to throw it up here, with some of the cruft trimmed off. The conclusion is that tangent lines to circles can be modeled by the following system of equations.
Substitute (x1β,y1β) with the coordinates of the first circle and r1β with its radius. Likewise, substitute x2β, y2β, and r2β for the second circle.
Use different states of the three plusβminus signs to generate eight different possible lines, and manually choose four from those eight as your four tangent lines (two internal and two external).
A couple years ago, i sometimes liked to make art in Desmos (an online
graphing calculator), and one of my almost-finished pieces was a bicycle. I
had written the equation for each line that made up the drawing of the
bike, and i could even adjust the seat height and pedal lengths with
variable sliders.
However, one feature of the bike was notably missing: the chain connecting the gears. This would have taken the form of lines tangent to the two circles representing the gears, but i didnβt know how to graph that precisely at the time.
β a bicycle chain, resembling circles with tangent lines
Iβve since lost the original Desmos project, but my unsolved problem has tormented me ever since. How do you write the linear equation for each of the lines that are tangent to two circles if you know the radii and coordinates of those circles?
Circle 1 with center C1β=(x1β,y1β) and radius r1β
Circle 2 with center C2β=(x2β,y2β) and radius r2β
r1ββ₯r2β
β‘ external tangents of two circles
A line is drawn between the centers of the circles, called C(x), and
both external tangent lines t1β(x) and t2β(x) are drawn. The points
of intersection between the tangent lines and circle 1 are
i1β=(xi1β,yi1β) and i2β=(xi2β,yi2β). The points of
intersection on circle 2 are i3β=(xi3β,yi3β) and
i4β=(xi4β,yi4β). All three lines intersect at point P. The angle
between the first tangent line and the line that connects the centers of
the circles is β C1βPi1β.
Angle β C1βi1βP is a right angle because it is the angle
between a tangent to a circle and a radius that passes through the point
of tangency, and the same is true for β C2βi3βPβ . Because these right angles are congruent, and because
β³C1βPi1β and β³C2βPi2β share the angle
β C1βPi1β, this makes the triangles similar.
Because these triangles are similar, the ratio between corresponding
sides is constant. Therefore,
r2βr1ββ=h2βh1ββ
We
can substitute h1β with the two lengths that make it up: h2β+d.
Then, by rewriting the equation, we can solve for h2β.
Now that h2β is defined, we can use trigonometry to
define the angle between the line that connects the circlesβ centers and
the first tangent line. This angle is β C2βPi3β, or ΞΈ.
Consider triangle β³C2βi3βP:
β’ triangle β³C2i3P
Because of the definition of the sine of an angle (the ratio between the
opposing side and the hypotenuse in a right triangle),
sinΞΈ=h2βr2ββ. By taking the inverse sine of each
side, we can define ΞΈ:
ΞΈ=arcsin(h2βr2ββ) To find the angle of
the first external tangent line, we can add ΞΈ to the angle of
C(x) with respect to the x-axis. Similarly, we can subtract ΞΈ
from the angle of C(x) to find the angle of the second tangent line.
ΞΈtβ=ΞΈCβΒ±ΞΈβ
β£ angles of external tangents and C(x)
But how do we know the angle of C(x)? The slope of C(x) can be found
by using the slope formula and substituting with the coordinates of the
centers of the circles. Then, we can convert this slope into an angle by
finding its inverse tangent.
Now, we can substitute the values of ΞΈCβ and
ΞΈ:
ΞΈtβΞΈCβΞΈΞΈtββ=ΞΈCβΒ±ΞΈ=arctan(x1ββx2βy1ββy2ββ)=arcsin(h2βr2ββ)=arctan(x1ββx2βy1ββy2ββ)Β±arcsin(h2βr2ββ)β
Because the tangent of the angle of a line produces its
slope, we can take the tangent of both sides to generate an equation for
both of the slopes of the external tangent lines:
Stβ=tan(arctan(x1ββx2βy1ββy2ββ)Β±arcsin((x1ββx2β)2+(y1ββy2β)2βr1ββr2ββ))
This equation, which uses trigonometric functions inside of a
trigonometric function, is not very elegant. To rewrite it, we can use a
trigonometric identity for the tangent of a sum or difference:
tan(Ξ±Β±Ξ²)=1βtan(Ξ±)tan(Ξ²)tan(Ξ±)Β±tan(Ξ²)β
In this case, Ξ±=arctan(x1ββx2βy1ββy2ββ)
and
Ξ²=arcsin((x1ββx2β)2+(y1ββy2β)2βr1ββr2ββ).
For ease of explanation, weβll first find tan(Ξ±) and
tan(Ξ²) separately, then substitute them into the identity.
The tangent of Ξ± is simple to find, because the arctangent and
the tangent functions cancel each other out:
However, the tangent of Ξ² is trickier because the
tangent function doesnβt cancel out the arcsine function. To remedy
this, we can use an identity for the tangent of an arcsine, as
demonstrated by figure 5.
β€ right triangle demonstration of tanβ(arcsin(x))
In figure 5, the sine of angle ΞΈ is the ratio
between the lengths of the opposite side and the hypotenuse, or
1xβ=x. Therefore, the arcsine of this ratio equals ΞΈ:
arcsin(x)=ΞΈ The tangent of ΞΈ, or in other words, the
tangent of arcsin(x), is equal to the ratio between the opposite
side and the adjacent side. The length of the adjacent side can be found
using the Pythagorean theorem: 1βx2β. Therefore,
tan(arcsin(x))=1βx2βxβ We can now
use this identity to find tan(Ξ²):
tan(Ξ²)tan(Ξ²)tan(Ξ²)tan(Ξ²)tan(Ξ²)tan(Ξ²)tan(Ξ²)β=tan(arcsin((x1ββx2β)2+(y1ββy2β)2βr1ββr2ββ))=1β((x1ββx2β)2+(y1ββy2β)2βr1ββr2ββ)2β(x1ββx2β)2+(y1ββy2β)2βr1ββr2βββ=1β(x1ββx2β)2+(y1ββy2β)2(r1ββr2β)2ββ(x1ββx2β)2+(y1ββy2β)2βr1ββr2βββ=(x1ββx2β)2+(y1ββy2β)2(x1ββx2β)2+(y1ββy2β)2ββ(x1ββx2β)2+(y1ββy2β)2(r1ββr2β)2ββ(x1ββx2β)2+(y1ββy2β)2βr1ββr2βββ=(x1ββx2β)2+(y1ββy2β)2(x1ββx2β)2+(y1ββy2β)2β(r1ββr2β)2ββ(x1ββx2β)2+(y1ββy2β)2βr1ββr2βββ=(x1ββx2β)2+(y1ββy2β)2β(x1ββx2β)2+(y1ββy2β)2β(r1ββr2β)2ββ(x1ββx2β)2+(y1ββy2β)2βr1ββr2βββ=(x1ββx2β)2+(y1ββy2β)2β(r1ββr2β)2βr1ββr2βββ
Now that we know tan(Ξ±) and tan(Ξ²),
we can return to rewriting the slope equation using the identity for the
tangent of a sum or difference.
We can rewrite each term with a common denominator.
Stββ=(x1ββx2β)(x1ββx2β)2+(y1ββy2β)2β(r1ββr2β)2β(x1ββx2β)(x1ββx2β)2+(y1ββy2β)2β(r1ββr2β)2βββ(x1ββx2β)(x1ββx2β)2+(y1ββy2β)2β(r1ββr2β)2β(y1ββy2β)(r1ββr2β)β(x1ββx2β)(x1ββx2β)2+(y1ββy2β)2β(r1ββr2β)2β(y1ββy2β)(x1ββx2β)2+(y1ββy2β)2β(r1ββr2β)2ββΒ±(x1ββx2β)(x1ββx2β)2+(y1ββy2β)2β(r1ββr2β)2β(x1ββx2β)(r1ββr2β)βββ Finally, multiplying each side by the common denominator
yields the final equation for the slopes of the external tangent lines:
Stβ=(x1ββx2β)(x1ββx2β)2+(y1ββy2β)2β(r1ββr2β)2ββ(y1ββy2β)(r1ββr2β)(y1ββy2β)(x1ββx2β)2+(y1ββy2β)2β(r1ββr2β)2βΒ±(x1ββx2β)(r1ββr2β)β
At first glance, this equation doesnβt appear any simpler than the one
involving nested trigonometric functions. However, by applying the
following substitutions, the symmetry and elegance of this equation
becomes clear: a=x1ββx2βb=y1ββy2βc=r1ββr2βStβ=aa2+b2βc2ββbcba2+b2βc2βΒ±acββ
In order to define an exact equation for the external tangents, defining
the slopes isnβt enough. We also need a point on each of the slopes, and
the easiest points to use are the points of tangency on circle 1.
A point of tangency on circle 1 will have an instantaneous slope equal
to that of the tangent line it corresponds to. Therefore, to figure out
which points on circle 1 can qualify as points of tangency, we need to
find the derivative (the slope at each point) of the equation of circle
1 and set it equal to the tangentβs slope, and then solve for the
x-value of the point of tangency. This can then be fed back into the
circle equation to define the other coordinate of the point of tangency,
which would complete the definition of the tangent line function.
This method presents one key problem, however: a circle equation is not
a function, and so its derivative would not be a function either. At
each x-value in the domain of the graph of the circle, there are two
possible y-values and two possible slopes, and as a result, there are
two points on circle 1 that could qualify as points of tangency for each
tangent line. Because there are two tangent lines, this makes four
possible points of tangency, but only two of them are correct.
β₯ two points of tangency on a circle that have the same
instantaneous slope
Ultimately, i decided to accept the fact that this approach would
generate not two, but four possible external tangents, and someone using
this equation would have to manually decide which definitions to use.
The first step is to find the derivative of the circle equation.
However, this equation is not defined simply in terms of y, as itβs
based on the Pythagorean theorem. (xβx1β)2+(yβy1β)2=r12β Implicit
differentiation would not work in this case, so we need to rewrite the
circle equation in terms of y before we differentiate it with respect
to x. (xβx1β)2+(yβy1β)2(yβy1β)2yβy1βyβ=r12β=r12ββ(xβx1β)2=Β±r12ββ(xβx1β)2β=Β±r12ββ(xβx1β)2β+y1ββ Now, we can find the derivative of this equation to find
the slope of any given point on circle 1.
We can use the chain rule for derivatives to continue.
dxdyβdxdyβdxdyβdxdyβdxdyββ=Β±21β(r12ββ(xβx1β)2)β21β(dxdβ[r12ββ(xβx1β)2])=Β±2r12ββ(xβx1β)2β1β(βdxdβ[(xβx1β)2])=Β±2r12ββ(xβx1β)2β1β(2(xβx1β)(1))=Β±2r12ββ(xβx1β)2β2(xβx1β)β=Β±r12ββ(xβx1β)2βxβx1βββ This resulting equation gives the relationship between
the slope of the tangent line (dxdyβ) and
the x-coordinate of the point of tangency on circle 1.
We need to rewrite this equation in terms of x, because in this case,
x is the x-coordinate of the point of tangency, which will be used
in the tangent line equation. However, the algebra that enables us to do
this is long and confusing. To help make the process easier to read, we
will temporarily reassign each variable to a single letter each:
dxdyβ=Stβr1βx=xiβx1ββ=a=b=c=dβ Essentially, we can rewrite the equation as a sum of
terms, which can be rearranged into a quadratic equation with multi-term
coefficients. These can be plugged into the quadratic formula in order
to solve for c, which represents xiβ. aΒ±ab2β(cβd)2β(Β±ab2β(cβd)2β)2a2(b2β(cβd)2)a2(b2β(c2β2cd+d2))a2(b2βc2+2cdβd2)a2b2βa2c2+2a2cdβa2d2a2b2βa2c2+2a2cdβa2d2βc2+2cdβd2βa2c2βc2+2a2cd+2cd+a2b2βa2d2βd2c2(βa2β1)+c(2a2d+2d)+(a2b2βa2d2βd2)β=Β±b2β(cβd)2βcβdβ=cβd=(cβd)2=(cβd)2=c2β2cd+d2=c2β2cd+d2=c2β2cd+d2=0=0=0β Now that the equation is in the form of a quadratic, we
can use the quadratic formula to determine the solutions for c.
c=2(βa2β1)β(2a2d+2d)Β±(2a2d+2d)2β4(βa2β1)(a2b2βa2d2βd2)ββ
For readability, weβll simplify the radicand in the quadratic formula
separately: (2a2d+2d)2β4(βa2β1)(a2b2βa2d2βd2)4a4d2+8a2d2+4d2β4(βa4b2+a4d2+a2d2βa2b2+a2d2+d2)4a4d2+8a2d2+4d2+4a4b2β4a4d2β4a2d2+4a2b2β4a2d2β4d2(4a4d2β4a4d2)+(8a2d2β4a2d2β4a2d2)+(4d2β4d2)+4a4b2+4a2b24a4b2+4a2b2β Then, we can substitute the radicand back into the
quadratic formula and continue simplifying. ccccccccccβ=2(βa2β1)β(2a2d+2d)Β±4a4b2+4a2b2ββ=β2(a2+1)β2d(a2+1)Β±4a4b2+4a2b2ββ=β2(a2+1)β2d(a2+1)Β±2aba2+1ββ=a2+1d(a2+1)βaba2+1ββ=a2+1d(a2+1)ββa2+1aba2+1ββ=dβa2+1aba2+1ββ=dβ(a2+1)1ab(a2+1)21ββ=dβab(a2+1)β21β=dβabβ (a2+1)21β1β=dβa2+1βabββ We can now reverse the temporary substitutions to give
us a definition of the x-coordinate of the point of tangency on
circle 1. a=Stβb=r1βc=xiβd=x1βxiβ=x1ββSt2β+1βStβr1βββ This equation is in terms of the slope of the tangent
line, the x-coordinate of the center of circle 1, and the radius of
circle 1. However, itβs important to note that the tangentβs slope is
itself defined by other given values in the problem. Earlier, we
manipulated the circle equation so that it was in terms of y, which
allowed us to find its derivative with respect to x. We can substitute
our definition of the x-coordinate of the point of tangency into this
circle equation, allowing us to define the corresponding y-coordinate.
yiβ=Β±r12ββ(xiββx1β)2β+y1β
The slopes of the tangent lines, the x-coordinates of the points of
tangency, and the y-coordinates of the points of tangency have all
been defined in terms of the original parameters of the problem. By
using the point-slope equation f(x)=m(xβx1β)+y1β, the final
system of equations can be displayed: Stβxiβyiβyβ=(x1ββx2β)(x1ββx2β)2+(y1ββy2β)2β(r1ββr2β)2ββ(y1ββy2β)(r1ββr2β)(y1ββy2β)(x1ββx2β)2+(y1ββy2β)2β(r1ββr2β)2βΒ±(x1ββx2β)(r1ββr2β)β=x1ββSt2β+1βStβr1ββ=Β±r12ββ(xiββx1β)2β+y1β=Stβ(xβxiβ)+yiββ Unfortunately, because of the ambiguity of the
plus-or-minus operators in the system of equations, two of the possible
equations generated are not correct, and so the correct equations must
be chosen manually.
β¦ four lines generated by the external tangent
system
The process for modelling the internal tangents to two circles is very
similar to the process for external tangents. In figure
2, two
similar triangles were used to write a ratio involving the radii and the
hypotenuses. In figure 8, triangles β³C1βPi1β and
β³C2βPi3β are similar because they share the vertical angle
ΞΈ, and they both have a right angle. This allows us to equate the
following ratios between corresponding sides:
r1βr2ββ=h1βh2ββ We can rewrite h2β as dβh1β and
then solve for h1β: r1βr2ββr1βh1βr2ββh1βr2βh1βr2β+r1βh1βh1β(r2β+r1β)h1ββ=h1βdβh1ββ=dβh1β=r1βdβr1βh1β=r1βd=r1βd=r2β+r1βr1βdββ This definition of h1β allows us to find ΞΈ
using trigonometry. We can express the sine of ΞΈ as the ratio
between the opposite side in the right triangle and the hypotenuse:
sin(ΞΈ)=h1βr1ββ Then, we can substitute for h1β and
solve for ΞΈ. sin(ΞΈ)sin(ΞΈ)sin(ΞΈ)ΞΈβ=r2β+r1βr1βdβr1ββ=r1βdr1β(r2β+r1β)β=dr2β+r1ββ=arcsin(dr2β+r1ββ)β Just like the external tangents, the angle of the
internal tangents is simply the angle of C(x), plus or minus the angle
ΞΈ (see figure 4{reference-type=βrefβ
reference=βfig:plusMinusThetaβ}). Because we already found the angle of
C(x) (called ΞΈCβ) when we modeled the external tangents, we can
use a similar formula as before: ΞΈtβΞΈCβΞΈtββ=ΞΈCβΒ±ΞΈ=arctan(x1ββx2βy1ββy2ββ)=arctan(x1ββx2βy1ββy2ββ)Β±arcsin(dr2β+r1ββ)β Then, because the tangent of the angle of a line equals
the slope of the line, we can take the tangent of each side to find the
slope of the internal tangent lines.
Stβ=tan(arctan(x1ββx2βy1ββy2ββ)Β±arcsin(dr2β+r1ββ))
Finally, we can substitute d with the formula for the distance between
C1β and C2β.
Stβ=tan(arctan(x1ββx2βy1ββy2ββ)Β±arcsin((x1ββx2β)2+(y1ββy2β)2βr1β+r2ββ))
This is very similar to the formula for the slope of the external
tangent lines. In fact, the sole difference between the formulas is that
the external tangent equation uses the difference between the circles'
radii, while the internal tangent equation uses the sum of the radii.
Souter tangentsβSinner tangentsββ=tan(arctan(x1ββx2βy1ββy2ββ)Β±arcsin((x1ββx2β)2+(y1ββy2β)2βr1ββr2ββ))=tan(arctan(x1ββx2βy1ββy2ββ)Β±arcsin((x1ββx2β)2+(y1ββy2β)2βr1β+r2ββ))β Conveniently, this difference is consistent throughout
the rest of the problem. At no point during the problem-solving process
involving the external tangents was the term r1ββr2β separated or
modified, which means that all we need to do to adapt our model to use
for the internal tangents is to replace r1ββr2β with r1β+r2β. Or, to
represent both set of tangents in the same system of equations, we can
use r1βΒ±r2β.
If we rearrange the previous system of equations for external tangent
lines, as well as replace r1ββr2β with r1βΒ±r2β, the updated
system of equations can be displayed. We can mathematically model
tangent lines to two circles on the coordinate plane using the following
system of equations:
Note that in each of the first three lines in the system
of equations, there are one or more uses of the plus-or-minus or
minus-or-plus operator. This means that there are 23=8 possible
linear functions that this system could generate, depending on which
option (plus or minus) one chooses for each line in the system. Only
four of these functions, however, will represent actual tangents,
internal or external, to the circles.
As previously noted, the biggest limitation in this model is that itβs
ambiguous: only half of the lines it produces are real tangent lines, so
someone using the model would need to manually choose which set to use. There are some situations in
which the model breaks β for example, when one or more of the tangent
lines would be vertical, the model produces an undefined slope.