题目下列分解因式正确的是( )A.x2+y2=(x+y)2x^{2}+y^{2}=\left(x+y\right)^{2}x2+y2=(x+y)2B.mx−nx+x=x(m−n)mx-nx+x=x\left(m-n\right)mx−nx+x=x(m−n)C.x2−2x−1=(x−1)2x^{2}-2x-1=\left(x-1\right)^{2}x2−2x−1=(x−1)2D.x2−1=(x+1)(x−1)x^{2}-1=\left(x+1\right)\left(x-1\right)x2−1=(x+1)(x−1)知识点:提公因式法、运用公式法章节:第12章 因式分解 / 12.2 因式分解的方法