matrix equation with variables