Two circles in a rectangle

enter image description here

Let $r$ be the radius. By matching the length of the long side, the following equation can be established,

$$r+\sqrt{(10+r)^2-(10-r)^2}+10=30$$

where the square-root term results from the Pythagorean theorem applied to the right triangle in the middle. The equation simplifies to

$$\sqrt{40r}+r=20$$

which yields the solution

$$r=20(2-\sqrt3)$$

or $40(2-\sqrt3)$ in diameter.


If $L\geqslant 2$ then of course the best diameter is $1$. Otherwise, the best circle will touch the long side $L$, the short side $1$, and also the big circle. Let $r$ be the radius of the best circle. The picture would look something like this:

enter image description here

Hence, the radius $r$ satisfies

$${\left(\frac12 + r\right)}^2 = {\left(\frac12 - r\right)}^2 + {\left(L - \frac12 - r\right)}^2,$$

with solution $r(L) = \frac12 + L - \sqrt{2L}$. As a sanity check, the diameter when $L=2$ is $2r(2) = 1$.

We also have $r(3/2) = 2-\sqrt3$, which scaled by the factor of $20$ in your original problem yields a diameter of $40(2-\sqrt3)\approx 10.72$, slightly larger than $10$.