40 ๐Ÿ”  Linear Algebra - JulTob/Mathematics GitHub Wiki

๐ŸŠ Linear Algebra

๐Ÿ‹ Matrices, Vectors, Linear Transformations

  • ๐Ÿ‹ โ€œSolve the matrix,โ€ transformations in 2D/3D, cryptography ciphers.

๐Ÿ‹โ€๐ŸŸฉ Eigenvalues & Eigenvectors

  • ๐Ÿ‹โ€๐ŸŸฉโ€œPopulation growthโ€, or Markov chain re-interpreted.

๐Ÿฅ Linear Systems

Linearity: When Stuff Scales Nicely

A system is linear if addition and multiplication work predictably. That means:

  • If you sum two inputs, is like summing the outputs.
  • If you scale an input, the output scales by the same factor.
graph LR
    x@{ shape: dbl-circ, label: "๐“" }
    x --> fx
    subgraph LinearSystem
        style LinearSystem fill:darkred,stroke:tomato,stroke-width:2px
        fx@{ shape: hex, label: "๐’ป(๐“)" }
end
graph LR
    x@{ shape: dbl-circ, label: "๐“" }
    y@{ shape: dbl-circ, label: "๐“Ž" }
    xy@{ shape: circ, label: "๐“+๐“Ž" }
    a@{ shape: dbl-circ, label: "โž•"}
    x --o a
    y --o a
    a --> xy
    xy --> fxy
    x --> fx
    y --> fy

    style a fill:silver ,stroke:#333,stroke-width:4px

    subgraph Adding
        style Adding fill:darkred,stroke:tomato,stroke-width:2px
        fx@{ shape: hex, label: "๐’ป(๐“)" }
        fy@{ shape: hex, label: "๐’ป(๐“Ž)" }
        fxy@{ shape: hex, label: "๐’ป(๐“+๐“Ž)" }
        fxay@{ shape: hex, label: "๐’ป(๐“)+๐’ป(๐“Ž)" }
        fa@{ shape: dbl-circ, label: "โž•"}
        fxy <==> fxay
        fx --o fa
        fy --o fa 
        fa --> fxay
    end
    style fa fill:silver ,stroke:#333,stroke-width:4px


graph LR
    x@{ shape: dbl-circ, label: "๐šŠ๐“" }
    x --> fx
    subgraph LinearSystem
        style LinearSystem fill:darkred,stroke:tomato,stroke-width:2px
        fx@{ shape: hex, label: "๐’ป(๐šŠ๐“)" }
        afx@{ shape: hex, label: "๐šŠ๐’ป(๐“)" }
        fx <==> afx
     end

For example, if you buy 2 apples for $1 each, the total cost is simply:

2ร—1=2

And if you buy 3 apples instead, the cost is:

3ร—1=3

Nothing unexpected happens: the relationship is straightforward. This makes linear functions incredibly useful in engineering, physics, and even art (perspective drawing relies on linear transformations!).


Conjuntos:

  • ๐‘Žโˆˆ๐”ธ ๐‘Ž Pertenece a ๐”ธ
  • โ„• Naturales
  • โ„ค Enteros
  • โ„š Fraccionales
  • โ„ Reales
  • โ„‚ Complejos
  • ๐”ธร—๐”น Binรณmio: ๏ฝ›(๐‘Ž,๐‘) | ๐‘Žโˆˆ๐”ธ, ๐‘โˆˆ๐”น๏ฝ
  • โ„ยฒ=โ„ร—โ„``๐‘ฃโˆŠโ„ยฒ: {๐‘ฃ := (๐‘ฅ,๐‘ฆ); ๐‘ฅ,๐‘ฆโˆŠโ„}
  • Circunferencia: ๐•Šยฒ | ๐‘ฃ := (๐‘ฅ,๐‘ฆ); ๐‘ฅยฒ+๐‘ฆยฒ=๐Ÿ
  • Esfera: ๐•Šยณ | ๐‘ฃ := (๐‘ฅ,๐‘ฆ,๐‘ง); ๐‘ฅยฒ+๐‘ฆยฒ+๐‘งยฒ=๐Ÿ
  • Cilรญndro: โ„‚ยณ | ๐‘ฃ := (๐‘ฅ,๐‘ฆ,๐‘ง); ๐‘ฅยฒ+๐‘ฆยฒ=๐Ÿ

