Bookmarks    
nPr and nCr    
Random Number    
SD Calculator    
Sample Size    
Percent Error    
Density    
Molarity    
Molar Mass    
Ohm's Law    
Watts to Amps    
Voltage Drop    
Long Division    
Mixed Numbers    
Rounding    
Nth Root    
Exponents    
Half-Life    
Polar Form    
De Moivre    
3D Distance    
Point to Line    
Cross Product    
Determinant    
Sin Cos Tan    
Triangle Area    
Scale Factor    
Sector Area    
Ellipse Area    
Cube Volume    
Box Volume    
Sphere Volume    
Cone Volume    
Pipe Volume    
Time Duration    
Time Card    
Present Value    
Future Value    
Churn Rate    
A/B Test Calc    
SEO Traffic    
Ideal Weight    
Fat Intake    
Child Height    
Golf Handicap    
Heat Index    
Wind Chill    
Dew Point    
Download Time    
kWh to Cost    
AC Size (BTU)    
Heating Costs    
LED Savings    
Trip Gas Cost    
Tire Size    
Solar Output    
Solar Payback    
Battery Size    
Wall Area    
Gravel Needed    
Mortar Mix    
Slope Grade    
Curtain Size    
Soil Needed    
Sod Needed    
Ramp Length    
Blind Size    
Drain Slope    
Board Feet    
Heat Loss    
Furniture Fit    
Moving Boxes    
Plywood Cuts    
Shelf Sag    
   Add
