A body of mass M is hanging by an inextensible string of mass m. If the free end of the string accelerates up with constant acceleration a, find the variation of tension in the string as a function of the distance measured from the mass M (bottom of the string).