Evanalysis
3.1Estimated reading time: 21 min

3.1 Matrix addition, subtraction, and scalar multiplication

Treat the basic matrix operations as entry-by-entry rules, and learn exactly when the operations make sense.

Course contents

This note is the point where matrices stop being only containers and start behaving like algebraic objects. Addition, subtraction, and scalar multiplication are computationally simple, but their definitions establish the structure used throughout linear algebra. The important work is therefore not just obtaining an answer: it is checking that the operation is defined, tracking the matrix size, and understanding why familiar algebraic laws remain valid.

Why matching positions matter

A matrix records quantities in named row-and-column positions. For example, rows may represent products and columns may represent months. Adding two such tables is meaningful only when the positions describe the same kind of data. Algebra expresses that requirement by insisting that the matrices have exactly the same size and that their entries are scalars from a common field.

Once those conditions are fixed, the operations are entrywise:

  • addition combines entries in matching positions;
  • subtraction measures the entrywise change from one matrix to another;
  • scalar multiplication applies one common scale factor to every entry.

Concept lensStructural

One position at a time

In an entrywise operation, the output at position (i,j)(i,j) uses only the input entries at that same position. This explains both the same-size requirement and why the output retains that size: every position has a corresponding position in each input. A proof can therefore fix one arbitrary position and use ordinary scalar algebra there.

Matrix multiplication will use a different rule: an output entry combines a whole row of one matrix with a whole column of the other. Two 2×32\times3 matrices can be added, but their matrix product is undefined. The shape check must follow the particular operation; two matrices being acceptable inputs for addition says nothing by itself about their suitability for multiplication.

Define the entrywise operations

Definition

Matrix equality

Let A=[aij]A = [a_{ij}] and B=[bij]B = [b_{ij}]. The equation A=BA = B means both that AA and BB have the same size and that

aij=bija_{ij}=b_{ij}

for every permitted row index ii and column index jj. Matching a few entries is not enough; equality is an entry-by-entry statement over the whole matrix.

Fix positive integers m,nm,n and a scalar field F\mathbb F, usually R\mathbb R in this course. Write Fm×n\mathbb F^{m\times n} for the set of all m×nm\times n matrices whose entries belong to F\mathbb F. Saying that matrices and scalars use the same field prevents an undeclared mixture of number systems. If a real matrix is to be placed in a larger number system, that common field must first be chosen.

Definition

Matrix addition, subtraction, and scalar multiplication

Suppose A=[aij]A=[a_{ij}] and B=[bij]B=[b_{ij}] are both in Fm×n\mathbb F^{m\times n}, and let c∈Fc\in\mathbb F.

  • The sum A+BA+B is the m×nm\times n matrix defined by [A+B]ij=aij+bij[A+B]_{ij}=a_{ij}+b_{ij}.
  • The scalar multiple cAcA is the m×nm\times n matrix defined by [cA]ij=caij[cA]_{ij}=ca_{ij}.
  • The additive inverse is −A=(−1)A-A=(-1)A, and subtraction is A−B=A+(−B)A-B=A+(-B).

Addition and subtraction are undefined when the two matrices have different sizes. Scalar multiplication always preserves the size of its matrix.

Definition

Zero matrix

The zero matrix in Fm×n\mathbb F^{m\times n}, denoted here by OO, is the m×nm\times n matrix whose every entry is zero. Its size is part of its identity: a 2×32\times 3 zero matrix and a 3×23\times 2 zero matrix are different objects.

The notation makes the entrywise rules compact. If A=[aij]A=[a_{ij}] and B=[bij]B=[b_{ij}], then

[A+B]ij=aij+bij,[A−B]ij=aij−bij,[cA]ij=caij.[A+B]_{ij}=a_{ij}+b_{ij},\qquad [A-B]_{ij}=a_{ij}-b_{ij},\qquad [cA]_{ij}=ca_{ij}.

These three formulas also provide a reliable equality test: to prove two matrix expressions equal, verify that they have the same size and then compare their arbitrary (i,j)(i,j) entries.

Linear combinations and closure

The three operations are often used together. If A,BA,B belong to Fm×n\mathbb F^{m\times n} and r,sr,s belong to F\mathbb F, then

rA+sBrA+sB

