Solving  Linear Systems, Existence and Uniqueness

Solving and Uniqueness

mymatrix  =  {
{1, 2, 
            1, 1}, 
{-1, 4, -2, 
            0}, 
{1, 3, 4, 5}, 
{1, 0, 1, 
            1}};

    mymatrix // MatrixForm

Det[mymatrix]

\(Two\ Vectors\ for\ \(x\& -> \)\ and\ \(b\& -> \)\ in\ \(A\+_\) \(x\& -> \) = \(b\& -> \)\)

myx  = {x, y, z, t};

myb  =  {a, b, c, d};

First equation in matrix equation

(mymatrix . myx)[[1]]

lhs  =  mymatrix . myx

Indexing an equation for each member of matrix equation:

linsys[i_Integer]  :=  lhs[[i]]  ==  myb[[i]]

linsys[2]

Solving a set of equation for the (Overscript[x,  ->])

linsol  = 
      Solve[{linsys[1], linsys[2],  linsys[3],  linsys[4]}, myx]

Doing the same thing a different way:

LinearSolve[mymatrix, myb]

And yet another way

Inverse[mymatrix] . myb

When determinants are zero

Create a matrix with one row as a linear combination of the others

myzeromatrix = 
{mymatrix[[1]], 
mymatrix[[2]], 
p*
              mymatrix[[1]]  +  q*mymatrix[[2]]  +  
            r*mymatrix[[4]], 
mymatrix[[4]]};
myzeromatrix // MatrixForm

Det[myzeromatrix]

LinearSolve[myzeromatrix, myb]

NullSpace[myzeromatrix]

zerolhs =  myzeromatrix . myx

zerolinsys[i_Integer]  :=  
      zerolhs[[i]]  ==  myb[[i]]

Table[zerolinsys[i], {i, 4}]

zerolinsol  = Solve[Table[zerolinsys[i], {i, 4}], myx]

zerolinsol  = 
      Solve[Table[
          zerolinsys[i] /. {a -> 0, b -> 0, c -> 0, 
              d -> 0}, {i, 4}], myx]

Determinants

Clear[rv]

rv[i_]  :=  rv[i]  = 
        Table[Random[Real, {-1, 1}], {j, 6}]

rv[1]

rv[2]

rv[1]

randmat  =  Table[rv[i], {i, 6}]

Det[randmat]

Det[{rv[2], rv[1], rv[3], rv[4], rv[5], rv[6]}]

Clear[a]

Det[{rv[3], rv[1], rv[2], rv[4], rv[5], rv[6]}]

Multiply one row by a constant and calculate determinant:

Det[{a*rv[2], rv[1], rv[3], rv[4], rv[5], rv[6]}]

Multiply two rows by a constant and calculate determinant:

Det[{a*rv[2], a*rv[1], rv[3], rv[4], rv[5], rv[6]}]

Multiply all rows by a constant and calculate determinant:

Det[a {rv[2], rv[1], rv[3], rv[4], rv[5], rv[6]}]

Clear[a, b, c, d, e]

lindepvec  =  
      a*rv[1]  +  b*rv[2]  +  c*rv[3]  +  d*rv[4]  +  
        e*rv[5]

Example of numerical precision:

Det[{rv[1], rv[2], rv[3], rv[4], rv[5], lindepvec}]

symvec  =  {a, a, a, c, c, c};

permuts  =  Permutations[symvec];
permuts // Dimensions

\(\(symbmat\  = \ {
	
          permuts[\([1]\)], 
	
          permuts[\([12]\)], 
	
          permuts[\([6]\)], 
	
          permuts[\([18]\)], 
	
          permuts[\([17]\)], 
	
          permuts[\([9]\)]
};\)\)
symbmat // MatrixForm

Det[symbmat]

randommat  =  
        Table[Table[
            Random[Integer, {-100, 100}]/Random[Integer, {-100, 100}], {i, 6}], {j, 6}];
randommat // MatrixForm

Det[randommat]

checka  = Det[symbmat . randommat] // Simplify

checka // N

checkb  = Det[randommat . symbmat] // Simplify

checka == checkb

(randommat . symbmat  -  symbmat . randommat) // Simplify // 
      MatrixForm

Linear Transformations

