Posts tagged with inner product

## How to multiply matrices

This is for my homies in maths class.

Mathematical matrices are blocks of numbers, arrayed in 2-D. (Higher-dimensional array-verbs are called tensors.)

1. Left “times” right equals target. Each entry in the target is the result of a series of +'s and ×'s along the red and blue. A long sum of pairwise products.

2. Your left hand goes across and your right hand goes up/down.
where
.
3. There need to be as many `abcdefg`'s as there are `1234567`'s or else the operation can't be done.
4. Also you can tell how big the output matrix will be. There can be three blue rows so the output has three rows. There can be four red columns so the output has four columns.
5. This is the “inner product” because multiplying vector-shaped blocks (tall blocks) like Aᵀ•B results in an equal or smaller sized output.

(There is also an “outer product" which is a different way of combining the info from the two matrices. That gives you an equal or larger shaped result when you multiply vector/list-shaped tall blocks A∧B.)
6. Try playing around with this one or that one.

Matrix multiplication is the simplest example of a linear operator, the broad class of which explains quantum mechanics and ODE’s. You can also apply different matrices at different points as in a vector field — on a flat surface or a curvy, holey surface.

## Outer Product

Well I thought the outer product was more complicated than this.

An inner product is constructed by multiplying vectors A and B like Aᵀ × B. (ᵀ is for turned.) In other words, timesing each a guy from A by his corresponding b guy from B.

$\dpi{300} \bg_white a_1 \! \cdot \! b_1 \ + \ a_2 \! \cdot \! b_2 \ + \ a_3 \! \cdot \! b_3 \ + \ \ldots$

$\dpi{300} \bg_white \sum^n_{i=1} a_i \cdot b_i$

After summing those products, the result is just one number.  In other words the total effect was to convert two length-n vectors into just one number. Thus mapping a large space onto a small space, Rⁿ→R.  Hence inner.

Outer product, you just do × Bᵀ.  That has the effect of filling up a matrix with the contents of every possible multiplicative combination of a's and b's.  Which maps a large space onto a much larger space — maybe squared as large, for instance putting two Rⁿ vectors together into an Rⁿˣⁿ matrix.

No operation was done to consolidate them, rather they were left as individual pieces.

So the inner product gives a “brief” answer (two vectors ↦ a number), and the outer product gives a “longwinded” answer (two vectors ↦ a matrix). Otherwise — procedurally — they are very similar.

(Source: Wikipedia)