add a method using matrix