In physics, the magnetic field is the field produced by a magnet. A field, in this context, is a vector field; that is, a vector for each point in space, possibly changing in time. Given the symbol B, the magnetic field points in the same direction as would a compass – away from the north pole of a magnet, and towards the north pole of the Earth.
Historically, B was called the magnetic flux density or the magnetic induction, and H (= B / &mu) was called the magnetic field, and this terminology is still often used to distinguish the two in the context of magnetic materials (non-trivial μ). Otherwise, however, this distinction is often ignored, and both symbols are frequently referred to as the magnetic field. (Some authors call H the auxiliary field, instead.)
Magnetic fields are produced by charges in motion, and moving charges are deflected by magnetic fields. The quantum-mechanical spin of a particle also produces a magnetic field—this is the source of the field in a ferromagnet.
Like the electric field, the magnetic field can be defined by the force it produces:
Maxwell did much to unify static electricity and magnetism, producing a set of four equations relating the two fields. However, under Maxwell's formulation, there were still two distinct fields describing different phenomena. It was Albert Einstein who, using special relativity showed that electric and magnetic fields are two aspects of the same thing (a rank-2 tensor), and that one observer may perceive a magnetic force where a moving observer perceives an electrostatic force. Thus, using relativity, magnetic forces may be predicted from knowledge of electrostatic forces alone. The equations given above are valid under relativity—indeed, their validity without relativity is questionable.
Technically, the magnetic field isn't a vector according to the formal definition, it is a pseudovector: it gains an extra sign flip under improper rotations of the coordinate system. (The distinction is important when using symmetry to analyze magnetic-field problems.) This is a consequence of the fact that B is related to two true vectors by a cross product (e.g. in the Lorentz force law).
See also electromagnetism, magnetism, electromagnetic field, electric field, Maxwell's equations