is called a linear combination of AA and BB. Its (i,j)(i,j) entry is raij+sbijra_{ij}+sb_{ij}, and its size is still m×nm\times n. The conclusion that the result remains in Fm×n\mathbb F^{m\times n} is called closure. Closure is not merely a vocabulary item: it assures us that a calculation made from allowed objects does not suddenly leave the collection we are studying.

Several familiar expressions are special linear combinations. The difference A−BA-B uses coefficients 11 and −1-1; over R\mathbb R, an average such as (1/2)A+(1/2)B(1/2)A+(1/2)B uses coefficients that sum to one; and OO can be written as 0A0A. The coefficients may be positive, negative, or zero. “Scaling” therefore does not always mean making entries physically larger: a negative coefficient also reverses signs, and the coefficient zero collapses every entry to zero.

The same-size condition still governs the entire expression. If AA is 2×32\times 3 and BB is 3×23\times 2, then rA+sBrA+sB is undefined even though rArA and sBsB are individually defined. Scalar multiplication cannot repair a dimension mismatch. Likewise, the scalars and matrix entries must be read in the chosen common field so that every scalar product and sum has an agreed meaning.

A useful hand-calculation habit is to write the dimensions beside the symbols before doing any arithmetic. Then copy the matrix brackets with the intended output size and fill one position at a time. This separates a structural check from the numerical work: if the dimensions fail, stop before computing; if they pass, each output position has one unambiguous recipe. For a final check, compare a corner entry and any entry involving a negative number against the original expression. Those positions often expose a shifted column or a lost sign. This routine becomes especially valuable when several additions and scalar multiples appear in one expression, because correct scalar arithmetic cannot rescue entries that were paired with the wrong positions.

Algebraic laws at a fixed matrix size

Theorem

Laws of matrix addition

Let A,B,C∈Fm×nA,B,C\in\mathbb F^{m\times n}. Then

A+B=B+A,A+B=B+A,(A+B)+C=A+(B+C),(A+B)+C=A+(B+C),A+O=O+A=A,A+O=O+A=A,

and

A+(−A)=(−A)+A=O.A+(-A)=(-A)+A=O.

Therefore matrices of one fixed size over one fixed field are closed under addition and form a commutative additive system with a unique zero matrix and a unique additive inverse for each matrix.

Theorem

Laws of scalar multiplication

Let A,B∈Fm×nA,B\in\mathbb F^{m\times n} and let r,s∈Fr,s\in\mathbb F. Then

r(A+B)=rA+rB,(r+s)A=rA+sA,r(A+B)=rA+rB,\qquad (r+s)A=rA+sA,(rs)A=r(sA),1A=A.(rs)A=r(sA),\qquad 1A=A.

Consequently,

0A=O,rO=O,(−1)A=−A.0A=O,\qquad rO=O,\qquad (-1)A=-A.

The two distributive laws are different: the first distributes one scalar over a matrix sum, whereas the second distributes a sum of scalars over one matrix.

Prove the laws one entry at a time

Every law above follows from the corresponding scalar law, but a matrix proof must explicitly pass through its entries. First note that both sides of each identity are m×nm\times n matrices. Fix an arbitrary position (i,j)(i,j).

For associativity of addition,

[(A+B)+C]ij=(aij+bij)+cij=aij+(bij+cij)=[A+(B+C)]ij.[(A+B)+C]_{ij} =(a_{ij}+b_{ij})+c_{ij} =a_{ij}+(b_{ij}+c_{ij}) =[A+(B+C)]_{ij}.

The middle equality is associativity in F\mathbb F. Because this holds at every position, matrix equality gives (A+B)+C=A+(B+C)(A+B)+C=A+(B+C).

For distribution of a scalar over a matrix sum,

[r(A+B)]ij=r(aij+bij)=raij+rbij=[rA+rB]ij.[r(A+B)]_{ij} =r(a_{ij}+b_{ij}) =ra_{ij}+rb_{ij} =[rA+rB]_{ij}.

Likewise,

[(r+s)A]ij=(r+s)aij=raij+saij=[rA+sA]ij,[(r+s)A]_{ij}=(r+s)a_{ij} =ra_{ij}+sa_{ij}=[rA+sA]_{ij},

and

[(rs)A]ij=(rs)aij=r(saij)=[r(sA)]ij.[(rs)A]_{ij}=(rs)a_{ij} =r(sa_{ij})=[r(sA)]_{ij}.

Commutativity, the zero law, the inverse law, and 1A=A1A=A follow by replacing the arbitrary entry with the matching scalar identity. This is a reusable proof method: same size plus equality of every arbitrary entry proves equality of matrices.

