Linear Maps Between Vector Spaces: Examples and Problems
Examples and Problems
Example 1
Consider the symmetric matrix:
Find , the determinant of , the kernel of , the eigenvalues and eigenvectors of , and find the coordinate transformation in which is diagonal.
Solution
Since is symmetric, therefore, . The determinant of can be obtained using the triple product of the row vectors. However, it is obvious that the first two vectors are linearly dependent (they are equal), therefore, . The kernel of can be obtained by finding the possible forms for the vector that would satisfy the following equation:
Therefore:
By setting , we have . Therefore, the kernel of has the form:
To find the eigenvalues of we find the possible values for that would make the matrix not invertible. In other words, we solve for that would satisfy:
Therefore:
Therefore, the possible three eigenvalues are: , and . Note that since is not invertible, is automatically an eigenvalue for .
The eigenvector corresponding to the eigenvalue can be found as follows:
which is the same equation to find the vectors of the kernel. So, a normalized vector in the kernel would satisfy this equation. Therefore,
The eigenvector corresponding to the eigenvalue can be found as follows:
Therefore, we have the following three equations:
Therefore, the normalized components of the second eigenvector are:
Since is symmetric, the third eigenvector has to be normal to the first and second eigenvectors. So, we can simply find a vector normal to and . Or we can solve the equation:
Therefore, we have the following three equations:
Therefore, the normalized components of the third eigenvector are:
The coordinate system in which the representation of the matrix is diagonal is the coordinate system made of the three normalized eigenvectors of . Setting , the coordinate transformation matrix has the form:
Note that the order of the vectors in was chosen so that is a rotation matrix, i.e., the vectors of have to obey the right hand orientation. Therefore, the components of when using as the basis set are:
Study the following Mathematica code and note the various functions used for matrix manipulations. Note that the function “NullSpace” can be used to find the vectors in the kernel. The actual kernel is the span of these vectors. Matrix multiplication is performed using the “.” character. Note also that the command “Eigensystem” in Mathematica can be used to produce the list of eigenvalues, followed by the list of eigenvectors. Study the code to see how the eigenvectors can be extracted, normalized, and then used to form the matrix .
View Mathematica Code
Mt = Transpose[M]
Det[M]
NullSpace[M]
a = Eigensystem[M]
ev1 = a[[2, 1]]/Norm[a[[2, 1]]]
ev2 = a[[2, 3]]/Norm[a[[2, 3]]]
ev3 = a[[2, 2]]/Norm[a[[2, 2]]]
Q = {ev1, ev2, ev3};
Q // MatrixForm
Mp = Q.M.Transpose[Q];
Mp // MatrixForm
View Python Code using Numpy
from numpy.linalg import *
from scipy.linalg import *
M = np.array([[1, 1, 0], [1, 1, 0], [0, 0, 1]])
print(“M^T=\n”,M.transpose()) # transpose matrix
print(“Det (M) =”,det(M)) # determinant
print(“Vectors in the Kernel (Nullspace)=\n”,null_space(M)) # null space unit matrix
eigen = eig(M) # eigen values and vectors
print(“eigenvectors and eigenvalues\n”,eigen)
# first index is eigen values
print(“Eigenvalues = \n”,eigen[0])
# Columns are normalized eigenvectors. Transpose is used to convert them into rows
print(“Eigenvectors = \n”,eigen[1].T)
#The rotation matrix is made out of the rows of the eigenvectors
Q=eigen[1].T
print(“Q =\n”,Q)
# @ is matrix multiply
print(“Q.M.Q^T=\n”,Q@M@Q.transpose())
# this also works
print(“Q.M.Q^T=\n”,Q.dot(M).dot(Q.transpose()))
View Python Code using Sympy
import sympy as sp
sp.init_printing(use_latex = “mathjax”)
M = Matrix([[1, 1, 0], [1, 1, 0], [0, 0, 1]])
# transpose matrix
display(“Transpose =”,M.T)
# determinant
display(“Det=”,M.det())
# null space
display(“Vectors in the Kernel (Nullspace) =”,M.nullspace())
# eigen values
display(“Eigenvalues=”,M.eigenvals())
# eigen vectors
vector = M.eigenvects()
display(“Eigenvalues and Eigenvectors =”,vector)
ev = [i[2][0].T for i in vector]
display(“extracted eigenvectors”,ev)
#The function Matrix ensures the list is a sympy matrix
Q = Matrix([i/i.norm() for i in ev])
display(“normalized eigenvectors”,Q)
display(“Check that triple product is positive”)
Q[0,:].dot(Q[1,:].cross(Q[2,:]))
# matrix multiply
display(“Diagonalized matrix = Q.M.Q^T”,Q*M*Q.T)
Q2 = Matrix([Q[2,:],Q[0,:],Q[1,:]])
display(“A different order could be used for Q”,Q2)
display(“Diagonalized matrix = Q.M.Q^T”,Q2*M*Q2.T)
Example 2
Consider the vectors , and . Consider the linear map represented by the matrix:
 Find the components of the vector , the image of the vector under the linear map .
 Show that the vectors , and form an orthonormal basis set.
 Find the components of and if the basis set is chosen for the coordinate system.
