=(x²-xy-2y²)+5yz-xz-2z²
=(x-2y)(x+y)+(xz+yz)-2xz+4yz-2z²
=(x-2y)(x+y)+z(x+y)-2xz+4yz-2z²
=(x+y)(x-2y+z)-2z(x-2y+z)
=(x+y-2z)(x-2y+z)
=(x²-xy-2y²)+5yz-xz-2z²
=(x-2y)(x+y)+(xz+yz)-2xz+4yz-2z²
=(x-2y)(x+y)+z(x+y)-2xz+4yz-2z²
=(x+y)(x-2y+z)-2z(x-2y+z)
=(x+y-2z)(x-2y+z)