Equation of motion in matrix form