Probability and random number calculators
Independent Events
Independent Events
Two Events Solver
Two Events Solver
Repeated Trials
Repeated Trials
Bayes' Theorem
Bayes' Theorem
Expected Value
Expected Value
Binomial Distribution
Binomial Distribution
nPr and nCr
nPr and nCr
Circular Permutation
Circular Permutation
With Repetition
With Repetition
Random Number
Random Number
Averages and statistics calculators
Average Calculator
Average Calculator
Mean Median Mode
Mean Median Mode
SD Calculator
SD Calculator
Quartiles & IQR
Quartiles & IQR
Frequency Table
Frequency Table
Correlation (r)
Correlation (r)
Normal Probability
Normal Probability
Z-Score Calculator
Z-Score Calculator
Confidence Interval
Confidence Interval
Sample Size
Sample Size
Mark & Recapture
Mark & Recapture
P-Value Calculator
P-Value Calculator
Percentage and ratio calculators
Percentage Calc
Percentage Calc
Percent Change
Percent Change
Percent Difference
Percent Difference
Percent Error
Percent Error
Ratio Calculator
Ratio Calculator
Discount Calculator
Discount Calculator
Sales Tax Calculator
Sales Tax Calculator
Margin Calculator
Margin Calculator
Speed calculators
Speed Calculator
Speed Calculator
Density and concentration calculators
Density
Density
Molarity
Molarity
Molar Mass
Molar Mass
Physics and electricity calculators
Ohm's Law
Ohm's Law
Watts to Amps
Watts to Amps
Resistor Colors
Resistor Colors
Voltage Drop
Voltage Drop
Unit conversion calculators
Weight Converter
Weight Converter
Shoe Size Converter
Shoe Size Converter
Integer and signed number calculators
Long Division
Long Division
LCM Calculator
LCM Calculator
GCF Calculator
GCF Calculator
Integer Calculator
Integer Calculator
Prime Factorization
Prime Factorization
Diophantine Solver
Diophantine Solver
Modulo Calculator
Modulo Calculator
Factor Calculator
Factor Calculator
Roman Numerals
Roman Numerals
Fraction, decimal and rounding calculators
Fraction Calculator
Fraction Calculator
Mixed Numbers
Mixed Numbers
Simplify Fractions
Simplify Fractions
Fraction to Decimal
Fraction to Decimal
Decimal to Fraction
Decimal to Fraction
Rounding
Rounding
Equation and inequality calculators
Linear Equation
Linear Equation
Linear Systems
Linear Systems
Quadratic Formula
Quadratic Formula
Absolute Value
Absolute Value
Quadratic Inequality
Quadratic Inequality
Polynomial calculators
Binomial Theorem
Binomial Theorem
Square root and nth root calculators
Simplify Radicals
Simplify Radicals
Nth Root
Nth Root
Exponent and logarithm calculators
Exponents
Exponents
Log Calculator
Log Calculator
Number of Digits
Number of Digits
Scientific Notation
Scientific Notation
Sci. Notation Math
Sci. Notation Math
Half-Life
Half-Life
Complex number calculators
Complex Numbers
Complex Numbers
Polar Form
Polar Form
De Moivre
De Moivre
Function and graph calculators
Slope Calculator
Slope Calculator
Linear Function
Linear Function
Direct & Inverse Variation
Direct & Inverse Variation
y = ax² Calculator
y = ax² Calculator
Distance Formula
Distance Formula
3D Distance
3D Distance
Section Formula
Section Formula
Point to Line
Point to Line
Lat/Long Distance
Lat/Long Distance
Complete the Square
Complete the Square
Circle Equation
Circle Equation
Conic Sections
Conic Sections
Polar Coordinates
Polar Coordinates
Sequence calculators
Arithmetic Sequence
Arithmetic Sequence
Geometric Sequence
Geometric Sequence
Fibonacci Sequence
Fibonacci Sequence
Recurrence Relation
Recurrence Relation
Vector calculators
Vector Calculator
Vector Calculator
Cross Product
Cross Product
Matrix calculators
Matrix Calculator
Matrix Calculator
Determinant
Determinant
Inverse Matrix
Inverse Matrix
Plane geometry calculators
Sin Cos Tan
Sin Cos Tan
Degrees ⇔ Radians
Degrees ⇔ Radians
a sin θ + b cos θ
a sin θ + b cos θ
Triangle Solver
Triangle Solver
Triangle Area
Triangle Area
Right Triangle
Right Triangle
Pythagorean Theorem
Pythagorean Theorem
Polygon Angles
Polygon Angles
Scale Factor
Scale Factor
Parallel Lines
Parallel Lines
Rectangle Area
Rectangle Area
Parallelogram Area
Parallelogram Area
Trapezoid Area
Trapezoid Area
Circle Calculator
Circle Calculator
Sector Area
Sector Area
Inscribed Angle
Inscribed Angle
Ellipse Area
Ellipse Area
Solid geometry calculators
Cube Volume
Cube Volume
Cube Surface Area
Cube Surface Area
Box Volume
Box Volume
Box Surface Area
Box Surface Area
Cylinder Volume
Cylinder Volume
Cylinder Surface
Cylinder Surface
Sphere Volume
Sphere Volume
Sphere Surface
Sphere Surface
Spherical Cap Volume
Spherical Cap Volume
Cap Surface Area
Cap Surface Area
Ellipsoid Volume
Ellipsoid Volume
Ellipsoid Surface
Ellipsoid Surface
Pyramid Volume
Pyramid Volume
Pyramid Surface
Pyramid Surface
Cone Volume
Cone Volume
Cone Surface Area
Cone Surface Area
Frustum Volume
Frustum Volume
Frustum Surface Area
Frustum Surface Area
Pipe Volume
Pipe Volume
Capsule Volume
Capsule Volume
Capsule Surface Area
Capsule Surface Area
Date and time calculators
Age Calculator
Age Calculator
Days Between Dates
Days Between Dates
Date Calculator
Date Calculator
Hours From Now
Hours From Now
Day of the Week
Day of the Week
Time Calculator
Time Calculator
Time Zone Converter
Time Zone Converter
Hours Calculator
Hours Calculator
Time Duration
Time Duration
Time Card
Time Card
Finance and economics calculators
Compound Interest
Compound Interest
Simple Interest
Simple Interest
Interest Calculator
Interest Calculator
TVM Calculator
TVM Calculator
Present Value
Present Value
Future Value
Future Value
ROI Calculator
ROI Calculator
IRR Calculator
IRR Calculator
Payback Period
Payback Period
Average Return
Average Return
GDP Calculator
GDP Calculator
Web marketing and ad metric calculators
CTR Calculator
CTR Calculator
Conversion Rate
Conversion Rate
CPC, CPM & CPA
CPC, CPM & CPA
ROAS Calculator
ROAS Calculator
Break-Even CPA
Break-Even CPA
LTV Calculator
LTV Calculator
CAC Calculator
CAC Calculator
Churn Rate
Churn Rate
A/B Test Calc
A/B Test Calc
A/B Sample Size
A/B Sample Size
SEO Traffic
SEO Traffic
Break-Even Point
Break-Even Point
Markup vs. Margin
Markup vs. Margin
CAGR Calculator
CAGR Calculator
Health and fitness calculators
BMI Calculator
BMI Calculator
Sleep Calculator
Sleep Calculator
Calorie Calculator
Calorie Calculator
BMR Calculator
BMR Calculator
TDEE Calculator
TDEE Calculator
Ideal Weight
Ideal Weight
Body Fat Calculator
Body Fat Calculator
Lean Body Mass
Lean Body Mass
Calories Burned
Calories Burned
Protein Intake
Protein Intake
Macro Calculator
Macro Calculator
Carb Calculator
Carb Calculator
Fat Intake
Fat Intake
Child Height
Child Height
Sports calculators
Golf Handicap
Golf Handicap
Pace Calculator
Pace Calculator
1RM Calculator
1RM Calculator
Target Heart Rate
Target Heart Rate
Weather calculators
Heat Index
Heat Index
Wind Chill
Wind Chill
Dew Point
Dew Point
Computer calculators
Base Converter
Base Converter
Subnet Calculator
Subnet Calculator
Download Time
Download Time
Household energy and budget calculators
Electricity Cost
Electricity Cost
kWh to Cost
kWh to Cost
Yearly kWh to Cost
Yearly kWh to Cost
AC Size (BTU)
AC Size (BTU)
AC Running Cost
AC Running Cost
Heating Costs
Heating Costs
Gas vs Electric
Gas vs Electric
LED Savings
LED Savings
Salary Calculator
Salary Calculator
Budget Calculator
Budget Calculator
Car calculators
Trip Gas Cost
Trip Gas Cost
EV Charging Cost
EV Charging Cost
EV vs Gas Cost
EV vs Gas Cost
MPG Calculator
MPG Calculator
Tire Size
Tire Size
Solar power and battery calculators
Solar Output
Solar Output
Solar Panel Count
Solar Panel Count
Solar Payback
Solar Payback
Battery Size
Battery Size
Home and DIY calculators
Tile Calculator
Tile Calculator
Stair Calculator
Stair Calculator
Concrete Volume
Concrete Volume
Wall Area
Wall Area
Wallpaper Rolls
Wallpaper Rolls
Paint Calculator
Paint Calculator
Flooring Needed
Flooring Needed
Exterior Walls
Exterior Walls
Gravel Needed
Gravel Needed
Mortar Mix
Mortar Mix
Slope Grade
Slope Grade
Lumber Cut List
Lumber Cut List
Lot Coverage/FAR
Lot Coverage/FAR
Sheet Vinyl Roll
Sheet Vinyl Roll
Insulation Needed
Insulation Needed
Curtain Size
Curtain Size
TV Size & Distance
TV Size & Distance
Soil Needed
Soil Needed
Sod Needed
Sod Needed
Block Calculator
Block Calculator
Brick Calculator
Brick Calculator
Deck Materials
Deck Materials
Ramp Length
Ramp Length
Pilot Hole Size
Pilot Hole Size
Room Ventilation
Room Ventilation
Paint Thinning
Paint Thinning
Baseboard & Trim
Baseboard & Trim
Blind Size
Blind Size
Picture Hanging
Picture Hanging
Drain Slope
Drain Slope
Screw Calculator
Screw Calculator
Board Feet
Board Feet
Fence Calculator
Fence Calculator
Wood Shrinkage
Wood Shrinkage
Caulk Calculator
Caulk Calculator
Heat Loss
Heat Loss
Furniture Fit
Furniture Fit
Moving Boxes
Moving Boxes
Storage Capacity
Storage Capacity
Plywood Cuts
Plywood Cuts
Shelf Sag
Shelf Sag

