Ta có: $a;b>0$; $ab^2=1\Rightarrow a=\dfrac1{b^2}$
$P=(1+a)(1+b)^2$
$=(1+a)(1+2b+b^2)$
$=1+2b+b^2+a+2ab+ab^2$
$=1+2b+b^2+\dfrac1{b^2}+2.\dfrac1{b^2}b+\dfrac1{b^2}b^2$
$=1+2b+b^2+\dfrac1{b^2}+\dfrac2b+1$
$=2+b^2+\dfrac1{b^2}+2\left({b+\dfrac1b}\right)$
Theo bất đẳng thức cosy:
$b^2+\dfrac1{b^2}\ge2$
$b+\dfrac1{b}\ge2$
$\Rightarrow P_{min}=2+2+2.2=8$
Dấu "=" xảy ra $\Leftrightarrow b^2=\dfrac1{b^2}\Leftrightarrow b^4=1\Leftrightarrow b=1$ $(b=-1<0\text{(loại)})$
$\Rightarrow a=1$