# How to find the equation of a line tangent a circle and a given point outside of the circle

I am given the equation of a circle: $(x + 2)^2 + (y + 7)^2 = 25$. The radius is $5$. Center of the circle: $(-2, -7)$.

Two lines tangent to this circle pass through point $(4, -3)$, which is outside of said circle. How would I go about finding one of the equations of the lines tangent to the circle?

I haven't started calculus, so I ask for advice fitting for someone starting a topic like this.

• Note that you don't need to tell us what the center of the circle is, that information is easily extracted from the equation for the circle. Also, you speak of "the lines tangent to this circle" as though there were only those two, but there are an infinite number of tangent lines for any given circle. – Jack M Oct 29 '13 at 0:00
• Hint: a line is tangent to a circle if and only if it is perpendicular to the radius (that is, to the line containing the center and the tangent point). – Sigur Oct 29 '13 at 0:11
• I'm not sure i follow that @Sigur, if i draw a circle $C$ and a point $P$ external to $C$, then a line that I draw from $P$ to $C$ that is tangent to $C$ isn't perpendicular to the line drawn from the origin of $C$ to $P$. So I've obviously misunderstood something. – baxx Apr 12 '16 at 20:24
• @baxx, should be from the center of the circle to the tangent point, not to $P$. – Sigur Apr 12 '16 at 21:44

A useful technique for this situation which avoids using calculus goes like this:

Find the equation of a line through the point $(4,-3)$ with gradient $k$, and then use this (linear) equation to substitute into the equation of the circle to get a quadratic. The two roots of this quadratic would give the 2 points of intersection of the line with the circle, but in our case, we want to know the values of $k$ for which the quadratic has a double root (i.e. the 2 points of intersection are actually coincident). Use the standard condition ($b^2=4ac$) for a double root of a quadratic.

In your case, the equation of the line through $(4,-3)$ with gradient $k$ is $y+3 = k(x-4)$, or $y+7 = k(x-4)+4$. Substituting this into the equation of the circle gives:

$$(x+2)^2 + (k(x-4)+4))^2 = 25$$

So you need to rearrange this quadratic in $x$ and find out which vales of $k$ give double roots.

• "without using calculus", how would you do it with calculus? – Vrisk Nov 7 '17 at 4:49

One possible approach would be the following:
1) Denote by $A$ the point $(4,-3)$, by $O$ the center of the circle, and by $P_1,P_2$ the two points on the circle in which the corresponding tangent line intersects the circle. Then both the triangles $AOP_1$ and $AOP_2$ are right, with hypotenuse $AO$.
2) The length of $AO$ is $\sqrt{(-2-4)^2+(-7-(-3))^2}=\sqrt{36+16}=\sqrt{52}$. The length of $OP_1$ and of $OP_2$ is the radius, and therefore equal to $5$. So, using the Pythagorean theorem, we get: $$|AP_1|=|AP_2|=\sqrt{|OA|^2-r^2}=\sqrt{52-25}=\sqrt{27}$$ 3) From here you can find both $P_1$ and $P_2$ - they are the points of intersections of the given circle with the circle of radius $\sqrt{27}$ around $(4,-3)$.
4) Now find the equations of two lines passing through given points.

Assume the point where the tangent touches the circle is $(x_1,y_2)$, then this point satisfies the equation of the circle and the equation

$$y'= \frac{y_1+3}{x_1-4 }\longrightarrow (*).$$

Now, you need to find $y'$ and evaluate it at the point $(x_1,y_1)$ and subs. back in (*), so you end up having two Equations in two variables. Solve them to find the point $(x_1,y_1)$ and finaly you will have two points that required to find the tangent plane.

The equation of any line passing through $(4,-3)$ is $$\frac{y+3}{x-4}=m\iff mx-y-4m-3=0$$ where $m$ is the gradient

Now, the perpendicular distance of tangent to center of circle = radius of circle

Do you know how to calculate the perpendicular distance of a line from the point?

Observe that the values of $m$

$(i)$ will be distinct real (hence, two tangents) if the point lies outside the circle,

$(ii)$ will be equal real (hence, one tangent) if the point lies on the circle,

$(iii)$ will be distinct imaginary (hence, no real tangents) if the point lies inside the circle,

