$x \times \left( x-1+i \right)-1\left( x-1+i \right)-i \times \left( x-1+i \right)$
Distribute $x$ through the parentheses${x}^{2}-x+xi-1\left( x-1+i \right)-i \times \left( x-1+i \right)$
Distribute $-1$ through the parentheses${x}^{2}-x+xi-x+1-i-i \times \left( x-1+i \right)$
Distribute $-i$ through the parentheses${x}^{2}-x+xi-x+1-i-xi+i-{i}^{2}$
Since two opposites add up to $0$, remove them from the expression${x}^{2}-x-x+1-i+i-{i}^{2}$
Since two opposites add up to $0$, remove them from the expression${x}^{2}-x-x+1-{i}^{2}$
By definition ${i}^{2}=-1$${x}^{2}-x-x+1-\left( -1 \right)$
When there is a $-$ in front of an expression in parentheses, change the sign of each term of the expression and remove the parentheses${x}^{2}-x-x+1+1$
Collect like terms${x}^{2}-2x+1+1$
Add the numbers${x}^{2}-2x+2$