Polinomios

โ„™โฟ(โ„) = { ๐‘Žโ‚€+๐‘Žโ‚+๐‘Žโ‚‚+๐‘Žโ‚ƒ.+.๐‘Žโ‚™ | ๐‘ŽแตขโˆŠโ„ }

Operaciones de conjuntos

  • Uniรณn ๐”ธโˆช๐”น : {๐‘ฅ | ๐‘ฅโˆˆ๐”ธ โ‹ ๐‘ฅโˆˆ๐”น}
  • Intersection ๐”ธโˆฉ๐”น : {๐‘ฅ | ๐‘ฅโˆˆ๐”ธ โ‹€ ๐‘ฅโˆˆ๐”น}
  • Complement โˆ๐”ธ: {๐‘ฅ | ๏ฟข๐‘ฅโˆˆ๐”ธ }
  • Relative Complement ๐”นโˆ–๐”ธ: {๐‘ฅ | ๏ฟข๐‘ฅโˆˆ๐”ธ โ‹€ ๐‘ฅโˆˆ๐”น}

Greatest common divisor

if the gcd of (x,y) =1
then x and y are coprimes, or relative primes.

$gcd (12, 15) = 3$

Euclidean:

$n = qd + r$
$gcd(n,d) = gcd(d,r)$

Least common multiple

The smallest integer that divides by both

$if$ $x โˆฃ n โˆง y โˆฃ n$
$โ‡’ lcm(x,y) โˆฃ n$

$d โˆฃ x, y$
$โ‡’ d โˆฃ gcd(x,y)$

Greatest Common divisor: Jars ๐Ÿบ

You have two jars
One holds 3 litres
one holds 5

Is it possible to measure out 1 later of water?
Generally, what quantities is it possible to measure?

2(3)๐Ÿบ - 1(5)๐Ÿบ = 1 ๐Ÿ’ง

What can we do with the two jars =

$aยท3 + bยท5$

negatives is removing

$n( 2(3) - 5 ) = 3ยท2n -5ยทn = n$

We can repeat the process of adding two jars of 3L and extracting one of 5L.

In general

Given integers x and y, determine all possible values of the form

${ ax + by : a, b โˆˆ โ„ค }$

Example

Consider two jars of 4L and 10L.

$4a + 10b$

We can only get even numbers.
proof:

$4a + 10b = 2$

or for any even number

$m(4a + 10b) = 4(am) + 10(bm) = 2m$

for

$a = -2$
$b = 1$

we see we can get any even number.

In general $ax + by$ is a linear combination.

The key is to know the smallest possible combination.

The greatest common divisor of two integers x and y in the smallest positive integer that is a linear combination of x and y

the set of linear combinations of x and y are the multiples of gcd(x,y)

${ ax + by : a, b โˆˆ โ„ค }$
$=$
${ ๐‘š ยท gcd(x,y) : ๐‘š โˆˆ โ„ค }$

As we have already seen, the answer is yes, we can measure 1 liter given 3-liter and 5-liter jars. Now we know the reason this is possible is that $gcd(3, 5) = 1$.

Linear Algebra

Vector Algebra

Addition

Vโƒ— + Uโƒ— = Wโƒ—

โˆ€i ( w[i] = v[i] + u[i] )

Multiplication

Wโƒ— = ๐‘ŽVโƒ—

โˆ€i ( w[i] = ๐‘Žยทv[i] )

Linear Combination

Addition and multiplication combined

๐‘ŽVโƒ— + ๐‘Uโƒ— = Wโƒ—

โˆ€i ( w [i] = ๐‘Žยทv[i] + ๐‘ยทu[i] )
๐‘Ž,๐‘โˆˆโ„

For any a and b of two vectors they can either fill a space or form a line

Vector Product

Vโƒ—ยทUโƒ— = ๐š 

Length

||Vโƒ—|| = โˆšVโƒ—ยทVโƒ—

Zero Vector

๏ผโƒ—: ๏ผ[i] = 0

๏ผโƒ— is into every linear combination (๐‘Ž,๐‘ = 0)

Linear components

