Multiply Matrices Calculator

Matrix Multiplication Calculator (3×3)

Matrix A

×

Matrix B

Resulting Matrix (A × B)

0
0
0
0
0
0
0
0
0

How Matrix Multiplication Works

Matrix multiplication is a fundamental operation in linear algebra. Unlike standard multiplication, multiplying two matrices involves calculating the dot product of rows from the first matrix and columns from the second matrix.

The Basic Rule of Dimensions

To multiply Matrix A by Matrix B, the number of columns in Matrix A must be equal to the number of rows in Matrix B. In our 3×3 calculator, this condition is always met as both matrices are 3×3 squares.

Step-by-Step Calculation Example

If you are calculating the element in the first row and first column of the result (r11), the formula is:

r11 = (a11 × b11) + (a12 × b21) + (a13 × b31)

Essentially, you take the entire first row of Matrix A, multiply it element-by-element with the first column of Matrix B, and sum the results.

Real-World Applications

  • Computer Graphics: Used for transforming 3D coordinates, rotation, scaling, and translation.
  • Data Science: Essential for algorithms like Principal Component Analysis (PCA) and training Neural Networks.
  • Physics: Describing rotations in space and quantum mechanics state vectors.
  • Economics: Modeling input-output relationships in complex industrial systems.

Frequently Asked Questions

Is Matrix Multiplication Commutative?
No. In most cases, A × B is NOT equal to B × A. The order of multiplication is critical.

What is an Identity Matrix?
An identity matrix is a square matrix with 1s on the diagonal and 0s elsewhere. Multiplying any matrix by an identity matrix results in the original matrix.

function calculateMatrixProduct() { // Get Matrix A values var a11 = parseFloat(document.getElementById("a11").value) || 0; var a12 = parseFloat(document.getElementById("a12").value) || 0; var a13 = parseFloat(document.getElementById("a13").value) || 0; var a21 = parseFloat(document.getElementById("a21").value) || 0; var a22 = parseFloat(document.getElementById("a22").value) || 0; var a23 = parseFloat(document.getElementById("a23").value) || 0; var a31 = parseFloat(document.getElementById("a31").value) || 0; var a32 = parseFloat(document.getElementById("a32").value) || 0; var a33 = parseFloat(document.getElementById("a33").value) || 0; // Get Matrix B values var b11 = parseFloat(document.getElementById("b11").value) || 0; var b12 = parseFloat(document.getElementById("b12").value) || 0; var b13 = parseFloat(document.getElementById("b13").value) || 0; var b21 = parseFloat(document.getElementById("b21").value) || 0; var b22 = parseFloat(document.getElementById("b22").value) || 0; var b23 = parseFloat(document.getElementById("b23").value) || 0; var b31 = parseFloat(document.getElementById("b31").value) || 0; var b32 = parseFloat(document.getElementById("b32").value) || 0; var b33 = parseFloat(document.getElementById("b33").value) || 0; // Row 1 var r11 = (a11 * b11) + (a12 * b21) + (a13 * b31); var r12 = (a11 * b12) + (a12 * b22) + (a13 * b32); var r13 = (a11 * b13) + (a12 * b23) + (a13 * b33); // Row 2 var r21 = (a21 * b11) + (a22 * b21) + (a23 * b31); var r22 = (a21 * b12) + (a22 * b22) + (a23 * b32); var r23 = (a21 * b13) + (a22 * b23) + (a23 * b33); // Row 3 var r31 = (a31 * b11) + (a32 * b21) + (a33 * b31); var r32 = (a31 * b12) + (a32 * b22) + (a33 * b32); var r33 = (a31 * b13) + (a32 * b23) + (a33 * b33); // Update result grid document.getElementById("r11").innerHTML = Number(r11.toFixed(4)); document.getElementById("r12").innerHTML = Number(r12.toFixed(4)); document.getElementById("r13").innerHTML = Number(r13.toFixed(4)); document.getElementById("r21").innerHTML = Number(r21.toFixed(4)); document.getElementById("r22").innerHTML = Number(r22.toFixed(4)); document.getElementById("r23").innerHTML = Number(r23.toFixed(4)); document.getElementById("r31").innerHTML = Number(r31.toFixed(4)); document.getElementById("r32").innerHTML = Number(r32.toFixed(4)); document.getElementById("r33").innerHTML = Number(r33.toFixed(4)); // Show section document.getElementById("result-section").style.display = "block"; } function clearMatrices() { var inputs = document.querySelectorAll('#matrix-calculator-container input'); for(var i = 0; i < inputs.length; i++) { inputs[i].value = "0"; } document.getElementById("result-section").style.display = "none"; }

Leave a Comment