Linear Algebra

Vector Algebra

Colab

Matrix Algebra

Types of Matrix

Diagonal Matrix

  • A square matrix whose off-diagonal elements are all zero.

Triangular Matrix

  • A square matrix whose elements above or below the main diagonal are all zero.
  1. Upper Triangular Matrix
  1. Lower Triangular Matrix

Identity Matrix

  • A diagonal matrix whose all diagonal entries are all 1.

Matrix Algebra

  • Two matrices are equal if their dimensions are equal and all corresponding elements are equal.

  • The addition or subtraction of two matrices, A and B of the same size yields a matrix C of the same size.

  1. Commutative Law: A + B = B + A
  2. Associative Law: A + (B + C) = (A + B) + C = A + B + C
  • Matrices of different sizes cannot be added or subtracted.

Scalar multiplication in matrices

Matrix Multiplication

  • The product of two matrices is another matrix.
  • The necessary condition for multiplication of two matrices A and B is that the number of columns of A must equal the number of rows of B.

Properties of Matrix Multiplication

  1. Associative Law:
  2. Distributive Law:
  3. Identity Matrix:

Note: Matrix multiplication is not commutative in general.i.e. AB != BA Note: AB=0 does not imply A=0 or B=0. Note: AB=AC does not imply B=C.

Transpose of a Matrix

  • The transpose of a matrix A is denoted by A^T.
  • The transpose of a matrix is obtained by interchanging the rows and columns of the matrix.
  • If A is an m x n matrix, then A^T is an n x m matrix.

Properties of Transpose

Determinant of a Matrix

  • Every square matrix has a determinant.
  • The determinant of a matrix is a number.
  • The determinant of a matrix is denoted by |A| or det(A).
  • The determinant of a 2x2 matrix is given by:
  • The determinant of a 3x3 matrix is given by:

Inverse of a Matrix

  • The inverse of a matrix A is denoted by .

  • If A is a square matrix, then A has an inverse if and only if the determinant of A is not equal to zero.

Properties of Inverse

  • A square matrix that has an inverse is called a non-singular matrix.
  • A square matrix that does not have an inverse is called a singular matrix.
  • Square matrices that are singular are also called degenerate matrices.
  • When the determinant of a matrix is zero, the matrix is singular and does not have an inverse.

Colab

Vector Space

  • A vector space is a set of vectors that are closed under two operations: vector addition and scalar multiplication.

Properties of Vector Space

  1. Closure under Addition: If u and v are vectors in V, then u + v is also in V.
  2. Associative Law: u + (v + w) = (u + v) + w
  3. Commutative Law: u + v = v + u
  4. (V,+) forms an abelian group.
  5. The operation (.) is defined between scalars and vectors such that if u is a vector in V and a is a scalar, then au is also in V.
  6. Distributive Law: a(u + v) = au + av
  7. Distributive Law: (ab)u = a(bu)
  8. Unitary law: 1u = u

Note: (V,+,.) is a vector space if it satisfies the above properties.

Geometric Interpretation of Vector Space

  • For n=1,2,or 3 the vector space is called 1D, 2D, or 3D space.

  • If V1, V2 and V3 are linearly independent vectors in a vector space.

    • V1 and V2 are not collinear, and V3 does not lie in the plane of V1 and V2.

Vector Subspace

  • If is a vector space, then any subset of that satisfies the properties of a vector space is called a subspace of .

Theorem-1

  • Let W be a subset of . Then W is a subspace of if and only if W satisfies the following three properties:
    1. W is non-empty.
    2. For any and any , .
Example
  • If we have a subspace of . Then,

    1. The origin is a subspace.
    2. A line passing through the origin is a subspace.
  • If we have a subspace of . Then,

    1. The origin is a subspace.
    2. A line passing through the origin is a subspace.
    3. A plane passing through the origin is a subspace.

Theorem-2

  • The intersection of any non-empty collection of subspaces of is a subspace of .

Theorem-3

  • The union of two subspaces of is a subspace of if one of them is contained in the other.
Example

= {(0,0,0)}$

Linear Span

  • Let be a vector space.
  • Let be a non-empty subset of V.Then the set is called the linear span of S.
Example
  • Let and and .

Theorem-1

  • Let be a vector space and be a non-empty subset of V.Then is a subspace of V.

Theorem-2

  • Let S be a non-empty subset of a vector space V. Then is the smallest subspace of that contains S.

Some important subspaces

Let,

where .Then

  1. The row space of A is given by is a subspace of .
  2. The column space of A is given by is a subspace of .
  3. The set is said to be nullspace of A.
  4. The set is said to be range of A. In general, column space .

Relevance with ML

In many of the ML algorithms:

  • We need to represent feature vectors as a linear combination of set of linearly independent vectors or orthogonal vectors.
  • We need to represent all the vectors of the feature space of our dataset as the linear combination of these vectors.

Basis

Definition: Let be a vector space. A basis for V is a set of linearly independent vectors that span V.

  • The space V is finite-dimensional if it has a finite basis.
  • A vector in basis is called basis vector.
Example
  1. Let and .
    • B is a basis for .
  2. Let and .
    • B is a basis for .
    • is a vector space. Now,

Theorem 1

  • Let be a basis for a vector space . If S be a subset of vectors having more than vectors, then the set S is linearly dependent.

Theorem 2

  • Let be a linearly independent subset of a n-dimensional vector space , where . Then S can be extended to a basis of .

Theorem 3

  • Let be a finite-dimensional vector space. Then any two bases of V have the same number of vectors.
Example

Theorem 4

  • Let be a finite-dimensional vector space and let and be two bases of V. Then
Example
  1. Find a basis and dimension of the subspaces S of given as
  • Hence, the basis is {(1,0,1),(0,1,1)} and the dimension is 2.

  1. Hence, the basis is {(1,1,1)} and the dimension is 1.

Basis of