# how can a matrix vector product reduce to a scalar?

I have an Excel spreadsheet with the following formula (paraphrased):

=MMULT(  MMULT(vector_as_n_column_matrix, n_by_n_square_matrix)
,TRANSPOSE(vector_as_n_column_matrix)
)


the matrix and vector contain floating point values. Excel evaluates this formula as a scalar. I don't recall matrix math working that way. However, it's been over 30 years since I studies linear algebra.

Does it make sense that the result should be a scalar? Can you explain why in terms of linear algebra?

-

Multiplying an $m\times n$ matrix on the right by an $n\times p$ matrix yields an $m\times p$ matrix. You have $$v^t Av$$ which is a $1\times n$ matrix times an $n\times n$ matrix times an $n\times 1$ matrix. The result is a $1\times 1$ matrix.
working from right to left : A $n\times n$ matrix times a $1 \times n$ vector yields a $1 \times n$ vector (given that they are of the same size). Your first $1\times n$ vector times this resultant vector yields a scalar [via the dot product] (again pending that the two vectors have the same dimension), so yes your answer makes sense .
Just to expand on what's already been said, given an $n\times n$ matrix $A\in M_{n\times n}(K)$, you can define the map $f:K^n\rightarrow K$ by $f_A(v)=v^\intercal A v$. These types of map are called bilinear forms (closely related: quadratic forms). Bilinear forms appear all over mathematics.