See attached file for graphs.© BrainMass Inc. brainmass.com September 24, 2018, 1:34 am ad1c9bdddf - https://brainmass.com/physics/amperes-law/find-the-magnetic-field-as-a-function-of-z-both-inside-and-outside-the-slab-11694
let the width of the slab is b.
Outside the slab: (|z| > a)
We draw a rectangle surrounding the slab (Ampere's circuit).
BY Ampere's ...
Complete formulas and calculations arrive at the answers to the problem.