Matrix arithmetic starts with the shape of the inputs. Two tables with the same number of entries can still be impossible to add because their rows and columns do not line up. Multiplication follows a different rule. The columns of the first matrix must match the rows of the second, and the product can have a shape different from either input.
TinyToolbox Matrix Calculator adds, subtracts, or multiplies two numeric matrices. Enter the matrices row by row, choose the operation, and check the expected dimensions before you calculate. A small manual check of one entry can tell you whether the rows, columns, and operand order were entered as intended.
Write each matrix as a rectangle
Count the rows and columns in each matrix. A matrix with two horizontal rows and three entries in each row is a 2 × 3 matrix. Dimensions always list the row count first. If one line has two entries and another has three, the input does not represent a rectangular matrix. Find out whether a missing entry is meant to be zero before inserting one.
Enter each row on a separate line and separate its numbers with spaces or commas. The following input represents two rows with three columns:
1 2 3
4 5 6
The calculator also accepts semicolons as row separators. For a first attempt, use separate lines so you can compare the displayed input with the original table. Leave out surrounding square brackets, column headings, and row numbers. Those labels can help explain the matrix in a document but do not belong in the data fields.
Each input can have up to ten rows and ten columns. You can use negative numbers, decimals, and zero. Use a period for the decimal point so a comma remains an unambiguous separator between entries. When copying from a spreadsheet, check where the rows break and confirm that blank cells have not disappeared from the middle of a row.
Run the calculation in TinyToolbox
- Open Matrix Calculator.
- Enter the first rectangle under Matrix A, one row per line.
- Choose Add, Subtract, or Multiply under Operation.
- Enter the second rectangle under Matrix B, one row per line.
- Select Calculate and read the rows under Matrix result.
If the tool reports incompatible dimensions, write the two dimension pairs on paper and compare them with the rule for the chosen operation. A shape error is often easier to spot by counting columns than by examining the actual numbers. If the tool rejects a rectangle, inspect each row for a missing value or an unexpected separator.
The result is displayed as rows of numbers. Count those rows and the values on each one. If an output contains a large number with grouping punctuation, check how that number is formatted before copying it back into an input that uses commas as separators. Keep the result and both source matrices available until you verify their shapes.
Add or subtract matching positions
Use these two inputs for a small check:
A
1 2
3 4
B
5 6
7 8
Paste only the numbers into each field, leaving the labels out. Choose Add. The top-left entry of the result is 1 + 5 = 6. The top-right entry is 2 + 6 = 8. The second row is 3 + 7 and 4 + 8, giving:
6 8
10 12
Choose Subtract to compute A minus B. Each entry in this example becomes −4 because every entry in B is four more than the matching entry in A. Swapping A and B changes those results to 4. Addition can use either order and produce the same values when dimensions match.
A 2 × 3 matrix cannot be added to a 3 × 2 matrix even though both contain six entries. Each output position needs a corresponding position on both sides. Reshaping or transposing a matrix changes which values occupy those positions, so make that change only when it belongs to the problem.
Multiply a row by a column
For multiplication, compare A’s columns with B’s rows. If A is 2 × 3 and B is 3 × 2, the shared inner dimension is three. The outer dimensions tell you that the result will have two rows and two columns. Each result entry sums three pairwise products.
Use the earlier 2 × 3 matrix as A:
1 2 3
4 5 6
For B, enter:
7 8
9 10
11 12
To compute the top-left entry, take A’s first row and B’s first column. Multiply matching positions and add them: 1 × 7 + 2 × 9 + 3 × 11 = 58. The top-right entry uses the same row of A and the second column of B, giving 1 × 8 + 2 × 10 + 3 × 12 = 64. Repeating with A’s second row gives this result:
58 64
139 154
This calculation uses rows and columns together. Multiplying each value by the value in the matching position would be an elementwise product, which is a different operation. If you get an unexpected value, identify which row and column created it and calculate their dot product by hand. The Online Calculator can help check the scalar arithmetic.
Check the order of multiplication
Swapping two matrices can change both the values and the shape of the product. In the example above, B times A is 3 × 3, because B now contributes three rows and A contributes three columns. Its top-left entry is 7 × 1 + 8 × 4 = 39. This shows why the A and B labels matter even when both orders are allowed.
Sometimes only one order is compatible. A 2 × 3 matrix times a 3 × 4 matrix gives a 2 × 4 matrix. In the reverse order, the inner dimensions would be four and two. That product is undefined. When reading a formula, preserve the order in which matrices are written rather than choosing an arrangement that makes the fields look more symmetrical.
For an easy sanity check, multiply a square matrix by the identity matrix of the same size. The identity has ones on the main diagonal and zeros elsewhere. The result should equal the original matrix. A column that moves or disappears in this test can indicate that the input was copied incorrectly.
Review the final shape and values
Check the operation, input dimensions, and first entry before carrying the result into another step. For addition or subtraction, the result has the same dimensions as both inputs. For multiplication, it has A’s row count and B’s column count. Verify at least one entry away from the top-left corner so you know the later row and column were also interpreted correctly.
The tool displays rounded numeric results using its formatting rules. If your problem requires exact fractions or high precision, keep the original values and use a suitable exact-arithmetic workflow. This form covers addition, subtraction, and matrix multiplication. Set out any transposition or other operation separately so your notes explain the intermediate inputs. Save the matrices in row order along with the chosen operation, and the result will be much easier to reproduce.
Compare several orders against two price lists
Suppose a classroom plans two supply orders. In the first order it needs 3 notebooks, 2 markers, and 1 folder. The second needs 1 notebook, 4 markers, and 2 folders. Write these quantities in matrix A with one order per row. Keep the item order the same across both rows.
3 2 1
1 4 2
Two suppliers price the notebook at 4 and 5, the marker at 2 and 1.50, and the folder at 3 and 4, in the same currency. Write their prices in matrix B, with one item per row and one supplier per column.
4 5
2 1.5
3 4
Open Matrix Calculator and choose multiplication using A followed by B. A has two rows and three columns. B has three rows and two columns, so the shared size is three and the result is a two-by-two matrix. Each row of the result describes an order. Each column describes a supplier. Keep those labels outside the numeric input and attach them when interpreting the output.
| Order | First supplier | Second supplier |
|---|---|---|
| First | 19 | 22 |
| Second | 18 | 19 |
To reproduce the upper-left cell, multiply the first order’s quantities by the first supplier’s prices in matching positions. The sum is 3 × 4 + 2 × 2 + 1 × 3, or 19. For the lower-right cell, use the second order and second supplier. The sum is 1 × 5 + 4 × 1.5 + 2 × 4, also 19. These equal values belong to different scenarios. Record both a row and a column label when you refer to a single total.
The result describes the quantities and prices you entered. If there is a delivery charge per order, add it separately to the applicable supplier’s total. The multiplication pairs quantities and unit prices. A flat charge for the entire order has a different relationship to the quantities. If a final quote includes an order-level discount, compare it with the calculated line total first and then apply the discount using the quote’s rules.
See what happens when you reverse the matrices
In the supply example, reversing the two matrices is still possible because B has two columns and A has two rows. The reversed product has three rows and three columns. That shape provides a quick check that it cannot be the table of two orders and two suppliers you intended. Computing the upper-left entry illustrates the change. The first row of B is 4 and 5, and the first column of A is 3 and 1. Their dot product is 17. The corresponding cell in the original product was 19.
A useful way to plan multiplication is to name the shared dimension. For A × B, the three items connect each order to each supplier. You can read across an order’s quantities and down a supplier’s prices in matching item order. If you write the suppliers as rows instead of columns, the price matrix is two by three. The multiplication as originally set up then fails because the number of columns in A is three while the number of rows in the price matrix is two. Rewrite the price list with items as rows before trying again.
Check the sequence within the shared dimension too. The shape check cannot detect that a supplier table lists markers before notebooks. The multiplication will still run and pair the first quantity with the first price. Verify at least one cell using the original item labels and adjust the order of the rows or columns if the hand calculation differs.
Verify an update without redoing every cell
Suppose you update the first order by adding two markers. Recalculate using the revised order row, 3, 4, 1. The first supplier’s total should increase by two times its marker price, from 19 to 23. The second supplier’s total should increase by three, from 22 to 25. The row for the second order should stay the same. This gives you a quick way to check precisely where an edit should appear.
Likewise, if the second supplier changes only the folder price, every order that includes folders can change in the second result column. The first supplier’s column should be unaffected. When a revised total changes in an unexpected place, inspect the original matrix entry and its labels. Keep a copy of both input matrices with the result so you can explain the change from the inputs.