<s>[INST] How to Determine an Equation of a Circle using a Line and Two Points on a Circle My question goes like this:
Determine the equation of a circle tangent to the $x$-axis and passing through $(5,1)$ and $(12,8)$.
I need not only the answers, but also the steps on how you did it so that I can do it on similar questions.
Thanks.
 [/INST] A careful diagram should make one guess that there are two such circles.
Our circle(s) passes through $(5,1)$ and $(12,8)$. So the perpendicular bisector of the line segment through these two points passes through the centre of the circle.
The line through our two points has slope $(8-1)/(12-5)$, which is $1$. So the perpendicular bisector has slope $-1$.
Now we can find the equation of the perpendicular bisector. It has slope $-1$ and passes through the midpoint $(17/2,9/2)$ of our line segment.  We find that the perpendicular bisector has equation $x+y=13$.  
Let the centre be $(a,b)$. Then $a+b=13$. Furthermore, because the circle is tangent to the $x$-axis, and cannot go below the $x$-axis, the radius must be $b$. So the square of the distance from $(a,b)$ to $(5,1)$ must be equal to $b^2$.
This gives us the equation
$$(a-5)^2+(b-1)^2=b^2,$$
which expands to 
$$a^2-10a-2b+26=0.$$
But $b=13-a$. Substitute. We get 
$$a^2 -8a=0.$$
Solve. We get $a=0$ or $a=8$. The corresponding $b$ are $b=13$ and $b=5$. Now the equations of the two circles are easy to write down. The first has centre $(0,13)$ and radius $13$. The second has centre $(8,5)$ and radius $5$. 
Another (faster) way: Let the radius of our target circle be $r$. Since the circle is tangent to the $x$-axis, the $y$-coordinate of the centre of the circle is $r$. Let the $x$-coordinate be $a$. 
Then the circle has equation
$$(x-a)^2+(y-r)^2=r^2,$$
Substitute $(5,1)$ and $(12,8)$ in the equation of the circle.
We get 
$a^2-10a-2r+26=0$ and $a^2-24a-16r+208=0$. Subtract to get rid of the $a^2$ term. We get $14a+14r=182$, which simplifies to $a+r=13$. Substitute $13-a$ for $r$ in the equation $a^2-10a-2r+26=0$. Quickly we arrive at $a^2-8a=0$, and it is almost all over.
</s>