Matrix Calculator (Add, Subtract, Multiply, Transpose, Power)

Choose the operation and the matrix sizes (rows and columns), then enter the entries in the grids. The transpose Aᵀ and the power Aⁿ use matrix A only.

Enter the entries as numbers (decimals and negatives are fine). Addition and subtraction need A and B to be the same size; the product AB needs "columns of A = rows of B".
Result
Choose the operation and the matrix sizes on the left, enter the entries and press "Calculate". The resulting matrix and the steps will appear here.

What you can do on this page

  • Add \(A+B\), subtract \(A-B\) and multiply \(AB\) matrices from 2×2 to 4×4 on the spot (rectangular sizes such as 2×3 work too)
  • You can also find the transpose \(A^{T}\), which swaps rows and columns, and powers \(A^{n}\) of a square matrix (\(n\) from 1 to 10)
  • See how each calculation works, such as the "row × column" dot product in multiplication, in steps with your actual numbers
  • A plain-language explanation of the formulas and copy-and-paste formulas for Excel, Google Sheets (MMULT, TRANSPOSE) and Python are all on this page
In the US, matrices usually first appear in Algebra 2 or Precalculus and are studied in depth in a college linear algebra course. Determinants and inverse matrices are not covered on this page.

What is this calculation used for?

Moving characters in games and 3D graphics

