1 | initial version |

Here is an example.

```
sage: a = matrix(QQ, [[1, 1, 1], [-2, 3, 2], [0, 1, 2]])
sage: b = matrix(QQ, [[-1, 1, 1], [1, 1, -1], [-3, 1, 3]])
sage: da, pa = a.jordan_form(transformation=True)
sage: db, pb = b.jordan_form(transformation=True)
sage: pa
[ 1 1 0]
[ 1 0 1]
[ 1 1 -1]
sage: pb
[ 0 1 1]
[ 1 1 0]
[-1 1 1]
```

Notice that `pa`

and `pb`

have the same columns, permuted.

So `a`

and `b`

can be simultaneously diagonalized!

Obtaining the simultaneous diagonal form is just a matter of reordering the columns of:

```
sage: da
[3|0|0]
[-+-+-]
[0|2|0]
[-+-+-]
[0|0|1]
sage: db
[2|0|0]
[-+-+-]
[0|1|0]
[-+-+-]
[0|0|0]
```

For instance, use the transformation matrix `pa`

to get simultaneous diagonalizations:

```
sage: qa = ~pa
sage: qa * a * pa
[3 0 0]
[0 2 0]
[0 0 1]
sage: qa * b * pa
[1 0 0]
[0 0 0]
[0 0 2]
```

2 | No.2 Revision |

~~Here ~~Getting a simultaneous basis of diagonalization for a list of diagonalizable matrices that
pairwise commute is ~~an example.~~just a matter of getting a diagonalization basis for any one of them!

This can be obtained with `jordan_form`

with the argument `transformation=True`

.

For example, starting from these two matrices `a`

and `b`

:

```
sage: a = matrix(QQ, [[1, 1, 1], [-2, 3, 2], [0, 1, 2]])
sage: b = matrix(QQ, [[-1, 1, 1], [1, 1, -1], [-3, 1, 3]])
```

Check that they commute:

```
sage: a * b
[-3 3 3]
[-1 3 1]
[-5 3 5]
sage: b * a
[-3 3 3]
[-1 3 1]
[-5 3 5]
sage: a * b == b * a
True
```

If we diagonalize them separately:

```
sage: da, pa = a.jordan_form(transformation=True)
sage: db, pb = b.jordan_form(transformation=True)
```~~sage: pa
[ 1 1 0]
[ 1 0 1]
[ 1 1 -1]
sage: pb
[ 0 1 1]
[ 1 1 0]
[-1 1 1]
~~

Notice

we can notice that the transformation matrices `pa`

and `pb`

have the same columns, ~~permuted.~~

So `a`

and `b`

can be simultaneously diagonalized!

```
sage: pa
[ 1 1 0]
[ 1 0 1]
[ 1 1 -1]
sage: pb
[ 0 1 1]
[ 1 1 0]
[-1 1 1]
```

Obtaining the simultaneous diagonal form is just a matter of reordering the columns of:

```
sage: da
[3|0|0]
[-+-+-]
[0|2|0]
[-+-+-]
[0|0|1]
sage: db
[2|0|0]
[-+-+-]
[0|1|0]
[-+-+-]
[0|0|0]
```

For instance, use the transformation matrix `pa`

to get simultaneous diagonalizations:

```
sage: qa = ~pa
sage: qa * a * pa
[3 0 0]
[0 2 0]
[0 0 1]
sage: qa * b * pa
[1 0 0]
[0 0 0]
[0 0 2]
```

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.