added some linear algebra