m |
|||
Line 12: | Line 12: | ||
See $A$ as $m$ vectors along rows: | See $A$ as $m$ vectors along rows: | ||
− | + | <math>A = \begin{bmatrix} | |
— \mathbf a_1 \,— \\ | — \mathbf a_1 \,— \\ | ||
— \mathbf a_2 \,— \\ | — \mathbf a_2 \,— \\ | ||
... \\ | ... \\ | ||
— \mathbf a_m \,— | — \mathbf a_m \,— | ||
− | \end{bmatrix} | + | \end{bmatrix}</math> |
And then multiply (using [[Dot Product]]) each row $(\mathbf a_i)^T$ with the vector $\bf x$: | And then multiply (using [[Dot Product]]) each row $(\mathbf a_i)^T$ with the vector $\bf x$: | ||
* $x_i = (\mathbf a_i)^T \mathbf b$ | * $x_i = (\mathbf a_i)^T \mathbf b$ | ||
− | * | + | * <math>\mathbf x = \begin{bmatrix} |
— (\mathbf a_1)^T \mathbf b \,— \\ | — (\mathbf a_1)^T \mathbf b \,— \\ | ||
— (\mathbf a_2)^T \mathbf b \,— \\ | — (\mathbf a_2)^T \mathbf b \,— \\ | ||
... \\ | ... \\ | ||
— (\mathbf a_m)^T \mathbf b \,— | — (\mathbf a_m)^T \mathbf b \,— | ||
− | \end{bmatrix} | + | \end{bmatrix}</math> |
* Where dot product is $\mathbf a^T \mathbf b = \sum\limits_{i=1}^m a_i b_i$ | * Where dot product is $\mathbf a^T \mathbf b = \sum\limits_{i=1}^m a_i b_i$ | ||
Line 33: | Line 33: | ||
Another way to see $A$ is as $n$ vectors along columns: | Another way to see $A$ is as $n$ vectors along columns: | ||
− | + | <math>A = \begin{bmatrix} | |
\mathop{a_1}\limits_|^| \ \mathop{a_2}\limits_|^| \ \cdots \ \mathop{a_n}\limits_|^| | \mathop{a_1}\limits_|^| \ \mathop{a_2}\limits_|^| \ \cdots \ \mathop{a_n}\limits_|^| | ||
− | \end{bmatrix} | + | \end{bmatrix}</math> |
When we multiply $A$ on a vector $\mathbf b$, it produces a [[Linear Combination]] of these column vectors: | When we multiply $A$ on a vector $\mathbf b$, it produces a [[Linear Combination]] of these column vectors: | ||
− | + | <math>A \mathbf b = \begin{bmatrix} | |
\mathop{a_1}\limits_|^| \ \mathop{a_2}\limits_|^| \ \cdots \ \mathop{a_n}\limits_|^| | \mathop{a_1}\limits_|^| \ \mathop{a_2}\limits_|^| \ \cdots \ \mathop{a_n}\limits_|^| | ||
\end{bmatrix} \mathbf b = | \end{bmatrix} \mathbf b = | ||
b_1 \begin{bmatrix} \mathop{a_1}\limits_|^| \end{bmatrix} | b_1 \begin{bmatrix} \mathop{a_1}\limits_|^| \end{bmatrix} | ||
+ b_2 \begin{bmatrix} \mathop{a_2}\limits_|^| \end{bmatrix} + \cdots | + b_2 \begin{bmatrix} \mathop{a_2}\limits_|^| \end{bmatrix} + \cdots | ||
− | + \ b_n \begin{bmatrix} \mathop{a_n}\limits_|^| \end{bmatrix} | + | + \ b_n \begin{bmatrix} \mathop{a_n}\limits_|^| \end{bmatrix}</math> |
=== Example === | === Example === | ||
− | + | <math>\begin{bmatrix} | |
2 & 5\\ | 2 & 5\\ | ||
1 & 3 | 1 & 3 | ||
Line 54: | Line 54: | ||
1 \\ | 1 \\ | ||
2 | 2 | ||
− | \end{bmatrix} | + | \end{bmatrix}</math> |
− | + | ||
Row at a time: | Row at a time: | ||
− | * | + | * <math>[2 \ 5] \begin{bmatrix} |
1 \\ | 1 \\ | ||
2 | 2 | ||
Line 75: | Line 74: | ||
12 \\ | 12 \\ | ||
7 | 7 | ||
− | \end{bmatrix} | + | \end{bmatrix}</math> |
Column at a time | Column at a time | ||
− | * | + | * <math>1 \begin{bmatrix} |
2 \\ | 2 \\ | ||
1 | 1 | ||
Line 88: | Line 87: | ||
12 \\ | 12 \\ | ||
7 | 7 | ||
− | \end{bmatrix} | + | \end{bmatrix}</math> |
Suppose we have an $m \times n$ matrix $A$ and $n$-vector $\mathbf b$
There are two equivalent ways to do it:
See $A$ as $m$ vectors along rows:
[math]A = \begin{bmatrix} — \mathbf a_1 \,— \\ — \mathbf a_2 \,— \\ ... \\ — \mathbf a_m \,— \end{bmatrix}[/math]
And then multiply (using Dot Product) each row $(\mathbf a_i)^T$ with the vector $\bf x$:
Another way to see $A$ is as $n$ vectors along columns:
[math]A = \begin{bmatrix} \mathop{a_1}\limits_|^| \ \mathop{a_2}\limits_|^| \ \cdots \ \mathop{a_n}\limits_|^| \end{bmatrix}[/math]
When we multiply $A$ on a vector $\mathbf b$, it produces a Linear Combination of these column vectors:
[math]A \mathbf b = \begin{bmatrix} \mathop{a_1}\limits_|^| \ \mathop{a_2}\limits_|^| \ \cdots \ \mathop{a_n}\limits_|^| \end{bmatrix} \mathbf b = b_1 \begin{bmatrix} \mathop{a_1}\limits_|^| \end{bmatrix} + b_2 \begin{bmatrix} \mathop{a_2}\limits_|^| \end{bmatrix} + \cdots + \ b_n \begin{bmatrix} \mathop{a_n}\limits_|^| \end{bmatrix}[/math]
[math]\begin{bmatrix} 2 & 5\\ 1 & 3 \end{bmatrix} \cdot \begin{bmatrix} 1 \\ 2 \end{bmatrix}[/math]
Row at a time:
Column at a time
A vector may be on the left of the matrix as well