Solution (source code)

= Solution

For the <force on a current loop in a bilinear magnetic field>, the arrow gives current in the positive $y$ direction on the edge $x=a$, and in the negative $x$ direction on the edge $y=a$. Use $d\mathbf F=I\,d\boldsymbol\ell\times\mathbf B$. The edges on the coordinate axes contribute zero because the applied field vanishes there. The other two give
$$
\mathbf F_{x=a}=I\alpha a\int_0^a y\,dy\,\hat{\mathbf x},\qquad
\mathbf F_{y=a}=I\alpha a\int_0^a x\,dx\,\hat{\mathbf y}.
$$
Thus the force on the square itself, excluding the supply leads, is
$$
\boxed{\mathbf F=\frac{I\alpha a^3}{2}(\hat{\mathbf x}+\hat{\mathbf y})
=2.5(\hat{\mathbf x}+\hat{\mathbf y})\,\mathrm N,\quad |\mathbf F|=3.54\,\mathrm N.}
$$
It lies in the plane along the diagonal towards increasing $x$ and $y$, at $45^\circ$ to either positive axis.