Linear Transformations and Matrices
A linear transformation is a mapping between vector spaces that preserves the operations of addition and scalar multiplication.
Properties of Linear Maps
is linear if for all and :
Every linear transformation between finite-dimensional vector spaces can be represented as a matrix.
python
1import numpy as np
2
3def apply_transformation(A, v):
4 return np.dot(A, v)
5
6# Rotation Matrix by 90 degrees (pi/2)
7theta = np.pi / 2
8R = np.array([[np.cos(theta), -np.sin(theta)],
9 [np.sin(theta), np.cos(theta)]])
10
11v = np.array([1, 0])
12v_rot = apply_transformation(R, v)
13
14print(f"Original: {v}")
15print(f"Rotated 90 deg: {v_rot.round(2)}")
Composition and Matrix Multiplication
If and are linear maps, their composition is also linear. The matrix representing is the product of the matrices representing and .
If A is a 3x2 matrix and B is a 2x5 matrix, what is the size of AB?
Change of Basis
The matrix representation of a linear map depends on the choice of bases for and . If is the matrix in basis , and is the transition matrix from basis to , then:
python
1# T in standard basis
2T_std = np.array([[1, 2], [3, 4]])
3
4# New basis B' = {[1,1], [1,0]}
5P = np.array([[1, 1], [1, 0]])
6P_inv = np.linalg.inv(P)
7
8# T in new basis
9T_new = P_inv @ T_std @ P
10print(f"Matrix in new basis:\n{T_new.round(2)}")