What This Calculator Does
This tool performs element-wise addition and subtraction of two matrices, A and B. You can compute the sum A+B, the difference A-B, or the reverse difference B-A. It supports any rectangular matrix from 1x1 up to 6x6, as long as both matrices share the same number of rows (\(m\)) and columns (\(n\)).
How to Use It
First set the number of rows and columns. Fill in the entries of Matrix A and Matrix B in the corresponding cells (cells beyond your chosen size are ignored). Pick an operation - A+B, A-B, or B-A - and choose how many significant digits to display the answer to. The calculator returns the result matrix C along with its dimensions.
The Formula Explained
Matrix addition and subtraction are defined entry by entry. For matrices of the same size, the result entry in row \(i\), column \(j\) is computed as $$C(i,j) = a(i,j) + sw \cdot b(i,j),$$ where the sign factor \(sw\) equals +1 for addition and -1 for subtraction. The reverse case B-A is computed directly as $$C(i,j) = b(i,j) - a(i,j).$$ Because every cell is treated independently, no division ever occurs, so there is no risk of a divide-by-zero error.
Worked Example
Let A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]], both 2x2. Then $$A+B = [[6, 8], [10, 12]],$$ $$A-B = [[-4, -4], [-4, -4]],$$ and $$B-A = [[4, 4], [4, 4]].$$ In every case the result keeps the same 2x2 dimensions.
FAQ
Can I add matrices of different sizes? No. Addition and subtraction are only defined when A and B have identical row and column counts. Mismatched sizes have no defined sum.
Is the result the same as B+A? Addition is commutative, so \(A+B = B+A\). Subtraction is not, which is why A-B and B-A are offered separately.
What happens to blank cells? Empty entries are treated as 0, so leave unused cells empty or enter explicit values to avoid surprises.