๐‘ŽVโƒ— : makes a line
๐‘ŽVโƒ— + ๐‘Uโƒ— : Makes a plane
๐‘ŽVโƒ— + ๐‘Uโƒ— + ๐‘Wโƒ— : Makes a volume
etc

Ordinary Equations

A set of ordinary equations can be represented by a linear combination of vectors, or a Matrix Equation.

 2๐‘Ž  ๏ผ  ๐‘ = 1
- ๐‘Ž  ๏ผ‹ 2๐‘ = 0
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
๐‘Ž (2, -1) + ๐‘ (-1,2) = (1,0)

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
โŽก  2  -1โŽคโŽ›๐‘ŽโŽž = โŽก 1 โŽค
โŽฃ -1   2โŽฆโŽ๐‘โŽ  = โŽฃ 0 โŽฆ

Dot Product

Vโƒ— โ‹… Uโƒ— = ๐ฐ
๐ฐ = โˆ‘ ๐ฏแตขร—๐’–แตข

Length

||Vโƒ—|| = โˆš Vโƒ—โ‹…Vโƒ— ]

Unit Vector

๐‘‰ฬ‚ = Vโƒ— โˆ• |Vโƒ—|
โ €โ €|| ๐‘‰ฬ‚ || = 1

In 2D

๐œƒฬ‚ = (cos๐œƒ, sin๐œƒ)

Perpendicularity

Vโƒ— โ‹… Uโƒ— = 0 โŸน Vโƒ—โˆŸ Uโƒ—
โ €โ €โ €โ €โ €โ €โ €โŸน ||Vโƒ—||ยฒ ๏ผ‹ ||Uโƒ—||ยฒ = ||Vโƒ— ๏ผ Uโƒ—||ยฒ

Vโƒ— โ‹… Uโƒ—ฬ‚ = cos ๐œƒ
โ €โ €โ € ๐œƒ := smallest angle โˆก๐‘‰,๐‘ˆ

cos ๐œƒ =
Vโƒ— โ‹… Uโƒ—
โ”€โ”€โ”€โ”€
||Vโƒ—|| || Uโƒ—||

Schwarz Inequality

|Vโƒ— โ‹… Uโƒ—| โ‰ค |Vโƒ—| ร— |Uโƒ—|

Triangular Inequality

|Vโƒ— + Uโƒ—| โ‰ค |Vโƒ—| + |Uโƒ—|

Matrix times Vector

โŽก a11  a12โŽคโŽ›๐‘ŽโŽž = โŽ›๐‘Žยทa11 ๏ผ‹ a12ยท๐‘โŽž
โŽฃ a21  a22โŽฆโŽ๐‘โŽ    โŽ๐‘Žยทa21 ๏ผ‹ a22ยท๐‘โŽ 

Matrix

: Vector of Vectors

Aโƒฃ = Aโƒ—โƒ—
โ•โ•
โŽกAโƒ—โ‚โŽค
โŽขAโƒ—โ‚‚โŽฅ 
โŽขโขฐ โŽฅ
โŽฃAโƒ—โ‚™โŽฆ
โ•โ•โ•โ•โ•
โŽกaโ‚โ‚ aโ‚โ‚‚ aโ‚โ‚ƒ โ‹ฏ aโ‚โ‚˜โ€†โŽค
โŽขaโ‚‚โ‚ aโ‚‚โ‚‚ aโ‚‚โ‚ƒ โ‹ฏ aโ‚‚โ‚˜โ€†โŽฅ 
โŽขโขฐ    โ‹ฎ    โ‹ฎ  โ‹ฑ โ‹ฎ  โŽฅ
โŽฃaโ‚™โ‚  aโ‚™โ‚‚  aโ‚™โ‚ƒ โ‹ฏ aโ‚™โ‚˜โ€‹โŽฆ

Matrix ร— Vector

Aโƒฃ vโƒ—
= (Aโƒ—โ‚ยท vโƒ— , Aโƒ—โ‚‚ยท vโƒ— , Aโƒ—โ‚ƒยท vโƒ— , โ‹ฏ Aโƒ—โ‚™ยท vโƒ— )

Inverse

๐ดโƒฃ vโƒ— = bโƒ—
vโƒ— = ๐ดโƒฃโปยน bโƒ—

