See diagram from previous post.
Triangles BEO and CGO are congruent.
Let BE = x , the angle at E is a right angle so x = (R + h)cos(theta).
EA = 5 - x, and if AD is to be a tangent to the semi circle, then the line from A to the point of tangency will have length 5 - x also.
Similarly on the RHS, the line from D to the point of tangency will have length 4 - x.
So, if AD is to be a tangent to the semi circle, it will have a length 9 - 2x = 9 - 2(R + h)cos(theta).
Now move into co-ordinate geometry mode.
Take BC to be the horizontal axis, with O as the origin.
Point A will have an x co-ordinate -(R + h) + 5cos(theta) and a y co-ordinate 5sin(theta).
Point D will have an x co-ordinate (R + h) - 4cos(theta) and a y co-ordinate 4sin(theta).
So,
AD2={9−2(R+h)cosθ}2={(R+h)−4cosθ−{−(R+h)+5cosθ}}2+(4sinθ−5sinθ)2,81−36(R+h)cosθ+4(R+h)2cos2θ=4(R+h)2−36(R+h)cosθ+81cos2θ+sin2θ,81+4(R+h)2cos2θ−4(R+h)2−81cos2θ−sin2θ=0,4(R+h)2(cos2θ−1)+81sin2θ−sin2θ=0,4(R+h)2(−sin2θ)+80sin2θ=0,(R+h)2=20,R+h=√20=2√5.
BC=2(R+h)=4√5.
.