{"id":720,"date":"2016-01-29T23:30:42","date_gmt":"2016-01-30T04:30:42","guid":{"rendered":"http:\/\/underthehood.blogwyrm.com\/?p=720"},"modified":"2022-07-28T06:27:07","modified_gmt":"2022-07-28T10:27:07","slug":"matrices-as-vectors","status":"publish","type":"post","link":"https:\/\/underthehood.blogwyrm.com\/?p=720","title":{"rendered":"Matrices as Vectors"},"content":{"rendered":"<p>This week&#8217;s post will be a short little dive into some of the lesser-known back-waters of linear algebra.  As discussed <a href=\"http:\/\/aristotle2digital.blogwyrm.com\/?p=265\">in other posts<\/a>, a vector space is a rather generic thing with applications to a wide variety of situations that often look quite different than the traditional length-and-direction or column-array pictures that tend to dot the landscape.  <\/p>\n<p>One particularly interesting application, if for no other reason than it helps break the fixation that a vector must look like an arrow or a vertically stacked set of numbers is the application to the set of $$2\\times2$$ matrices generically denoted as<\/p>\n<p>\\[ M = \\left[ \\begin{array}{cc} a &#038; b \\\\ c &#038; d \\end{array} \\right] \\; ,\\]<\/p>\n<p>where the unspecified numbers $$\\left\\{a, b, c, d\\right\\}$$ can be complex.<\/p>\n<p>There are two bases that are nice to use.  One is the obvious &#8216;natural&#8217; basis spanned by vectors <\/p>\n<p>\\[ \\left| v_1 \\right \\rangle = \\left[ \\begin{array}{cc} 1 &#038; 0 \\\\ 0 &#038; 0 \\end{array} \\right] \\; ,\\]<\/p>\n<p>\\[ \\left| v_2 \\right \\rangle = \\left[ \\begin{array}{cc} 0 &#038; 1 \\\\ 0 &#038; 0 \\end{array} \\right] \\; ,\\]<\/p>\n<p>\\[ \\left| v_3 \\right \\rangle = \\left[ \\begin{array}{cc} 0 &#038; 0 \\\\ 1 &#038; 0 \\end{array} \\right] \\; ,\\]<\/p>\n<p>and <\/p>\n<p>\\[ \\left| v_4 \\right \\rangle = \\left[ \\begin{array}{cc} 0 &#038; 0 \\\\ 0 &#038; 1 \\end{array} \\right] \\; .\\]<\/p>\n<p>The matrix $$M$$ is then decomposed, by inspection, to be<\/p>\n<p>\\[ \\left| M \\right \\rangle = a \\left| v_1 \\right \\rangle + b \\left| v_2 \\right \\rangle + c \\left| v_3 \\right \\rangle + d \\left| v_4 \\right \\rangle \\; .\\]<\/p>\n<p>Note the use of Dirac notation for both the basis vectors and the matrix $$M$$.  The reason for this notational standard is that it will suggest how to get the components without using inspection, which will be the goal for computer-based decomposition for the second basis discussed below. <\/p>\n<p>The usual way perform decomposition is to provide a natural inner product &#8211; bra with ket &#8211; so that, for example,  <\/p>\n<p>\\[ a = \\left \\langle w_1 \\right | \\left . M \\right \\rangle \\; .\\]<\/p>\n<p>So what is the rule for the bra $$\\left \\langle w_1 \\right |$$?  It can&#8217;t be the usual complex-conjugate, transpose since the right-hand side of the previous equation is a $$2\\times2$$ matrix but the left-hand side is a scalar.  Clearly, an added ingredient is needed.  And, as will be shown below, that added ingredient is taking the trace.<\/p>\n<p>How then to establish this?  Start by assuming the usual definition of the bra; that is let&#8217;s ignore the trace piece for the moment and define<\/p>\n<p>\\[ \\left \\langle w_i \\right | = \\left| v_i \\right \\rangle^{\\dagger} \\; i = 1,2,3,4 \\; .\\]<\/p>\n<p>The basic requirement to impose on the bra-ket relationship is <\/p>\n<p>\\[ \\left \\langle w_i \\right | \\left . v_j \\right \\rangle  = \\delta_{ij} \\; . \\]<\/p>\n<p>There are 16 possible combinations, but one really only need look at a subset to infer the pattern.  For convenience, take $$i=1$$ and let $$j=1,2,3,4$$.  The four resulting products are:<\/p>\n<p>\\[ \\left \\langle w_1 \\right | \\left. v_1 \\right \\rangle = \\left[ \\begin{array}{cc} 1 &#038; 0 \\\\ 0 &#038; 0 \\end{array} \\right] \\; ,\\]<\/p>\n<p>\\[ \\left \\langle w_1 \\right | \\left. v_2 \\right \\rangle = \\left[ \\begin{array}{cc} 0 &#038; 1 \\\\ 0 &#038; 0 \\end{array} \\right] \\; ,\\]<\/p>\n<p>\\[ \\left \\langle w_1 \\right | \\left. v_3 \\right \\rangle = \\left[ \\begin{array}{cc} 0 &#038; 0 \\\\ 0 &#038; 0 \\end{array} \\right] \\; ,\\]<\/p>\n<p>and<\/p>\n<p>\\[ \\left \\langle w_1 \\right | \\left. v_4 \\right \\rangle = \\left[ \\begin{array}{cc} 0 &#038; 0 \\\\ 0 &#038; 0 \\end{array} \\right] \\; .\\]<\/p>\n<p>The other 12 products are similar.  For each value of $$i$$, the matrix corresponding to $$j=i$$ has a single $$1$$ on the diagonal.  Of the three matrices that result from $$j \\neq i$$, two matrices are identically zero and the other one has a $$1$$ on the off-diagonal.  So to get a single outcome, $$0$$ for $$j \\neq i$$ and $$1$$ for $$j=i$$, simply take the trace of the resulting matrix.<\/p>\n<p>This algorithm applies equally well to the second basis, which is one that is based a set of matrices commonly found in modern physics.  This basis is spanned by the $$2\\times2$$ identity matrix and the Pauli matrices:<\/p>\n<p>\\[ \\left| I \\right \\rangle        = \\left[ \\begin{array}{cc} 1 &#038; 0  \\\\ 0 &#038; 1 \\end{array} \\right] \\; ,\\]<\/p>\n<p>\\[ \\left| \\sigma_x \\right \\rangle = \\left[ \\begin{array}{cc} 0 &#038; 1  \\\\ 1 &#038; 0 \\end{array} \\right] \\; ,\\]<\/p>\n<p>\\[ \\left| \\sigma_y \\right \\rangle = \\left[ \\begin{array}{cc} 0 &#038; -i \\\\ i &#038; 0 \\end{array} \\right] \\; ,\\]<\/p>\n<p>and <\/p>\n<p>\\[ \\left| \\sigma_z \\right \\rangle = \\left[ \\begin{array}{cc} 1 &#038; 0 \\\\ 0 &#038; -1 \\end{array} \\right] \\; .\\]<\/p>\n<p>There are two important points to raise here.  First, the bra-forms of this basis are identical to the basis itself.  Second, each Pauli matrix is trace-free.  Together these two properties simplify things.  To see this, start with the observation (which is well established in quantum mechanics texts) that the Pauli matrices obey the equation<\/p>\n<p>\\[  \\sigma_i \\sigma_j = i \\epsilon_{i j k} \\sigma_k + \\delta_{ij} I \\; .\\]<\/p>\n<p>Thus the trace-enabled inner product (bra-ket) adaptation that we are discussing becomes<\/p>\n<p>\\[ \\left \\langle \\sigma_i \\right | \\left . \\sigma_j \\right \\rangle = 2 \\delta_{i j} \\; , \\]<\/p>\n<p>where the first term on the right-hand side is zero since the Pauli matrices are traceless.<\/p>\n<p>There are two other types of combinations to consider.  One an inner product where one member is the identity matrix and the other is a Pauli matrix.  That inner product is zero again because the Pauli matrices are trace-free.  The second one inner product of the identity matrix with itself, which is simply $$2$$.  <\/p>\n<p>Decomposition by inspection really isn&#8217;t possible for a generic form of $$M$$, but a simple algorithm to perform the decomposition based on the analysis above is easy to implement.  The code to perform these computations in wxMaxima is:<\/p>\n<div class = \"myQuoteDiv\">\ncompose_matrix_2d(list) := (<br \/>\n  block([id2,sigma_x,sigma_y,sigma_z,M],<br \/>\n         id2         : matrix([1,0],[0,1]),<br \/>\n\t\t sigma_x     : matrix([0,1],[1,0]),<br \/>\n\t\t sigma_y     : matrix([0,-\n\t\t sigma_z     : matrix([1,0],[0,-1]),<\/p>\n<p>\t\t M : map(ratsimp,list[1]*id2 + list[2]*sigma_x + list[3]*sigma_y + list[4]*sigma_z)<br \/>\n       )<br \/>\n)$<\/p><\/div>\n \n<div class = \"myQuoteDiv\">\ndecompose_matrix_2d(M) := (<br \/>\n  block([id2,sigma_x,sigma_y,sigma_z,spec],<br \/>\n         id2         : matrix([1,0],[0,1]),<br \/>\n\t\t sigma_x     : matrix([0,1],[1,0]),<br \/>\n\t\t sigma_y     : matrix([0,-\n\t\t sigma_z     : matrix([1,0],[0,-1]),<br \/>\n\t\t spec        : [0,0,0,0],<br \/>\n\t\t spec[1]     : ratsimp(matrix_trace_2d( id2     . M )\/2),<br \/>\n\t\t spec[2]     : ratsimp(matrix_trace_2d( sigma_x . M )\/2),<br \/>\n\t\t spec[3]     : ratsimp(matrix_trace_2d( sigma_y . M )\/2),<br \/>\n\t\t spec[4]     : ratsimp(matrix_trace_2d( sigma_z . M )\/2),<br \/>\n\t\t spec<br \/>\n       )<br \/>\n)$<\/div>\n \n<div class = \"myQuoteDiv\">\nmatrix_trace_2d(M) := (<br \/>\n  block( result : M[1,1] + M[2,2] )<br \/>\n)$<\/div>\n \n<p>For a general matrix<\/p>\n<p>\\[ M = \\left[ \\begin{array}{cc} i &#038; -3 + 4 i \\\\ 19 &#038; 6 + 5 i \\end{array} \\right] \\; \\]<\/p>\n<p>the components are<\/p>\n<p>\\[ M \\doteq \\left[ \\begin{array}{c} 3 + 3 i \\\\ 8 + 2 i \\\\ -2 &#8211; 11 i \\\\ -3 &#8211; 2 i \\end{array} \\right] \\] <\/p>\n<p>a result that the reader is invited to confirm by performing the linear combination and which the reader is challenged to arrive at more easily than the method given here.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week&#8217;s post will be a short little dive into some of the lesser-known back-waters of linear algebra. As discussed in other posts, a vector space is a rather generic&#8230; <a class=\"read-more-button\" href=\"https:\/\/underthehood.blogwyrm.com\/?p=720\">Read more &gt;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-720","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/underthehood.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/posts\/720","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/underthehood.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/underthehood.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/underthehood.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/underthehood.blogwyrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=720"}],"version-history":[{"count":2,"href":"https:\/\/underthehood.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/posts\/720\/revisions"}],"predecessor-version":[{"id":723,"href":"https:\/\/underthehood.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/posts\/720\/revisions\/723"}],"wp:attachment":[{"href":"https:\/\/underthehood.blogwyrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=720"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/underthehood.blogwyrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=720"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/underthehood.blogwyrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=720"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}