๐ดโƒฃโปยน ๐ดโƒฃ = ๐ผโƒฃ
๐ผโƒฃ = ( uโƒ—โ‚, uโƒ—โ‚‚, uโƒ—โ‚ƒ โ€ฆ uโƒ—โ‚™)
uโƒ—แตข = { 1 at i, 0 else)

Calculate Inverse

Transform ๐ดโƒฃ into ๐ผโƒฃ , then apply the same transformations into ๐ผโƒฃ . Thats the inverse.

โŽก1  2โŽคโŽก1 0โŽค 
โŽฃ3  4โŽฆโŽฃ0 1โŽฆ
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• 2ยช - 3ยท1ยช
โŽก1   2โŽคโŽก 1 0โŽค 
โŽฃ0  -2โŽฆโŽฃ-3 1โŽฆ
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• 1ยช + 2ยช
โŽก1   0โŽคโŽก-2 1โŽค 
โŽฃ0  -2โŽฆโŽฃ-3 1โŽฆ
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• -2ยช/2
โŽก1  0โŽคโŽก -2     1 โŽค 
โŽฃ0  1โŽฆโŽฃ 1.5  -0.5โŽฆ

To Annulate a matrix with the inverse, apply matrices left to right (as presented)

Dependence

wโƒ— is dependent if
wโƒ— = ๐‘Žvโƒ— + ๐‘uโƒ—

A matrix has independent column is invertible and the solution is unique.

Solving Linear Equations

๐ดโƒฃ xโƒ— = bโƒ—
โŽง ๐‘ฅโ‚ ๐‘Žโ‚โ‚ + โ‹ฏ + ๐‘ฅโ‚™๐‘Žโ‚โ‚™  = ๐‘โ‚
โŽจ โ‹ฎ                    โ‹ฎ
โŽฉ ๐‘ฅโ‚ ๐‘Žโ‚˜โ‚ + โ‹ฏ + ๐‘ฅโ‚™๐‘Žโ‚˜โ‚™   = ๐‘โ‚˜

-- Example
โŽก1  -2โŽคโŽก๐‘ฅโŽค = โŽ› 1 โŽž
โŽฃ3   2โŽฆโŽฃ๐‘ฆโŽฆ   โŽ 11โŽ 

Matrix Transpose

Bโƒฃ = Aโƒฃแต€ : { ๐‘แตขโฑผ = ๐‘Žโฑผแตข}

Gaussian method

Column 1. Use the first equation to create zeros below the first pivot.
Column 2. Use the new equation 2 to create zeros below the second pivot.
Columns 3 to n. Keep going to find all n pivots and the upper triangular U.

  1. A linear system Aโƒฃ xโƒ—=bโƒ— becomes upper triangular Uโƒฃxโƒ—=cโƒ— after elimination.
  2. We subtract โ„“แตขโฑผ times equation j from equation i, to make the (i, j) entry zero. โ€จ3. The multiplier is โ„“แตขโฑผ= entry to eliminate in row i : pivot in row j
  • Pivots can not be zero!
  1. When zero is in the pivot position, exchange rows if there is a nonzero below it.โ€จ
  2. The upper triangular Ux = c is solved by back substitution (starting at the bottom).
  3. When breakdown is permanent, Ax = b has no solution or infinitely many.

Rules of Matrices

Bโƒฃ(Aโƒฃ ๐‘ฅโƒ—) = (BโƒฃAโƒฃ) ๐‘ฅโƒ—
AโƒฃBโƒฃ = Cโƒฃ  โ‡ BโƒฃAโƒฃ = Cโƒฃ

Augmented Matrix

[๐ด | ๐š‹]

Matrices do something

Aโƒฃ ๐‘ฅโƒ—= ๐‘ฅโ‚ times column 1 + ยท ยท ยท + ๐‘ฅโ‚™ times column n.
And (Aโƒฃ๐‘ฅโƒ—)แตข = โˆ‘โฑผโ‚Œโ‚ ๐‘Žแตขโฑผ ๐‘ฅโฑผ

Identity matrix = Iโƒฃ
elimination matrix = Eโƒฃแตขโฑผ using โ„“แตขโฑผ
exchange matrix = Pโƒฃแตขโฑผ.

