Maximize $z$ over $x + y + z = 3$ and $x^2 + y^2 + z^2 = 6$ Suppose that $x$, $y$, and $z$ are real numbers such that $x + y + z = 3$ and $x^2 + y^2 + z^2 = 6$. What is the largest possible value of $z$?

I tried applying Cauchy-Schwarz to get $(x^2+y^2+z^2)(1+1+1)\geq (x+y+z)^2$, but this doesn't say anything. I also tried some different ways to apply Cauchy, but they all didn't do much.
Thanks in advance!!

Here is a solution avoiding calculus.
Use cylindrical coordinates.
$x = r \cos\theta, y = r \sin\theta, z = z, r \geq 0$
From $x^2 + y^2 + z^2 = 6$, we get
$$z^2 = 6 - r^2 \tag1$$
From $x + y + z = 3$, we get
$ \displaystyle r = \frac {3-z}{\cos\theta + \sin\theta} \tag2$
From $(1), z \leq \sqrt6~$ and so we know $(3 - z)$ is positive.
As we know, $(1)$ is a sphere centered at the origin. The lower the radius of the circle parallel to xy-plane on the sphere, the higher the value of $|z|$.
From $(2)$, we see that at any given $z$, of all the circles parallel to xy-plane that intersect the plane $x + y + z = 3$, the one with minimal $r$ is one when $~(\cos \theta + \sin \theta)~$ is maximum. We know that maximum value of $~(\cos\theta + \sin\theta)~$ is $~\sqrt2~$. That leads to $~ \displaystyle r = \frac{3-z}{\sqrt2}~$. Now plugging into $(1)$ and solving should give us the maximum and minimum value of $z$.
$ \displaystyle z^2 = 6 - \frac{(3-z)^2}{2}$
Simplifying, $z^2 - 2 z - 1 = 0$
Solving, $z = 1 + \sqrt 2~$ is the maximum and $z = 1 - \sqrt 2~$ is the minimum.

To find maximum of $(\cos\theta + \sin\theta)$, we maximize $(\cos\theta + \sin\theta)^2$.
$(\cos\theta + \sin\theta)^2 = 1 + \sin2\theta \leq 2 \implies \cos\theta + \sin\theta \leq \sqrt2$. The maximum occurs at $\theta = \pi/4$.