Consequences and cancellation

The two theorems let us derive useful rules instead of memorizing them as new facts. Because A−B=A+(−B)A-B=A+(-B), distribution gives

r(A−B)=rA−rB.r(A-B)=rA-rB.

Indeed, r(−B)=(−r)B=−(rB)r(-B)=(-r)B=-(rB), as can be checked at an arbitrary entry. Be careful, however: subtraction itself is generally neither commutative nor associative. Usually A−B≠B−AA-B\ne B-A, and (A−B)−C(A-B)-C need not equal A−(B−C)A-(B-C). Rewriting every subtraction as addition of an inverse reveals the correct parentheses and signs.

Addition also has a cancellation law. If A,B,CA,B,C belong to the same Fm×n\mathbb F^{m\times n} and satisfy A+B=A+CA+B=A+C, add −A-A to both sides. Associativity and the zero law reduce the equation to B=CB=C. For fixed A,D∈Fm×nA,D\in\mathbb F^{m\times n}, the equation A+X=DA+X=D in the unknown X∈Fm×nX\in\mathbb F^{m\times n} therefore has the unique solution X=D−AX=D-A. This justifies additive “moving to the other side”; it is shorthand for applying the same permitted operation to both sides.

Scalar cancellation needs a condition that additive cancellation does not. If rA=rBrA=rB and r≠0r\ne0, multiplication by the scalar 1/r1/r gives A=BA=B. If r=0r=0, both sides equal OO for every pair A,BA,B, so no equality between the original matrices follows. Similarly, rA=OrA=O implies A=OA=O only when rr is nonzero. Stating this hypothesis prevents a common logical error.

Finally, over R\mathbb R, a matrix equation is really a system of scalar equations in matching positions. If X=[xij]X=[x_{ij}] and 2X+A=B2X+A=B, then every entry satisfies 2xij+aij=bij2x_{ij}+a_{ij}=b_{ij}. Solving these scalar equations simultaneously yields X=(1/2)(B−A)X=(1/2)(B-A). The compact matrix manipulation and the entrywise method are not rival techniques; they are two descriptions of exactly the same reasoning.

Compare the entrywise operations

The following sequence keeps the row-and-column positions fixed as addition, subtraction, and scalar multiplication change their entries. Compare the zero matrix and additive inverse in the same positions before trying a calculation.

Entrywise matrix arithmetic

Follow same-size compatibility, entrywise addition, scalar scaling, subtraction by additive inverse, and the zero-matrix identity move in one short sequence.

  1. Same-size gate

    A + B and A - B require A and B to have the same m x n size, so every entry has a corresponding partner.

  2. Entrywise addition

    The output entry at position (i,j) is built from the two input entries in that same position: [A+B]_{ij}=a_{ij}+b_{ij}.

  3. Scalar multiplication

    A scalar multiplies every entry of A. The entries change, but the result is still an m x n matrix.

  4. Subtraction via inverse

    Subtraction is defined as A - B = A + (-B), so it uses the same size rule as addition.

  5. Zero and inverse

    The zero matrix O and the additive inverse -A must have the same size as A, so A+O=A and A+(-A)=O are well-defined.

  6. Entrywise laws

    The familiar algebraic laws are proved by checking the (i,j)-entry on both sides of the proposed matrix equality.

For addition and subtraction, the size match is part of the definition. For scalar multiplication, one scalar reaches every entry while the matrix shape stays fixed.

Try a linear combination

The live block below lets you switch among A+BA+B, A−BA-B, and cAcA. Before reading its output, predict one selected entry and the size of the result. No matter which operation you choose, the output keeps the same size as the input matrix or matrices.

Read and try

Compare entrywise matrix operations

The live lab keeps fixed same-size matrices A and B in view, then displays A+B, A-B, and cA so readers can check the entrywise rule against each output cell.

Matrix A

1-2
30

B

41
-12

A + B

5-1
22

A - B

-3-3
4-2
2-4
60

Addition and subtraction are entrywise. Scalar multiplication multiplies every entry by the same scalar, so the matrix size stays unchanged.

Calculate with shapes and signs

Worked example

A rectangular numerical calculation

Let

A=[1−2304−1],B=[51−32−46].A=\begin{bmatrix}1&-2&3\\0&4&-1\end{bmatrix},\qquad B=\begin{bmatrix}5&1&-3\\2&-4&6\end{bmatrix}.

