### 15.1.7 Equivalent matrix

The changebase command changes a matrix to represent the same linear function in a different basis.

- changebase takes two arguments:
  - A, a matrix.
  - P, a change-of-basis matrix.
- changebase(A,P) returns the matrix P−1AP.

#### Examples

changebase([[1,2],[3,4]],[[1,0],[0,1]])

⎡ ⎢ ⎣ |
1 | 2
3 | 4
| ⎤ ⎥ ⎦

changebase([[1,1],[0,1]],[[1,2],[3,4]])

⎡ ⎢ ⎢ ⎢ ⎢ ⎣ |
−5 | −8
9
2
| 7
| ⎤ ⎥ ⎥ ⎥ ⎥ ⎦

Indeed:

⎡ ⎢ ⎣ |
1 | 2
3 | 4
| ⎤ ⎥ ⎦ |
−1
| · |
⎡ ⎢ ⎣ |
1 | 1
0 | 1
| ⎤ ⎥ ⎦
| · |
⎡ ⎢ ⎣ |
1 | 2
3 | 4
| ⎤ ⎥ ⎦
| = |
⎡ ⎢ ⎢ ⎢ ⎢ ⎣ |
−5 | −8
9
2
| 7
| ⎤ ⎥ ⎥ ⎥ ⎥ ⎦
| .