In order to reduce the bending moment in the cantilever beam $A B,$
a cable and counterveight are permanently attached at end $B$. Determine the magnitude of the counterweight for which the maximum absolute value of the bending moment in the beam is as small as possible and the corresponding value of $|M|_{\max }$. Consider $(a)$ the case when the distributed load is permanently applied to the beam, $(b)$ the more general case when the distributed load may either be applied or removed.