Find the equation of the circle that touches these three lines $x= 0$, $y=0$, $x = a$. 
Find the equation of the circle that touches these three lines $x= 0$, $y=0$, $x = a$.

Here is my attempt:
$x = 0$ and $y = 0$, these both line go through the $x$ and $y$ axes. And also the circle touches those two lines. So the center will be $C(p,p)$. That means $r = k = h = p$. The circle also touches the $x = a$ line. That means $r = a/2$. From that, I determined the center as $C(a/2, a/2)$.
The equation:
$$\left(x - \frac{a}{2}\right)^2 + \left(y - \frac{a}{2}\right)^2 = \left(\frac{a}{2}\right)^2$$
$$x^2 + y^2 - 2ax - 2ay + \frac{a^2}{4} = 0$$
which is not the correct answer. 

Now can anyone tell me what's wrong with this attempt? 


If the simple error in your calculation [coefficient in middle $2xy$ term in expansion of $(x+y)^2$ ] is removed the correct equation is
$$ (x^2+y^2)-a (x+y)+ \frac{a^2}{4}=0 $$
The origin/corner touching circle is in the first or fourth quadrant according as odd term $y$ is positive or negative. 
$$ (x^2+y^2)-a (x-y)+ \frac{a^2}{4}=0 $$
Everything else is quite OK.
