a)\(\left(2x+1\right)^2+\left(2x-1\right)^2-2\left(1+2x\right)\left(2x-1\right)\)
\(=\left(2x+1-2x+1\right)^2\)
\(=2^2=4\)
b)\(\left(x-1\right)^3-\left(x+2\right)\left(x^2-2x+4\right)+3\left(x-1\right)\left(x+1\right)\)
\(=x^3-3x^2+3x-1-x^3+8+3x^2-3\)
\(=3x+4\)