<s>[INST] Circle passing through two points and tangent to a line 
"Find the equation of the circle passing through the origin $(0,0)$, the point $(1,0)$ and tangent to the line $x-2y+1=0$."

What I have done:
The equation of a circle with radius $R$ and center $(x_0,y_0)$ is $(x-x_0)^2+(y-y_0)^2=R^2$. Since the circle passes through $(0,0)$ and $(1,0)$ it must be $$\tag{1}  x_0^2+y_0^2=R^2$$ $$ \tag{2} (1-x_0)^2+y_0^2=R^2$$ and since it is tangent to the line $x-2y+1=0$ the distance from the center to this line must equal the radius $R$ hence (using the fact that the distance $d$ from a point $(x_0,y_0)$ to a line $ax+by+c=0$ is $d=\frac{|ax_0+by_0+c|}{\sqrt{a^2+b^2}}$) we have  $$R=\frac{|ax_0+by_0+c|}{\sqrt{a^2+b^2}}=\frac{|1x_0-2y_0+1|}{\sqrt{1^2+(-2)^2}}=\frac{|x_0-2y_0+1|}{\sqrt{5}} \tag{3}$$
From (1) and (2) we have
$$x_0^2 + y_0^2 = (1 - x_0)^2 + y_0^2 \Rightarrow x_0 = \dfrac{1}{2} \tag{4}$$
Equating (1) , (3) and (4) we have
$$\dfrac{1}{4}+y_0^2 = \dfrac{(\frac{3}{2}-2y_0)^2}{5} \Rightarrow y_0 = -3 \pm \sqrt{10}$$
So there are two solutions,
$$R^2 = \dfrac{1}{4}+(-3+\sqrt{10})^2 \Rightarrow (x - \dfrac{1}{4})^2+(y + 3 - \sqrt{10})^2 = \dfrac{1}{4} + (-3 + \sqrt{10})^2$$
and
$$R^2 = \frac{1}{4} + (-3 - \sqrt{10})^2 \Rightarrow (x - \frac{1}{4})^2 + (y + 3 + \sqrt{10})^2 = \dfrac{1}{4} + (-3 - \sqrt{10})^2$$.
Now, when I plot these solutions they appear to be wrong, so I would like to know which mistake(s) I have made.

 [/INST] There is a very neat way of doing it if you are familiar with the idea of family of circles.
Equation of family of circles passing through $O(0, 0)$ and $A(1, 0)$ is given by
$$(x-0)(x-1)+(y-0)(y-0)+ky=0$$
where k is the parameter.
On simplification we get
$x^2+y^2-x+ky=0$
So the centre of above circle is $\left(\frac{1}{2},-\frac{k}{2}\right)$ and radius is $\frac{\sqrt{1+k^2}}{2}$
Since the line $x-2y+1=0$ is tangent to above circle so perpendicular dropped from centre to the line must be equal to the radius of the circle
$$\frac{\sqrt{1+k^2}}{2}=\frac{|1-2(-\frac{k}{2})+1|}{\sqrt{1^2+2^2}}$$
Solving for k we get $k=8\pm5\sqrt3$
</s>