Having a bit of trouble with this one. Can anyone help?

Many thanks.

Q.Find the values of a & b if $\displaystyle (2x+a)^2 = 4x^2+12x+b$, for all x.

Attempt:$\displaystyle 4x^2+4xa+a^2 = 4x^2+12x+b$

$\displaystyle 4a = 12 => a = 3$

$\displaystyle a^2 = b => 3^2 = b => b = 9$

Ans.(From text book): a = 3, b = 7