How can I find the equation of a circle given two points and a tangent line through one of the points?

Here is a geometric version, not using a single formula. Start with the points $A$ and $B$ and a line $\ell$ through $A$ (see the figure below).

Construct the perpendicular line to $\ell$ through $A$ (the $\color{red}{\text{red}}$ line). Construct the perpendicular bisectors between $A$ and $B$ (the $\color{green}{\text{green}}$ line, the green dot is the midpoint of $A$ and $B$). The intersection of both constructed lines is the circle's center. The readius is the distance of the center to $A$.

You can translate every step into a formula to solve it numerically if necessary.


Hint. The center of such circle is on the line which is orthogonal to tangent line and passes through the point of tangency.

Therefore, in your case, the coordinate of the center is $C=(1+2t,7-9t)$ for some $t\in \mathbb{R}$. In order to find $t$, impose that $C$ has the same distance from the given points $P=(1,7)$ and $Q=(−6,0)$: $$|CP|^2=|CQ|^2\Leftrightarrow (4+81)t^2=(7+2t)^2+(7-9t)^2.$$


You can write a linear combination using the degenerate circle with centre $(1,7)$ and radius $r=0$ and the tangent which is like a degenerate circle with "infinite" radius

You get $(x-1)^2+(y-7)^2+k(2x-9y+61)=0$

Then plugging the coordinates of the other point $(-6;\;0)$ you have

$(-7)^2+(-7)^2+k(-12+61)=0$

solving for $k$ we get $k=-2$

the wanted circle has equation $(x-1)^2+(y-7)^2-2(2x-9y+61)=0$

$\color{red}{x^2+y^2-6 x+4 y-72=0}$

centre $(3;\;-2)$ and radius $r=\sqrt{3^2+2^2-(-72)}=\sqrt{85}$