Suppose you have a matrix $A =\begin{bmatrix} 1 & 2 \\ 3 & 4 \\ 5 & 6 \end{bmatrix}$ and $B = [1,2]$. I want to multiply the matrices together so I get a $3 \times 1$ resulting matrix where each entry is equal to $1*a1 + 2*a2$. How would I do this? The number of columns in matrix in matrix A is not the same as the number of rows in matrix B so I am not sure what to do.

  • 1
    $\begingroup$ You sure ly want $B$ to be a column, not a row, vector. $\endgroup$ – Julien Apr 19 '13 at 21:22

If $A$ is a $m\times n$ and $B$ is a $j\times k$ matrix, then multiplication $AB$ is only defined when $n=j$, and the result will be an $m\times k$ matrix.

You could modify the example you have by transposing one of the matrices. For example, $AB^T$ is defined, and $BA^T$ is defined. The former would be a $3\times 1$ and the latter would be a $1\times 3$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.