<< Graphics`Polyhedra`

Show[Polyhedron[Octahedron], Lighting -> False]

Polyhedron[Octahedron] // InputForm // 
      Short

Clear[coloct];
coloct = 
      Graphics3D[{
{Hue[0/8], 
            Polygon[{{0. , 0. , 1.4142135623730951}, {1.4142135623730951, 
                  0. , 0. }, {0. , 1.4142135623730951, 0. }}]}, {Hue[1/8], 
            Polygon[{{0. , 0. , 1.4142135623730951}, {0. , 
                  1.4142135623730951, 0. }, {-1.4142135623730951, 0. , 
                  0. }}]}, {Hue[2/8], 
            Polygon[{{0. , 0. , 
                  1.4142135623730951}, {-1.4142135623730951, 0. , 
                  0. }, {0. , -1.4142135623730951, 0. }}]}, {Hue[3/8], 
            Polygon[{{0. , 0. , 
                  1.4142135623730951}, {0. , -1.4142135623730951, 
                  0. }, {1.4142135623730951, 0. , 0. }}]}, {Hue[4/8], 
            Polygon[{{1.4142135623730951, 0. , 
                  0. }, {0. , -1.4142135623730951, 0. }, {0. , 
                  0. , -1.4142135623730951}}]}, {Hue[5/8], 
            Polygon[{{1.4142135623730951, 0. , 0. }, {0. , 
                  0. , -1.4142135623730951}, {0. , 1.4142135623730951, 
                  0. }}]}, {Hue[6/8], 
            Polygon[{{0. , 
                  0. , -1.4142135623730951}, {0. , -1.4142135623730951, 0. }, {-1.4142135623730951, 0. , 0. }}]}, {Hue[
              7/8], Polygon[{{0. , 1.4142135623730951, 0. }, {0. , 
                  0. , -1.4142135623730951}, {-1.4142135623730951, 
                  0. , 0. }}]}}, {AmbientLight -> GrayLevel[0], 
          AspectRatio -> 1, Axes -> False, 
          AxesEdge -> Automatic, AxesLabel -> None, 
          AxesStyle -> Automatic, Background -> Automatic, 
          Boxed -> True, BoxRatios -> Automatic, 
          BoxStyle -> Automatic, ColorOutput -> Automatic, 
          DefaultColor -> Automatic, Epilog -> {}, 
          FaceGrids -> None, ImageSize -> Automatic, 
          Lighting -> True, 
          LightSources -> {{{1. , 0. , 1. }, 
                RGBColor[1, 0, 0]}, {{1. , 1. , 1. }, 
                RGBColor[0, 1, 0]}, {{0. , 1. , 1. }, RGBColor[0, 0, 1]}}, 
          Plot3Matrix -> Automatic, PlotLabel -> None, 
          PlotRange -> All, PlotRegion -> Automatic, 
          PolygonIntersections -> True, Prolog -> {}, 
          RenderAll -> True, Shading -> True, 
          SphericalRegion -> True, Ticks -> Automatic, 
          ViewCenter -> Automatic, 
          ViewPoint -> {1.3, -2.4, 2. }, 
          ViewVertical -> {0. , 0. , 1. }, 
          DefaultFont :> $DefaultFont, 
          DisplayFunction :> $DisplayFunction, 
          FormatType :> $FormatType, 
          TextStyle :> $TextStyle}]

Show[coloct, Lighting -> False]

Clear[tmat];
tmat =  {{1, 0, 0}, {0, 1, 0},  {0, 0, -1}}

Show[
      coloct /. {Polygon[{a_List ,  b_List ,  c_List}] -> 
            Polygon[{tmat . a, tmat . b, tmat . c}]}, 
      Lighting -> False]

seetrans[tranmat_] :=  
      Show[coloct /. {Polygon[{a_List ,  b_List ,  c_List}] -> 
              Polygon[{tranmat . a, tranmat . b, tranmat . c}]}, 
        Lighting -> False]

seetrans[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}]

seetrans[{{Cos[Pi/4], Sin[Pi/4], 0}, {Sin[-Pi/4], Cos[Pi/4], 
          0}, {0, 0, 1}}]

seetrans[{{-1, 0, 0}, {0, -1, 0}, {0, 0, 5}}]