ProMathTools
ProMathTools

Matrix Add/Subtract

Use this calculator to perform addition or subtraction on two matrices. Enter your matrices, select the operation, and get the result instantly.

Enter elements separated by commas or spaces. Use a new line for each row. E.g., 1 2 3 4

Enter elements separated by commas or spaces. Use a new line for each row. E.g., 5 6 7 8

Choose to add or subtract Matrix B from Matrix A.

How it works

Use this calculator to perform addition or subtraction on two matrices. Enter your matrices, select the operation, and get the result instantly.


The Formula

For two matrices A and B of the same dimensions (m x n):

Matrix Addition: C = A + B, where C_ij = A_ij + B_ij

Matrix Subtraction: D = A - B, where D_ij = A_ij - B_ij

Worked Example

  1. Example: Adding Two 2x2 Matrices

    Let Matrix A = [[1, 2], [3, 4]] and Matrix B = [[5, 6], [7, 8]]. To add them, we add corresponding elements: C_11 = A_11 + B_11 = 1 + 5 = 6 C_12 = A_12 + B_12 = 2 + 6 = 8 C_21 = A_21 + B_21 = 3 + 7 = 10 C_22 = A_22 + B_22 = 4 + 8 = 12 Result Matrix C = [[6, 8], [10, 12]]


Tips, Assumptions & Limitations

  • Matrices must have the exact same number of rows and columns to be added or subtracted.
  • Enter matrix elements separated by commas or spaces. Use a new line for each new row.
  • Ensure all elements are valid numbers. Non-numeric inputs will cause an error.
FAQ

Matrices are rectangular arrays of numbers, symbols, or expressions arranged in rows and columns. They are fundamental in linear algebra and used in various fields like physics, engineering, computer graphics, and economics.

You can only add or subtract two matrices if they have the exact same dimensions (i.e., the same number of rows and the same number of columns). If their dimensions differ, the operation is undefined.

To add or subtract matrices, you simply add or subtract the corresponding elements in each position. For example, to find the element in the first row, first column of the result matrix, you add/subtract the elements in the first row, first column of the original matrices.

Yes, the calculator can handle matrices of various sizes, limited by practical input constraints. Ensure your input format is correct for larger matrices (each row on a new line, elements separated by commas or spaces).

Companion article

Matrix Addition and Subtraction: A Step-by-Step Guide

Related Calculators

Browse Category

All Math Calculators

Related Guides


How this calculator works

Matrices are fundamental mathematical objects used to represent and manipulate data in various fields, from computer graphics to economics. Two of the most basic operations you can perform with matrices are addition and subtraction. This guide will walk you through the principles of these operations and show you how to use our online calculator to solve them effortlessly.

Explanation

Matrix addition and subtraction are straightforward operations, but they come with a crucial condition: the matrices involved must have the exact same dimensions. This means they must have the same number of rows and the same number of columns. If this condition is not met, the operation is undefined. When adding two matrices, say A and B, to get a result matrix C, each element C_ij is found by adding the corresponding elements A_ij and B_ij. Similarly, for subtraction, if you subtract matrix B from matrix A to get matrix D, each element D_ij is found by subtracting B_ij from A_ij. These operations are performed element by element.

Formula

Given two matrices A and B, both of dimension m x n:

Matrix Addition:
C = A + B
Where C_ij = A_ij + B_ij

Matrix Subtraction:
D = A - B
Where D_ij = A_ij - B_ij

Worked example

Let's consider an example for both addition and subtraction. **Example 1: Matrix Addition** Suppose we have: Matrix A = [[2, 3], [1, 5]] Matrix B = [[4, 0], [6, 7]] To find A + B: C_11 = 2 + 4 = 6 C_12 = 3 + 0 = 3 C_21 = 1 + 6 = 7 C_22 = 5 + 7 = 12 Result: A + B = [[6, 3], [7, 12]] **Example 2: Matrix Subtraction** Using the same matrices A and B: To find A - B: D_11 = 2 - 4 = -2 D_12 = 3 - 0 = 3 D_21 = 1 - 6 = -5 D_22 = 5 - 7 = -2 Result: A - B = [[-2, 3], [-5, -2]]

How to use this tool

Using our Matrix Addition and Subtraction Calculator is simple. First, enter the elements of your first matrix (Matrix A) into the 'Matrix A' input field. Each row should be on a new line, and elements within a row can be separated by commas or spaces. Do the same for your second matrix (Matrix B) in the 'Matrix B' field. Next, select your desired operation ('Add' or 'Subtract') from the dropdown menu. The calculator will then instantly display the resulting matrix, showing each row of the answer.

Frequently asked questions

What is the identity matrix?
The identity matrix, denoted as I, is a square matrix where all elements on the main diagonal are 1s and all other elements are 0s. When an identity matrix is multiplied by another matrix, the other matrix remains unchanged. It's like the number '1' in scalar multiplication.
Can I add more than two matrices at once?
While this specific calculator is designed for two matrices, matrix addition is associative, meaning you can add multiple matrices by performing the operation sequentially (e.g., (A + B) + C). You can use this tool multiple times for more than two matrices.
What if my matrices have different dimensions?
If your matrices have different dimensions, the calculator will return an error, as matrix addition and subtraction are only defined for matrices of identical dimensions. You cannot add or subtract matrices of different sizes.

Read the full guide →

About UsBlogChrome ExtensionFAQsTerms and ConditionsPrivacy PolicySitemap
EmailLinkedInFacebook

© 2025-2026 PromathTools. All rights reserved.

Built by KruskalCode – SaaS & Automation Experts · EverydayDevTools