The following problem is an interesting application of Ampere’s law apart from usual applications found in honors syllabus (eg infinite straight conductor, Solenoid and Torroid). This is to be found in the excellent book by Griffith on Electrodynamics. (Example 5.7 from 3rd edition of Griffith Electrodynamics).
Lets first visualize the problem. This will help us solve the problem. We chose a Cartesian coordinate system as shown. Our infinite surface current is a sheet that is concurrent with the XY-plane. We also show the Ampere-loop which is a rectangle of length l parallel to the y-axis. This loop is half above the XY-plane and half below.
Lets first of all find out the direction of the magnetic field due to the given current. The magnetic field can neither have a x-component nor have a z-component. The magnetic field is directed along y-axis only.
How did we know the direction of field for regions above and below the sheet of current? You can check with right-hand thumb rule for direction of current and direction of field. As simple as Mama’s instant snacks technique.
PS: erratum; read fillament as filament.