\(a+b\ge2\sqrt{ab}\Rightarrow\sqrt{ab}\le\dfrac{1}{2}\Rightarrow ab\le\dfrac{1}{4}\Rightarrow\dfrac{1}{ab}\ge4\)
\(B=a^2+b^2+\dfrac{1}{a^2}+\dfrac{1}{b^2}+4\ge\dfrac{\left(a+b\right)^2}{2}+\dfrac{2}{ab}+4\ge\dfrac{1}{2}+2.4+4=\dfrac{25}{2}\)
\(\Rightarrow B_{min}=\dfrac{25}{2}\) khi \(a=b=\dfrac{1}{2}\)