\(P=\frac{\left(a+1\right)^2}{b}+\frac{\left(b+1\right)^2}{a}\ge\frac{\left(a+b+2\right)^2}{a+b}=\frac{\left(a+b\right)^2+4\left(a+b\right)+4}{a+b}\)
\(\Rightarrow P\ge a+b+\frac{4}{a+b}+4\ge2\sqrt{\frac{4\left(a+b\right)}{a+b}}+4=8\)
\(\Rightarrow p_{min}=8\) khi \(a=b=1\)