Solution
The components of are:
The vectors , and are orthogonal to each other and the norm of each is equal to 1. In addition, the order , and follows the right hand orientation. Setting the coordinate transformation matrix is:
Therefore, the components of the vectors , and the matrix are:
View Mathematica Code
M = {{2, 1, 0}, {1, 5, 2}, {2, 1, 3}};
Print[“y=Mx”]
y = M.x;
y // MatrixForm
u = {3/5, 4/5, 0};
v = {4/5, 3/5, 0};
w = {0, 0, 1.};
Norm[u]
Norm[v]
Norm[w]
u.v
u.w
v.w
Q = {u, v, w};
Q // MatrixForm
xp = Q.x;
Print[“x'”]
xp // MatrixForm
yp = Q.y;
Print[“y'”]
yp // MatrixForm
Mp = Q.M.Transpose[Q];
Print[“M'”]
Mp // MatrixForm
Print[“M’x'”]
Mp.xp // MatrixForm
View Python Code using Numpy
from numpy.linalg import *
x = np.array([1, 1, 1])
M = np.array([[2, 1, 0], [1, 5, 2], [2, 1, 3]])
# matrix multiply
y = np.matmul(M,x)
# same operation
y = M@x
print(y)
u = np.array([3/5, 4/5, 0])
v = np.array([4/5, 3/5, 0])
w = np.array([0, 0, 1])
print(“Check length of vectors”)
print(“u=”,norm(u))
print(“v=”,norm(v))
print(“w=”,norm(w))
# @ also works as dot product
print(“Check orthogonality”)
print(“u.v =”,u@v)
print(“u.w =”,u@w)
print(“v.w =”,v@w)
print(“Check orientation”)
print(“u.v\u00D7w=”,u@np.cross(v,w))
# Q will be a 3 x 3
Q = u
# Adds row to matrix
Q = np.vstack([Q, v])
Q = np.vstack([Q, w])
print(“Q=\n”,Q)
#Alternatively, Q can be defined as:
Q=np.array([u,v,w])
print(“Q=\n”,Q)
print(“x=\n”,x)
xp = Q@x
yp = Q@y
Mp = Q@M@Q.transpose()
print(“x’=\n”,xp)
print(“y=\n”,y)
print(“M=\n”,M)
print(“M’=\n”,Mp)
print(“y’=M’x’=\n”,Mp@xp)
print(“y’= Qy\n”,yp)
View Python Code using Sympy
import sympy as sp
sp.init_printing(use_latex = “mathjax”)
# vector []
x = Matrix([1, 1, 1])
M = Matrix([[2, 1, 0], [1, 5, 2], [2, 1, 3]])
y = M*x
display(y)
# you need [[]] to use matrix operations
ul = [3/5, 4/5, 0]
vl = [4/5, 3/5, 0]
wl = [0, 0, 1]
u = Matrix(ul)
v = Matrix(vl)
w = Matrix(wl)
display(“Check the length of each vector”)
display(u.norm())
display(v.norm())
display(w.norm())
display(“Check the mutual orthogonality”)
display(u.dot(v))
display(u.dot(w))
display(v.dot(w))
display(“Check the orientation”)
display(u.dot(v.cross(w)))
Q = Matrix([ul,vl,wl])
xp = Q*x
Mp = Q*M*Q.T
yp1 = Q*y
yp2 = Mp*xp
display(“Change of coordinate system matrix=”,Q)
display(“x in new coordinate system=x’=Qx”,xp)
display(“M in new coordinate system=M’=QMQ^T”,Mp)
display(“y in new coordinate system=y’=Qy”,yp1)
display(“y in new coordinate system=y’=M’x'”,yp2)
Example 3
In the following code, the rotation matrix is defined using the function “RotationMatrix[angle]”. Notice that the angle input is automatically set at radians unless the command “Degree” is used. Because of the symbolic notation of Mathematica, the function FullSimplify[] is used to show that the rotation matrix preserves the norm of the vector after rotation and that the rotation angle between and its image is exactly 20 degrees.
View Mathematica Code
Q=RotationMatrix[Pi/6];
(*The following is a rotation matrix using 20 degrees*)
Q=RotationMatrix[20Degree];
u={2,2};
v=Q.u;
Norm[u]
Norm[v]
FullSimplify[Norm[v]]
VectorAngle[u,v]
FullSimplify[VectorAngle[u,v]]
View Python Code using Numpy
from numpy.linalg import *
# input degrees get radians
theta = np.radians(20)
c, s = np.cos(theta), np.sin(theta)
# using the 2D rotation formula
Q = np.array([[c, s], [s, c]])
print(“Q =\n”,Q)
u = np.array([2, 2])
v = Q@u
print(“v =”,v)
print(“u =”,norm(u))
print(“v =”,norm(v))
# using angle formula
th=np.arccos(u@v/norm(u)/norm(v))
print(“theta(rad) =”,th)
View Python Code using Sympy
from mpmath import radians# degree radius conversion
import sympy as sp
from sympy import pi, simplify
sp.init_printing(use_latex = “mathjax”)
# The following is a general rotation matrix with an angle rot in the counterclockwise direction
rot = sp.symbols(“rot”)
Q = Matrix([[sp.cos(rot),sp.sin(rot)],[sp.sin(rot),sp.cos(rot)]])
display(Q)
#Set rot = 20 degrees = 20 Pi/180 = pi/9 radians
Q = Q.subs({rot:20*sp.pi/180})
display(“Q =”,Q)
u = Matrix([2, 2])
v = Q*u
display(“v=”,v)
display(“u=”,u.norm())
display(“v=”,v.norm())
# simplifies the expression above
display(simplify(v.norm()))
# evaluates the expression above
display(v.norm().evalf())
theta = sp.acos(u.dot(v)/u.norm()/v.norm())
# simplifies the expression above
thetasimplified = simplify(theta)
display(“\u03B8(rad) = “,theta)
display(“\u03B8(rad) = “,thetasimplified)
display(“\u03B8(rad) = “,thetasimplified.evalf())
Example 4
In the following code, an array of 4 points is defined and used to draw a triangle. Then, a new array is calculated by applying a rotation of 60 degrees to every point and thus a new triangle rotated by 60 degrees is defined. Finally, two triangles are created using the Polygon function and viewed using the Graphics function.
View Mathematica Code
Q=RotationMatrix[th];
(*The following line stores the array of 4 vertices in the variable Points*)
Points={{0,1},{5,1},{2,3},{0,1}};
(*The following line rotates each of the 4 elements in Points using the rotation matrix Q, then, forms a new array of 4 rotated vertices in the variable Points2. The new array is formed using the Table command*)
Points2=Table[Q.Points[[i]],{i,1,4}];
(*The following lines define two polygons c and c2 using the vertices defined in the variable Points and Points2*)
c=Polygon[Points];
c2=Polygon[Points2];
(* The following line views the objects c and c2 with the default graphics formatting*)
Graphics[{c,c2},Axes>True,AxesOrigin>{0,0}]
(*The following line views the objects while applying specific graphics formatting*)
Graphics[{Opacity[0.6],c,c2},Axes>True,AxesOrigin>{0,0},AxesStyle>{Directive[Bold,17],Directive[Bold,17]}]
Example 5
The function “RotationMatrix[angle,vector]” can be used to create a rotation matrix create that is a rotation around a particular vector. You can use two or threedimensional graphics objects to visualize the effect of the rotation matrices. For example, in the following code, a rotation matrix with an angle of 60 degrees around the vector is first defined. Then a unit cube is created and transformed by a geometric transformation of the original cube.
View Mathematica Code
Qx=RotationMatrix[thx,{1,0,0}];
c=Cuboid[{0,0,0},{1,1,1}];
c1=GeometricTransformation[c,Qx]
(*Viewing the two objects using the default graphics formatting*)
Graphics3D[{c,,c1},Axes>True,AxesOrigin>{0,0,0}]
(*Viewing the two objects using a specific formatting*)
Graphics3D[{GrayLevel[.3,0.4],Specularity[White,2],EdgeForm[Thickness[0.005]],c,Specularity[White,6],EdgeForm[Thickness[0.01]],c1},Axes>True,AxesOrigin>{0,0,0},Lighting>”Neutral”,AxesStyle>{Directive[Bold,13],Directive[Bold,13],Directive[Bold,13]}]
Example 6
In the following code, the rotation matrices , and defined as rotations around , and , respectively, are created. A cuboid is then defined with opposite corners at , and . The function “Manipulate[]” is used to view the cuboid before and after applying the rotations (blue cuboid) and (red cuboid). Copy and paste the code into your Mathematica software, and move the sliders to change the values of the rotation angles. The order of consecutive rotations is important. The application of on a vector is equivalent to rotating the vector first by , then by and finally by . The resulting vector is different if is applied.
View Mathematica Code
Manipulate[Qx = RotationMatrix[thx, {1, 0, 0}];
Qy = RotationMatrix[thy, {0, 1, 0}];
Qz = RotationMatrix[thz, {0, 0, 1}];
c = Cuboid[{0, 0, 0}, {3, 2, 1}];
c1 = GeometricTransformation[c, Qx.Qy.Qz];
c2 = GeometricTransformation[c, Qz.Qy.Qx];
Graphics3D[{c, {Blue, c1}, {Red, c2}}, AxesStyle > {Directive[Bold, 13], Directive[Bold, 13], Directive[Bold, 13]}, AxesLabel > {“x”, “y”, “z”}, Axes > True, AxesOrigin > {0, 0, 0}], {thx, 0, 2 Pi}, {thy, 0, 2 Pi}, {thz, 0, 2 Pi}]
Example 7
In the following code, two reflection matrices are created using the “ReflectionMatrix[vector]” function. Reflection is applied across the plane perpendicular to the vector specified. The blue and red triangles are reflections across the planes passing through the origin and perpendicular to the blue and red arrow directions, respectively.
View Mathematica Code
Q2=ReflectionMatrix[{1,1}]
Points={{0,1},{5,1},{2,3},{0,1}};
Points1=Table[Q1.Points[[i]],{i,1,4}];
Points2=Table[Q2.Points[[i]],{i,1,4}];
L1=Arrow[{{5,0},{5,0}}]
L2=Arrow[{{5,5},{5,5}}]
c=Polygon[Points];
c1=Polygon[Points1];
c2=Polygon[Points2];
(*In gray tones*)
Graphics[{c,{GrayLevel[0.2],c1},{Arrowheads[{.1,.1}],{GrayLevel[0.2],L1}},{Arrowheads[{.1,.1}],{GrayLevel[0.5],L2}},{GrayLevel[0.5],c2}},Axes>True,AxesStyle>{Directive[Bold,13],Directive[Bold,13]},AxesOrigin>{0,0}]
(*In colour*)
Graphics[{c,{Blue,c1},{Arrowheads[{.1,.1}],{Blue,L1}},{Arrowheads[{.1,.1}],{Red,L2}},{Red,c2}},Axes>True,AxesOrigin>{0,0}]
Problems
 Show that a matrix is not invertible if and only if 0 is an eigenvalue for . In this case, what can you say about the set .
 Find the determinant, the eigenvalues, and the eigenvectors of the following matrices. If a matrix is not invertible, then find its kernel. If a matrix is invertible, then, find its inverse:
 Repeat the previous question for the following matrices:
 Consider the vectors , and . Find the volume of the parallelepiped formed by the three vectors. Also, find the volume of the parallelepiped formed when the three vectors are linearly mapped using the matrices , and defined below. Comment on the results.
 Consider a parallelepiped with edges , and where , and . Determine the new volume of the parallelpiped after a transformation of the space by the matrix :

Chose a value for in the following matrices so that each matrix is not invertible. Then, find the kernel in each case:
 Use Mathematica Software to draw a twodimensional polygon with five sides, and then use the table command to create 10 copies of the polygon rotated with an angle between each copy. Finally, use the graphics command to view the 10 polygons you drew.
 The shown rectangle has a length of 2 units and height of 4 units. Find the coordinates of its vertices in the orthonormal basis set . Find the coordinates of the vertices in the coordinate system defined by the basis set .
 The shown rectangle has a length of 2 units and height of 4 units. Find the coordinates of its vertices if the rectangle is rotated counterclockwise by the angle shown in the figure. Comment on the difference between the linear mapping used in this problem and that used in the previous problem.
 Verify that the following matrix is an orthogonal matrix, and specify whether it is a rotation or a reflection.
 Find the components , and so that the following is a rotation matrix:
 Find the components , and so that the following is a reflection matrix:
 Find two possible combinations for the missing components in so that it is a rotation matrix:
 Find two possible combinations for the missing components in so that it is an orthogonal matrix associated with reflection:

Consider the orthonormal basis set and the matrix :
 Let . Verify that and find the vector that is orthogonal to both , and . Find a new orthonormal basis set using the normalized vectors of , and .
 Find the components of the matrix in the new orthonormal basis set .
 Find the three invariants of and and verify that they are equal.
 Find the eigenvalues of and and verify that they are equal.
 Find the components of the eigenvectors of and the eigenvectors of and comment on whether they are the same vectors or not.
 Repeat the previous question with , and:
 Consider the orthonormal basis set and the matrix :
 Consider the symmetric matrix :
 Find the eigenvalues and eigenvectors of .
 Find a new coordinate system such that the matrix of components in the new coordinate system is a diagonal matrix.
 Identify the positive definite and semipositive definite symmetric matrices in the following:
 Find the missing values in the components of the orthogonal matrix so that it represents a change of basis while maintaining the proper orientation.
 Find the eigenvalues and eigenvectors of the following symmetric matrices and then perform the diagonalization process for each.
 The figure below shows a square with dimension . Determine the transformation matrix applied to the object to produce the image shown.
 Let , and be three vectors that are linearly independent. Using the properties of the dot product, construct an orthonormal basis set as a function of , and . (The construction is referred to as: GramSchmidt Process)
 Let . Find an example of a matrix such that . Then, show that if is a rotation matrix, then .
 Using Einstein summation convention, and assuming that the underlying space is the Euclidean space , show that the following relations hold true for the Kronecker Delta and the alternator :
 Write the following expressions out in full assuming that the underlying space is the Euclidean space :
 Write the following expressions in a compact form using index notation and the Einstein summation convention:

 .
 In the following expressions assume that

 Show that symmetric and antisymmetric matrices stay symmetric and antisymmetric, respectively, under any orthogonal coordinate transformation.
 Using the definitions of symmetric and antisymmetric tensors without reference to components.
 Using the component forms of symmetric and antisymmetric matrices.
 In a three dimensional Euclidean vector space, how many independent components will the following tensors have:
 A “completely symmetric” third order tensor.
 A “completely symmetric” fourth order tensor.
 Show that if and are symmetric matrices, then is not necessarily a symmetric matrix. (Hint: Find a counter example). On the other hand, show that if and are symmetric matrices that have the same eigenvectors (also called “coaxial”), then and are symmetric.
 Show that if is a symmetric matrix, then , the matrix is symmetric.
 Let and is the identity matrix. Using the algebraic structure of matrices, show that if and , then . The matrix is referred to as the inverse of and is denoted .
 Let be a symmetric matrix. Let and be the minimum and maximum eigenvalues of . Show that . (The quantity is referred to as the Rayleigh Quotient)
 Let . Let be an invertible symmetric matrix. Show the following:
 is symmetric.
 Let be a symmetric matrix. Let be another matrix. Find the restriction on to ensure that the matrix is symmetric, i.e., that . (Hint: in a coordinate system of the eigenvectors of the ratios between the off diagonal components of is equal to the ratios between the corresponding eigenvalues of )

As will be discussed later, the stress at a point can be described as a symmetric matrix with the following form: