Question: I'm asked to find force on square loop (side a) carrying current $I$, flowing counter clockwise, when we look down x-axis, lying in yz plane. the loop is centered at the origin. The magnetic field is given as:

$\vec{B} = kz\hat{x}$

Its solution states that force on left an right cancel each other .The force on top is $IaB=iak(a/2)$ pointing upward and the force on bottom is$IaB=-iak(a/2)$ also pointing upward .How the force on bottom is upward? (From where minus sign came?). By R.H.R it should be downward.

Answer: 
The minus is coming from the value of z. Note that the loop is *centered* at the origin on the *yz plane*, and the value of B is *dependent on the value of z*.

The forces on the left and right arms of the loop cancel out, the forces on the top and bottom arm are also opposite but due to the nature of the B field (dependence on z) the values are opposite in sign.

So one is $iak(a/2)$ in the $\hat z$ direction and the other is $iak(-a/2)$ in the $-\hat z$ direction. so when you add them together, instead of cancelling out you are left with double of the force.
This problem is given in griffith book of electrodynamics. Here minus sign comes from the negative z direction because loop is placed at centre half of which in positive axis and remaining half lies in negative axis.