Both matrices are 2×32\times 3 over R\mathbb R, so their sum and difference are defined. Keeping the layout visible gives

A+B=[1+5−2+13+(−3)0+24+(−4)−1+6]=[6−10205],A+B =\begin{bmatrix} 1+5&-2+1&3+(-3)\\ 0+2&4+(-4)&-1+6 \end{bmatrix} =\begin{bmatrix}6&-1&0\\2&0&5\end{bmatrix},

and

A−B=[1−5−2−13−(−3)0−24−(−4)−1−6]=[−4−36−28−7].A-B =\begin{bmatrix} 1-5&-2-1&3-(-3)\\ 0-2&4-(-4)&-1-6 \end{bmatrix} =\begin{bmatrix}-4&-3&6\\-2&8&-7\end{bmatrix}.

Finally,

−2A=[−24−60−82].-2A=\begin{bmatrix}-2&4&-6\\0&-8&2\end{bmatrix}.

All three results remain 2×32\times 3; the scalar −2-2 changes signs and magnitudes, not dimensions.

Worked example

Solve a matrix equation entrywise

Suppose the matrices have real entries and

3X−2A=B,3X-2A=B,

where

A=[1−230],B=[47−36].A=\begin{bmatrix}1&-2\\3&0\end{bmatrix},\qquad B=\begin{bmatrix}4&7\\-3&6\end{bmatrix}.

Matrix algebra permits the same additive rearrangement as scalar algebra:

3X=B+2A,X=13(B+2A).3X=B+2A, \qquad X=\frac13(B+2A).

Now compute rather than treating the fraction as “matrix division”:

B+2A=[47−36]+[2−460]=[6336],B+2A =\begin{bmatrix}4&7\\-3&6\end{bmatrix} +\begin{bmatrix}2&-4\\6&0\end{bmatrix} =\begin{bmatrix}6&3\\3&6\end{bmatrix},

so

X=[2112].X=\begin{bmatrix}2&1\\1&2\end{bmatrix}.

Verification is part of the solution:

3X−2A=[6336]−[2−460]=[47−36]=B.3X-2A =\begin{bmatrix}6&3\\3&6\end{bmatrix} -\begin{bmatrix}2&-4\\6&0\end{bmatrix} =\begin{bmatrix}4&7\\-3&6\end{bmatrix}=B.

Worked example

Verify a distributive law numerically

Take

P=[1−203],Q=[41−52].P=\begin{bmatrix}1&-2\\0&3\end{bmatrix},\qquad Q=\begin{bmatrix}4&1\\-5&2\end{bmatrix}.

The left-hand side of −2(P+Q)=−2P+(−2)Q-2(P+Q)=-2P+(-2)Q is

−2(P+Q)=−2[5−1−55]=[−10210−10].-2(P+Q) =-2\begin{bmatrix}5&-1\\-5&5\end{bmatrix} =\begin{bmatrix}-10&2\\10&-10\end{bmatrix}.

The right-hand side is

−2P+(−2)Q=[−240−6]+[−8−210−4]=[−10210−10].-2P+(-2)Q =\begin{bmatrix}-2&4\\0&-6\end{bmatrix} +\begin{bmatrix}-8&-2\\10&-4\end{bmatrix} =\begin{bmatrix}-10&2\\10&-10\end{bmatrix}.

One example does not prove the theorem, but it checks the arithmetic and shows how the general entrywise proof manifests in a concrete case.

Why the zero matrix matters

If OO is the zero matrix of the same size as AA, then A+O=AA+O=A. This matters later because the vector space of m×nm\times n matrices needs an additive identity. That identity depends on the size: a 2×22\times 2 zero matrix cannot replace a 3×33\times 3 zero matrix in an equality or addition.

The equation A+X=OA+X=O also has exactly one solution, namely X=−AX=-A. To see uniqueness, add −A-A to both sides and use associativity. Thus the zero matrix and additive inverse are structural objects, not merely convenient notation.

Common mistakes

Common mistake

Checking entries but forgetting dimensions

The expressions A+BA+B and A−BA-B require equal numbers of rows and equal numbers of columns. Having the same total number of entries is insufficient: a 2×32\times 3 matrix cannot be added to a 3×23\times 2 matrix.

Common mistake

Applying a scalar to only part of a matrix

