Find the points on the sphere $x^2 + y^2 + z^2 = 4$ that are closest to, and farthest from the point (3, 1, -1). Find the points on the sphere $x^2 + y^2 + z^2 = 4$ that are closest to, and farthest from the point $(3, 1, -1)$.
I identified that this is a constrained optimisation problem which I will solve using an auxiliary function and a Lagrange multiplier however I am struggling to continue from there as I am unsure which is the constraining function.
Any help would be greatly appreciated!
 A: Do you have to use Lagrange multipliers?
The sphere is centered at the origin, and the point lies outside it.  If you find the line through $(3,1,-1)$ and the origin, the closest and farthest points will be the two points of intersection between the line and the sphere.
Seeing that the length of the vector from the origin to the point of interest is $\sqrt{11}$, and the required vector is the same one scaled so that its length is 2, we can multiply it by $\frac{2}{\sqrt{11}}$ to get:
$$(\pm 6/\sqrt{11}, \pm 2/\sqrt{11}, \mp 2/\sqrt{11}).$$
Courtesy of Doug's expression in his answer:
$$F(x,y,z,\lambda) = (x-3)^2 + (y-1)^2 + (z+1)^2 - \lambda(x^2 + y^2 + z^2 - 4),$$
setting the four partials to zero gives the following four equations:
$$2x - 6 - 2 \lambda x = 0$$
$$2y - 2 - 2 \lambda y = 0$$
$$2z + 2 - 2 \lambda z = 0$$
$$x^2 + y^2 + z^2 - 4 = 0$$
Eliminating lambda in the top three equations leads to:
$$x = 3y = -3z.$$
This allows expressing the last of the four equations in one variable, which can then be solved:
$$\left(y - \frac{4}{11}\right)\left(y + \frac{4}{11}\right) = 0 \to y = \pm 2/\sqrt{11},$$ and the other values follow from there.
A: $(2/\sqrt{11})(3,1,-1)$ is the closest point and $(-2/\sqrt{11})(3,1,-1)$ is the most distant point.
If you have to use Lagrange multipliiers....
minimize/maximize: $(x-3)^2 + (y-1)^2 + (z+1)^2$  (this is the distance squared from x,y,z to your point.)
constrained by: $x^2 + y^2 + z^2 = 4$
$F(x,y,z,\lambda) = (x-3)^2 + (y-1)^2 + (z+1)^2 - \lambda(x^2 + y^2 + z^2 - 4)$
Now find, $\frac{\partial F}{\partial x},\frac{\partial F}{\partial y},\frac{\partial F}{\partial z},\frac{\partial F}{\partial \lambda}$ and set them all equal to $0,$  and solve the system of equations.  
