(3+ab)^2

(x-2)(x+1)-3(4-x)(2x+1)

3^2 + 2(3)(ab) + (ab)^2

x(x+1) - 2(x+1) - 12(2x+1) + 3x(2x+1)

just expand those out and collect like terms