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

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

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

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

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

It's clear that

$d_{x}=\frac{x-1}{\sqrt{(x-1)^{2}+(y-2)^{2}+(z-3)^{2}}}$
$d_{y}=\frac{y-2}{\sqrt{(x-1)^{2}+(y-2)^{2}+(z-3)^{2}}}$
$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?

$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.

2. P.S. Apologies in advance if this was the wrong forum for this question.

3. 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.

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

Your equation describes a plane in $\mathbb{R}^3$ in normal form. That means you know the perpendicular direction to this plane: $\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: $[1, -1, 1] \cdot [x, y, z]=4$
Line: $[x, y, z]=[1, 2, 3]+r \cdot [1, -1, 1]$

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

Plug in this value into the equation of the line: $[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:
$d=\left|[1, 2, 3] - \left[\frac{5}{3},\frac{4}{3},\frac{11}{3} \right] \right|$

$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

5. [quote=markholden;28463]The question: find the point on the plane $x-y+z=4$ that is closest to the point $(1,2,3)$.

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

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

One way of doing this is to write:

$
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 $(x,y)$ which minimised $D$ which is a point at which:

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

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

RonL

6. Hello, Mark!

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

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

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

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

Then: / $\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}$

$\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): . $\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: . $\lambda\,=\,-\frac{4}{3}$
Substitute into (4), (5), (6): . $\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: . $\left(\frac{5}{3},\:\frac{4}{3},\:\frac{11}{3}\rig ht)$