splits show_matrix into two small functions. _matrix function is used to create a string for showing matrix