# maxima and minima of f(x,y,z)

• Nov 21st 2006, 09:07 PM
markholden
maxima and minima of f(x,y,z)
The question: find the point on the plane $\displaystyle x-y+z=4$ that is closest to the point $\displaystyle (1,2,3)$.

So I guess in math terms the problem is to find $\displaystyle min(d)$ where

$\displaystyle d=\sqrt{(x-1)^{2}+(y-2)^{2}+(z-3)^{2}}$

It's clear that

$\displaystyle d_{x}=\frac{x-1}{\sqrt{(x-1)^{2}+(y-2)^{2}+(z-3)^{2}}}$
$\displaystyle d_{y}=\frac{y-2}{\sqrt{(x-1)^{2}+(y-2)^{2}+(z-3)^{2}}}$
$\displaystyle d_{z}=\frac{z-3}{\sqrt{(x-1)^{2}+(y-2)^{2}+(z-3)^{2}}}$

And of course, what you're supposed to do is set them equal to zero and solve. Only problem is, I have no clue how to do that. Any help appreciated. Thanks in advance.

Edit: Never mind, is it as stupid as I think it is?

$\displaystyle d_{x}=0\ \Rightarrow\ x-1=0\ \Rightarrow\ x=1$

Is that the solution? If so, I think I should bash my head against a wall.
• Nov 21st 2006, 09:15 PM
markholden
P.S. Apologies in advance if this was the wrong forum for this question.
• Nov 21st 2006, 11:23 PM
TD!
What you are doing now is finding the distance between some arbitrary point (x,y,z) and the point (1,2,3).
If you're going to minimize that, then you'll find x = 1 indeed, and y = 2 and z = 3, since the closest point will be the point itself ;)

What you're forgetting is to implement the fact that your point isn't arbitrary, it has to satisfy x-y+z=4.
You could do this with Lagrange multipliers, or substitute (for example) y by x+z-4 in your expression, leaving a two-variable problem.

Another hint: since you're only asked to find the closest point, you might as well minimize dē, the square distance.
This way you'll lose the annoying square root, but your solution will be the same since minimal distance implies minimal quadratic distance.
• Nov 22nd 2006, 10:22 PM
earboth
Quote:

Originally Posted by markholden
The question: find the point on the plane $\displaystyle x-y+z=4$ that is closest to the point $\displaystyle (1,2,3)$.
...

Hello, Markholden,

Your equation describes a plane in $\displaystyle \mathbb{R}^3$ in normal form. That means you know the perpendicular direction to this plane: $\displaystyle \vec{n}=[1, -1, 1]$.

If you use this direction and the given point you can construct a straight line which intercept the plane in the point you are looking for:

Plane: $\displaystyle [1, -1, 1] \cdot [x, y, z]=4$
Line: $\displaystyle [x, y, z]=[1, 2, 3]+r \cdot [1, -1, 1]$

Calculating the intercept: $\displaystyle [1, -1, 1] \cdot \left( [1, 2, 3]+r \cdot [1, -1, 1] \right)=4$
Calculate the scalar products: $\displaystyle 2 + 3r=4\ \Longleftrightarrow\ r=\frac{2}{3}$

Plug in this value into the equation of the line: $\displaystyle [x, y, z]=[1, 2, 3]+\frac{2}{3} \cdot [1, -1, 1]=\left[\frac{5}{3},\frac{4}{3},\frac{11}{3} \right]$

The distance between this point and the given point is:
$\displaystyle d=\left|[1, 2, 3] - \left[\frac{5}{3},\frac{4}{3},\frac{11}{3} \right] \right|$

$\displaystyle d=\sqrt{\left(-\frac{2}{3} \right)^2+\left( \frac{2}{3} \right)^2+\left(-\frac{2}{3} \right)^2}=\frac{2}{3}\cdot \sqrt{3} \approx 1.1547$

