A flagpole is 40m high, the angle of elevation of its top form a point A on level ground is 39° form another point B in line with A and the foot of the pole, the angle of elevation is 60°. Calculate the distance AB

Draw a diagram and review the basic trig functions. You can see that

AB = 40cot39° - 40cot60° = 40(cot39° - cot60°)