In the solution, it is amazingly simple, but i don't understand why they do what they did.
It is because of the symmetry of the cosine curve (actually the anti-symmetry
of cos about pi/2) guarantees that the part of the area above y=b/2 fits
exactly (when rotated through 90 degrees) above the part from a/2 to form
a rectangle of length a and width b/2.
RonL