Study Web

Matrices

1.2 Operations with Matrices

Matrix equality, addition, scalar multiplication, and matrix multiplication — definitions, worked examples, and the transpose rule (AB)ᵀ = BᵀAᵀ.

1.2 Operations with Matrices

Definition 1.5 (Equality): Matrices A and B are equal if they have equal size and if their corresponding elements are equal — i.e., A = B if both are m×n and aik = bik for all i = 1,…,m and k = 1,…,n.

Matrix Addition

Definition 1.6: Let A and B be m×n matrices. The sum A + B is a new m×n matrix whose (i,k) entry is aik + bik.

Example 1.3:

12
03
A
+
−512
1−7
B
=
1−52+12
0+13−7
element-wise
=
−414
1−4
A + B
Matrix addition is commutative: A + B = B + A
Matrix addition is associative: (A + B) + C = A + (B + C)

Scalar Multiplication

Definition 1.7: The product λA is obtained by multiplying every element of A by the scalar λ.

Example 1.4:

4 ×
5−10
−73
11−18
A (3×2)
=
20−40
−2812
44−72
4A

The difference A − B = A + (−1)B. Example 1.6:

12
03
A
−512
1−7
B
=
6−10
−110
A − B

Matrix Multiplication

Definition 1.8: Let A be m×n and B be n×p. The product AB is a new m×p matrix C = AB, whose (i,k) entry is:
cik = ai1b1k + ai2b2k + … + ainbnk = Σj=1..n aijbjk

Dimension rule:

A (m × n)
×
B (n × p)
=
C (m × p)
← inner dims must match

Example 1.7: Row × Column

579
A (1×3)
×
2
4
6
B (3×1)
=
5×2 + 7×4 + 9×6
step
=
92
AB (1×1)

Example 1.8: Row × Matrix

579
A (1×3)
×
20
4−3
61
B (3×2)
=
92−12
AB (1×2)
BA does not exist here: (3×2)(1×3) — inner dims 2 ≠ 1. Generally AB ≠ BA.

Example 1.9: Associativity — (CA)B = C(AB)

21
03
15
C (3×2)
×
−14
13−3
A (2×2)
×
52
3−1
B (2×2)
=
7017
16887
287139
CAB (3×2)
Order of multiplication matters: CAB ≠ ACB or any other rearrangement.

Transpose of a Product

(AB)T = BT AT

Example 1.10: Verify (AB)T = BTAT for:

−12
1−3
A (2×2)
,
52
3−1
104
BT (3×2)
AB =
1−4−2
−45−2
AB (2×3)
1−4
−45
−2−2
(AB)T (3×2)
=
1−4
−45
−2−2
BTAT

Compatibility Summary

(2×3)(3×4) → valid → result 2×4 (1×3)(3×2) → valid → result 1×2 (2×3)(4×3) → INVALID (3×2)(1×3) → INVALID