How to get alternative form from equation 1)
$$ 1) -a^2 + a + b^2 -b $$
to equation 2)
$$ 2) (a-b)(a+b-1)$$
How to get alternative form from equation 1)
$$ 1) -a^2 + a + b^2 -b $$
to equation 2)
$$ 2) (a-b)(a+b-1)$$
On
Group terms and factor, e.g. by first using $\color{blue}{a^2-b^2=(a-b)(a+b)}$ and then putting the common term $\color{red}{a-b}$ up front: $$\begin{align}-a^2 + a + b^2 -b & = -\left(\color{blue}{a^2-b^2}\right)+a-b \\[4 pt] & = -\color{blue}{\left(a-b\right)\left(a+b\right)}+a-b \\[4 pt] & = -\color{red}{\left( a-b \right)} \left( \left(a+b\right)+1\right) \\[4 pt] & = -\left( a-b \right) \left( a+b+1\right) \end{align}$$ Note that there's an extra minus (missing in your answer).
On
First rearrange the equation slightly:
$$b^2-a^2+a-b$$
Note that we have a 'difference of two squares'
$$(b-a)(b+a)+a-b$$
Recognise that $a-b\equiv -(b-a)$
$$(b-a)(b+a)-(b-a)$$
Now we have $(b-a)$ as a common factor so factorise:
$$(b-a)\left ((b+a)-1 \right)$$
becomes
$$(b-a)(b+a-1)$$
and
$$-(a-b)(a+b-1)$$
$$-a^2+a+b^2-b=-(a^2-b^2)+(a-b)$$
$$=-(a-b)(a+b)+(a-b)$$
To make it more obvious let $C=a-b$
$$=-C(a+b)+C$$
$$=C\big(-(a+b)+1\big)$$
$$=-C\big((a+b)-1\big)$$
$$=-(a-b)(a+b-1)$$