In cAcA, the scalar multiplies every entry, including zeros and negative entries. For example, −2(−3)=6-2(-3)=6; losing this sign is a common arithmetic error.

Common mistake

Treating a scalar as a matrix addend

In this course, an expression such as A+5A+5 is not defined. Do not add 55 to every entry or only to diagonal entries unless a separate convention has been explicitly introduced.

Common mistake

Calling scalar multiplication matrix division

The step from 3X=C3X=C to X=(1/3)CX=(1/3)C is multiplication by the scalar 1/31/3. It does not assert that division by a matrix is available.

The rules to carry forward

  • Matrix equality requires the same dimensions and equality at every corresponding entry.
  • Addition and subtraction require matrices in the same Fm×n\mathbb F^{m\times n}; scalar multiplication preserves that space.
  • The zero matrix and −A-A supply the additive identity and additive inverse.
  • Addition and scalar multiplication obey their familiar laws because each law holds at an arbitrary (i,j)(i,j) entry in the scalar field.
  • For reliable calculations, check dimensions first, keep positions aligned, compute every entry, and substitute back when solving a matrix equation.

Exercises

Checkpoint

Why is matrix addition only defined for matrices of the same size?

Answer in one sentence using the phrase “corresponding entries.”

Solution · Answer

Matrix addition is entrywise, so each entry of one matrix must have a corresponding entry in the other matrix; this requires equal row and column counts.

Checkpoint

If AA is a 3×43 \times 4 matrix, what is the size of −A-A?

Focus on shape, not on the signs of the entries.

Solution · Answer

−A-A is still a 3×43\times 4 matrix because multiplication by −1-1 changes every entry but does not change the number of rows or columns.

Checkpoint

Let AA be 2×32 \times 3 and BB be 3×23 \times 2. Which of A+BA + B, A−BA - B, and 2A2A are defined?

State each one separately.

Solution · Guided solution

A+BA+B is undefined because the sizes do not match. A−BA-B is undefined for the same reason. 2A2A is defined and is 2×32\times 3 because scalar multiplication needs only one matrix and one scalar.

Checkpoint

Compute 2A−B2A-B for A=[1−12034]A=\begin{bmatrix}1&-1&2\\0&3&4\end{bmatrix} and B=[32−2−151]B=\begin{bmatrix}3&2&-2\\-1&5&1\end{bmatrix}.

Write 2A2A first, and then subtract corresponding entries.

Solution · Guided solution

Both matrices are 2×32\times 3, so the expression is defined. We obtain

2A=[2−24068],2A=\begin{bmatrix}2&-2&4\\0&6&8\end{bmatrix},

and hence

2A−B=[2−3−2−24−(−2)0−(−1)6−58−1]=[−1−46117].2A-B =\begin{bmatrix}2-3&-2-2&4-(-2)\\0-(-1)&6-5&8-1\end{bmatrix} =\begin{bmatrix}-1&-4&6\\1&1&7\end{bmatrix}.

Checkpoint

Solve X+2A=CX+2A=C when A=[2−103]A=\begin{bmatrix}2&-1\\0&3\end{bmatrix} and C=[54−21]C=\begin{bmatrix}5&4\\-2&1\end{bmatrix}.

Isolate XX, compute it, and check one entry of the original equation.

Solution · Guided solution

Subtract 2A2A from both sides:

X=C−2A=[54−21]−[4−206]=[16−2−5].X=C-2A =\begin{bmatrix}5&4\\-2&1\end{bmatrix} -\begin{bmatrix}4&-2\\0&6\end{bmatrix} =\begin{bmatrix}1&6\\-2&-5\end{bmatrix}.

For example, the (1,2)(1,2) entry checks as 6+2(−1)=46+2(-1)=4, matching the (1,2)(1,2) entry of CC; computing the other three entries gives the full equality.

Checkpoint

Why is the zero matrix called the additive identity?

Use the equation that expresses its identity role and state the size condition.

Solution · Guided solution

For every A∈Fm×nA\in\mathbb F^{m\times n}, the zero matrix O∈Fm×nO\in\mathbb F^{m\times n} satisfies A+O=O+A=AA+O=O+A=A. The matrices must have the same size so that the additions are defined.

Read 2.1 Matrix basics first if you want a slower introduction to rows, columns, entries, and matrix size.

Read 3.2 Matrix multiplication, identity matrices, and linear systems next to study the first matrix operation that is not entrywise.

Key terms in this unit