So, $\overrightarrow{B}=\mathrm{B} \sin \theta \hat{\mathrm{i}}-\mathrm{B} \cos \theta \hat{\mathrm{j}}$
Here $\mathrm{B}=\frac{\mu_{0}}{2 \pi} \frac{\mathrm{I}}{\mathrm{r}}$
$\sin \theta=\frac{\mathrm{y}}{\mathrm{r}}$ and $\cos \theta=\frac{\mathrm{x}}{\mathrm{r}}$
$\overrightarrow {\text{B}} = \frac{{{\mu _0}{\text{I}}}}{{2\pi }} \cdot \frac{1}{{{{\text{r}}^2}}}({\text{y}}\widehat {\text{i}} - {\text{x}}\widehat {\text{j}})$
$ = \frac{{{\mu _0}{\text{I}}({\text{y}}\widehat {\text{i}} - {\text{xj}})}}{{2\pi \left( {{{\text{x}}^2} + {{\text{y}}^2}} \right)}}\left[ {{\text{as}}\,\,\,{{\text{r}}^2} = {{\text{x}}^2} + {{\text{y}}^2}} \right]$



