This question is from a codejam (codejam challenge). Here is the full text, (images and examples are in the link):
To start with, ignore the racquet's handle. Assume the racquet is a perfect ring, of outer radius R and thickness t (so the inner radius of the ring is R−t).
The ring is covered with horizontal and vertical strings. Each string is a cylinder of radius r. Each string is a chord of the ring (a straight line connecting two points of the circle). There is a gap of length g between neighbouring strings. The strings are symmetric with respect to the center of the racquet i.e. there is a pair of strings whose centers meet at the center of the ring.
The fly is a sphere of radius f. Assume that the racquet is moving in a straight line perpendicular to the plane of the ring. Assume also that the fly's center is inside the outer radius of the racquet and is equally likely to be anywhere within that radius. Any overlap between the fly and the racquet (the ring or a string) counts as a hit.
I tried solving the above without looking at the answer and failed. I proceeded to find the area of the racquet for any g,r,R and t. I thought the probability would be: (area of racquet / area of circle with radius R) * (area of fly). Then I realized this fails to consider the case where the fly's radius is greater than the gap, in which case the probability should be 1. So at this point I have some equations that (i think) should provide me the area of the racquet. Here they are in lambda equation form in python (sorry, I haven't used latex in a while).
You could go on without reading this part. I'm providing it to show that I have done some work:
#variables dependent on i
l = lambda i: ( (R-t)**2 - (r + (g + 2*r)*i)**2 ) ** 0.5
B = lambda i: 2 * l(i) * (2*r)
k = lambda i: (g + 2*r)*i - r
h = lambda i: ( (R-t)**2 - k(i)**2 ) ** 0.5 - l(i)
C = lambda i: ( h(i)**2 + (2*r)**2 ) ** 0.5
x = lambda i: ( (R-t)**2 - (C(i)/2)**2 ) ** 0.5
theta = lambda i: 2 * asin( C(i) / (2.0*(R-t)) )
T = lambda i: r*h(i) + ( (R-t)**2 / 2.0 ) * theta(i) - (C(i)/2.0)*x(i)
#constant variables (independent of i)
P = int((R - (t+r)) / (g + 2*r))
n = (2*P + 1)**2
S = 4 * (r**2)
#areas
Asample = pi * (R**2)
A1 = Asample - pi*(R-t)**2
Aswat = A1 + 2 * ( (B(0)+2*T(0)) + 2 * sum( B(i) + 2*T(i) for i in range(1,P+1)) ) - (n*S)
Afly = pi * (f**2)
I then proceed to read the solution/analysis of this challenge (challenge solution). Here is a part of it:
The first step in solving this problem involves a standard trick. Instead of looking for the region that will hit the fly's circular body, we look for the region where the center of the fly must avoid. The problem is thus transformed into an equivalent one where we thicken the size of the racquet to t + f and the radius of the strings from r to r + f. And we consider the fly to be simply a single point, only focusing on its center.
Hmmm. How cool. That simplifies a lot! But I would like to see/know why that is equivalent? Why can you do that? What is this "standard trick"?
They say why it's equivalent: it is the region that the center of the fly has to avoid if the entire fly is to avoid the racquet.
The fly, by definition, consists of all points that have distance $f$ or less from the center. A string is defined as all points that have distance $r$ from the line at the center.
If the fly hits the string, then that means that there was a point that was simultaneously at most $f$ from the center of the fly and at most $r$ from the center of a string. This can be rephrased as the center of the fly being at most $f+r$ from the center of the string.