Maximum value of $(x−1)^2+ (y−1)^2+ (z−1)^2$ with constraint $x^2+y^2+z^2 ≤2 , z≤1$ So the problem is that I have $D(f)=\{(x,y,z), x^2+y^2+z^2 ≤2 , z≤1\}$ and I have to determine the maximum value for the function $(x−1)^2+ (y−1)^2+ (z−1)^2$ in $D$.
I'm just confused as I don't actually know if $z\le1$  counts as a constraint as well, or is it just for me to sketch the area, which is actually a part of the question.
Furthermore, I know that I have to use Lagrange multiplier method, but I honestly don't know how because $\le$ is making the question hard for me. Do I just calculate as usual and count $\le$ the same as $=$?
appreciate all the feedback
Edit: I have calculated the grad f =0 which is = $D(f)=(2(x-1), 2(y-1), 2(z-1))$ where I've got that $x=y=z= 1$ and $f(1, 1, 1)=0$. (I don't know what to do with this though). Then I calculated $L(x, y, x, λ) = (x−1)^2+(y−1)^2+(z−1)^2 +λ(x^2+y^2+z^2-2)$, then the four cases where I got the same value which is $-2λ= 2(x-1)/x = 2(y-1)/y = 2(z-1)/z$. Which means that $x=y=z$, put it in the $D$ function $x^2+ x^2+ x^2$ and ended up with $x=y=z= −+√2/√3$. I took the minus sign for the maximum distance from $(1,1,1)$. which means that the answer is $x=y=z= −√2/√3$. Is it correct?

Using Lagrange multipliers method.
Calling $p = (x,y,z),\ p_0=(1,1,1),\ p_1 = (0,0,1), f = \|p-p_0\|^2$ and using $e_1, e_2$ as slack variables to avoid the inequalities we have
$$
L = f + \lambda(\|p\|^2-2+e_1^2)+\mu(p\cdot p_1-1-e_2^2)
$$
The stationary points are the solutions for
$$
\nabla L = \cases{2(1+\lambda)p-2p_0-\mu p_1=0\\
\|p\|^2-2+e_1^2=0\\
p\cdot p_1-1-e_2^2=0\\
\lambda e_1=0\\
\mu e_2 = 0}
$$
obtaining
$$
\left[
\begin{array}{cccccc}
f & x & y & z & e_1^2 & e_2^2\\
0 & 1 & 1 & 1 & 1 & 0 \\
 3+2 \sqrt{2} & -\frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} & 1 & 0 & 0 \\
 3-2 \sqrt{2} & \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} & 1 & 0 & 0 \\
\end{array}
\right]
$$
NOTE
Null $e_k$'s represent actuating restrictions.
