Factoring $x^2-y^2-z^2+2yz+x+y-z$ This is a factorization problem on polynomials. I can't find a way to solve it, neither can a math program called MathWay. Help me, please.

$$x^2-y^2-z^2+2yz+x+y-z$$
My book says that the answer is $(x+y-z)(x-y+z+1)$.


You can consider $\,x^2+x-y^2-z^2+2yz+y-z\,$ as a quadratic in $\,x\,$, and find its roots using the quadratic formula, the discriminant being:
$$
\begin{align}
\Delta_x = 1 - 4(-y^2-z^2+2yz+y-z) &= 4y^2 - 4(2z+1)y +4z^2+4z+1 \\
 &= \left(2y\right)^2- 2 \cdot 2y(2z+1)+\left(2z+1\right)^2 \\
 &= \left(2y-2z-1\right)^2
\end{align}
$$
Therefore the roots are $\displaystyle x_{1,2} = \frac{-1 \pm \left(2y-2z-1\right)}{2}=\begin{cases}y-z-1 \\ -y+z\end{cases}\;$ and the original polynomial factors as $\,(x-x_1)(x-x_2)\,$.
