Simple analytic geometry question I need help with Give the equation of a circle with the center $ (a,0) $ which is tangent to the line $ y = x $
I now have $ (x-a)^2 + y^2 = r^2 $ but I don't know how to continue.. please help!
 A: If the circle is tangent to that line, the point of tangency will be $(a/2,a/2)$. Can you see why that is? Can you use that to find $r$?
A: Let's calculate the intersection of $y=x$ and the circle.
So, $(x-a)^2+x^2=r^2$ as $y=x$,
$\implies 2x^2-2ax+a^2-r^2=0$
As $y=x$ is a tangent of the circle, the roots of the above equation must be same, so that the two points of intersection coincide.
So, $(-2a)^2=4\cdot 2\cdot (a^2-r^2)$  (as the discriminant$(B^2-4AC)$ of $Ax^2+Bx+C=0$ must be $0$ for the roots to be equal)
$\implies r^2=\frac{a^2}{2}$
So, the equation of the circle :$$(x-a)^2+y^2=\frac{a^2}{2}$$
Observe that the value of $x$ is $\frac{2a}{2\cdot 2}=\frac a 2$ (as the equal roots of $Ax^2+Bx+C=0$ are $-\frac{B}{2A}$), which we did not need here.  
The relationship between $r,a$ can attained at least in following 3 ways:
Differentiating,  $(x-a)^2+y^2=r^2$ wrt $x$, $\frac{dy}{dx}=\frac{a-x}{y}$
(1)Observe that at the point of intersection the gradient is $1$.
So, $\frac{a-x}{y}=1\implies x+y=a$ , but $y=x$, So, $x=y=\frac{a}{2}$
$\implies r^2=(\frac{a}{2}-a)^2+(\frac{a}{2})^2=\frac{a^2}{2}$
(2)
$$\left(\frac{x-a}{r}\right)^2+\left(\frac{y}{r}\right)^2=1$$
So, the parametric equation of the circle $(a+r\cos t,r\sin t) $.
$a+r\cos t=r\sin t\implies a=r(\sin t-\cos t)\implies a^2=r^2(1-\sin2t)$
$\left(\frac{dy}{dx}\right)_t=-\cot t$
So, $-\cot t=1$ as at the point of intersection the gradient is $1$,
$\implies \tan t=-1\implies$
$$ \sin2t=\frac{2\tan t}{1+\tan^2t}=-1$$
$\implies a^2=r^2(1-(-1))=2r^2$
(3)Let the point of intersection be $(b,b)$.
The gradient of $y=x$ is 1.
The gradient of the line joining  $(a,o), (b,b)$ is $\frac{b-0}{b-a}=\frac{b}{b-a}$
These two lines are perpendicular, so , $1\cdot \frac{b}{b-a}=-1\implies b=a-b\implies b=\frac a2$
So, $r^2=(\frac{a}{2}-a)^2+(\frac{a}{2})^2=\frac{a^2}{2}$
A: Since the line $y=x$ is tangent to the circle implies the $\perp_r $ distance between the center of the circle and the line $y=x$ must be equal to the radius of the circle. (why?)
Now, $r=\perp_r$ distance of $(a,0)$ from line $y=x$ is $|\frac{a}{\sqrt{1^2+1^2}}|=\frac{|a|}{\sqrt 2}$ 
Thus, equation of circle is $(x-a)^2+y^2=\frac{a^2}{2}$
