Matrix Multiplication Calculator - Online Matrices Dot Product (2024)

  1. Mathematics
  2. Matrix
  3. Matrix Product

Multiplication of 2 Matrices

Multiplication of 1 Matrix and 1 Vector

Multiplication of Row Matrix by Column Matrix

Multiplication by a Scalar (Number)

Answers to Questions (FAQ)

What is a matrix product? (Definition)

The matrix product is the name given to the most common matrix multiplication method.

$ M_1=[a_{ij}] $ is a matrix of $ m $ rows and $ n $ columns and $ M_2=[b_{ij}] $ is a matrix of $ n $ rows and $ p $ columns (all formats are possible 2x2, 2x3, 3x2, 3x3, 3x4, 4x3, etc.). The matrix product $ M_1.M_2 = [c_{ij}] $ is a matrix of $ m $ rows and $ p $ columns, with: $$ \forall i, j: c_{ij} = \sum_{k=1}^n a_{ik}b_{kj} $$

The multiplication of 2 matrices $ M_1 $ and $ M_2 $ is noted with a point $ \cdot $ or . so $ M_1 \cdot M_2 $ (the same point as for the dot product)

The matrix product is only defined when the number of columns of $ M_1 $ is equal to the number of rows of $ M_2 $ (matrices are called compatible)

How to multiply 2 matrices? (Matrix product)

The multiplication of 2 matrices $ M_1 $ and $ M_2 $ forms a result matrix $ M_3 $. The matrix product consists in carrying out additions and multiplications according to the positions of the elements in the matrices $ M_1 $ and $ M_2 $.

$$ M_1 = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix} \\ M_2 = \begin{bmatrix} b_{11} & b_{12} & \cdots & b_{1p} \\ b_{21} & b_{22} & \cdots & b_{2p} \\ \vdots & \vdots & \ddots & \vdots \\ b_{n1} & b_{n2} & \cdots & b_{np} \end{bmatrix} \\ M_1 \cdot M_2 = \begin{bmatrix} a_{11}b_{11} +\cdots + a_{1n}b_{n1} & a_{11}b_{12} +\cdots + a_{1n}b_{n2} & \cdots & a_{11}b_{1p} +\cdots + a_{1n}b_{np} \\ a_{21}b_{11} +\cdots + a_{2n}b_{n1} & a_{21}b_{12} +\cdots + a_{2n}b_{n2} & \cdots & a_{21}b_{1p} +\cdots + a_{2n}b_{np} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1}b_{11} +\cdots + a_{mn}b_{n1} & a_{m1}b_{12} +\cdots + a_{mn}b_{n2} & \cdots & a_{m1}b_{1p} +\cdots + a_{mn}b_{np} \end{bmatrix} $$

To calculate the value of the element of the matrix $ M_3 $ in position $ i $ and column $ j $, extract the row $ i $ from the matrix $ M_1 $ and the row $ j $ from the matrix $ M_2 $ and calculate their dot product. That is, multiply the first element of row $ i $ of $ M_1 $ by the first element of column $ j $ of $ M_2 $, then the second element of row $ i $ of $ M_1 $ by the second element of the column $ j $ of $ M_2 $, and so on, note the sum of the multiplications obtained, it is the value of the scalar product, therefore of the element in position $ i $ and column $ j $ in $ M_3 $.

Example: $$ \begin{bmatrix} 1 & 0 \\ -2 & 3 \end{bmatrix} \cdot \begin{bmatrix} 2 & -1 \\ 4 & -3 \end{bmatrix} = \begin{bmatrix} 1 \times 2 + 0 \times 4 & 1 \times -1 + 0 \times -3 \\ -2 \times 2 + 4 \times 3 & -2 \times -1 + 3 \times -3 \end{bmatrix} = \begin{bmatrix} 2 & -1 \\ 8 & -7 \end{bmatrix} $$

How to multiply a matrix by a vector?

The matrix product between a matrix $ M $ of dimensions $ m \times n $ and a column vector $ V $ of dimension $ n \times 1 $ results in a new column vector of dimension $ m \times 1 $ .

The principle is similar for a row vector.

How to multiply a matrix by a scalar?

The product of the matrix $ M=[a_{ij}] $ by a scalar (number) $ \lambda $ is a matrix of the same size as the initial matrix $ M $, with each item of the matrix multiplied by $ \lambda $.

$$ \lambda M = [ \lambda a_{ij} ] $$

What are matrix multiplication properties?

Associativity: $$ A \times (B \times C) = (A \times B) \times C $$

Distributivity: $$ A \times (B + C) = A \times B + A \times C $$

$$ (A + B) \times C = A \times C + B \times C $$

$$ \lambda (A \times B) = (\lambda A) \times B = A \times (\lambda B) $$

The order of the operands matters with matrix multiplication, so $$ M_1.M_2 \neq M_2.M_1 $$ (non-commutativity, except in special cases)

How to multiply two matrices of incompatible shapes?

There is a matrix product compatible with any matrix sizes (3x3,4x4,5x5,etc.): the Kronecker product

Source code

dCode retains ownership of the "Matrix Product" source code. Except explicit open source licence (indicated Creative Commons / free), the "Matrix Product" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "Matrix Product" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "Matrix Product" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!
Reminder : dCode is free to use.

Cite dCode

The copy-paste of the page "Matrix Product" or any of its results, is allowed (even for commercial purposes) as long as you credit dCode!
Exporting results as a .csv or .txt file is free by clicking on the export icon
Cite as source (bibliography):
Matrix Product on dCode.fr [online website], retrieved on 2024-06-23, https://www.dcode.fr/matrix-multiplication

Matrix Multiplication Calculator - Online Matrices Dot Product (2024)

References

Top Articles
Latest Posts
Article information

Author: Neely Ledner

Last Updated:

Views: 6174

Rating: 4.1 / 5 (42 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Neely Ledner

Birthday: 1998-06-09

Address: 443 Barrows Terrace, New Jodyberg, CO 57462-5329

Phone: +2433516856029

Job: Central Legal Facilitator

Hobby: Backpacking, Jogging, Magic, Driving, Macrame, Embroidery, Foraging

Introduction: My name is Neely Ledner, I am a bright, determined, beautiful, adventurous, adventurous, spotless, calm person who loves writing and wants to share my knowledge and understanding with you.