In 3D graphics, transformations such as rotating or scaling a character are calculated by "multiplying the coordinates by a matrix". Several transformations can be combined into one matrix by multiplying the matrices together first.
The GPU (graphics processor) in a game console or computer is a special-purpose calculator built to do huge numbers of these matrix multiplications.

Editing photos and images (an image is a matrix of numbers)

A digital image is itself a matrix: the brightness of each pixel arranged in rows and columns. Filters in photo apps, such as blur and sharpen, are calculated as operations on this matrix.
Seeing "an image as a matrix" is also the starting point of AI techniques such as image recognition.

Solving systems of equations at once (structures and circuits)

A system of equations with many unknowns can be written as a single equation, \(A\boldsymbol{x} = \boldsymbol{b}\), by putting the coefficients in a matrix.
In the strength analysis of buildings and the analysis of electric circuits, thousands or tens of thousands of equations are put into this form and solved at once by computer matrix calculations.

Counting routes in a transit map or links in a social network (adjacency matrix and powers)

Write the links between stations, or between people, as a matrix with "1 if connected, 0 if not" (an adjacency matrix). Then the entry in row \(i\), column \(j\) of the power \(A^{n}\) is "the number of ways to get from \(i\) to \(j\) by following exactly \(n\) links".
This idea is one of the foundations of route planners and of "friends of friends" analysis in social networks.

Estimating ripple effects in the economy (input-output tables)

National and regional economic statistics use a large matrix, called an input-output table, to show how much each industry buys from the others. The ripple effect, "if demand in one industry grows, how much does production grow in the others", is estimated with matrix calculations on this table (a method developed by Wassily Leontief, who won the Nobel Prize in Economics for it).

Inside AI (machine learning) is matrix multiplication

Most of the calculation in AI that handles text and images (neural networks) is repeating "multiply a list of input numbers by a learned matrix".
Because so much of the computing for training and running AI is matrix multiplication, GPUs, which are good at matrix calculations, have become essential for AI development.

Formula

