Skip to content

Matrix Addition, Subtraction & Scalar Multiplication

Apply an entry-by-entry operation to matrices up to 3 × 3.

Enter the matrices

Your data stays in this browser.

Matrix A

Matrix B

2 × 2

Result

Ready for your matrix

Choose an operation, fill every visible cell, and calculate A + B, A − B, or c × A.

How to add, subtract, or scale a matrix

Enter matrices of the right size

Choose one to three rows and one to three columns. Addition and subtraction use two matrices with exactly the same shape, so changing the size changes both A and B together. Scalar multiplication uses only Matrix A plus one ordinary number called c. Each visible cell is required, including cells whose value is zero. Negative numbers and decimals are accepted with a period as the decimal separator.

The grid follows standard row-and-column notation. The first box is row 1, column 1; moving right changes the column, and moving down changes the row. Clear A and Clear B independently empty the named grid and remove result state while leaving the selected size and operation in place. Editing a cell, changing c, changing the operation, or resizing immediately removes an older result so it cannot be mistaken for the new input.

What the calculation does

For A + B, the calculator pairs entries in the same position and adds them: the value at row i and column j is aᵢⱼ + bᵢⱼ. Subtraction uses aᵢⱼ − bᵢⱼ in the same positions, so the order matters. These are entry-by-entry operations. No row is combined with a column, which is why addition and subtraction require the two grids to have identical dimensions.

For c × A, every entry of A is multiplied by the same scalar c. A negative scalar reverses every sign, zero produces a zero matrix, and one leaves A unchanged. The displayed cells use at most two decimal places and omit unnecessary trailing zeros. The calculation itself keeps JavaScript numeric precision until the result is formatted, so the displayed rounding does not feed back into another cell.

Use the result confidently

Check the result by selecting one position and repeating only that small calculation. For example, the top-right cell of A − B must equal the top-right value of A minus the top-right value of B. For scalar multiplication, verify one positive, one negative, and one zero entry when they are available. This quick position check catches swapped signs and copied-row mistakes without redoing the whole matrix.

Matrix addition is useful when two tables describe matching categories, such as combining monthly changes by region. Subtraction compares matching measurements, and scalar multiplication applies one common factor to every measurement. The tool copies the displayed matrix as bracketed rows. It does not save a file or upload inputs; paste the copied rows into notes, a worksheet, or a message if you need to keep them.

Worked examples

Add two 2 × 2 matrices

Let A = [[1, 2], [3, 4]] and B = [[5, -1], [0, 2.5]]. Pair the four positions: 1 + 5 = 6, 2 + (-1) = 1, 3 + 0 = 3, and 4 + 2.5 = 6.5. The result is [[6, 1], [3, 6.5]].

Multiply a 2 × 3 matrix by a scalar

Let c = -2 and A = [[1, -3, 0], [2.5, 4, -1]]. Multiplying every entry by -2 gives [[-2, 6, 0], [-5, -8, 2]]. Nothing is added across a row, and the 2 × 3 shape is unchanged.

Limits and troubleshooting

Supported input and precision

Matrices are limited to 1 × 1 through 3 × 3 and ordinary finite numeric entries. Enter decimals directly; fraction text such as 1/3, symbolic variables, complex numbers, and formulas are outside this page. Very large or extremely tiny nonzero magnitudes are rejected to avoid misleading overflow or underflow.

The result is a decimal display rounded to at most two places. This is convenient for quick numeric work but is not an exact rational-arithmetic engine. If an assignment requires an exact fraction, keep the fraction calculation separately rather than treating a rounded decimal as an exact value.

Common errors and fixes

A blank-cell message means at least one visible entry is empty; type 0 when the intended value is zero. A number message usually means a comma, fraction slash, letter, or extra expression was entered. A range or overflow message means the values are beyond the safe limits of this small calculator.

This page deliberately excludes matrix division, inverse matrices, row reduction, symbolic algebra, and unlimited sizes. Use the separate matrix multiplication, transpose, or determinant page when that is the operation you need.

Frequently asked questions

Can matrices with different dimensions be added?

No. Addition and subtraction pair positions, so both matrices must have the same row and column counts. This page keeps their size selectors together to make that rule visible.

Is scalar multiplication the same as matrix multiplication?

No. Scalar multiplication multiplies every cell by one number. Matrix multiplication combines each row of A with each column of B and follows a different dimension rule.

Why did my result disappear when I edited a cell?

The old result belongs to the previous input. Removing it immediately prevents you from copying or reading a stale answer after a value, size, or operation changes.

Are zero and negative values allowed?

Yes. Enter 0 explicitly for a zero cell. Negative values and decimal values are supported as long as every entry and the result stay finite and within the stated range.

Does the calculator store or transmit my matrices?

The calculation runs in this browser. This page adds no matrix-specific analytics and does not send cell contents. Copying writes only the displayed result to your clipboard when the browser permits it.