Solve Matrix Calculator

.matrix-solver-container { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; max-width: 800px; margin: 20px auto; padding: 25px; border: 1px solid #e0e0e0; border-radius: 12px; background-color: #ffffff; box-shadow: 0 4px 6px rgba(0,0,0,0.05); } .matrix-solver-container h2 { color: #2c3e50; text-align: center; margin-bottom: 25px; } .matrix-grid-wrapper { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; margin-bottom: 30px; } .matrix-box { background: #f8f9fa; padding: 15px; border-radius: 8px; border: 1px solid #dee2e6; } .matrix-title { font-weight: bold; display: block; margin-bottom: 10px; text-align: center; color: #495057; } .matrix-inputs { display: grid; grid-template-columns: repeat(3, 60px); gap: 8px; } .matrix-inputs input, .constant-inputs input { width: 60px; height: 40px; text-align: center; border: 1px solid #ced4da; border-radius: 4px; font-size: 16px; } .constant-inputs { display: grid; grid-template-columns: 60px; gap: 8px; } .matrix-button-row { text-align: center; margin-top: 20px; } .calculate-btn { background-color: #007bff; color: white; border: none; padding: 12px 30px; font-size: 18px; border-radius: 6px; cursor: pointer; transition: background 0.2s; } .calculate-btn:hover { background-color: #0056b3; } .matrix-result-area { margin-top: 30px; padding: 20px; background-color: #f1f8ff; border-radius: 8px; border-left: 5px solid #007bff; display: none; } .matrix-result-area h3 { margin-top: 0; color: #0056b3; } .result-item { margin: 10px 0; font-size: 18px; } .article-section { margin-top: 40px; line-height: 1.6; color: #333; } .article-section h2 { color: #2c3e50; border-bottom: 2px solid #eee; padding-bottom: 10px; } .example-box { background: #fff8e1; padding: 15px; border-radius: 5px; margin: 15px 0; }

3×3 Matrix Equation Solver

Solve systems of linear equations (Ax = B) using Cramer's Rule.

Matrix A (Coefficients)
× [X] =
Vector B (Constants)

Solution:

What is a Matrix Solver?

A matrix solver is a mathematical tool designed to find the values of unknown variables in a system of linear equations. In linear algebra, a system of equations can be represented as Ax = B, where A is the coefficient matrix, x is the vector of unknowns (usually x, y, and z), and B is the constant vector.

Understanding Cramer's Rule

This calculator utilizes Cramer's Rule, an explicit formula for the solution of a system of linear equations with as many equations as unknowns. It uses determinants to find individual variables. To solve for a variable, we replace the corresponding column in Matrix A with Vector B, calculate the new determinant, and divide it by the original determinant of Matrix A.

Example System:
1x + 2y + 3z = 14
0x + 1y + 4z = 17
5x + 6y + 0z = 11

Steps:
1. Calculate Det(A). If Det(A) = 0, the system has no unique solution.
2. To find X, replace the first column of A with [14, 17, 11] and find the new determinant (DetX).
3. X = DetX / Det(A).

Why Use This Matrix Calculator?

Solving 3×3 matrices manually is prone to human error due to the number of arithmetic steps involved (multiplications, subtractions, and nested determinants). This tool provides instant, accurate results for engineering, physics, and advanced mathematics homework or professional data analysis.

Common Applications

  • Physics: Solving Kirchhoff's laws in circuit analysis.
  • Engineering: Structural analysis and force distribution.
  • Economics: Calculating equilibrium in multi-market models.
  • Computer Science: Transformation matrices in 3D graphics.
function getDet3x3(m) { var det = m[0] * (m[4] * m[8] – m[5] * m[7]) – m[1] * (m[3] * m[8] – m[5] * m[6]) + m[2] * (m[3] * m[7] – m[4] * m[6]); return det; } function solveMatrix() { 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; var b1 = parseFloat(document.getElementById("b1").value) || 0; var b2 = parseFloat(document.getElementById("b2").value) || 0; var b3 = parseFloat(document.getElementById("b3").value) || 0; var mainMatrix = [a11, a12, a13, a21, a22, a23, a31, a32, a33]; var detA = getDet3x3(mainMatrix); var resDiv = document.getElementById("matrix-results"); var detOut = document.getElementById("determinant-output"); var varOut = document.getElementById("variable-output"); resDiv.style.display = "block"; if (Math.abs(detA) < 0.0000001) { detOut.innerHTML = "Determinant |A| = 0"; varOut.innerHTML = "The system has no unique solution (it is either inconsistent or dependent)."; return; } // Matrix for X var matX = [b1, a12, a13, b2, a22, a23, b3, a32, a33]; var detX = getDet3x3(matX); // Matrix for Y var matY = [a11, b1, a13, a21, b2, a23, a31, b3, a33]; var detY = getDet3x3(matY); // Matrix for Z var matZ = [a11, a12, b1, a21, a22, b2, a31, a32, b3]; var detZ = getDet3x3(matZ); var x = detX / detA; var y = detY / detA; var z = detZ / detA; detOut.innerHTML = "Determinant |A| = " + detA.toFixed(4).replace(/\.?0+$/, "") + ""; varOut.innerHTML = "X = " + x.toFixed(4).replace(/\.?0+$/, "") + "" + "Y = " + y.toFixed(4).replace(/\.?0+$/, "") + "" + "Z = " + z.toFixed(4).replace(/\.?0+$/, ""); }

Leave a Comment