Matrices and Operations

Last updated: December 2024

Disclaimer: These are my personal notes compiled for my own reference and learning. They may contain errors, incomplete information, or personal interpretations. While I strive for accuracy, these notes are not peer-reviewed and should not be considered authoritative sources. Please consult official textbooks, research papers, or other reliable sources for academic or professional purposes.

1. Matrix Definition

A matrix $A$ of size $m \times n$ is an array of numbers:

$$A = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix}$$

2. Basic Operations

2.1 Matrix Addition

For matrices $A$ and $B$ of the same size:

$$(A + B)_{ij} = A_{ij} + B_{ij}$$

2.2 Scalar Multiplication

For scalar $c$ and matrix $A$:

$$(cA)_{ij} = c \cdot A_{ij}$$

2.3 Matrix Multiplication

For $A$ of size $m \times n$ and $B$ of size $n \times p$:

$$(AB)_{ij} = \sum_{k=1}^n A_{ik} B_{kj}$$

Note: Matrix multiplication is not commutative: $AB \neq BA$ in general.

3. Special Matrices

4. Transpose

The transpose of matrix $A$ is:

$$(A^T)_{ij} = A_{ji}$$

Properties:

5. Determinant

For a $2 \times 2$ matrix:

$$\det(A) = \begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad - bc$$

For larger matrices, use cofactor expansion or row operations.

6. Inverse

A matrix $A$ is invertible if $\det(A) \neq 0$. The inverse satisfies:

$$AA^{-1} = A^{-1}A = I$$

For $2 \times 2$ matrix:

$$A^{-1} = \frac{1}{\det(A)} \begin{bmatrix} d & -b \\ -c & a \end{bmatrix}$$

7. Rank

The rank of a matrix is the maximum number of linearly independent rows (or columns).

8. Row Operations

Elementary row operations:

9. Row Echelon Form (REF)

A matrix is in REF if:

10. Reduced Row Echelon Form (RREF)

In addition to REF properties:

11. Systems of Linear Equations

A system $Ax = b$ can be solved using:

12. Code Example

# Python code for matrix operations
import numpy as np

# Create matrices
A = np.array([[1, 2], [3, 4]])
B = np.array([[5, 6], [7, 8]])

# Basic operations
C = A + B  # Addition
D = A @ B  # Matrix multiplication
E = A.T    # Transpose

# Determinant and inverse
det_A = np.linalg.det(A)
inv_A = np.linalg.inv(A)

# Solve system Ax = b
b = np.array([1, 2])
x = np.linalg.solve(A, b)

print(f"Determinant: {det_A}")
print(f"Inverse:\n{inv_A}")
print(f"Solution: {x}")

13. References