Ta có \(a-b=5\Rightarrow\left(a-b\right)^2=25\Rightarrow a^2+b^2=25+2ab=25+2\cdot2=29\) (Do ab=2)
\(B=3\left[\left(a^2+b^2\right)^2-2a^2b^2\right]+2\left[\left(a-b\right)\left(a^4+b^4+a^3b^2+a^2b^3\right)\right]\)
= \(3\left[29^2-2\cdot4\right]+2\left\{5\left[\left(a^2+b^2\right)^2-2a^2b^2+ab\left(a^2+b^2\right)\right]\right\}\)
= 3\(\cdot833+10\left[29^2-2\cdot4+2\cdot29\right]\) \(=2499+10\cdot891=11409\)