  The topological derivative represents the sensitivity of a domain-dependent
functional with respect to a local perturbation of the domain and is a valuable
tool in topology optimization. Motivated by an application from electrical
engineering, we derive the topological derivative for an optimization problem
which is constrained by the quasilinear equation of two-dimensional
magnetostatics. Here, the main ingredient is to establish a sufficiently fast
decay of the variation of the direct state at scale 1 as $|x|\rightarrow
\infty$. In order to apply the method in a bi-directional topology optimization
algorithm, we derive both the sensitivity for introducing air inside
ferromagnetic material and the sensitivity for introducing material inside an
air region. We explicitly compute the arising polarization matrices and
introduce a way to efficiently evaluate the obtained formulas. Finally, we
employ the derived formulas in a level-set based topology optimization
algorithm and apply it to the design optimization of an electric motor.
