  We proposed a formula for the $Z_2$ invariant for topological insulators,
which remains valid without translational invariance. Our formula is a local
expression, in the sense that the contributions mainly come from quantities
near a point. Using almost commute matrices, we proposed a method to
approximate this invariant with local information. The validity of the formula
and the approximation method is proved.
