Skip to main content

1.12 Image and Kernel

The image and kernel of a linear mapping are vector subspaces with certain important properties

Definition:  Image and Kernel

For $\Phi: V \to W $, we define the kernel or null space

$ker(\Phi)=\Phi^{-1}(0_w)=\{v \in V: \Phi(v)=0_w\}$

and image or range

$Im(\Phi) =\Phi(V)=\{w \in W| \exists v \in V: \Phi(v)=w\}$

We also call $V$ and $W$ as domain and codomain of $\Phi$, respectively.

Intuitively, the kernel is the set of vectors in $v \in V$ that $\Phi$ maps onto the neutral element $0_w \in W$. The image is the set of vectors $w \in W$  that can be “reached” by $\Phi$ from any vector in $V$ . An illustration is given in figure.


Remark: Consider a linear mapping $\Phi: V \to W$, where $V,W$ are vector spaces.

  • It always holds that $\Phi(0_v)=0_w$ and therefore $0_v \in ker(\Phi)$.In particular the null space is never empty.
  • $Im(\Phi) \subseteq W$ is a subspace of $W$, and $ker(\Phi) \subseteq V$ is a subspace of $V$.

Remark(Null space and Column space)

Let us consider $A \in \mathbb{R}^{m \times n}$ and a linear mapping $\Phi: \mathbb{R}^n \to \mathbb{R}^m, x \to Ax$

  • for $A=[a_1,\ldots,a_n]$, where $a_i$ are the columns of $A_i$, we obtain$Im(\Phi)={Ax:x \in \mathbb{R}^n}=\sum_{i=1}^n x_ia_i : x_1,\ldots,x_n \in \mathbb{R}$             $=span[a_1,\ldots,a_n] \subseteq \mathbb{R}^m$
  • i.e., the image is the span of the columns of $A$, also called the column space. Therefore, the column space(image) is a subspace of $\mathbb{R}^m$ ,where $m$ is the height of the matrix.
  • $rk(A)=dim(Im(\Phi))$
  • The kernel/null space $ker(\Phi)$ is the general solution to the homogenious system of linear equations $Ax=0$ and captures all possible linear combination of elements in $\mathbb{R}^n$ that produces $0 \in \mathbb{R}^m$
  • The kernel is a subspace of $\mathbb{R}^n$, where $n$ is the width of the matrix.
  • The kernel focuses on the relationship among the columns, and we can use it to determine whether/how we can express a column as a linear combination of other columns
Rank Nullity Theorem
For vector spaces $V,W$ and a linear mapping $\Phi:V \to W$ it holds that

$dim(ker(\Phi))+ dim(Im(\Phi))= dim(V)$
The rank nullity theorem is also referred to as the fundamental theorem of linear mapping.

If  $dim(Im(\Phi)) < dim(V)$, then $ker(\Phi)$ is non trivial, i.e, the kernel contains more than $0_v$ and $dim(ker(\Phi)) \ge 1$.

If $A_\phi$ is the transformation matrix of $\Phi$ with respect to an ordered basis and $dim(Im(\Phi)) < dim(V)$, then the system of linear equations $A_\phi x=0$ has infinitely many solutions.

If $dim(V)=dim(W)$, then the following three way equivalence holds
$\Phi$ is injective
$\Phi$ is surjective
$\Phi$ is bijective
since $Im(\Phi) \subseteq W$






import sympy as sp
import numpy as np
row1=[1,2,-1,0]
row2=[1,0,0,1]
M = sp.Matrix((row1,row2))
print("Transformation Matrix")
display(M)
print("Reduced Echelon Form")
display(M.rref())

O/P
Transformation Matrix
$\displaystyle \left[\begin{matrix}1 & 2 & -1 & 0\\1 & 0 & 0 & 1\end{matrix}\right]$
Reduced Echelon Form
(Matrix([ [1, 0, 0, 1], 
             [0, 1, -1/2, -1/2]]), (0, 1))

Note: from the reduced echelon form we can find out the null space.

We can also sympy package nullspace method to find null space
# import sympy
from sympy import *
M = Matrix([[1, 2, -1, 0], [1, 0, 0, 1]])
display(M)
# Use sympy.nullspace() method
M_nullspace = M.nullspace()
print("Nullspace of a matrix : ")
display(M_nullspace)

O/P
$\displaystyle \left[\begin{matrix}1 & 2 & -1 & 0\\1 & 0 & 0 & 1\end{matrix}\right]$
Nullspace of a matrix :
[Matrix([ [ 0], [1/2], [ 1], [ 0]]), 
 Matrix([ [ -1], [1/2], [ 0], [ 1]])]



Example:
Find the Image and Kernel of a linear mapping $A=\begin{bmatrix}
2 &3 \\
6 & 9
\end{bmatrix}$

After row reduction the echelon form is
$A=\begin{bmatrix}
2 &3 \\
0 & 0
\end{bmatrix}$

$A=\begin{bmatrix}
1 &3/2 \\
0 & 0
\end{bmatrix}$

So the pivot column indicate linear independent vector

$Im(A)=span(\begin{bmatrix}
2 \\
6 \\
\end{bmatrix})$

The null space is spanned by

$Null(A)=span(\begin{bmatrix}
3/2 \\
-1 \\
\end{bmatrix})$

Example ( university question)
Consider the transformation $T (x, y) = (x + y, x + 2y, 2x + 3y)$. Obtain ker $T$ and use this to calculate the nullity. Also find the transformation matrix for $T$.

The transformation matrix is

$T=\begin{bmatrix}
1 & 1 \\
1 & 2 \\
2 & 3
\end{bmatrix}$

The null space consist of  the trivial vector 
$\begin{bmatrix}0 \\
0\\
\end{bmatrix}$

