matrix formalism