If $x, y, z$ are real numbers satisfying $x^2 +y^2 +z^2 = 2$, prove the inequality
\[ x + y + z \leq 2 + xyz \]
When does equality occur?
1. **First Solution by Symmetry and Polynomial Argument:**

   Without loss of generality (WLOG), assume that \( x \leq y \leq z \). By considering the polynomial \( (t-x)(t-y)(t-z) + k = (t-x_1)(t-y_1)^2 \) for some \( k \geq 0 \), we can rewrite the polynomial in terms of \( t \). This implies that \( y_1 = z_1 \), and we have the following equalities:
   \[
   x + y + z = x_1 + y_1 + z_1,
   \]
   \[
   xy + yz + zx = x_1 y_1 + y_1 z_1 + z_1 x_1,
   \]
   \[
   xyz \geq x_1 y_1 z_1.
   \]
   Therefore, it suffices to prove the inequality for the case \( x \leq y = z \).

2. **Case \( x \leq y = z \):**

   In this case, we have:
   \[
   xyz + 2 - x - y - z = xy^2 + 2 - x - 2y = (1 - y)(2 - x - xy).
   \]
   We need to show that \( (1 - y)(2 - x - xy) \geq 0 \).

   Given \( x^2 + 2y^2 = 2 \), we have \( y \leq 1 \). Also, we need to show:
   \[
   2x(y + 1) \leq x^2 + (y + 1)^2 = -y^2 + 2y + 3 = -(y - 1)^2 + 4 \leq 4.
   \]
   This inequality holds true, and equality holds if and only if \( (x, y, z) = (0, 1, 1) \) or any permutation of it.

3. **Second Solution by Lagrange Multiplier:**

   Consider the constraint \( g(x, y, z) = x^2 + y^2 + z^2 = 2 \), which represents a sphere in \( \mathbb{R}^3 \). Using the method of Lagrange multipliers, we need to find the extrema of \( f(x, y, z) = xyz - x - y - z \) subject to the constraint \( g(x, y, z) = 2 \).

   The gradients are:
   \[
   \nabla f = \begin{pmatrix} yz - 1 \\ zx - 1 \\ xy - 1 \end{pmatrix}, \quad \nabla g = \begin{pmatrix} 2x \\ 2y \\ 2z \end{pmatrix}.
   \]
   Setting \( \nabla f = \lambda \nabla g \), we get:
   \[
   \begin{pmatrix} yz - 1 \\ zx - 1 \\ xy - 1 \end{pmatrix} = \lambda \begin{pmatrix} 2x \\ 2y \\ 2z \end{pmatrix}.
   \]
   This implies:
   \[
   yz - 1 = 2\lambda x, \quad zx - 1 = 2\lambda y, \quad xy - 1 = 2\lambda z.
   \]
   From these equations, we get:
   \[
   xyz = (2\lambda x + 1)x = (2\lambda y + 1)y = (2\lambda z + 1)z.
   \]
   This leads to:
   \[
   (2\lambda x + 2\lambda y + 1)(x - y) = (2\lambda y + 2\lambda z + 1)(y - z) = (2\lambda z + 2\lambda x + 1)(z - x) = 0.
   \]
   WLOG, assume \( y \) is the median of \( x, y, z \).

4. **Case Analysis:**

   - **Case 1:** If \( x \neq y \) and \( y \neq z \), then \( x + y = y + z = -\frac{1}{2\lambda} \Rightarrow x = z \). This is impossible.
   - **Case 2:** If \( x = y = z \), then \( x = y = z = \pm \sqrt{\frac{2}{3}} \Rightarrow f(x, y, z) = \mp \frac{7}{3}\sqrt{\frac{2}{3}} \).
   - **Case 3:** If \( x \neq y \) and \( y = z \), then \( x + y = x + z = -\frac{1}{2\lambda} \Rightarrow z(x + y) = 1 \). This leads to:
     \[
     x^2 + 2y^2 = 2 = 2y(x + y) = 2xy + 2y^2 \Rightarrow x^2 = 2xy \Rightarrow x = 0 \text{ or } x = 2y.
     \]
     This gives \( (x, y) = (0, \pm 1) \) or \( (\pm \frac{2}{\sqrt{3}}, \pm \frac{1}{\sqrt{3}}) \Rightarrow f(x, y, z) = \mp 2 \) or \( \mp \frac{10}{3\sqrt{3}} \).

   Among \( \mp \frac{7}{3}\sqrt{\frac{2}{3}}, \mp 2, \mp \frac{10}{3\sqrt{3}} \), the minimum is \( -2 \).

   Equality holds if and only if \( (x, y, z) = (0, 1, 1) \) or any permutation of it.

The final answer is \( \boxed{ x + y + z \leq 2 + xyz } \) with equality if and only if \( (x, y, z) = (0, 1, 1) \) or any permutation of it.