Linear Algebra

Matrix Basics and Operations

1. Matrices and Matrix Operations: The Basics

Now we formally define the tool we've been using!

Definition of a Matrix

A matrix is a rectangular array of numbers. The numbers inside the matrix are called the entries.

Size of a Matrix

The size of a matrix is always described as:

[Row]×[Column][\text{Row}] \times [\text{Column}]

(Hint: Rows run horizontally \leftrightarrow, Columns run vertically \updownarrow)

An m×nm \times n matrix is a matrix having mm rows and nn columns.

2. Matrix Terminology: Square Matrices and the Trace

Square Matrix

A matrix is a square matrix if the number of rows equals the number of columns (e.g., 2×22 \times 2, 3×33 \times 3).

Zero Matrix

A matrix where every single entry is 00. Denoted as 0m×n\mathbf{0}_{m \times n}.

The Main Diagonal

In a square matrix, the main diagonal is the line of entries starting from the top-left corner down to the bottom-right corner. (Entries a11,a22,a33anna_{11}, a_{22}, a_{33} \dots a_{nn}).

Remark: A non-square matrix does NOT have a main diagonal.

The Trace of a Matrix (tr(A)\text{tr}(A))

Let AA be a square matrix. The trace of AA is defined as the sum of all the entries on its main diagonal:

tr(A)=a11+a22++ann\text{tr}(A) = a_{11} + a_{22} + \dots + a_{nn}

Remark: The trace of a non-square matrix is undefined.

3. Matrix Arithmetic: Addition, Subtraction, and Scalars

Addition (A+BA + B) and Subtraction (ABA - B)

To add or subtract two matrices, you simply add or subtract the corresponding entries in the exact same positions.

Crucial Rule: Matrices must be the exact same size to be added or subtracted.

Scalar Multiplication (cAcA)

Let cc be a scalar (a regular real number). To find cAcA, you multiply every single entry inside matrix AA by the number cc.

4. Matrix Multiplication (ABA \cdot B)

Matrix multiplication is highly specific and does not work like normal multiplication.

The Dimension Rule

Let AA be an (m×r)(m \times r) matrix and BB be an (r×n)(r \times n) matrix. You can only multiply them if the middle two numbers match (the columns of AA must equal the rows of BB).

The result, ABAB, will be a new matrix with the outer dimensions: (m×n)(m \times n).

How to Multiply ("Row by Column")

To find the entry in the ii-th row and jj-th column of your new matrix ABAB:

  1. Single out the ii-th row from matrix AA.
  2. Single out the jj-th column from matrix BB.
  3. Multiply their corresponding entries together one by one, and add the resulting products.

Important Note: Unlike regular numbers where 3×4=4×33 \times 4 = 4 \times 3, in matrices, ABBAAB \neq BA! Sometimes ABAB works, but if you flip them, the dimensions no longer match and BABA is "undefined".

Back to Linear Algebra