solving matrix transpose