Find a point on the line: $y=2x-5$ that is the closest to $P(1,2)$ This is our line: $f(x)=2x-5$
I have to find a point on this line that is the closest to the point $P(1,2)$. How do I go on about solving this? Should I use derivative and distance from the point to the line? I've done this so far:
$d\to$ distance between $P(1,2)$ and $f(x)$
$d= \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$
But how do I get the $x_2,y_2 $ from $f(x)$?

$$minimize \hspace{1.5mm}(x-1)^2+(y-2)^2$$
$$s.t. \hspace{1.5mm} 2x -y -5 = 0$$
Lagrangian function: $$ \mathcal{L} = (x-1)^2+(y-2)^2 + \lambda (2x -y -5) .$$
Thus,
$$\frac{\partial \mathcal{L}}{\partial x} = 2x -2 +2\lambda =0 \Rightarrow \lambda = 1-x.$$
$$\frac{\partial \mathcal{L}}{\partial y} = 2y-4-\lambda =0 \Rightarrow \lambda = 2y -4.$$
Then, $x = 5-2y$. Substituting in the constraint:
$2(5-2y)-y-5 =0 \Rightarrow y = 1.$ As $x = 5-2y$, then $x = 3$. Thus, $(3,1)$ is the only critical point. It is a minimal point because the Hessian
\begin{equation}
H =  \left [ \begin{array}{cc}
2 & 0 \\
0 & 2\\
\end{array} \right]
\end{equation} is positive definite.
