Matrix ProductsMatrices > Basics | Matrix products | Special matrices | QR | Matrix inverses | Linear maps | Matrix norms | Applications
Matrix-vector productDefinitionWe define the matrix-vector product between a ![]()
Interpretation as linear combinations of columnsIf the columns of ![]()
Example: Interpretation as scalar products with rowsAlternatively, if the rows of ![]() then ![]()
Example: Absorption spectrometry: using measurements at different light frequencies. Left productIf ![]() Example: Return to the network example, involving a Matlab syntaxThe product operator in Matlab is *. If the sizes are not consistent, Matlab will produce an error. Matlab syntax
>> A = [1 2; 3 4; 5 6]; % 3x2 matrix >> x = [-1; 1]; % 2x1 vector >> y = A*x; % result is a 3x1 vector >> z = [-1; 0; 1]; % 3x1 vector >> y = z'*A; % result is a 1x2 (i.e., row) vector Matrix-matrix productDefinitionWe can extend matrix-vector product to matrix-matrix product, as follows. If ![]() Transposing a product changes the order, so that Column-wise interpretationIf the columns of ![]() In other words, Row-wise interpretationThe matrix-matrix product can also be interpreted as an operation on the rows of ![]() (Note that Block Matrix ProductsMatrix algebra generalizes to blocks, provided block sizes are consistent. To illustrate this, consider the matrix-vector product between a ![]() where ![]() Symbolically, it's as if we would form the ‘‘scalar’’ product between the ‘‘row vector Likewise, if a ![]() Again, symbolically we apply the same rules as for the scalar product — except that now the result is a matrix. Example: Gram matrix. Finally, we can consider so-called outer products. Consider the case for example when ![]() Then the product ![]() Trace, scalar productTraceThe trace of a square Some important properties:
![]() Matlab syntax
>> A = [1 2 3; 4 5 6; 7 8 9]; % 3x3 matrix >> tr = trace(A); % trace of A Scalar product between matricesWe can define the scalar product between two ![]() The above definition is symmetric: we have ![]() Our notation is consistent with the definition of the scalar product between two vectors, where we simply view a vector in Matlab syntax
>> A = [1 2; 3 4; 5 6]; % 3x2 matrix >> B = randn(3,2); % random 3x2 matrix >> scal_prod = trace(A'*B); % scalar product between A and B >> scal_prod = A(:)'*B(:); % this is the same as the scalar product between the % vectorized forms of A, B |