So I am given the function $x^2 + y^2$ and the constraint $x^2 -2x +y^2 -4y=0$. Must find max and min values (answers are $f(0,0)$ is a min and $f(2,4)$ is a max.) I use $\nabla f = \lambda \nabla g$. and get $x= \lambda(x-1)$ and $y=\lambda(y-2)$. Not sure if I messed up there or what, but I haven't been able to get to the answers once I plug $x$ and $y$ into the constraint. Any help at all is appreciated.
[Math] Finding Max and Min values using Lagrange Multipliers
lagrange multipliermaxima-minimamultivariable-calculus
Related Solutions
Let's form the Lagrangian first:
$$L(x,\lambda)=x^TAx-\lambda x^Tx-\lambda=x^T(A-\lambda I)x-\lambda$$
Now, if you take derivative with respect to $x$, and set to zero you get:
$$\frac{\partial}{\partial x}L(x,\lambda)=\frac{\partial}{\partial x} (x^TAx-\lambda x^Tx-\lambda)=2(A-\lambda I)x=0$$
$$\Rightarrow Ax=\lambda x$$
Therefore, $\lambda $ should be the eigen value of $A$, and $x$ should be an eigen vector.
Now, w.l.g, let $\lambda_1\geq \lambda_2\geq\ldots\geq\lambda_n$, be the eigenvalues of $A$, and $x_1,x_2,\ldots,x_n$ be the corresponding eigenvectors, then you have:
$$Ax_i=\lambda_i x_i$$ $$\Rightarrow x_i^TAx_i=x_i^T\lambda_i x_i=\lambda_i x_i^Tx_i=\lambda_i.1=\lambda_i$$
Therefore, $x_1^TAx_1=\lambda_1$ is the maximum achievable value, and $x_n^TAx_n=\lambda_n$ is the minumum.
Your extremal points are correct, but you made rather more work for yourself than you needed to. The Lagrange-multiplier method does tell us about the extremal points on the constraint circle. So we find a minimum value $ \ -75 \ $ at $ \ (-3, \ 4) \ $ and a maximum of $ \ 125 \ $ at $ \ (3, \ -4) \ $ .
You are also correct in saying that we are not finished, as we must also investigate the "interior" of the disk $ \ x^2 \ + \ y^2 \ < \ 25 \ $ . For that, we would use "critical point" analysis, which really proceeds in the same way that we use for functions of one variable: we have $ \ f_x \ = \ 2x \ - \ 12 \ = \ 0 \ \ ,$ $ \ \ f_y \ = \ 2y \ + \ 16 \ = \ 0 \ $ , which tells us that there is a critical point for $ \ f(x, \ y) \ $ at $ \ (6, \ -8) \ $ . But this point is completely outside the constraint circle, so there is no critical point within the disk. So our examination is complete -- we have found the absolute maximum and minimum of our function within the constraint disk and on its boundary.
(Using an argument based on your discussion of the first partial derivatives, you would perhaps want to say something more like this. We have
$$ -5 \ \le \ x \ \le \ 5 \ \ , \ \ -5 \ \le \ y \ \le \ 5 \ $$
$$ \Rightarrow \ \ 2 \ (-5) \ - \ 12 \ \le \ f_x \ \le \ 2 \ (5) \ - \ 12 \ \ , \ \ 2 \ (-5) \ + \ 16 \ \le \ f_y \ \le \ 2 \ (5) \ + \ 16 $$
$$ \Rightarrow \ \ -22 \ \le \ f_x \ \le \ -2 \ \ , \ \ 6 \ \le \ f_y \ \le \ 26 \ \ . $$
Hence, there are no points within the square $ \ [-5, \ 5] \ \times \ [-5, \ 5] \ $ , which contains the constraint circle, for which the first derivatives are zero, and thus there are no critical points within the interior of the circle.)
$ \ \ $
There is a geometrical interpretation for this problem. Considering the function $ \ z \ = \ f(x,y) \ = \ x^2 \ + \ y^2 \ - \ 12x \ + \ 16y \ = \ (x-6)^2 \ + (y + 8)^2 \ - \ 100 \ $ as describing a surface in three dimensions, this is a paraboloid with circular cross-sections "opening" in the positive $ \ z-$ direction with its vertex at $ \ (x, \ y, \ z) \ = \ (6, \ -8, \ -100 \ ) $ . We are looking for the extremal values of $ \ z \ $ where this paraboloid passes on or within the circular cylinder $ \ x^2 \ + \ y^2 \ = \ 25 \ $ .
From this description, we see that the minimal value of the function, $ \ -100 \ $ does not fall within the constraint region. Since the "height" of the surface relative to the $ \ xy-$ plane only increases as we "move away" from the vertex, we expect that there can be no extrema within the constraint cylinder. So the extremal points will only be found on the surface of the cylinder, $ \ x^2 \ + \ y^2 \ = \ 25 \ $ .
The level curves of our function are circles centered on $ \ (x, \ y) \ = \ (6, \ -8) \ $ . The Lagrange-multiplier method locates points where these level curves are just tangent to the constraint circle, which you found to lie at $ \ (-3, \ 4) \ $ and $ \ (3, \ -4) \ $ . The function $ \ f(x, \ y) \ $ can be understood as a "distance-squared" function of points measured from $ \ (6, \ -8) \ $ ; the closest point on the constraint circle is $ \ (3, \ -4) \ $ , the farthest, $ \ (-3, \ 4) \ $ .
If we take the ratio between the Lagrange equations, with $ \ \lambda \ \neq \ 1 \ $ , we obtain
$$ \ \frac{(\lambda \ - \ 1) \ \cdot \ 2 \ y}{(\lambda \ - \ 1) \ \cdot \ 2 \ x} \ = \ \frac{8}{-6} \ \ \Rightarrow \ \ \frac{y}{x} \ = \ -\frac{4}{3} \ \ . $$
[We can neglect the case of $ \ \lambda \ = \ 1 \ $ , as it cannot be applied consistently in the two equations.]
This tells us that the two extremal points lie on the line $ \ y \ = \ -\frac{4}{3} \ x \ $ , marked in light blue on the graph below. Since the constraint circle is symmetric about the origin, and the function to be extremized is radially symmetric about its center, we would expect that the extremal points will lie on a line through the origin, diametrically opposite one another on the constraint circle.
Here is a similar problem, but with the minimum of the function falling within the constraint circle.
Best Answer
The system that you should get is$$\left\{\begin{array}{l}x=\lambda(x-1)\\y=\lambda(y-2)\\x^2-2x+y^2-4y=0.\end{array}\right.$$From the first equation you get that $x=\frac\lambda{\lambda-1}$ and from the second equation you get that $y=\frac{2\lambda}{\lambda-1}$. Now, replace these values of $x$ and $y$ in the third equation in order to get $\lambda$: