Trouble with finding shortest distance between $y=x^2$ and $y=x-1$ with Lagrangian multipliers I've found another thread with a similar question, but none of the answers help with the specific part I'm stuck on. 
Just to make things simpler, I've used the square of the distance $f(x_1,x_2,y_1,y_2)=(x_1-x_2)^2+(y_1-y_2)^2$, and I have constraints $G_1=x_1^2-y_1$, and $G_2=x_2-y_2-1$.
Taking the gradients of $f$, $G_1$, and $G_2$, I have the system of equations
$2(x_1-x_2)=2\lambda_1x_1$
$2(y_1-y_2)=-\lambda_1$
$-2(x_1-x_2)=\lambda_2$
$-2(y_1-y_2)=-\lambda_2$
What I've done so far is, I've first observed that the immediate implication of the 2nd and 4th equations is that $\lambda_1=-\lambda_2$. Using this, I cancelled out the 1st and 3rd equations with the substituted value for $\lambda_2$, and got that $2\lambda_1x_1=\lambda_1\implies x_1=\frac{1}{2}$, and by constraint 1 that $y_1=\frac{1}{4}$. From here though, I'm not sure how to pin down the value of $\lambda$, and therefore determine $x_2$ and $y_2$.
 A: The shortest distance between the parabola $y = x^2$ and straight line $y = x - 1$ occurs when the tangent to the parabola is parallel to the line, i.e. when their slopes are equal. Now, slope of tangent of parabola $y = x^2$ is
$$
m = \frac{dy}{dx} = 2x
$$
and the slope of the straight line $= 1$. Hence the shortest distance occurs at $x = 1/2$. The point on the parabola corresponding to $x = 1/2$ is $(1/2, 1/4)$. Hence, perpendicular distance of this point from the given straight line is:
$$
d = \frac{|0.5 - 0.25 - 1|}{\sqrt{2}} = \frac{3}{4\sqrt{2}}
$$
which is the shortest distance between the curves.
EDIT: This, I guess, isn't the answer you're looking for. But I find this approach much easier and shorter than using Lagrange multipliers. Hence just shared this technique.
A: the distance between the curves is given by $$\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$$ with $$y_1=x_1^2,y_2=x_2-1$$ with these equations we obtain
$$\sqrt{(x_2-x_1)^2+(x_2-1-x_1^2)^2}$$ now you must differentiate this with respect to $$x_1,x_2$$
A: Perhaps one could use Lagrange multipliers in more elegant way, but this will work.
Define $$D(x,y,x',y') = (x-x')^2+(y-y')^2$$ and $$g(x,y,x',y') = (y-x^2)^2 + (y'-x'+1)^2.$$
Then you want to optimize $D$ with respect to $g(x,y,x',y') = 0$. Calculate gradients:
$$\nabla D = 2(x-x',y-y',-(x-x'),-(y-y'))\\
\nabla g = 2((y-x^2)(-2x),y-x^2,-(y'-x'+1),y'-x'+1)$$
Set $\nabla D = \lambda \nabla g$ to get system
\begin{align}
x-x' &=-2\lambda x(y-x^2)\\
y-y' &=\lambda (y-x^2)\\
x-x' &=\lambda (y'-x'+1)\\
y-y' &=-\lambda (y'-x'+1)\\
\end{align}
From equations 1 and 2 we get $$x-x' = -2x(y-y')$$ and from equations 3 and 4 we get $$x-x' = -(y-y')$$ which gives us $$(2x-1)(y-y') = 0$$ You can quickly check that $y-y' = 0$ is impossible since it would imply that $x-x'= 0$ as well, but our parabola and line do not intersect. Thus, $x = \frac 12$. Now you know $y = \frac 14$ and from the system \begin{align}x-x' &= y'-y\\ y' &= x'-1\end{align} you can get $x'$ and $y'$. This will give you your distance.
