# 3-D Matrix Multiplication in Numpy

I have to multiply two 2-D matrices, `bob`

and `tim`

, in Numpy Python 3.x

`bob.shape`

gives `(2,4)`

`tim.shape`

gives `(7,4)`

This piece of code gives a 3-D matrix with a shape of `(2,7,4)`

```
np.array([foo*tim for foo in bob])
```

It gives the output I want. But, I was wondering if there was a more elegant/faster way to do this in numpy rather than me having to iterate through `bob`

### 1 Answer

## Have an answer?

JD