# Matrix trace

### Description

Calculates the trace of a matrix

### Usage

1 | ```
tr(M)
``` |

### Arguments

`M` |
a matrix |

### Value

returns the sum of the diagonal elements

### Author(s)

Michael Friendly

### Examples

1 2 |

Calculates the trace of a matrix

1 | ```
tr(M)
``` |

`M` |
a matrix |

returns the sum of the diagonal elements

Michael Friendly

1 2 |