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: 
I'm not sure I understand how the loop is set but your case must be similar to the left and right side of the loop below.Since the current is flowing in a loop, on the left side it will flow the opposite direction of the way it does on the other side.Using the right-hand rule you will now see that the forces are equal and opposite,as shown in the picture, explaining the minus in your problem.

[![enter image description here](https://i.stack.imgur.com/ANYW7.jpg)](https://i.stack.imgur.com/ANYW7.jpg)

So, watch out which direction the current is going, always use the R.H.R. and carefully you will have no problem.
You are correct, and the "solution" is apparently in error. The force on the top leg is equal and opposite to the force on the bottom leg. They cancel just as the forces on the left and right legs do. There is no net force on the loop.