# Direction of magnetic field (in general)

We use right-hand rule (r-h-r) in order to determine the direction of the magnetic field due to a configuration of currents. For me it is easy when the configuration has a cyllindrical symmetry, but if not (for example, a slab) confuses me, can someone give me a clue about how to use r-h-r in a case like this or better, in general?

In this example, the magnetic field points in $y-$direction, why?

• Are you referring to a bar magnet when you say 'slab' ? Commented May 7, 2018 at 6:54
• Yes, I am. For example, if you have a slab in the $xy$-plane and a current in the $x-$direction, it supposes that the magnetic field points in the $y-$direction, but I don't understand why. Commented May 7, 2018 at 7:01
• The right hand rule gives you the direction of magnetic field for current carrying wires. But the layout of magnetic field lines for a bar magnet is their characteristic and you cant use any rule to find their direction. Since you have posted the question, it is quite clear that you dont refer to a bar magnet when you say 'slab'. Commented May 7, 2018 at 7:11

The trick is noticing the dependence on $z$ if you will. Let us review first the right hand rule, the usage is simple, open your hand completely and place the center of your palm at the charge/orgin depending on the case, point your fingers in the direction of the first vector (the pointing, middle, ring and little fingers) while keeping your thumb extended. Then close your fist towards the direction of the second vector (this should only be possible in one of two ways) then your thumb should be pointing towards the result of $\vec{a}\times\vec{b}$.
Now for the case at hand we want $\vec{B}$ so by using Biot-Savart's Law, you can do the following: imagine you are looking at a cross-section of the slab (the plane $YZ$) and picture the current(s) as many lines (vectors) coming out of the page from every point within the cross-section of the slab (that is arrows just coming towards you).
Now every such arrow produces a magnetic field around it pointing in anti-clockwise direction, as stated by the r-h-r. If they were all the same you can see they would cancel with their neighbours. The only contributions would occur towards the edges (but forget about those for now). So in the interior all this little circling magnetic fields cancel each other in principle. However, notice that when you start increasing $z$, the current gets stronger meaning the magnitude of this little magnetic fields too and now the lower parts are not as strong as upper parts, so they wont cancel out (while left and right parts will still cancel). All in all you will add everything to obtain many contributions pointing towards the $-y$ direction.