Matrix Operations Guide
A matrix is a rectangular array of numbers arranged in rows and columns. Matrix operations are fundamental in linear algebra, computer graphics, engineering, and machine learning.
Basic Matrix Operations
- Addition/Subtraction: Add or subtract corresponding elements. Matrices must be same size.
- Multiplication: For A(m×n) × B(n×p), the inner dimensions must match. Result is m×p.
- Transpose (Aᵀ): Flip rows and columns — rows become columns.
- Determinant: A scalar value that describes certain properties of the matrix.
det([[a,b],[c,d]]) = ad − bc
Matrix Operation Rules
Matrices are rectangular arrays of numbers used in linear algebra. They are fundamental tools in science, engineering, computer graphics, and machine learning.
| Operation | Requirement | Result Size |
|---|---|---|
| Addition (A + B) | A and B same size | Same as A and B |
| Subtraction (A − B) | A and B same size | Same as A and B |
| Multiplication (A × B) | Columns of A = Rows of B | Rows of A × Cols of B |
| Transpose (Aᵀ) | Any matrix | Rows/cols swapped |
| Determinant det(A) | Square matrix only | Scalar value |
2×2 Matrix Formulas
For A = [[a,b],[c,d]]:
det(A) = ad − bc
Inverse A⁻¹ = (1/det) × [[d,−b],[−c,a]] (if det ≠ 0)
Transpose Aᵀ = [[a,c],[b,d]]
det(A) = ad − bc
Inverse A⁻¹ = (1/det) × [[d,−b],[−c,a]] (if det ≠ 0)
Transpose Aᵀ = [[a,c],[b,d]]
Worked Example — 2×2 Multiplication
A = [[1,2],[3,4]], B = [[5,6],[7,8]]
A×B = [[1×5+2×7, 1×6+2×8],[3×5+4×7, 3×6+4×8]]
= [[5+14, 6+16],[15+28, 18+32]]
= [[19, 22],[43, 50]]
A×B = [[1×5+2×7, 1×6+2×8],[3×5+4×7, 3×6+4×8]]
= [[5+14, 6+16],[15+28, 18+32]]
= [[19, 22],[43, 50]]
Why Matrices Matter
- 3D graphics: Every rotation, scaling, and translation in video games and 3D software uses matrix multiplication
- Machine learning: Neural networks perform matrix multiplications billions of times per second during training
- Physics: Solving systems of linear equations, quantum mechanics (state matrices)
- Economics: Input-output models of national economies use large matrices
- Computer vision: Image transformations, convolution operations in CNNs