How can I calculate the radius of a circle that touches AD and DC and goes through point B of a square

enter image description here

Let $I$ and $J$ be the tangent points.

So, $OI=JO=OB=r$ and then

$$OD=r\sqrt{2} \quad \text{(Pythagoras Theorem)}$$

$$BD=BO+OD=\sqrt{2}=r+r\sqrt{2} \Rightarrow r=\frac{\sqrt{2}}{1+\sqrt{2}}$$


The circle only touches the sides, that means that the sides are tangent to the circle. Say the center of the circle is O, the touching point on DC is M, the touching point on AD is N. You can easily prove that O is on the diagonal BD (two right angle triangles DNO and DMO). Then, say the radius of the circle is denoted by $R$. The length ON=OM=$R$, and since O is on the diagonal, DNO and DMO are right angle isosceles triangles. Then ON=ND=$R$, so OD=$R\sqrt{2}$. The length of BD=$\sqrt{2}$=OB+OD=$R+R\sqrt{2}$. Therefore $R=\frac{\sqrt{2}}{1+\sqrt{2}}$