aboutsummaryrefslogtreecommitdiff
path: root/li/01_intro
blob: 8e8e9afda9633fa3169c1b27ae7d7439b0c37c64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Solution of a system is the set of points/combinations of variables that
satisfy an equation like 3x+2y=1.

[3 2][x
      y] = 1 is equivalent
A := [3 2]
X := [x y]^T
b := 1
AX = b

Some systems like:
x - 2y = 0
x + y = 1
x - y = 2
have no solutions.
This can be written as a a matrix too.
Asking "does this system have a solution" is equivalent to asking:
Can [0 1 2]^T be written as a linear combination/in span of [1 1 1]^T
and [-2 1 -1]^T

-----
How to solve Ax = b where A is an mxn matrix, x is a nx1 matrix of free
variables, and b is a mx1 matrix of constants.

Ex.
A = [ 3 1  0 4
      0 1  2 5
      0 0 -1 1 ]
x = [ x1 x2 x3 x4 ]^T
b = [ 0 1 2 ]

Find the free variable, and then back-substitute
x4 = t
-x3 + x4 = 2 --> x3 = t - 2
x2 + 2*x3 + 5*x4 = 1 --> x2 + 2*(t-2) + 5*t = 1 --> x2 = 5 - 7t
3*x1 + x2 + x4 = 0 --> 3*x1 + 5 - 7t + t = 0 --> x1 = -5/3 + 2t

Pivot element := first non-zero element in a matrix row AND everything
below it is zero

A matrix is in *row echelon* form iff pivot elements are to the left of
all pivot elements in a lower row.
    Therefore, all non-zero rows have a pivot but not every column.
Note: column echelon form also exists.

Generally, solving Ax = B can be done by solving
CAx = Cb where C is an invertible mxm matrix.
Single row operations used in Gaussian elimination are a subset of these
operations.

Ex.
A = 3x4 matrix.
Multiply 1/3 to first row: 1/3 R1 -> R1.
C = 3x3 matrix.
[ 1/3 0 0
  0   1 0
  0   0 1 ] * A
C^{-1} =
[ 3 0 0
  0 1 0
  0 0 1 ]

Switch rows R2 and R3:
C = [ 1 0 0
      0 0 1
      0 1 0 ]
C = C^{-1}

Add cR1 to R3:
C = [ 1 0 0
      0 1 0
      c 0 1 ]
C^{-1} = [ 1 0 0
           0 1 0
          -c 0 1 ]