Multiplying ๐ดโƒฃ xโƒ— = bโƒ— by Eโƒฃโ‚‚โ‚ subtracts a multiple โ„“โ‚‚โ‚ of equation 1 from equation 2. The number -โ„“โ‚‚โ‚ is the (2, 1) entry of the elimination matrix Eโ‚‚โ‚

For the augmented matrix [Aโƒฃ bโƒ—], that elimination step gives [ Eโƒฃโ‚‚โ‚Aโƒฃ Eโƒฃโ‚‚โ‚bโƒ—]

When Aโƒฃ multiplies any matrix Bโƒฃ, it multiplies each column of Bโƒฃ separately.

Aโƒฃโ‚˜โ‚“โ‚™ ร— Bโƒฃโ‚™โ‚“โ‚š = 
     ๏ผป BอŽฬ…โ‚    , BอŽฬ…โ‚‚     , โ‹ฏ    BอŽฬ…โ‚š ] 
โŽกAโƒ—โ‚;โŽค โŽก Aโƒ—โ‚ยทBอŽฬ…โ‚ , Aโƒ—โ‚ยทBอŽฬ…โ‚‚ ,โ‹ฏ, Aโƒ—โ‚ยทBอŽฬ…โ‚š;โŽค  
โŽขAโƒ—โ‚‚;โŽฅ โŽข Aโƒ—โ‚‚ยทBอŽฬ…โ‚ , Aโƒ—โ‚‚ยทBอŽฬ…โ‚‚ ,โ‹ฏ, Aโƒ—โ‚‚ยทBอŽฬ…โ‚š;โŽฅ
โŽขโ‹ฎ  ;โŽขโŽฅ โ‹ฎ                        |
โŽฃAโƒ—โ‚˜ โŽฆ โŽฃAโƒ—โ‚˜ยทBอŽฬ…โ‚  , Aโƒ—โ‚˜ยทBอŽฬ…โ‚‚ ,โ‹ฏ, Aโƒ—โ‚˜ยทBอŽฬ…โ‚š โŽฆ
= 
Cโƒฃโ‚˜โ‚“โ‚š

Cแตขโฑผ := Aโƒ—แตขโ‹…Bโƒ—แต€โฑผ


(AโƒฃBโƒฃ)Cโƒฃ = Aโƒฃ(BโƒฃCโƒฃ)
(AโƒฃBโƒฃ)๐‘ฅโƒ— = Aโƒฃ๏ผˆBโƒฃ๐‘ฅโƒ—๏ผ‰

Aโƒฃ(Bโƒฃ+Cโƒฃ) = AโƒฃBโƒฃ + AโƒฃCโƒฃ
(Aโƒฃ+Bโƒฃ)Cโƒฃ = AโƒฃCโƒฃ + BโƒฃCโƒฃ

Sqare Matrices

Aโƒฃยฒ = AโƒฃAโƒฃ
Aโƒฃโฟโบแต = Aโƒฃโฟ ยท Aโƒฃแต
(Aโƒฃโฟ)แต = Aโƒฃโฟโ แต

Invertion

AโƒฃโปยนAโƒฃ = Iโƒฃ = AโƒฃAโƒฃโปยน
  detโจAโƒฃโฉ
  Aโƒฃxโƒ—๏ผ0โƒ— โŸบ xโƒ—๏ผ0โƒ—
(AโƒฃBโƒฃ)โปยน = Bโƒฃโปยน Aโƒฃโปยน

AโƒฃAโƒฃโปยน๏ผIโƒฃ

Transpose

(Aโƒฃxโƒ— )แต€ = xโƒ—แต€ Aโƒฃแต€
(AโƒฃBโƒฃ)แต€ = Bโƒฃแต€ Aโƒฃแต€
(Aโƒฃโปยน)แต€๏ผ(Aโƒฃแต€)โปยน
Aโƒฃ๐‘ฅโƒ— โ‹… ๐‘ฆโƒ— = ๐‘ฅโƒ— โ‹… Aโƒฃแต€๐‘ฆโƒ—
(Aโƒฃ+Bโƒฃ)แต€ =  Aโƒฃแต€ + Bโƒฃแต€

Symmetric.

IFF Sโƒฃ ๏ผSโƒฃแต€

Orthogonal

IFF Qโƒฃโปยน๏ผQแต€

Permutation matrix

has the rows of Iโƒฃ in any order.