See $12(b)$ here

My work out

(-3+7)/(4+2)=tan(33.7°)

2. PC distance:

√((-3+7)²+(4+2)²)=√52

3. ∠CPQ = arcsin(5/√52)=43.9°

4. Equations of tangent passing through PQ & PR

(Y+3)/(X-4)=tan(33.7±43.9)

Without any loss of generality we can draw a tangent to a circle with centre $$C\equiv(C_x,C_y)$$ and radius $$r$$ and choose a point $$P\equiv(P_x,P_y)$$ on the tangent so that its distance from the origin is $$\overline{CP}\equiv d$$ with $$d \ge r$$.

From the sketch above we recognize that the tangency points can be described as the sums of vectors, i.e.,

$$\overrightarrow{OT_1} = \overrightarrow{OC}+ \frac{a}{d}\,\overrightarrow{CP}+ \frac{b}{d}\,\overrightarrow{CP}',\qquad \overrightarrow{OT_2} = \overrightarrow{OC}+ \frac{a}{d}\,\overrightarrow{CP}- \frac{b}{d}\,\overrightarrow{CP}'$$

where the prime in $$\overrightarrow{CP}'$$ represents a 90⁰ anticlockwise rotation of the vector.

Because our task is now to determine $$a/d$$ and $$b/d$$, we observe that the triangles $$CT_1C'$$ and $$CPT_1$$ are similar so that, with the position $$\rho=r/d$$, we have

$$\frac{a}{r} = \frac{r}{d} \implies \frac{a}{d}=\left(\frac{r}{d}\right)^2 =\rho^2$$

and

$$\frac{b}{r} = \frac{R}{d} \implies \frac{b}{d}=\frac{rR}{d^2} =\rho\frac Rd$$

but $$R=\sqrt{d^2-r^2}$$ and eventually we can write

$$\frac{b}{d}= \rho\sqrt{1-\rho^2}.$$

From the last relation we recognize 1) that a real solution requires $$\rho\le1$$ (i.e., $$P$$ is not inside the circle) and 2) that for $$\rho=1$$ the point $$P$$ is on the circumference and the tangency points degenerate into $$P$$.

The OP can now compute the tangency points, etc.

E.g., in Python 3

from math import sqrt
# Data Section, change as you need #
Cx, Cy = -2, -7                    #
r = 5                              #
Px, Py =  4, -3                    #
# ################################ #
dx, dy = Px-Cx, Py-Cy
dxr, dyr = -dy, dx
d = sqrt(dx**2+dy**2)
if d >= r :
rho = r/d
bd = rho*sqrt(1-rho**2)
T1x = Cx + ad*dx + bd*dxr
T1y = Cy + ad*dy + bd*dyr
T2x = Cx + ad*dx - bd*dxr
T2y = Cy + ad*dy - bd*dyr

print('The tangent points:')
print('\tT1≡(%g,%g),  T2≡(%g,%g).'%(T1x, T1y, T2x, T2y))
if (d/r-1) < 1E-8:
print('P is on the circumference')
else:
print('The equations of the lines P-T1 and P-T2:')
print('\t%+g·y%+g·x%+g = 0'%(T1x-Px, Py-T1y, T1y*Px-T1x*Py))
print('\t%+g·y%+g·x%+g = 0'%(T2x-Px, Py-T2y, T2y*Px-T2x*Py))
else:
print('''\
Point P≡(%g,%g) is inside the circle with centre C≡(%g,%g) and radius r=%g.
No tangent is possible...''' % (Px, Py, Cx, Cy, r))


Executing the program yields

The tangent points:
T1≡(-1.1139,-2.07914),  T2≡(2.88314,-8.0747).
The equations of the lines P-T1 and P-T2:
-5.1139·y-0.920857·x-11.6583 = 0
-1.11686·y+5.0747·x-23.6494 = 0


Let eq of tangents be y= mx+ c then it passes through point (4,-3) So -3=4m+c let it put aside Now tangent touches circle so radius = distance between centre and line 5 = |-2m+7+c|/(m^2+1)^1/2 By solving we get 11 m^2 +24m=9 We get two values of m These are slopes of linesenter preformatted text here We can equation of lines and angle between lines This is my idea