Matrix Equations Solver
Solve linear matrix equations AX=B.
Loading tool…
About this tool
Enter a square matrix A and a right-hand side B to solve AX = B. For A = [2 1; 1 1] and B = [5; 3], X = [2; 1].
How to use
1
Step 1
Type A, one row per line.
2
Step 2
Type B as a column, one entry per line.
3
Step 3
Press Calculate to see X and the working.
How it works
If A has an inverse, X = A⁻¹B. The tool inverts A first and then multiplies. This is the matrix form of a linear system, so it solves 3×3 or larger systems that the two-equation solver cannot.
AX = B → X = A⁻¹B
Worked example
Check the answer
- Input
- A = [2 1; 1 1], B = [5; 3]
- Output
- X = [2; 1]
- Walkthrough
- det A = 1. A⁻¹ = [1 −1; −1 2]. Multiplying by B gives [5 − 3; −5 + 6] = [2; 1]. Check: 2×2 + 1 = 5 and 2 + 1 = 3.
Limitations
- A singular matrix has no inverse and returns Matrix is singular.
- Inverse entries are rounded to six digits before multiplying, so larger systems can be off in the fifth decimal: the 3×3 system with answer (1, −2, 4) returns −1.99999 and 3.99999.
Questions
What is X if A = [2 1; 1 1] and B = [5; 3]?
X = [2; 1].
What if A is singular?
No inverse exists, so the tool returns an error. [1 2; 2 4] is an example.
Can it solve 3 unknowns?
Yes, with a 3×3 A and a 3×1 B, but expect small rounding in the last digits.
Features
- Any square system
- Shows the inverse step
- Runs in your browser
Related resources
Guides and videos from around the web—opens on YouTube or the publisher’s site.
Vectors | Essence of linear algebra
3Blue1Brown
Visual vectors when algebra tools move toward matrices.
Watch on YouTubeVariables on both sides — example
Khan Academy
Worked example to check against solver output.
Watch on YouTube
- Quadratic Equations
Math is Fun
Factoring and formula methods next to quadratic solvers.
- Systems of Linear Equations
Math is Fun
Two-variable systems for simultaneous equation calculators.
More Math tools
See all ›System of Equations Solver
Solve simultaneous linear equations.
Cramer's Rule Calculator
Solve linear systems with determinants.
Matrix Least Squares Calculator
Solve rectangular least-squares problems min ‖Ax − b‖.
Matrix Rank Calculator
Compute the rank of a matrix via row reduction.
LU Decomposition Calculator
Factor a matrix into PA = LU with partial pivoting.
Null Space Calculator
Find a basis for the null space of a matrix.