I have a point $r=(100,0)$ and want to find the closest point to it from this set:
$$k = \{(a,b) : b^2=1+a/4\}$$
where $a$ belongs to $[-4,0]$.
I thought about defining function $h(x)=|r-x|$, and using Lagrange multipliers to locate minimum point. However, I calculated the gradient of both and everything fine but i don't know how to force $a$ to be in $[-4,0]$.
Thanks in advance.
The squared distance between a free point $(x,y)$ and the fixed point $(100,0)$ is $(x-100)^2 + y^2$. If the free point travels along the curve $y^2 = 1 + \frac{x}{4}$, then the squared distance is
$$f (x) := (x-100)^2 + 1 + \frac{x}{4}$$
where $x \in [-4,0]$. If the minimum is attained in the interior of $[-4,0]$, then it can be found by making the first derivative vanish. If the minimum is not attained in the interior, then it is attained on the boundary. Hence, one must evaluate $f$ at three values to find the minimum.