There are a lot of posts on this already, but apparent all of them just consider some special case. I am now struggling with this more general case.
Let there be a magnetic field with strength $B$. Let $C$ be a loop of wire with current $I$ in it. $C$ lies on a plane, the normal of which makes an angle $\theta$ with the magnetic field lines. $C$ encloses an area $A$.
My goal is to compute the torque. The formula for this is $$ \boldsymbol\tau=I\int_C \mathbf r\times (d\mathbf r \times \mathbf B), $$ and ideally, I should get the answer $AB\sin \theta$. However, I am facing two difficulties: I don't know how to choose the origin; the torque clearly depends on the choice of origin, so it is impossible to obtain the answer $AB\sin \theta$ if I don't know where the origin is. Correction: torque as a vector, of course, does not depend on the choice of origin, so if we can evaluate it as an vector, then it's OK. Secondly, when evaluating the integral, I find it difficult to get the factor $A$ out of it. I know that $$ A=\frac12 \left|\int_C \mathbf r \times d\mathbf r\right|, $$ but the problem is that cross products are not associative - so I cannot get an $A$ out of the formula for $\boldsymbol\tau$.
How could I overcome those problems?