  We study the bound states of a two dimensional free electron gas (2DEG)
subjected to a perpendicular inhomogeneous magnetic field. An analytical
transfer matrix (ATM) based exact quantization formula is derived for magnetic
fields that vary (arbitrarily) along one spatial direction. As illustrative
examples, we consider (1) a class of symmetric power law magnetic fields
confined within a strip, followed by the problem of a (2) 2DEG placed under a
thin ferromagnetic film, which are hitherto unexplored. The exact Landau levels
for either cases are obtained. Also, the role of the fringing magnetic field
(present in the second example) on these levels is discussed.
