Minimizing the distance from a point to a graph

In this figure, you are given the graph of a function [math]f[/math] and a black point [i]not [/i]on the graph of [math]f[/math]. You must find the point(s) on the graph of [math]f[/math] that are closest to the given point.[br][br]Drag the blue point on the graph around, and you'll see that the distance from it to your given point changes (indicated by the length of the dashed red segment). Call this distance [math]D\left(x\right)[/math]. You want the [math]x[/math]-values that minimize [math]D\left(x\right)[/math]. [br][br]Finally, observe the graph of [math]D\left(x\right)[/math], and see how this relates to the graph of [math]f[/math] and the given black point. You might first think to solve this type of minimization problem by solving [math]D'\left(x\right)=0[/math], however, here's a trick to make your calculations easier: if you minimize the [i]square [/i]of the distance you can avoid calculations with square roots.

Information: Minimizing the distance from a point to a graph