Ta có: \(tan\alpha=3=\frac{sin\alpha}{cos\alpha}\Rightarrow sin\alpha=3cos\alpha\)
Suy ra: \(B=\frac{\left(sin\alpha-cos\alpha\right)\left(sin^2\alpha+cos^2\alpha+sin\alpha.cos\alpha\right)}{\left(sin\alpha+cos\alpha\right)\left(sin^2\alpha+cos^2\alpha-sin\alpha.cos\alpha\right)}\)
\(=\frac{2cos\alpha.\left(1+3cos^2\alpha\right)}{4cos\alpha.\left(1-3cos^2\alpha\right)}=\frac{1+3cos^2\alpha}{2.\left(1-3cos^2\alpha\right)}\)