Given the linear transformation $T(x,y,z,w)=(x+2y-z,x+w) $, find the basis each for Ker(T) and Range(T) ( University Question)

The transformation matrix is
$\begin{bmatrix}
1 & 2 & -1 & 0 \\
1 & 0 & 0 & 1 \\
\end{bmatrix}$

After row reduction, the reduced echelon form is
$\begin{bmatrix}
1 & 2 & -1 & 0 \\
0 & -2 & 1 & 1 \\
\end{bmatrix} R2= R2-R1$

$\begin{bmatrix}
1 & 0 & 0 & 1 \\
0 & -2 & 1 & 1 \\
\end{bmatrix}  R1=R1+R2$

$\begin{bmatrix}
1 & 0 & 0 & 1 \\
0 & 1 & -1/2 & -1/2 \\
\end{bmatrix}  R2=R2/-2$

Basis for Range(T) is $\begin{bmatrix}
1 \\
1\\
\end{bmatrix}\begin{bmatrix}
2 \\
0 \\
\end{bmatrix} $
Basis for Ker(T) is $\begin{bmatrix}
0 \\
-1/2 \\
-1\\
0
\end{bmatrix}\begin{bmatrix}
1 \\
-1/2 \\
0\\
-1
\end{bmatrix} $
 
 Let $T$ be the linear transformation from $R^2$ to $R^3$ defined by $T(v)=Av$, with standard matrix $A=\begin{bmatrix} 2& -6 & 4 \\ 1 & -1 & 2 \end{bmatrix}$. Find the kernel and image of $T$.
After row reduction, the reduced echelon form is
 
$A=\begin{bmatrix} 2& -6 & 4 \\ 1 & -1 & 2 \end{bmatrix}$
 
$R1=R1/2$
 $A=\begin{bmatrix} 1& -3& 2 \\ 1 & -1 & 2 \end{bmatrix}$
 
 
$R2=R2-R1$
 $A=\begin{bmatrix} 1& -3& 2 \\ 0 & 2 & 0 \end{bmatrix}$
 
$R2=R2/2$
 $A=\begin{bmatrix} 1& -3& 2 \\ 0 & 1 & 0 \end{bmatrix}$
 
 
$R1=R2*3 + R1$
 $A=\begin{bmatrix} 1& 0& 2 \\ 0 & 1 & 0 \end{bmatrix}$
 
Basis for Range(T) is $\begin{bmatrix}
2 \\
1\\
\end{bmatrix}\begin{bmatrix}
-6 \\
-1 \\
\end{bmatrix} $
Basis for Ker(T) is 
$\begin{bmatrix}
2 \\
0 \\
-1\\
\end{bmatrix}$

Comments

Popular posts from this blog

Mathematics for Machine Learning- CST 284 - KTU Minor Notes - Dr Binu V P

  Introduction About Me Syllabus Course Outcomes and Model Question Paper University Question Papers and Evaluation Scheme -Mathematics for Machine learning CST 284 KTU Overview of Machine Learning What is Machine Learning (video) Learn the Seven Steps in Machine Learning (video) Linear Algebra in Machine Learning Module I- Linear Algebra 1.Geometry of Linear Equations (video-Gilbert Strang) 2.Elimination with Matrices (video-Gilbert Strang) 3.Solving System of equations using Gauss Elimination Method 4.Row Echelon form and Reduced Row Echelon Form -Python Code 5.Solving system of equations Python code 6. Practice problems Gauss Elimination ( contact) 7.Finding Inverse using Gauss Jordan Elimination  (video) 8.Finding Inverse using Gauss Jordan Elimination-Python code Vectors in Machine Learning- Basics 9.Vector spaces and sub spaces 10.Linear Independence 11.Linear Independence, Basis and Dimension (video) 12.Generating set basis and span 13.Rank of a Matrix 14.Linear Mapping...

Vectors in Machine Learning

As data scientists we work with data in various formats such as text images and numerical values We often use vectors to represent data in a structured and efficient manner especially in machine learning applications In this blog post we will explore what vectors are in terms of machine learning their significance and how they are used What is a Vector? In mathematics, a vector is a mathematical object that has both magnitude and direction. In machine learning, a vector is a mathematical representation of a set of numerical values. Vectors are usually represented as arrays or lists of numbers, and each number in the list represents a specific feature or attribute of the data. For example, suppose we have a dataset of houses, and we want to predict their prices based on their features such as the number of bedrooms, the size of the house, and the location. We can represent each house as a vector, where each element of the vector represents a specific feature of the house, such as the nu...

2.14 Singular Value Decomposition

The Singular Value Decomposition ( SVD) of a matrix is a central matrix decomposition method in linear algebra.It can be applied to all matrices,not only to square matrices and it always exists.It has been referred to as the 'fundamental theorem of linear algebra'( strang 1993). SVD Theorem: Let $A^{m \times n}$ be a rectangular matrix of rank $r \in [0,min(m,n)]$. The SVD of A is a decomposition of the form. $A= U \Sigma V^T $ with an orthogonal matrix $U \in \mathbb{R}^{m \times m}$ with column vectors $u_i, i=1,\ldots,m$ and an orthogonal matrix $V \in \mathbb{R}^{n \times n}$ with column vectors $v_j, j=1,\ldots,n$.Moreover, $\Sigma$ is an $m \times n$ matrix with $\sum_{ii} = \sigma \ge 0$ and $\sigma_{ij}=0, i \ne j$. The diagonal entries $\Sigma_i=1,\ldots,r$ of $\sigma$ are called singular values . $u_i$ are called left singular vectors , and $v_j$ are called right singular vectors .By convention singular values are ordered ie; $\sigma_1 \ge \sigma_2 \ldots \sigma_r \...