Addition and subtraction (entry by entry in the same position)
Standard notation (the usual math form)
\((A+B)_{ij}\) \(=\) \(a_{ij}\) \(+\) \(b_{ij}\)
In words (symbols replaced with words)
③ entry in row \(i\), column \(j\) of the sum \(A+B\) \(=\) ① \(a_{ij}\): entry in row \(i\), column \(j\) of A \(+\) ② \(b_{ij}\): entry in row \(i\), column \(j\) of B
The formula in words
① Add the \(a_{ij}\): entry in row \(i\), column \(j\) of A and the
② \(b_{ij}\): entry in row \(i\), column \(j\) of B , and you get the
③ entry in row \(i\), column \(j\) of the sum \(A+B\) (for subtraction, just change "+" to "−")
Quick example
To add two 2×2 matrices, add the entries in the same position
\(\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} + \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix} = \begin{pmatrix} 1+5 & 2+6 \\ 3+7 & 4+8 \end{pmatrix} = \begin{pmatrix} 6 & 8 \\ 10 & 12 \end{pmatrix}\)
Key idea
You can add or subtract only when A and B have the same size (the same numbers of rows and columns). Addition gives the same answer in either order (\(A+B=B+A\)), but for subtraction, just as with ordinary numbers, the order changes the answer.
Multiplication (dot product of a row of A and a column of B)
Standard notation (the usual math form)
\(c_{ij}\) \(=\) \(a_{i1}\) \(\times\) \(b_{1j}\) \(+ \cdots +\) \(a_{in}\) \(\times\) \(b_{nj}\)
In words (symbols replaced with words)
③ \(c_{ij}\): entry in row \(i\), column \(j\) of the product \(AB\) \(=\) ① \(a_{i1}\): 1st entry in row \(i\) of A \(\times\) ② \(b_{1j}\): 1st entry in column \(j\) of B \(+ \cdots +\) \(a_{in}\): \(n\)th entry in row \(i\) of A \(\times\) \(b_{nj}\): \(n\)th entry in column \(j\) of B
The formula in words
① Pair up the \(a_{i1}, \dots, a_{in}\): entries in row \(i\) of A with the
② \(b_{1j}, \dots, b_{nj}\): entries in column \(j\) of B in order from the start, multiply each pair and add them all, and you get the
③ \(c_{ij}\): entry in row \(i\), column \(j\) of the product \(AB\)
Quick example
The (1, 1) entry of AB is the dot product of "row 1 of A" and "column 1 of B". For example,
\(c_{11} = 1 \times 2 + 2 \times 1 = 4\)
\(\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} \begin{pmatrix} 2 & 0 \\ 1 & 2 \end{pmatrix} = \begin{pmatrix} 1 \times 2 + 2 \times 1 & 1 \times 0 + 2 \times 2 \\ 3 \times 2 + 4 \times 1 & 3 \times 0 + 4 \times 2 \end{pmatrix} = \begin{pmatrix} 4 & 4 \\ 10 & 8 \end{pmatrix}\)
Key idea
The product \(AB\) can be calculated (is defined) only when "columns of A = rows of B". The product of an \(m \times n\) matrix and an \(n \times p\) matrix is an \(m \times p\) matrix. Also, unlike ordinary numbers, you cannot swap the order (\(AB\) and \(BA\) are generally not equal, and sometimes only one of them is defined).
Transpose (swap rows and columns)
Standard notation (the usual math form)
In words (symbols replaced with words)
\((A^{T})_{ij}\) \(=\) \(a_{ji}\)
② entry in row \(i\), column \(j\) of the transpose \(A^{T}\) \(=\) ① \(a_{ji}\): entry in row \(j\), column \(i\) of A
The formula in words
① The \(a_{ji}\): entry in row \(j\), column \(i\) of A becomes, with rows and columns swapped, the
② entry in row \(i\), column \(j\) of the transpose \(A^{T}\)
Quick example
Transposing a 2×3 matrix moves row 1 to column 1 and row 2 to column 2, giving a 3×2 matrix
\(A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix} \quad \Longrightarrow \quad A^{T} = \begin{pmatrix} 1 & 4 \\ 2 & 5 \\ 3 & 6 \end{pmatrix}\)
Key idea
Besides \(A^{T}\), the transpose is also written \(A^{\top}\) or \(A'\) in some books and software. Transposing twice brings you back to the original (\((A^{T})^{T} = A\)).
Powers (multiplying the same square matrix again and again)
Standard notation (the usual math form)
In words (symbols replaced with words)
\(A^{n}\) \(=\) \(\underbrace{A\,A\,\cdots\,A}_{n}\)
② \(A^{n}\): matrix \(A\) to the \(n\)th power \(=\) ① \(n\) copies of the square matrix \(A\) multiplied together
The formula in words
① \(n\) copies of the square matrix \(A\) multiplied together give
② \(A^{n}\): matrix \(A\) to the \(n\)th power (calculate in order from the left: \(A^{2}=AA\), \(A^{3}=A^{2}A\), and so on)
Quick example
The cube of \(A = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}\) takes two multiplications:
\(A^{2} = AA = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix} \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix} = \begin{pmatrix} 1 & 2 \\ 0 & 1 \end{pmatrix}\)
\(A^{3} = A^{2}A = \begin{pmatrix} 1 & 2 \\ 0 & 1 \end{pmatrix} \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix} = \begin{pmatrix} 1 & 3 \\ 0 & 1 \end{pmatrix}\)
Key idea
Powers exist only for square matrices (rows = columns). If the matrix is not square, the condition for the product \(AA\), "columns of A = rows of A", cannot be met. Also note that you do not raise each entry to the \(n\)th power; you repeat matrix multiplication \(n-1\) times.
Matrix addition and subtraction work "entry by entry in the same position", and multiplication is built from "the dot product of a row of A and a column of B". Multiplication is defined only when "columns of A = rows of B", and the big difference from ordinary numbers is that swapping the order usually changes the result.

