Why torque on current carrying circular loop in uniform magnetic field is differs from results of $\mu \times \vec{B}$ if we apply calculus method We have a current carrying circular wire kept in uniform magnetic field $\vec{B}$, as shown, I tried to derive the torque $\vec{\tau}$ acting on it

For 2 elemental parts on wire subtending angle $d\theta$ at center right at opposite to each other
$$d\vec{\tau} = 2idl B \sin\theta r$$
it gives
$$\tau = -2i
  r^2 \cos \theta$$
on varying $\theta$ from $0$ to $\pi$ I get net torque $\tau = 4ir^2\times B$
but by applying $\tau = I\vec{A}\times\vec {B}$
Note- Here $r$ is radius of wire, there is a factor of 2 because they are 2 elemental parts situated just opposite to each other .Torque on both elemental parts would have same magnitude and would add up ,I replaced $dl$ with $rd\theta$
.Angle $\theta$ is shown in pic.
I got another answer $\tau = I\pi r^2 B$, which is correct
I don't know why there is so much differences in answers , although both processes look correct
 A: There are actually two cross-products, and you've ignored one of them.
I'm going to assume that the magnetic field is in the plane of the loop, pointing along $\mathbf{\hat{y}}$, while the loop is in the $xy-$plane.
The infinitesimal torque is given by $$\text{d}\boldsymbol{\tau} = \text{d}\mathbf{F}\times \mathbf{r}.$$
The infinitesimal force is $\text{d}\mathbf{F} = I \text{d}\mathbf{l}\times\mathbf{B}$.
As you've pointed out, $$\text{d}\mathbf{F} = I B r\,\,\text{d}\theta \sin{\theta}\, \mathbf{\hat{z}}$$
So far, what you've done seems correct. (You can verify that the net force on the wire is indeed $0$ by integrating over $\theta$.)  However, when you calculate the infinitesimal torque, you need to find
$$\text{d}\boldsymbol{\tau} = \text{d}\mathbf{F}\times \mathbf{r} = I B r \sin{\theta}\text{d}\theta \mathbf{\hat{z}}\times (r \cos{\theta} \mathbf{\hat{x}} + r\sin{\theta} \mathbf{\hat{y}} ),$$
where in the last step I've written $\mathbf{r} = r \cos{\theta} \mathbf{\hat{x}} + r\sin{\theta} \mathbf{\hat{y}}.$ Expanding this, we have two terms. It can be easily shown (I'll leave it as an exercise) that one of those terms integrates to $0$ as $\theta$ runs from $[0,2\pi)$, and the other term gives you
$$\boldsymbol{\tau} = -\mathbf{\hat{x}} I B r^2 \int_0^{2\pi}\sin^2\theta\, \text{d}\theta =  -I \pi r^2 B\, \mathbf{\hat{x}},$$
which is exactly what you'd get if you calculated it using $$\boldsymbol{\tau} = I \mathbf{A}\times\mathbf{B} = I \pi r^2 B \mathbf{\hat{z}}\times \mathbf{\hat{y}} = - I \pi r^2 B \mathbf{\hat{x}}.$$
