Matrix Multiplication

## Description

The Sage commands for calculating the sum of two matrices, $AB$, where

(1)\begin{align} A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} \quad \text{and} \quad B = \begin{pmatrix} -4 & 3 \\ -2 & 6 \end{pmatrix}. \end{align}

## Sage Cell

#### Code

```
A = matrix([[1,2],[3,4]])
B = matrix([[-4,3],[-2,6]])
A*B
```

## Options

#### Matrix-Vector Product

We can also take the product of a matrix and a vector:

#### Code

```
A = matrix(QQ, [[1, 2], [3, 4]])
v = vector(QQ, [-1, 2])
A*v
```

#### Matrix Exponentiation

We can also take an exponent of a matrix in the same way we would take the exponent of a real number.

#### Code

```
A = matrix([[1,2],[3,4]])
A^3
```

## Tags

CC:math.la.i.mat.mult

Primary Tags: Linear Algebra: Matrices.

Secondary Tags: Matrices: Matrix algebra.

## Related Cells

## Attribute

Permalink:

Author: T. Judson

Date: 19 Jul 2017 09:24

Submitted by: Tom Judson