  We give a pedagogical introduction to two aspects of magnetic fields in the
early universe. We first focus on how to formulate electrodynamics in curved
space time, defining appropriate magnetic and electric fields and writing
Maxwell equations in terms of these fields. We then specialize to the case of
magnetohydrodynamics in the expanding universe. We emphasize the usefulness of
tetrads in this context. We then review the generation of magnetic fields
during the inflationary era, deriving in detail the predicted magnetic and
electric spectra for some models. We discuss potential problems arising from
back reaction effects and from the large variation of the coupling constants
required for such field generation.
