Distance between projection points on the legs of right triangle (solution by Calculus)

From the right triangle ABC shown below, AB = 40 cm and BC = 30 cm. Points E and F are projections of point D from hypotenuse AC to the perpendicular legs AB and BC, respectively. How far is D from AB so that length EF is minimal?