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

**Problem**

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?

**Solution**

$\dfrac{y}{x} = \dfrac{30}{40}$

$y = \frac{3}{4}x$

By Pythagorean theorem

$d = \sqrt{(40 - x)^2 + y^2}$

$d = \sqrt{(40 - x)^2 + (\frac{3}{4}x)^2}$

$d = \sqrt{(40 - x)^2 + \frac{9}{16}x^2}$

For minimum length of d, differentiate then equate to zero

$\dfrac{dd}{dx} = \dfrac{2(40 - x)(-1) + \frac{9}{8}x}{2\sqrt{(40 - x)^2 + \frac{9}{16}x^2}} = 0$

$-2(40 - x) + \frac{9}{8}x = 0$

$\frac{25}{8}x = 80$

$x = 25.6 \, \text{ cm}$

Distance of D from side AB for minimum length of d

$y = \frac{3}{4}(25.6)$

$y = 19.2 \, \text{ cm}$ *answer*

The same problem was solved by Geometry alone. See the solution here: Distance between projection points