#!/usr/bin/env python # coding: utf-8 # # Matrix Math # # Our Notebooks are not meant to serve as a comprehensive recap of mathematics in general. We're not engaged in the project of forming an encyclopedia. Far from it. The purpose of these Notebooks is more to demonstrate a methodolgy a teacher or student might adopt in order to give rise to (to float) a curriculum. # # A curriculum is a host of topics that hang together and mutually refer to one another, more like a mini-language or simple system. # # This Matrix Math page is a case in point. The Pauli Matricies usually appear in the context of particle physics aka quantum mechanics, which features groups, such as SU(2) and SU(3). That context is mentioned in the embedded Youtubes, but this Notebook itself is silent about the physics of whatsons (e.g. electrons) but for here. # # Many of our pages contain the word sandbox in their filenames, or otherwise remind that they're more like playgrounds, or one could say launch pads, or jumping off points, into wider studies. # # An individual curriculum developer and/or team will crystallize only so much content. For example Stephen Wolfram and his brother Conrad likewise advocate, through demonstration, span mathematics with Mathematica and its Wolfram Language, another set of landscapes in a different ecosystem, not featuring the Python language. # # For many students, a curriculum such as this one might serve as a stepping stone to the Wolfram universe. Tour in other lands, and return with baubles. Take forth our Quadrays and Cabal of Polyhedrons to these other worlds, bring back skills and insights. # # One way to approach a math is to let its jargon pile up for awhile, as you keep exercising the jargon to make sure you have it down. # # Spending too much time on one concept may actually be a pitfall, because it depends for its meaning on other concepts. To delay reaching these other concepts is to make understanding even a first one all that more difficult. # # For example, the idea of a complex conjugate, of a number or matrix, as distinct from its inverse or transpose, may not at first be clear. # # However, already, we know a matrix has an inverse and so on. That could be the news right there. Then we go back and add more flesh. # In[1]: from IPython.display import YouTubeVideo # In[2]: YouTubeVideo("yeK2N7FbkVI") # In[3]: YouTubeVideo("DUuTx2nbizM") # In[4]: YouTubeVideo("7rE9gcj5I2U") # In[5]: YouTubeVideo("ganF52dxL1U") # In[6]: import sympy as sp from sympy import Matrix # We're in the realm of $\mathbb{C}$. # # * A Matrix is Hermitian if it equals its own conjugate transpose. # * A Matrix is Skew Hermitian if its negative equals its conjugate transpose # * A Matrix is Unitary if its inverse equals its conjugate transpose # * A Matrix is Special Unitary if it is unitary and has a determinant of 1. # The Pauli Matrices are unitary and Hermitian, meaning they also have to be self inverses. # In[7]: σ0, σ1, σ2, σ3 = sp.symbols('σ0 σ1 σ2 σ3') # ## Sandbox Area # In[8]: sp.sqrt(-1) # In[9]: sp.I # In[10]: sp.I.conjugate() # In[11]: c = 3 + 2*sp.I; c # In[12]: c.conjugate() # change the sign of the imaginary part # In[13]: c * c.conjugate() # In[14]: _.expand() # In[15]: a, b = sp.symbols('a b') # Here are the four 2x2 Pauli matrices, including I itself as "sigma zero" (σ0). # In[16]: σ0 = sp.eye(2) σ0 # In[17]: σ1 = Matrix([[0, 1], [1, 0]]) σ1 # In[18]: σ2 = Matrix([[0, -sp.I], [sp.I, 0]]) σ2 # In[19]: σ3 = Matrix([[1, 0], [0, -1]]) σ3 # That Pauli matrices self multiply to give an inverse is another way of saying they're self inverses. # # $$ # A A^{-1} = I # $$ # # $$ # A = 1/A # $$ # In[20]: σ0 ** 2, σ1 ** 2, σ2 ** 2, σ3 ** 2 # In[21]: σ3 * σ2 # In[22]: σ2 * σ3 # In[23]: σ3 * σ2 - σ2 * σ3 # In[24]: m = 2 * sp.I * σ1; m # In[25]: m.conjugate() # change the sign of any imaginary part # In[26]: m_h = m.conjugate().transpose() m_h # # * Hermitian: $A^{\dagger} = A$ # * Unitary: $A^{\dagger} = A^{-1}$ # In[27]: m * m_h # In[28]: m.inv() # In[29]: m * m.inv() # In[30]: m.is_hermitian # complex conjugate is also the inverse # In[31]: σ3.is_hermitian # In[32]: σ3 == σ3.conjugate().transpose() # In[33]: σ2.is_hermitian # In[34]: σ2.inv() == σ2.conjugate().transpose() # In[35]: σ1.is_hermitian # In[36]: σ1.inv() # In[37]: σ1.inv() * σ1 # In[38]: σ1.conjugate().transpose() # In[39]: σ1.det() # In[40]: σ2.det() # In[41]: σ3.det()