matrix logic examples