︠64f6ecb2-282e-4457-9fee-5d5380ea8a3ci︠ %html

Links to other worksheets:

Book, (1) Linear Algebra Arithmetic, (2) Linear Algebra Applications, (4) Linear Transformations, (5) Changing Bases

︡52453910-29ce-4d99-821b-d96ff4aa9aab︡{"html": "

Links to other worksheets:

\n

Book, (1) Linear Algebra Arithmetic, (2) Linear Algebra Applications, (4) Linear Transformations, (5) Changing Bases

"}︡ ︠23b5e48f-e6a6-4ceb-b6e3-1ca28dce161ei︠ %html

This first block of code comes from the Linear Tranformation unit.  It is a reminder of how a linear transformation transforms the plane.  Most of the examples in this unit take the code below and modify it slightly to illustrate change of bases.

︡c3355d80-c3c4-4ac4-9e00-f612f32290e9︡{"html": "

This first block of code comes from the Linear Tranformation unit.  It is a reminder of how a linear transformation transforms the plane.  Most of the examples in this unit take the code below and modify it slightly to illustrate change of bases.

"}︡ ︠e31232e2-a543-4d5d-87fe-f2e639332fcd︠ A=matrix(QQ, [[2,1], [0,3]]) EV=A.eigenvectors_right() e1=vector([1,0]) e2=vector([0,1]) c1,c2=A.columns() z=(0,0) boxplot=arrow(z,e1,color='red',aspect_ratio=1) boxplot+=arrow(z,e2,color='blue') boxplot+=arrow(e2,e2+e1,color='red',linestyle='dashed') boxplot+=arrow(e1,e1+e2,color='blue',linestyle='dashed') boxplot+=arrow(z,c1,color='red',aspect_ratio=1) boxplot+=arrow(z,c2,color='blue') boxplot+=arrow(c2,c2+c1,color='red',linestyle='dashed') boxplot+=arrow(c1,c1+c2,color='blue',linestyle='dashed') evplot=arrow(z,z) for i in range(len(EV)): for j in range( len( EV[i][1] ) ): if EV[i][0]==EV[i][0].conjugate(): evplot+=arrow(z,EV[i][0]*(EV[i][1][j])/EV[i][1][j].norm(),color='purple') evplot+=arrow(z,(EV[i][1][j])/EV[i][1][j].norm(),color='green') evplot+=arrow(z,-EV[i][0]*(EV[i][1][j])/EV[i][1][j].norm(),color='purple') evplot+=arrow(z,-(EV[i][1][j])/EV[i][1][j].norm(),color='green') var('t') r=vector([cos(t),sin(t)]) circleplot=parametric_plot(r,(t,0,2*pi)) circleplot+=parametric_plot(A*r,(t,0,2*pi)) r=1/3*vector([(1 - sin(t))*cos(t)+1.5, (1 - sin(t))*sin(t)+2.5]) heart=parametric_plot( r, (t, pi/2, 3*pi/2),color='black') heart+=parametric_plot( r, (t, -pi/2, pi/2),color='brown') heart+=parametric_plot( A*r, (t, pi/2, 3*pi/2),color='black') heart+=parametric_plot( A*r, (t, -pi/2, pi/2),color='brown') html.table([["Matrix",A],["Determinant",A.det()],["Eigenvalues and Eigenvectors","Under the table"],[ boxplot+heart,boxplot+evplot+circleplot ]]) EV ︡e0bcfafc-6b4b-47f2-a205-d463c14b6741︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Matrix\\left(\\begin{array}{rr}\n2 & 1 \\\\\n0 & 3\n\\end{array}\\right)
Determinant6
Eigenvalues and EigenvectorsUnder the table
\n
\n"}︡{"stdout": "[(3, [\n(1, 1)\n], 1), (2, [\n(1, 0)\n], 1)]"}︡ ︠48df0094-b9ba-45b9-b2dd-12749d763ab8i︠ %html

The code below shows how a basis for $\mathbb{R}^2$ is really just a way of defining a new coordinate system ($xy$ axes) in 2D. The coordinates of $(a,b)$ relative to this new system satisfy $A [(a,b)] = (a,b)$, so the coordinates are $[(a,b)]=A^{-1}(a,b)$.

︡2770d500-b452-4f1b-a086-a2caeee0e44e︡{"html": "

The code below shows how a basis for $\\mathbb{R}^2$ is really just a way of defining a new coordinate system ($xy$ axes) in 2D. The coordinates of $(a,b)$ relative to this new system satisfy $A [(a,b)] = (a,b)$, so the coordinates are $[(a,b)]=A^{-1}(a,b)$.

"}︡ ︠f8e9936b-5bc4-4854-ae83-9481ce2aea75︠ Basis=[[1,2],[2,-3]] A=matrix(QQ, Basis).transpose() e1=vector([1,0]) e2=vector([0,1]) c1,c2=A.columns() z=(0,0) boxplot=arrow(z,c1,color='red',aspect_ratio=1) boxplot+=arrow(z,c2,color='blue') for n in [-2,-1,0,1,2]: for m in [-2,-1,0,1,2]: boxplot+=arrow(m*c1+n*c2,m*c1+n*c2+c1,color='red',linestyle='dashed') boxplot+=arrow(m*c2+n*c1,m*c2+n*c1+c2,color='blue',linestyle='dashed') var('a,b') html.table([ ["Basis",Basis], ["Matrix",A], ["Inverse",A.inverse()], ["Determinant",A.det()], ["vector (a,b) has coordinates [(a,b)]_S = ",A.inverse()*vector([a,b])], [ boxplot ] ]) ︡a9ee2f46-2ed5-4545-a160-ac304addc725︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Basis\\left[\\left[1, 2\\right], \\left[2, -3\\right]\\right]
Matrix\\left(\\begin{array}{rr}\n1 & 2 \\\\\n2 & -3\n\\end{array}\\right)
Inverse\\left(\\begin{array}{rr}\n\\frac{3}{7} & \\frac{2}{7} \\\\\n\\frac{2}{7} & -\\frac{1}{7}\n\\end{array}\\right)
Determinant-7
vector (a,b) has coordinates [(a,b)]_S = \\left(\\frac{3}{7} \\, a + \\frac{2}{7} \\, b,\\frac{2}{7} \\, a - \\frac{1}{7} \\, b\\right)
\n
\n"}︡ ︠8d52104a-7376-402d-a23c-f01cbd46da75i︠ %html

The code below shows how a basis for $\mathbb{R}^3$ is really just a way of defining a new coordinate system ($xyz$ axes) in 3D. The coordinates of $(a,b,c)$ relative to this new system satisfy $A [(a,b,c)] = (a,b,c)$, so the coordinates are $[(a,b,c)]=A^{-1}(a,b,c)$.

︡9c7c2363-fbf9-41b0-b51b-14f0175fb909︡{"html": "

The code below shows how a basis for $\\mathbb{R}^3$ is really just a way of defining a new coordinate system ($xyz$ axes) in 3D. The coordinates of $(a,b,c)$ relative to this new system satisfy $A [(a,b,c)] = (a,b,c)$, so the coordinates are $[(a,b,c)]=A^{-1}(a,b,c)$.

"}︡ ︠cb0fab6b-556b-4a70-91db-af3d484e19e6︠ Basis=[[1,2,0],[2,-3,0],[0,-1,1]] A=matrix(QQ, Basis).transpose() e1=vector([1,0,0]) e2=vector([0,1,0]) e3=vector([0,0,1]) c1,c2,c3=A.columns() z=(0,0,0) boxplot=arrow3d(z,c1,color='red',aspect_ratio=1) boxplot+=arrow3d(z,c2,color='blue') boxplot+=arrow3d(z,c3,color='green') for n in [-1,0,1]: for m in [-1,0,1]: for p in [-1,0,1]: boxplot+=arrow3d(m*c1+n*c2+p*c3,m*c1+n*c2+p*c3+c1,color='red',linestyle='dashed') boxplot+=arrow3d(m*c2+n*c1+p*c3,m*c2+n*c1+p*c3+c2,color='blue',linestyle='dashed') boxplot+=arrow3d(m*c2+n*c1+p*c3,m*c2+n*c1+p*c3+c3,color='green',linestyle='dashed') var('a,b,c') html.table([ ["Basis",Basis], ["Matrix",A], ["Inverse",A.inverse()], ["Determinant",A.det()], ["vector (a,b,c) has coordinates [(a,b)]_S = ",A.inverse()*vector([a,b,c])] ]) boxplot ︡a55ced55-3215-4c66-ab12-14d47626debf︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Basis\\left[\\left[1, 2, 0\\right], \\left[2, -3, 0\\right], \\left[0, -1, 1\\right]\\right]
Matrix\\left(\\begin{array}{rrr}\n1 & 2 & 0 \\\\\n2 & -3 & -1 \\\\\n0 & 0 & 1\n\\end{array}\\right)
Inverse\\left(\\begin{array}{rrr}\n\\frac{3}{7} & \\frac{2}{7} & \\frac{2}{7} \\\\\n\\frac{2}{7} & -\\frac{1}{7} & -\\frac{1}{7} \\\\\n0 & 0 & 1\n\\end{array}\\right)
Determinant-7
vector (a,b,c) has coordinates [(a,b)]_S = \\left(\\frac{3}{7} \\, a + \\frac{2}{7} \\, b + \\frac{2}{7} \\, c,\\frac{2}{7} \\, a - \\frac{1}{7} \\, b - \\frac{1}{7} \\, c,c\\right)
\n
\n"}︡ ︠5e4f9261-db67-4c05-9c59-05f3797a3814i︠ %html

The following code illustrates how the exact same vector has different coordinates relative to different bases.  Remember that the vector always satisfies $$B[\vec v]_S=\vec v.$$ So if $S$ and $S'$ are two different bases, with matrices $B$ and $B'$ formed by placing the basis vectors in columns, then $$B[\vec v]_S = B'[\vec v]_{S'}.$$ We can then compute two change of bases matrices $$P[\vec v]_S = [\vec v]_{S'}\quad \text{and}\quad Q[\vec v]_{S'} = [\vec v]_{S}$$ where $P = B'^{-1}B$ and $Q = B^{-1} B'$.

 

︡d0c80993-c370-473a-8aab-73d980fb4924︡{"html": "

The following code illustrates how the exact same vector has different coordinates relative to different bases.  Remember that the vector always satisfies $$B[\\vec v]_S=\\vec v.$$ So if $S$ and $S'$ are two different bases, with matrices $B$ and $B'$ formed by placing the basis vectors in columns, then $$B[\\vec v]_S = B'[\\vec v]_{S'}.$$ We can then compute two change of bases matrices $$P[\\vec v]_S = [\\vec v]_{S'}\\quad \\text{and}\\quad Q[\\vec v]_{S'} = [\\vec v]_{S}$$ where $P = B'^{-1}B$ and $Q = B^{-1} B'$.

\n

 

"}︡ ︠125c0a50-cfb0-4aee-bfd4-501b531bd841︠ Basis1=[[1,2],[2,-3]] Basis2=[[1,0],[2,1]] v=vector([5,1]) A1=matrix(QQ, Basis1).transpose() A2=matrix(QQ, Basis2).transpose() e1=vector([1,0]) e2=vector([0,1]) b11,b12=A1.columns() b21,b22=A2.columns() z=(0,0) boxplot1=arrow(z,b11,color='red',aspect_ratio=1) boxplot1+=arrow(z,b12,color='blue') for n in [-2,-1,0,1,2]: for m in [-2,-1,0,1,2]: boxplot1+=arrow(m*b11+n*b12,m*b11+n*b12+b11,color='red',linestyle='dashed') boxplot1+=arrow(m*b12+n*b11,m*b12+n*b11+b12,color='blue',linestyle='dashed') boxplot1+=arrow(z,v,color='black') boxplot2=arrow(z,b21,color='red',aspect_ratio=1) boxplot2+=arrow(z,b22,color='blue') for n in [-2,-1,0,1,2]: for m in [-2,-1,0,1,2]: boxplot2+=arrow(m*b21+n*b22,m*b21+n*b22+b21,color='red',linestyle='dashed') boxplot2+=arrow(m*b22+n*b21,m*b22+n*b21+b22,color='blue',linestyle='dashed') boxplot2+=arrow(z,v,color='black') var('a,b') html.table([ ["Basis"],[Basis1,Basis2], ["Matrix"],[A1,A2], ["Inverse"],[A1.inverse(),A2.inverse()], ["Determinant"],[A1.det(),A2.det()], ["P = (B2)^{-1} B1 and Q = B1^{-1} B2"], [A2.inverse()*A1, A1.inverse()*A2], ["The coordinates of v relative to each basis",v],[A1.inverse()*v,A2.inverse()*v], [ boxplot1,boxplot2 ] ]) ︡3bcd6797-05a3-4770-a929-07cbdcba511e︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Basis
\\left[\\left[1, 2\\right], \\left[2, -3\\right]\\right]\\left[\\left[1, 0\\right], \\left[2, 1\\right]\\right]
Matrix
\\left(\\begin{array}{rr}\n1 & 2 \\\\\n2 & -3\n\\end{array}\\right)\\left(\\begin{array}{rr}\n1 & 2 \\\\\n0 & 1\n\\end{array}\\right)
Inverse
\\left(\\begin{array}{rr}\n\\frac{3}{7} & \\frac{2}{7} \\\\\n\\frac{2}{7} & -\\frac{1}{7}\n\\end{array}\\right)\\left(\\begin{array}{rr}\n1 & -2 \\\\\n0 & 1\n\\end{array}\\right)
Determinant
-71
P = (B2)^{-1} B1 and Q = B1^{-1} B2
\\left(\\begin{array}{rr}\n-3 & 8 \\\\\n2 & -3\n\\end{array}\\right)\\left(\\begin{array}{rr}\n\\frac{3}{7} & \\frac{8}{7} \\\\\n\\frac{2}{7} & \\frac{3}{7}\n\\end{array}\\right)
The coordinates of v relative to each basis\\left(5,1\\right)
\\left(\\frac{17}{7},\\frac{9}{7}\\right)\\left(3,1\\right)
\n
\n"}︡ ︠75ac2306-d855-41fd-8f1b-ee7f56e8844ai︠ %html

The words "change of basis matrix from $S$ to $S'$" are used in two opposite ways in different places. The matrix $P$ in $P[\vec v]_S = [\vec v]_{S'}$ can be call the change of basis matrix from $S$ to $S'$ or the change of basis matrix from $S'$ to $S$ (notice the reversal).  It depends on the context and the use the author wished to emphasize.

  1. If we start with coordinates $[\vec v]_S$ relative to $S$, then multiplying by $P$ on the left transforms these to coordinates $[\vec v]_{S'}$ relative to $S'$.  We say that $P$ is a change of basis matrix from $S$ to $S'$, as inputing coordinates relative to $S$ outputs coordinates relative to $S'$. Think of multiplication by $P$ as a way to transform us from what we know $S$ to what we want $S'$.
  2. If we start with coordinates $[\vec v]_{S'}$ relative to $S'$, then replacing $[\vec v]_{S'}$ with $P[\vec v]_{S}$ transform equations written relative to ${S'}$ into equations written relative to $S$.  We then say that $P$ is a change of basis matrix from $S'$ to $S$, as it transforms equation from $S'$ to $S$.

The following code shows how to change equations from one coordinate system to another. In the example below, the set $S$ is the standard basis, whereas the set $S'$ is the standard basis rotated 45 degrees counterclockwise.  Here are some things to notice:

The $xy$ axes are marked in red and blue.The $uv$ axes are marked in orange and green. You can modify the xy basis, the uv basis, as well as any of the equations. If you need to adjust the viewing bounds to include more than [-3,3] in each window, feel free to adjust these.

︡956dc51a-0aef-4f0d-84f2-878c1249ba21︡{"html": "

The words \"change of basis matrix from $S$ to $S'$\" are used in two opposite ways in different places. The matrix $P$ in $P[\\vec v]_S = [\\vec v]_{S'}$ can be call the change of basis matrix from $S$ to $S'$ or the change of basis matrix from $S'$ to $S$ (notice the reversal).  It depends on the context and the use the author wished to emphasize.

\n
    \n
  1. If we start with coordinates $[\\vec v]_S$ relative to $S$, then multiplying by $P$ on the left transforms these to coordinates $[\\vec v]_{S'}$ relative to $S'$.  We say that $P$ is a change of basis matrix from $S$ to $S'$, as inputing coordinates relative to $S$ outputs coordinates relative to $S'$. Think of multiplication by $P$ as a way to transform us from what we know $S$ to what we want $S'$.
  2. \n
  3. If we start with coordinates $[\\vec v]_{S'}$ relative to $S'$, then replacing $[\\vec v]_{S'}$ with $P[\\vec v]_{S}$ transform equations written relative to ${S'}$ into equations written relative to $S$.  We then say that $P$ is a change of basis matrix from $S'$ to $S$, as it transforms equation from $S'$ to $S$.
  4. \n
\n

The following code shows how to change equations from one coordinate system to another. In the example below, the set $S$ is the standard basis, whereas the set $S'$ is the standard basis rotated 45 degrees counterclockwise.  Here are some things to notice:

\n\n

The $xy$ axes are marked in red and blue.The $uv$ axes are marked in orange and green. You can modify the xy basis, the uv basis, as well as any of the equations. If you need to adjust the viewing bounds to include more than [-3,3] in each window, feel free to adjust these.

"}︡ ︠833c1554-1b40-4ad8-8b72-8310e4c62faa︠ var('x,y,u,v,a,b') xybasis = [[1,0],[0,1]] uvbasis = [[1/sqrt(2),1/sqrt(2)],[-1/sqrt(2),1/sqrt(2)]] uv_eqn = u^2/4+v^2/9==1 xy_eqn = y==sin(pi*x) B1 = matrix(xybasis).transpose() B2 = matrix(uvbasis).transpose() xycoordinates = B1.inverse()*vector([a,b]) uvcoordinates = B2.inverse()*vector([a,b]) P1 = B1.inverse()*B2 #Solve for [v]_S1 P2 = B2.inverse()*B1 #Solve for [v]_S2 uv_in_terms_of_xy = P2*vector([x,y]) xy_in_terms_of_uv = P1*vector([u,v]) uv_eqn_to_xy = uv_eqn.subs(u=uv_in_terms_of_xy[0],v=uv_in_terms_of_xy[1]) xy_eqn_to_uv = xy_eqn.subs(x=xy_in_terms_of_uv[0],y=xy_in_terms_of_uv[1]) html.table([ ["Basis", xybasis, uvbasis], ["Basis Matrix", B1, B2], ["Inverse", B1.inverse(), B2.inverse()], ["Coordinates of (a,b)", xycoordinates, uvcoordinates], ["(x,y) = some function of (u,v)",xy_in_terms_of_uv,vector([u,v])], ["(u,v) = some function of (x,y)",vector([x,y]),uv_in_terms_of_xy], ["Changing an equation from uv to xy", uv_eqn_to_xy, uv_eqn], ["Changing an equation from xy to uv", xy_eqn, xy_eqn_to_uv], ]) html.table([ [implicit_plot(uv_eqn_to_xy,(x,-3,3),(y,-3,3),aspect_ratio=1,axes_labels=["x - axis","y - axis"])+implicit_plot(xy_eqn,(x,-3,3),(y,-3,3))+arrow((-3*P1).column(0),(3*P1).column(0),color='orange')+arrow((-3*P1).column(1),(3*P1).column(1),color='green')+arrow([-3,0],[3,0],color='red')+arrow([0,-3],[0,3],color='blue') , implicit_plot(xy_eqn_to_uv,(u,-3,3),(v,-3,3),aspect_ratio=1,axes_labels=["u - axis","v - axis"])+implicit_plot(uv_eqn,(u,-3,3),(v,-3,3))+arrow((-3*P2).column(0),(3*P2).column(0),color='red')+arrow((-3*P2).column(1),(3*P2).column(1),color='blue')+arrow([-3,0],[3,0],color='orange')+arrow([0,-3],[0,3],color='green') ] ]) ︡c40f31ef-5547-4d97-bf8b-1bf2860f594f︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Basis\\left[\\left[1, 0\\right], \\left[0, 1\\right]\\right]\\left[\\left[\\frac{1}{2} \\, \\sqrt{2}, \\frac{1}{2} \\, \\sqrt{2}\\right], \\left[-\\frac{1}{2} \\, \\sqrt{2}, \\frac{1}{2} \\, \\sqrt{2}\\right]\\right]
Basis Matrix\\left(\\begin{array}{rr}\n1 & 0 \\\\\n0 & 1\n\\end{array}\\right)\\left(\\begin{array}{rr}\n\\frac{1}{2} \\, \\sqrt{2} & -\\frac{1}{2} \\, \\sqrt{2} \\\\\n\\frac{1}{2} \\, \\sqrt{2} & \\frac{1}{2} \\, \\sqrt{2}\n\\end{array}\\right)
Inverse\\left(\\begin{array}{rr}\n1 & 0 \\\\\n0 & 1\n\\end{array}\\right)\\left(\\begin{array}{rr}\n\\frac{1}{2} \\, \\sqrt{2} & \\frac{1}{2} \\, \\sqrt{2} \\\\\n-\\frac{1}{2} \\, \\sqrt{2} & \\frac{1}{2} \\, \\sqrt{2}\n\\end{array}\\right)
Coordinates of (a,b)\\left(a,b\\right)\\left(\\frac{1}{2} \\, \\sqrt{2} a + \\frac{1}{2} \\, \\sqrt{2} b,-\\frac{1}{2} \\, \\sqrt{2} a + \\frac{1}{2} \\, \\sqrt{2} b\\right)
(x,y) = some function of (u,v)\\left(\\frac{1}{2} \\, \\sqrt{2} u - \\frac{1}{2} \\, \\sqrt{2} v,\\frac{1}{2} \\, \\sqrt{2} u + \\frac{1}{2} \\, \\sqrt{2} v\\right)\\left(u,v\\right)
(u,v) = some function of (x,y)\\left(x,y\\right)\\left(\\frac{1}{2} \\, \\sqrt{2} x + \\frac{1}{2} \\, \\sqrt{2} y,-\\frac{1}{2} \\, \\sqrt{2} x + \\frac{1}{2} \\, \\sqrt{2} y\\right)
Changing an equation from uv to xy\\frac{1}{36} \\, {\\left(\\sqrt{2} x - \\sqrt{2} y\\right)}^{2} + \\frac{1}{16} \\, {\\left(\\sqrt{2} x + \\sqrt{2} y\\right)}^{2} = 1\\frac{1}{4} \\, u^{2} + \\frac{1}{9} \\, v^{2} = 1
Changing an equation from xy to uvy = \\sin\\left(\\pi x\\right)\\frac{1}{2} \\, \\sqrt{2} u + \\frac{1}{2} \\, \\sqrt{2} v = \\sin\\left(\\frac{1}{2} \\, {\\left(\\sqrt{2} u - \\sqrt{2} v\\right)} \\pi\\right)
\n
\n"}︡{"html": "\n
\n\n\n\n\n\n\n\n
\n
\n"}︡ ︠6ab65047-150d-499e-aa03-f8ceada35de2i︠ %html

In the previous worksheet, we saw how a linear transformation tells us how to map the unit square to a parallelogram.  When you pick a different basis, the "unit square" is really a parallelogram whose edges are formed by the basis vectors.  This parallelogram representing the unit square is then mapped to the range and we have to find its coordinates relative to the new basis. In what follows below, we use the following color scheme:

  1. In the left picture, which represents the domain:
  2. In the right picture, which represents the range

The columns of $[T]_{S,S'}$ are precisely the coordinates of the images of the red and blue vectors relative to the orange and green vectors.

︡b595907e-b753-4219-b289-8c6faa590773︡{"html": "

In the previous worksheet, we saw how a linear transformation tells us how to map the unit square to a parallelogram.  When you pick a different basis, the \"unit square\" is really a parallelogram whose edges are formed by the basis vectors.  This parallelogram representing the unit square is then mapped to the range and we have to find its coordinates relative to the new basis. In what follows below, we use the following color scheme:

\n
    \n
  1. In the left picture, which represents the domain:\n\n
  2. \n
  3. In the right picture, which represents the range\n\n
  4. \n
\n

The columns of $[T]_{S,S'}$ are precisely the coordinates of the images of the red and blue vectors relative to the orange and green vectors.

"}︡ ︠308621f6-8ceb-4836-b722-0ab39a794791︠ domain_basis=[[-1,1],[2,1]] range_basis=[[3,0],[0,2]] standard_matrix=matrix(QQ, [[2,1], [0,3]]) A=standard_matrix B1=matrix(QQ,domain_basis).transpose() B2=matrix(QQ,range_basis).transpose() e1=vector([1,0]) e2=vector([0,1]) c1,c2=A.columns() d1,d2=B1.columns() r1,r2=B2.columns() z=(0,0) boxplot1=arrow(z,e1,color='black',aspect_ratio=1) boxplot1+=arrow(z,e2,color='brown') boxplot1+=arrow(e2,e2+e1,color='black',linestyle='dashed') boxplot1+=arrow(e1,e1+e2,color='brown',linestyle='dashed') boxplot1+=arrow(z,d1,color='red',aspect_ratio=1) boxplot1+=arrow(z,d2,color='blue') boxplot1+=arrow(d2,d2+d1,color='red',linestyle='dashed') boxplot1+=arrow(d1,d1+d2,color='blue',linestyle='dashed') boxplot2=arrow(z,c1,color='black',aspect_ratio=1) boxplot2+=arrow(z,c2,color='brown') boxplot2+=arrow(c2,c2+c1,color='black',linestyle='dashed') boxplot2+=arrow(c1,c1+c2,color='brown',linestyle='dashed') boxplot2+=arrow(z,A*d1,color='red',aspect_ratio=1) boxplot2+=arrow(z,A*d2,color='blue') boxplot2+=arrow(A*d2,A*(d2+d1),color='red',linestyle='dashed') boxplot2+=arrow(A*d1,A*(d1+d2),color='blue',linestyle='dashed') for n in [-2,-1,0,1,2]: for m in [-2,-1,0,1,2]: boxplot2+=arrow(m*r1+n*r2,m*r1+n*r2+r1,color='orange',linestyle='dashed') boxplot2+=arrow(m*r2+n*r1,m*r2+n*r1+r2,color='green',linestyle='dashed') var('x,y,a,b') html.table([ ["$S$ - Basis for Domain",domain_basis], ["$S'$ - Basis for Range",range_basis], ["$B$ - matrix of domain basis vectors",B1], ["$B'$ - matrix of range basis vectors",B2], ["$B'^{-1}$", B2.inverse() ], ["$T(x,y)$ - The linear transformation ",A*vector([x,y])], ["$[T]_{E_2}$ - The standard matrix representation ",A], ["$[T]_{S,S'}$ - The matrix representation relative to $S$ and $S'$",B2.inverse()*A*B1], ["$[T(s,y)]_{S_'} = [T]_{S,S'}[(a,b)]_S$",B2.inverse()*A*vector([a,b])], [boxplot1,boxplot2], ]) ︡3c2dee68-8a3f-48cf-8486-29e7815ff6d0︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
S - Basis for Domain\\left[\\left[-1, 1\\right], \\left[2, 1\\right]\\right]
S' - Basis for Range\\left[\\left[3, 0\\right], \\left[0, 2\\right]\\right]
B - matrix of domain basis vectors\\left(\\begin{array}{rr}\n-1 & 2 \\\\\n1 & 1\n\\end{array}\\right)
B' - matrix of range basis vectors\\left(\\begin{array}{rr}\n3 & 0 \\\\\n0 & 2\n\\end{array}\\right)
B'^{-1}\\left(\\begin{array}{rr}\n\\frac{1}{3} & 0 \\\\\n0 & \\frac{1}{2}\n\\end{array}\\right)
T(x,y) - The linear transformation \\left(2 \\, x + y,3 \\, y\\right)
[T]_{E_2} - The standard matrix representation \\left(\\begin{array}{rr}\n2 & 1 \\\\\n0 & 3\n\\end{array}\\right)
[T]_{S,S'} - The matrix representation relative to S and S'\\left(\\begin{array}{rr}\n-\\frac{1}{3} & \\frac{5}{3} \\\\\n\\frac{3}{2} & \\frac{3}{2}\n\\end{array}\\right)
[T(s,y)]_{S_'} = [T]_{S,S'}[(a,b)]_S\\left(\\frac{2}{3} \\, a + \\frac{1}{3} \\, b,\\frac{3}{2} \\, b\\right)
\n
\n"}︡ ︠3c5dcab8-0913-4422-aab1-934bb7b9c234i︠ %html

The code below repeats what was done above, but without drawing any pictures. This way you can work with the code for any linear transformation of the form $T:\mathbb{R}^n\to \mathbb{R}^m$. As long as your vector spaces are finite dimensional, then the code below will help you see how to create a matrix representation relative to any basis.

︡e77f1d70-4cdf-413f-a871-ae5b47a556a5︡{"html": "

The code below repeats what was done above, but without drawing any pictures. This way you can work with the code for any linear transformation of the form $T:\\mathbb{R}^n\\to \\mathbb{R}^m$. As long as your vector spaces are finite dimensional, then the code below will help you see how to create a matrix representation relative to any basis.

"}︡ ︠fb5acb3d-ddcf-4d29-9e6b-c489f089393b︠ domain_basis=[[-1,1,0],[2,1,2],[3,-2,1]] range_basis=[[3,1],[-1,3]] var('a,b,c') v=vector([a,b,c]) #The vector you wish to transform - relative to a standard or 'usual' basis standard_matrix=matrix(QQ, [[2,1,0], [0,3,-2]]) A=standard_matrix B1=matrix(QQ,domain_basis).transpose() B2=matrix(QQ,range_basis).transpose() html.table([ ["$S$ - Basis for Domain",domain_basis], ["$S'$ - Basis for Range",range_basis], ["$B$ - matrix of domain basis vectors",B1], ["$B'$ - matrix of range basis vectors",B2], ["$B'^{-1}$", B2.inverse() ], ["$A=[T]$ - Standard matrix representation ",A], ["$[T]_{S,S'} = B'^{-1}AB$ - Matrix representation relative to $S$ and $S'$",B2.inverse()*A*B1], ["$v$ - standard coordinates",v], ["$[v]_S$ - coordinates relative to $S$",B1.inverse()*v], ["$T(v)$ - standard coordinates of $T(v)$",A*v], ["$[T(v)]_{S_'} = [T]_{S,S'}[v]_S$ - coordinates of $T(v)$ relative to $S'$",B2.inverse()*A*v], ]) ︡09515284-c78e-464c-9a34-098e68aba35d︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
S - Basis for Domain\\left[\\left[-1, 1, 0\\right], \\left[2, 1, 2\\right], \\left[3, -2, 1\\right]\\right]
S' - Basis for Range\\left[\\left[3, 1\\right], \\left[-1, 3\\right]\\right]
B - matrix of domain basis vectors\\left(\\begin{array}{rrr}\n-1 & 2 & 3 \\\\\n1 & 1 & -2 \\\\\n0 & 2 & 1\n\\end{array}\\right)
B' - matrix of range basis vectors\\left(\\begin{array}{rr}\n3 & -1 \\\\\n1 & 3\n\\end{array}\\right)
B'^{-1}\\left(\\begin{array}{rr}\n\\frac{3}{10} & \\frac{1}{10} \\\\\n-\\frac{1}{10} & \\frac{3}{10}\n\\end{array}\\right)
A=[T] - Standard matrix representation \\left(\\begin{array}{rrr}\n2 & 1 & 0 \\\\\n0 & 3 & -2\n\\end{array}\\right)
[T]_{S,S'} = B'^{-1}AB - Matrix representation relative to S and S'\\left(\\begin{array}{rrr}\n0 & \\frac{7}{5} & \\frac{2}{5} \\\\\n1 & -\\frac{4}{5} & -\\frac{14}{5}\n\\end{array}\\right)
v - standard coordinates\\left(a,b,c\\right)
[v]_S - coordinates relative to S\\left(-5 \\, a - 4 \\, b + 7 \\, c,a + b - c,-2 \\, a - 2 \\, b + 3 \\, c\\right)
T(v) - standard coordinates of T(v)\\left(2 \\, a + b,3 \\, b - 2 \\, c\\right)
[T(v)]_{S_'} = [T]_{S,S'}[v]_S - coordinates of T(v) relative to S'\\left(\\frac{3}{5} \\, a + \\frac{3}{5} \\, b - \\frac{1}{5} \\, c,-\\frac{1}{5} \\, a + \\frac{4}{5} \\, b - \\frac{3}{5} \\, c\\right)
\n
\n"}︡ ︠6de93654-28b8-4f07-ae08-65ad31d5963ai︠ %html

I still need to give an example of what happens if you choose the null space as part of your basis, and the image of the other vectors in your basis as a basis for the range.  Then the map is simply the identity. Maybe I won't visualize this, rather just show how to do it.

Then I need to show what happens if I use eigenvectors as the basis vectors.  This provides a really nice way to view the matrix transformation.

︡7a21a920-67e6-4e30-a28d-46749bdbc40e︡{"html": "

I still need to give an example of what happens if you choose the null space as part of your basis, and the image of the other vectors in your basis as a basis for the range.  Then the map is simply the identity. Maybe I won't visualize this, rather just show how to do it.

\n

Then I need to show what happens if I use eigenvectors as the basis vectors.  This provides a really nice way to view the matrix transformation.

"}︡ ︠1e65a01b-df0b-4dc6-9cbd-987e6cd2f625︠ standard_matrix=matrix(QQ, [[2,1], [0,3]]) EV=standard_matrix.right_eigenmatrix()[1] A=standard_matrix B1=EV B2=EV e1=vector([1,0]) e2=vector([0,1]) c1,c2=A.columns() d1,d2=B1.columns() r1,r2=B2.columns() z=(0,0) boxplot1=arrow(z,e1,color='black',aspect_ratio=1) boxplot1+=arrow(z,e2,color='brown') boxplot1+=arrow(e2,e2+e1,color='black',linestyle='dashed') boxplot1+=arrow(e1,e1+e2,color='brown',linestyle='dashed') boxplot1+=arrow(z,d1,color='red',aspect_ratio=1) boxplot1+=arrow(z,d2,color='blue') boxplot1+=arrow(d2,d2+d1,color='red',linestyle='dashed') boxplot1+=arrow(d1,d1+d2,color='blue',linestyle='dashed') boxplot2=arrow(z,c1,color='black',aspect_ratio=1) boxplot2+=arrow(z,c2,color='brown') boxplot2+=arrow(c2,c2+c1,color='black',linestyle='dashed') boxplot2+=arrow(c1,c1+c2,color='brown',linestyle='dashed') for n in [-2,-1,0,1,2]: for m in [-2,-1,0,1,2]: boxplot2+=arrow(m*r1+n*r2,m*r1+n*r2+r1,color='orange',linestyle='dashed') boxplot2+=arrow(m*r2+n*r1,m*r2+n*r1+r2,color='green',linestyle='dashed') boxplot2+=arrow(z,A*d1,color='red',aspect_ratio=1) boxplot2+=arrow(z,A*d2,color='blue') boxplot2+=arrow(A*d2,A*(d2+d1),color='red',linestyle='dashed') boxplot2+=arrow(A*d1,A*(d1+d2),color='blue',linestyle='dashed') var('x,y,a,b') html.table([ ["$P$ - matrix of basis vectors",B1], ["$P^{-1}$", B2.inverse() ], ["$T(x,y)$ - The linear transformation ",A*vector([x,y])], ["$[T]_{E_2}$ - The standard matrix representation ",A], ["$[T]_{P}$ - The matrix representation relative to eigenvectors",B2.inverse()*A*B1], ["$[T(a,b)]_{P} = [T]_{P}[(a,b)]_P$",B2.inverse()*A*vector([a,b])], [boxplot1,boxplot2], ]) ︡a7a3dcd8-f5cd-487d-ab95-86fbfe5e79c3︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
P - matrix of basis vectors\\left(\\begin{array}{rr}\n1 & 1 \\\\\n1 & 0\n\\end{array}\\right)
P^{-1}\\left(\\begin{array}{rr}\n0 & 1 \\\\\n1 & -1\n\\end{array}\\right)
T(x,y) - The linear transformation \\left(2 \\, x + y,3 \\, y\\right)
[T]_{E_2} - The standard matrix representation \\left(\\begin{array}{rr}\n2 & 1 \\\\\n0 & 3\n\\end{array}\\right)
[T]_{P} - The matrix representation relative to eigenvectors\\left(\\begin{array}{rr}\n3 & 0 \\\\\n0 & 2\n\\end{array}\\right)
[T(a,b)]_{P} = [T]_{P}[(a,b)]_P\\left(3 \\, b,2 \\, a - 2 \\, b\\right)
\n
\n"}︡ ︠6f724e3c-11d4-402c-8cce-6793a8855367︠ A=matrix(QQ, [[2,1], [0,3]]) EV=A.eigenvectors_right() print(EV) P=A.eigenmatrix_right()[1] e1=vector([1,0]) e2=vector([0,1]) c1,c2=(A*P).columns() ev1,ev2=P.columns() z=(0,0) boxplot=arrow(z,ev1,color='red',aspect_ratio=1) boxplot+=arrow(z,ev2,color='blue') boxplot+=arrow(ev2,ev2+ev1,color='red',linestyle='dashed') boxplot+=arrow(ev1,ev1+ev2,color='blue',linestyle='dashed') boxplot+=arrow(z,c1,color='red',aspect_ratio=1) boxplot+=arrow(z,c2,color='blue') boxplot+=arrow(c2,c2+c1,color='red',linestyle='dashed') boxplot+=arrow(c1,c1+c2,color='blue',linestyle='dashed') var('t') r=vector([cos(t),sin(t)]) circleplot=parametric_plot(P*r,(t,0,2*pi)) circleplot+=parametric_plot(A*P*r,(t,0,2*pi)) r=1/3*vector([(1 - sin(t))*cos(t)+1.5, (1 - sin(t))*sin(t)+2.5]) heart=parametric_plot( P*r, (t, pi/2, 3*pi/2),color='black') heart+=parametric_plot( P*r, (t, -pi/2, pi/2),color='brown') heart+=parametric_plot( A*P*r, (t, pi/2, 3*pi/2),color='black') heart+=parametric_plot( A*P*r, (t, -pi/2, pi/2),color='brown') html.table([ ["Eigenvalues",A.eigenvalues()], ["$P$ - matrix of basis vectors",P], ["$P^{-1}$", P.inverse() ], ["$T(x,y)$ - The linear transformation ",A*vector([x,y])], ["$[T]_{E_2}$ - The standard matrix representation ",A], ["$[T]_{P}$ - The matrix representation relative to eigenvectors",P.inverse()*A*P], ["$[T(a,b)]_{P} = [T]_{P}[(a,b)]_P$",P.inverse()*A*vector([a,b])], [ boxplot+heart,boxplot+circleplot ], ]) ︡b7d8e780-d51a-40ad-bf34-1c16a46fd908︡{"stdout": "[(3, [\n(1, 1)\n], 1), (2, [\n(1, 0)\n], 1)]"}︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Eigenvalues\\left[3, 2\\right]
P - matrix of basis vectors\\left(\\begin{array}{rr}\n1 & 1 \\\\\n1 & 0\n\\end{array}\\right)
P^{-1}\\left(\\begin{array}{rr}\n0 & 1 \\\\\n1 & -1\n\\end{array}\\right)
T(x,y) - The linear transformation \\left(2 \\, x + y,3 \\, y\\right)
[T]_{E_2} - The standard matrix representation \\left(\\begin{array}{rr}\n2 & 1 \\\\\n0 & 3\n\\end{array}\\right)
[T]_{P} - The matrix representation relative to eigenvectors\\left(\\begin{array}{rr}\n3 & 0 \\\\\n0 & 2\n\\end{array}\\right)
[T(a,b)]_{P} = [T]_{P}[(a,b)]_P\\left(3 \\, b,2 \\, a - 2 \\, b\\right)
\n
\n"}︡ ︠38c36662-6945-4a61-9782-c4d09f7dd5c4i︠ %html

When you choose as your basis a set of eigenvectors of $A$, the matrix $P$ whose columns are eigenvectors allows us to diagonalize $A$.  We have the equation $AP=PD$ where $D$ is the diagonal matrix whose diagonal entries are the eigenvectors.  The code below illustrates how to do this for any matrix.  If the matrix is not diagonalizable, it is precisely because there are not enough linearly independent eigenvectors. In this case, Jordan form provides a simple way to view the transformation.  We'll be looking at Jordan form more in the next unit.

︡faccfb25-8e74-41de-b1fd-a8a6d2920c43︡{"html": "

When you choose as your basis a set of eigenvectors of $A$, the matrix $P$ whose columns are eigenvectors allows us to diagonalize $A$.  We have the equation $AP=PD$ where $D$ is the diagonal matrix whose diagonal entries are the eigenvectors.  The code below illustrates how to do this for any matrix.  If the matrix is not diagonalizable, it is precisely because there are not enough linearly independent eigenvectors. In this case, Jordan form provides a simple way to view the transformation.  We'll be looking at Jordan form more in the next unit.

"}︡ ︠7c620167-a7a0-4f95-8641-44f0f4d08e0f︠ A=matrix(QQ, [[5,1,4], [0,5,3], [0,0,7] ]) EV=A.eigenvectors_right() P=A.eigenmatrix_right()[1] print(EV) html.table([ ["Eigenvalues - if there is a repeat, does P contain a column of zeros?",A.eigenvalues()], ["$P$ - matrix of basis vectors - does it contain a column of zeros?",P], ]) J, P = A.jordan_form(transformation = True) print("When there is not basis of eigenvectors, the matrix is not diagonalizable") html.table([ ["$P$ - matrix of basis vectors using generalized eigenvectors",P], ["$J=P^{-1}AP$ - Jordan Form",P.inverse()*A*P], ["$J$ - Jordan Form with an emphasis on the Jordan blocks",J], ]) ︡339abe59-2145-4e5b-b68e-d77bdb576ae6︡{"stdout": "[(7, [\n(1, 6/11, 4/11)\n], 1), (5, [\n(1, 0, 0)\n], 2)]"}︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n
Eigenvalues - if there is a repeat, does P contain a column of zeros?\\left[7, 5, 5\\right]
P - matrix of basis vectors - does it contain a column of zeros?\\left(\\begin{array}{rrr}\n1 & 1 & 0 \\\\\n\\frac{6}{11} & 0 & 0 \\\\\n\\frac{4}{11} & 0 & 0\n\\end{array}\\right)
\n
\n"}︡{"stdout": "When there is not basis of eigenvectors, the matrix is not diagonalizable"}︡{"html": "\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
P - matrix of basis vectors using generalized eigenvectors\\left(\\begin{array}{rrr}\n1 & 1 & 0 \\\\\n\\frac{6}{11} & 0 & 1 \\\\\n\\frac{4}{11} & 0 & 0\n\\end{array}\\right)
J=P^{-1}AP - Jordan Form\\left(\\begin{array}{rrr}\n7 & 0 & 0 \\\\\n0 & 5 & 1 \\\\\n0 & 0 & 5\n\\end{array}\\right)
J - Jordan Form with an emphasis on the Jordan blocks\\left(\\begin{array}{r}\n\\left(\\begin{array}{r}\n7\n\\end{array}\\right) & \\left(\\begin{array}{rr}\n0 & 0\n\\end{array}\\right) \\\\\n\\left(\\begin{array}{r}\n0 \\\\\n0\n\\end{array}\\right) & \\left(\\begin{array}{rr}\n5 & 1 \\\\\n0 & 5\n\\end{array}\\right)\n\\end{array}\\right)
\n
\n"}︡