# Multiplying $3\times 1$ and $1\times 3$ matrices together

Can someone explain how to multiply these two matrices?

$\left( \begin{array}{ccc}1 \\ 3\\1 \end{array} \right) \cdot \left( \begin{array}{ccc}-1&0&2 \end{array} \right)$

I thought that the solution would just be the dot product between the two, giving us $(1)$, but the solution is actually $\left( \begin{array}{ccc}-1&0&2\\-3&0&6\\-1&0&2 \end{array} \right)$.

• This is not row times column, but column times row. – hardmath Oct 14 '14 at 3:53

You're multiplying a $3 \times 1$ matrix $(a_i)$ by a $1 \times 3$ matrix $(b_j)$, which gives a $3 \times 3$ matrix, namely the one with $(i, j)$ entry $a_i b_j$.

If you multiplied them in the reverse order, you'd get a $1 \times 1$ matrix, with sole entry $$\sum_{i = 1}^3 a_i b_i,$$ which is just the dot product of the two vectors both regarded as column vectors.

For multiplying A and B , AB will have no of rows as of A and no of colums as of B

The result matrix is $c_{ij}=\sum_{k=1}^n a_{ik}b_{kj}$

"Its the mantra line-by-colum" take the first line, in case is the element 1 and multiply by the first colum element -1.

first line * second columm 1*0

first line * third columm 1*2

then pass to second line and repeat

second line* first collun, and go on