\(M=2\left(a^3+b^3\right)-3\left(a^2+b^2\right)\)
\(=2\left(a+b\right)\left(a^2+ab+b^2\right)-3a^2-3b^2\)
\(=2a^2+2ab+2b^2-3a^2-3b^2\)
\(=-a^2+2ab-b^2\)
\(=-\left(a^2-2ab+b^2\right)\)
\(=-\left(a-b\right)^2\)
\(=-\left(1-b-b\right)^2=-\left(1-2b\right)^2\)