MatrixStep

Matrix equation AX = B calculator

Reduces [A | B] to RREF to find X = A⁻¹B.

INPUT

Integers, fractions (1/3) and decimals (0.25) are accepted. Empty cells count as 0. Paste a block of numbers from a spreadsheet or textbook into the first cell to fill the whole matrix.

RESULT

LaTeX is the math code you can paste into Overleaf, Notion equation blocks or Word's equation editor.

The matrix equation AX = B

If A is invertible the unique solution is X = A⁻¹B. Instead of computing the inverse, reduce [A | B]: X appears on the right.

Each column of B is the right-hand side of a linear system Ax = b, so AX = B solves several systems with the same coefficient matrix at once.

Full explanation with examples: How to Solve the Matrix Equation AX = B (X = A⁻¹B, XA = B, No-Solution Case)

Exam tipFor XA = B, transpose both sides: AᵀXᵀ = Bᵀ, which has the same form.

How to do it by hand

  1. Check that A is square with det(A) ≠ 0. Then there is exactly one solution, X = A⁻¹B.
  2. Instead of computing the inverse separately, form the augmented matrix [A | B] and reduce the left side to RREF. This handles every column of B at once.
  3. When the left side becomes I, the right side is X. Each column of B is an independent linear system.
  4. For XA = B, transpose both sides to AᵀXᵀ = Bᵀ, solve, and transpose the result back.
Worked example

Solve AX = B with A = [2 1; 1 1], B = [3; 2].

[2 1 | 3; 1 1 | 2] → R₁ ↔ R₂ → [1 1 | 2; 2 1 | 3] → R₂ − 2R₁ → [1 1 | 2; 0 −1 | −1]

R₂ × (−1) → [1 1 | 2; 0 1 | 1] → R₁ − R₂ → [1 0 | 1; 0 1 | 1]. X = [1; 1]

Check: A·[1; 1] = [2+1; 1+1] = [3; 2] = B ✓

Where is it used?

  • Solving several systems with the same coefficient matrix and different right-hand sides: one reduction handles every column of B.
  • Finding a transformation: the linear map X that sends input vectors A to output vectors B is the solution of XA = B.
  • Control theory and least squares (AᵀA)X = AᵀB naturally produce matrix equations of this form.

Common mistakes

  • Writing X = B/A as if dividing. There is no matrix division, and A⁻¹B differs from BA⁻¹. For AX = B, multiply by A⁻¹ on the left: X = A⁻¹B.
  • Trying to invert A when det(A) = 0. Then there is no solution or infinitely many; this calculator reports that case separately.
  • Solving XA = B as if it were AX = B. Which side you multiply on changes the answer.

How to use

  1. Set the matrix size with the row and column buttons. Up to 6×6 is supported.
  2. Type numbers into the cells and the result updates instantly. Enter fractions as 1/3 and negatives as -2.
  3. Enter moves to the next cell; the ← → ↑ ↓ arrow keys move between cells.
  4. Open ‘Steps’ to see the full working. ‘Copy LaTeX’ copies the result as math code you can paste into Overleaf, a Notion equation block or Word's equation editor.

FAQ

How do I solve XA = B?
Transpose to get AᵀXᵀ = Bᵀ. Enter Aᵀ and Bᵀ, solve for Xᵀ, then transpose the result.
What if A is not square?
This calculator takes a square A. For rectangular A, solve column by column with the linear system calculator, or it becomes a least-squares problem.
What if B is the identity?
Then X = A⁻¹, which is exactly what the inverse calculator does.

Related guides