Tools / Matrix calculator
Matrix calculator
Solve a set of linear equations, find a determinant, inverse or rank, or multiply matrices, with the working shown step by step. It also builds the mesh-current matrix for a resistor network by inspection, the shortcut that skips pages of loop algebra.
Start from an example
A three-mesh resistor network. Every mesh current is taken in the same direction, so each shared resistor gets a minus sign in the matrix. The currents come out as 2, 1 and 3 mA.
What to do
Diagonal boxes: the total resistance in each mesh (kΩ). Boxes above the diagonal: the resistance that two meshes share, with 0 or empty if they share none. Last column: the sum of the source voltages round the mesh, positive when a source drives current in the direction of the mesh current. Boxes below the diagonal fill themselves in.
| Mesh 1 | Mesh 2 | Mesh 3 | Source voltage (V) | |
|---|---|---|---|---|
| Mesh 1 | ||||
| Mesh 2 | 3 | |||
| Mesh 3 | 1 | 2 |
The matrix, written by inspection
R·I = V, with R in kΩ and V in volts.
| 5 | −3 | −1 |
| −3 | 8 | −2 |
| −1 | −2 | 6 |
| I₁ |
| I₂ |
| I₃ |
| 4 |
| −4 |
| 14 |
Mesh currents
Current in each shared resistor
A shared resistor carries the difference of the two mesh currents that pass through it, taken in the direction of the first mesh.
- Check: substituting the currents back gives a largest error of 0 in the equations.
- The matrix is symmetric by construction, because the resistance shared by meshes i and j is the same from either side.
Working
Show the steps
- Start with the matrix.
5 −3 −1 4 −3 8 −2 −4 −1 −2 6 14 - Column 1: divide row 1 by 5; row 2 − (−3) × row 1; row 3 − (−1) × row 1.
1 −0.6 −0.2 0.8 0 6.2 −2.6 −1.6 0 −2.6 5.8 14.8 - Column 2: divide row 2 by 6.2; row 1 − (−0.6) × row 2; row 3 − (−2.6) × row 2.
1 0 −0.451613 0.645161 0 1 −0.419355 −0.258065 0 0 4.70968 14.129 - Column 3: divide row 3 by 4.70968; row 1 − (−0.451613) × row 3; row 2 − (−0.419355) × row 3.
1 0 0 2 0 1 0 1 0 0 1 3
How to read it
Solving. The tool applies Gauss–Jordan elimination: it swaps rows to put the largest number in the pivot position, scales the pivot row to 1, and removes that column from every other row. Reading the final matrix tells you whether the equations have one solution, none, or infinitely many. The condition number says how much errors in the numbers are magnified in the answer: above about a million, the data would need to be very precise to trust the result.
Mesh currents by inspection. Draw every mesh current in the same direction, say clockwise. Then the matrix R·I = V can be written without any algebra. Each diagonal entry is the sum of all resistors in that mesh. Each off-diagonal entry is minus the resistance shared by the two meshes (0 if they share none). Each entry of V is the sum of the source voltages around that mesh, positive when the source pushes current the same way as the mesh current. The matrix is symmetric, which is a quick check on your entries.
Limits: up to 8×8, real numbers (decimals, exponents like 2e-3, and fractions like 1/3), double-precision arithmetic. A pivot smaller than about 10⁻¹⁰ of the largest entry is treated as zero, so a matrix that is singular only in the thirteenth digit is reported as singular. The mesh shortcut applies to planar resistor circuits with voltage sources and no current sources shared between meshes.