Symbols and terms

Symbols

\(A,\ B\) A, B Names given to matrices. By custom, matrices are named with capital letters.
\(a_{ij}\) a sub i j The entry of matrix \(A\) in row \(i\), column \(j\) (the number in the \(i\)th row from the top and the \(j\)th column from the left). The small letters at the lower right (the subscripts) give its position.
\(b_{ij}\) b sub i j The entry of matrix \(B\) in row \(i\), column \(j\). It is read the same way as \(a_{ij}\); only the name of the matrix differs.
\(m \times n\) m by n The size (dimensions) of a matrix: \(m\) rows (horizontal lines) and \(n\) columns (vertical lines). (Example: a 2×3 matrix has 2 numbers down and 3 across, 6 numbers in all.)
\(c_{ij}\) c sub i j When the product \(AB\) is called \(C\), the entry of \(C\) in row \(i\), column \(j\).
\(A^{T}\) A transpose The transpose of \(A\): the matrix with rows and columns swapped. It is also written \(A^{\top}\) or \(A'\).
\(A^{n}\) A to the n The matrix made by multiplying \(n\) copies of \(A\). It is defined only for square matrices.
\(\sum\) sigma The sign for "add them all up". \(\sum_{k=1}^{n} a_{ik} b_{kj}\) tells you to add up \(a_{ik} b_{kj}\) for every \(k\) from 1 to \(n\).

Terms

matrix Numbers arranged in a rectangle (rows and columns). Each number in it is called an entry. As in a spreadsheet, a position is given by "which row and which column".
row A horizontal line of numbers in a matrix. Rows are counted from the top - row 1, row 2, and so on. Think of rows of seats in a theater.
column A vertical line of numbers in a matrix. Columns are counted from the left - column 1, column 2, and so on. Think of the columns (pillars) of a building, which stand up and down.
entry Each number in a matrix. It is also called an element. The entry in row \(i\), column \(j\) is written with subscripts, like \(a_{ij}\).
square matrix A matrix with the same number of rows and columns (shaped like a square). Powers, as well as determinants and inverses (not covered on this page), exist only for square matrices.
transpose The matrix with rows and columns swapped. The transpose of an \(m \times n\) matrix is an \(n \times m\) matrix.
dot product The value you get by pairing up two lists of numbers from the start, multiplying each pair and adding them all. In matrix multiplication, the dot product of a row of A and a column of B gives one entry of the product.
linear algebra The branch of mathematics that deals with matrices and vectors. It is often a required first- or second-year college course and is the foundation of computer graphics, statistics, AI and more.

Good to know before you start

Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.

Operations with negative numbers (Grade 7)
  • Being able to add, subtract and multiply accurately with negative numbers
Variables and subscripts (Grade 6 to high school)
  • Being able to read the small characters at the lower right, as in \(a_{12}\) (subscripts), as labels for a position, not as values
Exponents (Grade 6)
  • Knowing that the small number at the upper right of \(A^{3}\) (the exponent) tells you to multiply 3 of them together
Rows and columns of a table (elementary school)
  • Knowing that in a table rows run across and columns run up and down, and being able to name a position such as "row 2, column 3"

How to calculate it in Excel

Copy the whole table below and paste it into cell A1 in Excel. It works as is.
Table to find the sum A + B
Row 1 of matrix A 1 2
Row 2 of matrix A 3 4
Row 1 of matrix B 5 6
Row 2 of matrix B 7 8
Row 1 of A + B =B1+B3 =C1+C3
Row 2 of A + B =B2+B4 =C2+C4
Table to find the difference A − B
Row 1 of matrix A 9 8
Row 2 of matrix A 7 6
Row 1 of matrix B 1 2
Row 2 of matrix B 3 4
Row 1 of A − B =B1-B3 =C1-C3
Row 2 of A − B =B2-B4 =C2-C4
Table to find the product AB
Row 1 of matrix A 1 2
Row 2 of matrix A 3 4
Row 1 of matrix B 2 0
Row 2 of matrix B 1 2
AB (spills from row 1 automatically) =MMULT(B1:C2,B3:C4)
Table to find the transpose Aᵀ
Row 1 of matrix A 1 2 3
Row 2 of matrix A 4 5 6
Aᵀ (spills from row 1 automatically) =TRANSPOSE(B1:D2)
Table to find the power A³
Row 1 of matrix A 1 1
Row 2 of matrix A 0 1
A³ (spills from row 1 automatically) =MMULT(MMULT(B1:C2,B1:C2),B1:C2)
For addition and subtraction, just combine the cells in the same position, as in "=B1+B3" (in the first table, A + B comes out as 6, 8, 10, 12).
Use the MMULT function for multiplication and the TRANSPOSE function for the transpose. In recent Excel (such as Microsoft 365), the result spreads into the neighboring cells automatically (spill). In the third table AB is 4, 4, 10, 8, and in the fifth table A³ is 1, 3, 0, 1.
In older Excel, first select a range the same size as the result, type the formula, and confirm it with Ctrl+Shift+Enter.

How to calculate it in Google Sheets

Copy the whole table below and paste it into cell A1 in Google Sheets. It works as is.
Table to find the sum A + B
Row 1 of matrix A 1 2
Row 2 of matrix A 3 4
Row 1 of matrix B 5 6
Row 2 of matrix B 7 8
Row 1 of A + B =B1+B3 =C1+C3
Row 2 of A + B =B2+B4 =C2+C4
Table to find the product AB
Row 1 of matrix A 1 2
Row 2 of matrix A 3 4
Row 1 of matrix B 2 0
Row 2 of matrix B 1 2
AB (spills from row 1 automatically) =MMULT(B1:C2,B3:C4)
Table to find the transpose Aᵀ
Row 1 of matrix A 1 2 3
Row 2 of matrix A 4 5 6
Aᵀ (spills from row 1 automatically) =TRANSPOSE(B1:D2)
Table to find the power A³
Row 1 of matrix A 1 1
Row 2 of matrix A 0 1
A³ (spills from row 1 automatically) =MMULT(MMULT(B1:C2,B1:C2),B1:C2)
The same MMULT and TRANSPOSE functions as in Excel work as is. Copy the whole table and paste it into cell A1.
In Google Sheets, the results of MMULT and TRANSPOSE spread into the neighboring cells automatically (no Ctrl+Shift+Enter needed).

How to calculate it in Python

A = [[1, 2], [3, 4]]
B = [[2, 0], [1, 2]]

def matrix_add(x, y):        # addition (add the entries in the same position)
    return [[x[i][j] + y[i][j] for j in range(len(x[0]))] for i in range(len(x))]

def matrix_multiply(x, y):   # multiplication (dot product of a row of A and a column of B)
    return [[sum(x[i][k] * y[k][j] for k in range(len(y))) for j in range(len(y[0]))] for i in range(len(x))]

def matrix_transpose(x):     # transpose (swap rows and columns)
    return [[x[i][j] for i in range(len(x))] for j in range(len(x[0]))]

def matrix_power(x, n):      # power (multiply n times in order from the left)
    result = x
    for _ in range(n - 1):
        result = matrix_multiply(result, x)
    return result

print("A + B =", matrix_add(A, B))
print("AB =", matrix_multiply(A, B))
print("Transpose of A =", matrix_transpose(A))
print("A cubed =", matrix_power(A, 3))
Runs with the standard library only. Replace A and B at the top with your own matrices and run it (for subtraction, just change the "+" in matrix_add to "-"). For serious numerical work, the standard choice is NumPy, a library made for matrices (multiplication can be written "A @ B").

How to write it in LaTeX and other math languages (copy and paste)

Addition and subtraction (entry by entry in the same position)
(A + B)ᵢⱼ = aᵢⱼ + bᵢⱼ
(A + B)_{ij} = a_{ij} + b_{ij}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <msub>
      <mrow><mo>(</mo><mi>A</mi><mo>+</mo><mi>B</mi><mo>)</mo></mrow>
      <mrow><mi>i</mi><mi>j</mi></mrow>
    </msub>
    <mo>=</mo>
    <msub><mi>a</mi><mrow><mi>i</mi><mi>j</mi></mrow></msub>
    <mo>+</mo>
    <msub><mi>b</mi><mrow><mi>i</mi><mi>j</mi></mrow></msub>
  </mrow>
</math>
(A + B)_(ij) = a_(ij) + b_(ij)
A + B
C := A + B;
C = A + B;
(A + B)_ij = a_ij + b_ij
Multiplication (dot product of a row of A and a column of B)
cᵢⱼ = aᵢ₁b₁ⱼ + aᵢ₂b₂ⱼ + ⋯ + aᵢₙbₙⱼ
c_{ij} = \sum_{k=1}^{n} a_{ik} b_{kj}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <msub><mi>c</mi><mrow><mi>i</mi><mi>j</mi></mrow></msub>
    <mo>=</mo>
    <munderover>
      <mo>&#x2211;</mo>
      <mrow><mi>k</mi><mo>=</mo><mn>1</mn></mrow>
      <mi>n</mi>
    </munderover>
    <msub><mi>a</mi><mrow><mi>i</mi><mi>k</mi></mrow></msub>
    <msub><mi>b</mi><mrow><mi>k</mi><mi>j</mi></mrow></msub>
  </mrow>
</math>
c_(ij) = sum_(k=1)^(n) a_(ik) b_(kj)
A . B
C := A . B;
C = A * B;
c_ij = ∑_(k=1)^n a_ik b_kj
Transpose (swap rows and columns)
(Aᵀ)ᵢⱼ = aⱼᵢ
(A^{T})_{ij} = a_{ji}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <msub>
      <mrow><mo>(</mo><msup><mi>A</mi><mi>T</mi></msup><mo>)</mo></mrow>
      <mrow><mi>i</mi><mi>j</mi></mrow>
    </msub>
    <mo>=</mo>
    <msub><mi>a</mi><mrow><mi>j</mi><mi>i</mi></mrow></msub>
  </mrow>
</math>
(A^T)_(ij) = a_(ji)
Transpose[A]
C := LinearAlgebra:-Transpose(A);
C = A.';
(A^T)_ij = a_ji
Powers (multiplying the same square matrix again and again)
Aⁿ = AA⋯A
A^{n} = \underbrace{AA\cdots A}_{n}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <msup><mi>A</mi><mi>n</mi></msup>
    <mo>=</mo>
    <mi>A</mi><mi>A</mi><mo>&#x22EF;</mo><mi>A</mi>
  </mrow>
</math>
A^n
MatrixPower[A, n]
C := A^n;
C = A^n;
A^n

How to have ChatGPT  do the calculation

You are a calculation assistant for matrices. Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing).

For the matrices A = [[1, 2], [3, 4]] and B = [[2, 0], [1, 2]], find each of the following matrices.
1. The sum A + B
2. The difference A − B
3. The product AB
4. The transpose of A
5. A cubed (A to the 3rd power)

For each one, show the formula you used (which entries you combined and how) and the resulting matrix from the execution.

How to Use
  1. 1
    Enter your numbers
    Type the numbers you want to calculate with into the input fields
  2. 2
    Calculate
    Press the "Calculate" button
  3. 3
    Check the result
    The result appears on the spot. The same page also explains the idea behind the calculation and the formula
  DataChef Features
Easy and Free
Unlimited conversions for free.
No technical knowledge required.
Intuitive and user-friendly operation.
No Registration Required
Available immediately after access.
Can be used without registering personal information.
Safe and Secure
Fully SSL encrypted communication.
Automatic file deletion by clicking "download".
Fast
High-speed site access
and rapid file conversion.
No Watermark
No watermark.
No attribution required.
Commercial Use Available
Free for commercial use.
No need to contact us for commercial use permission.