EB
• Nov 22nd 2006, 11:27 PM
CaptainBlack
[quote=markholden;28463]The question: find the point on the plane $\displaystyle x-y+z=4$ that is closest to the point $\displaystyle (1,2,3)$.

So I guess in math terms the problem is to find $\displaystyle min(d)$ where

$\displaystyle d=\sqrt{(x-1)^{2}+(y-2)^{2}+(z-3)^{2}}$
quote]

One way of doing this is to write:

$\displaystyle D=d^2=(x-1)^{2}+(y-2)^{2}+(z-3)^{2} =(x-1)^2+(y-2)^2+(1-x+y)^2$

Then you want to find $\displaystyle (x,y)$ which minimised $\displaystyle D$ which is a point at which:

$\displaystyle \frac{\partial D}{\partial x}=0$, and $\displaystyle \frac{\partial D}{\partial y}=0$

These give a pair of linear simultaneous equations which can be solved for $\displaystyle x$ and $\displaystyle y$, then $\displaystyle z$ can be found by plugging these into the equation of the plane.

RonL
• Nov 24th 2006, 12:31 AM
Soroban
Hello, Mark!

Quote:

Find the point on the plane $\displaystyle x-y+z=4$ that is closest to the point $\displaystyle (1,2,3)$

I would take TD's advice and use Lagrangian multipliers.

We want to minimize: .$\displaystyle D\:=\:(x-1)^2 + (y-2)^2 + (z-3)^2$
. . with the constraint: $\displaystyle g(x) \:=\:x - y + z - 4 \:=\:0$

We have: .$\displaystyle f(x,y,z,\lambda) \;=\;(x-1)^2 + (y-2)^2 + (z-3)^2 + \lambda(x - y + z - 4)$

Then: /$\displaystyle \begin{Bmatrix}(1) &\frac{\partial f}{\partial x} \:=\:2(x-1) + \lambda\:=\:0 \\ \\ (2) &\frac{\partial f}{\partial y} \:=\:2(y -2) - \lambda\:=\:0 \\ \\ (3) & \frac{\partial f}{\partial z} \:=\:2(z-3) + \lambda\:=\:0 \\ \\ (4) &\frac{\partial f}{\partial \lambda} \:=\:x - y + z - 4 \:=\:0\end{Bmatrix}$

$\displaystyle \begin{array}{ccc}\text{From }(1):\;x \:=\:\text{-}\frac{1}{2}\lambda + 1 \\ \text{From }(2):\;y \;\,=\;\,\frac{1}{2}\lambda + 2 \\ \text{From }(3):\;z\:=\:\text{-}\frac{1}{2}\lambda + 3\end{array} \begin{array}{ccc}(4)\\(5)\\(6)\end{array}$

Substitute into (4): .$\displaystyle \left(\text{-}\frac{1}{2}\lambda + 1\right) - \left(\frac{1}{2}\lambda + 2\right) + \left(\text{-}\frac{1}{2}\lambda + 3\right) - 4 \:= \:0$
. . and we have: .$\displaystyle \lambda\,=\,-\frac{4}{3}$
Substitute into (4), (5), (6): .$\displaystyle \begin{array}{ccccc}x\:= \\ \\ y\:= \\ \\ z\:=\:\end{array} \begin{array}{ccccc}\text{-}\frac{1}{2}\left(\text{-}\frac{4}{3}\right) + 1 \\ \\ \frac{1}{2}\left(\text{-}\frac{4}{3}\right) + 2 \\ \\ \text{-}\frac{1}{2}\left(\text{-}\frac{4}{3}\right) + 3\end{array} \begin{array}{ccccc}=\:\frac{5}{3}\\ \\ =\:\frac{4}{3} \\ \\ =\:\frac{11}{3}\end{array}$

Therefore, the closest point is: .$\displaystyle \left(\frac{5}{3},\:\frac{4}{3},\:\frac{11}{3}\rig ht)$