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.
 A: 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.
A: Plot of the solution. The equations are $(6)$ (blue circle) and $(7)$ (black circle)



*

*Start with the equation of a circle centered at $(h,k)$ and radius $r$
$$
\begin{equation}
(x-h)^{2}+(y-k)^{2}=r^{2}.  \tag{1}
\end{equation}
$$

*Since the points $N(5,1)$ and $M(12,8)$ lay on the circle, we have the
equations $$(5-h)^{2}+(1-k)^{2}=(12-h)^{2}+(8-k)^{2}=r^{2}.\tag{1'}$$

*Simplify the first two equations of $(1')$. They become $$k=13-h.$$ Substitute this value of $k$ in $(1)$ 
$$
(x-h)^{2}+(y-13+h)^{2}=r^{2}.\tag{2}
$$

*Solve for $y$ $$y=13-h\pm \sqrt{-h^{2}-x^{2}+2xh+r^{2}}\tag{2'}$$ and compute the derivative 
$$y'=\pm \frac{h-x}{\sqrt{-h^{2}-x^{2}+2xh+r^{2}}}.\tag{3}$$

*Consequently, at $x=h,y=0$ the circle is tangent to the $x$-axis. Substitute these values in $(2)$ $$(-13+h)^{2}-r^{2}=0\tag{4}$$ and solve for $h$, getting $$h=13\pm r.$$ 

*Use the coordinates of e.g. $N(5,1)$ in $(2)$  and choose $h=13- r$ $$
(5-\left( 13-r\right) )^{2}+(1-13+\left( 13-r\right) )^{2}-r^{2}=0\tag{5}
$$

*Solving for $r$ we get the solutions  $r=5$ and $r=13$. One of the equations of the circle is $$ \boxed{(x-8)^{2}+(y-5)^{2}=5^{2}}\tag{6}$$ and the other $$\boxed{x^{2}+(y-13)^{2}=13^{2}.}\tag{7}$$

*The solution $h=13+r$ results in a radius $r<0$, which is impossible.
A: Well, we have a few equations to work with.
( 5-a)^2 + (1-b)^2 = R^2
(12-a)^2 + (8-b)^2 = R^2

Also, using the fact that y'=0 where y=0, we can implicitly differentiate the equation of the circle to discover:
(x-a)^2 + (y-b)^2 = R^2  equation of circle
2(x-a) + 2(y-b)y' = 0    implicit differentiation
2(x-a) = 0               use y' = 0, y = 0
x = a                    solution

So the point (a, 0) is also on the circle. Now we have a new equation:
(a-a)^2 + (0-b)^2 = R^2

And that's all there is to it.
EDIT: Well, of course, you still need to solve the system. If help is needed with that, I'll edit this answer accordingly. The basic idea is that b is +R or -R, and so you try to solve the other two equations under each of these possibilities.
A: Patrick has given the correct equations but I will just add to the understanding part, as you've asked for it in the question. The basic idea is to figure out all the possibilities that fit the requirements. Going into the equation might lead you to an incorrect answer. It helps if you expect a certain solution. For eg, the given conditions imply clearly that the circle has to be above the x-axis if the x-axis is tangent to it and the points on its circumference are above the x-axis. Without writing an equation, you can tell that there are at most two possible circles that can lie above the x-axis and go through these points. So, all you need to find out is the origin of the circle and its radius - 3 variables. So you need 3 unique equations. Here, we start with the first two equations given by Patrick. The center is at a distance ( = R) from a point on its circumference. Two points give you two equations. Finally, the tangent is basically a line that is at a distance (= R) from the centre of circle. In the current case, the tangent was X=0, which simplified things. Usually, that will not be the case. You can make the third equation using this idea as explained here.
