Matrix algebra II

advertisement
Lecture 4
Solving simple stoichiometric equations
a1FeS2  11O2  a2 Fe2O3  a3SO2
a1  2a2
a1  2a2  0a3  0
2a1  a3
2a1  0a2  a3  0
22  3a2  2a3
0a1  3a2  2a3  22
The Gauß scheme
A linear system of equations
 1  2 0  a1   0 

   
 2 0  1 a 2    0 
0 3
2  a3   22

a1a2  2a2  0a3  0
2a1  0a2 a3  a3  0
0a1  3a2  2a1a3  22
Multiplicative elements.
A non-linear system
Matrix algebra deals essentially with linear linear systems.
x  a0  a1u1  a2u2  a3u3  ... anun
Solving a linear system
 1  2 0  a1   0 

   
 2 0  1 a 2    0 
0 3
2  a3   22

 a1   0   1  2 0 
    

 a 2    0  /  2 0  1
 a   22  0 3
2 
 3   
The division through a vector or a matrix is not defined!
 a11 a12 
 b1 
; B   
A  
a
a
22 
 21
 b2 
 a11b1  a12b2 
 c1 
  C   
A  B  
a
b

a
b
 21 1 22 2 
 c2 
C  c1   b1   a11 a12 

   /   
B  c2   b2   a21 a22 
c1  a11b1  a12b2
c2  a21b1  a22b2
2 equations and four unknowns
For a non-singular square matrix
the inverse is defined as
A  A 1  I
A 1  A  I
A matrix is singular if it’s
determinant is zero.
a
A   11
 a21
a12 

a22 
a
DetA  A   11
 a21
Singular matrices are those where some rows or
columns can be expressed by a linear
combination of others.
Such columns or rows do not contain additional
information.
They are redundant.
 1 2 3


A   2 4 6
7 8 9


r2=2r1
a12 
  a11a22  a21a12
a22 
Det A: determinant of A
1 2 3 


A  4 5 6 
 6 9 12


r3=2r1+r2
A linear combination of vectors
V  k1V1  k2V2  k3V3  ... kn Vn
A matrix is singular if at least one
of the parameters k is not zero.
The inverse of a 2x2 matrix
a
A   11
 a12
a21 

a22 
 a22
1

A 
a11a22  a12 a21   a12
Determinant
1
 a21 

a11 
The inverse of a square matrix only exists
if its determinant differs from zero.
Singular matrices do not have an inverse
The inverse of a diagonal matrix
 a11

 0
A
...

 0

 1

 a11

0
1
A 

 ...
 0


0 

0 
... ... 

... ann 
0 ...
a22 ...
...
0
0
1
a22
...
0

0 


... 0 

... ... 
1 
...
ann 
...
(A•B)-1 = B-1 •A-1 ≠ A-1 •B-1
The inverse can be unequivocally calculated by the Gauss-Jordan algorithm
Solving a simple linear system
1
a1FeS2  11O2  a2 Fe2O3  a3SO2
1
 1  2 0   1  2 0  a1   a1   a1   1  2 0   0 

 
      
  
 2 0  1  2 0  1 a 2   I a 2    a 2    2 0  1  0 
0 3
2   0 3
2  a3   a3   a3   0 3
2   22

4FeS2  11O2  2Fe2O3  8SO2
The general solution of a linear system
 1 0 ...

0 1 ...
A 1A  I
Identity matrix I  
 ... ... ...
1

XA B
 0 0 ...

Only possible if A is not singular.
IX  XI  X
If A is singular the system has no solution.
AX  B  A 1AX  A 1B
3x  2 y  4 z  10
 3x  3 y  8 z  12
9 x  0.5 y  2.3z  1
Systems with a unique solution
The number of independent equations
equals the number of unknowns.
2
4 
 3


3
8 
3
 9  0.5 2.3 


1
0

0
...

1 
2
4 
 3


3
8 
3
 9  0.5 2.3 


X: Not singular
10  x   0.3819 
    

12   y    4.5627 
 1   z    0.0678
    

2
4 10
 3


3
8 12
3
 9  0 .5 2 .3 1 


The augmented matrix Xaug
is not singular and has the
same rank as X.
The rank of a matrix is
minimum number of
rows/columns of the largest
non-singular submatrix
A  X  B  A 1  A  X  A 1  B  X  A 1  B
Consistent system
Solutions extist
rank(A) = rank(A:B)
Single
solution extists
rank(A) = n
Inconsistent system
No solutions
rank(A) < rank(A:B)
Multiple
solutions extist
rank(A) < n
a1  2a 2  a 3  2a 4  5
2a1  3a 2  2a 3  3a 4  6
3a1  4a 2  4a 3  3a 4  7
5a1  6a 2  7a 3  8a 4  8
 1a1

 2a1
 3a
 1
 5a
 1
1

2
3

5
2 a2
1a3
3a2
2a3
4 a2
4a3
6 a2
7 a3
1
2 1 2 1 2
 
3 2 3 2 3


3 4
4 4 3
 
6 7 8 5 6
 a1   1
  
 a2    2
 a3   3
  
 a4   5
1
2a4   1
 
3a4   2


3a4
3
 
8a4   5
2 1 2   a1   5 
    
3 2 3   a2   6 
    

a
4 4 3
7
  3  
6 7 8   a4   8 
1 2   a1   1
   
2 3   a2   2





3
a3
4 3
   
7 8   a4   5
2 1 2 5
  
3 2 3 6


7
4 4 3
  
6 7 8 8
1
2 1 2 5
  
3 2 3 6


7
4 4 3
  
6 7 8 8
a1  2a 2  a 3  2a 4  5
2a1  3a 2  2a 3  3a 4  6
3a1  4a 2  4a 3  3a 4  7
5a1  6a 2  7a 3  8a 4  8
2x1  6x 2  5x 3  9x 4  10   2

2x1  5x 2  6x 3  7x 4  12 
 2

4x1  4x 2  7x 3  6x 4  14   4

5x1  3x 2  8x 3  5x 4  16 
 5
2x1  3x 2  4x 3  5x 4  10   2

4x1  6x 2  8x 3  10x 4  20 
 4

4x1  5x 2  6x 3  7x 4  14   4

5x1  6x 2  7x 3  8x 4  16 
 5
6
5
5
6
4
7
3
8
3
9   x1
 
7   x2

6   x3
 
5 
 x4
4

 10 



   12 

 14 




 16 

 x1

   x2
7   x3
 
8  
 x4
5 

Infinite number of 6solutions
8 10
5
6
6
7
3
No solution
6
4
8
5
6
6
7
2x1  3x 2  4x 3  5x 4  10   2

4x1  6x 2  8x 3  10x 4  12 
 4

4x1  5x 2  6x 3  7x 4  14   4

5x1  6x 2  7x 3  8x 4  16 
 5
2x1  3x 2  6x 3  9x 4  10   2

2x1  4x 2  5x 3  6x 4  12   2

4x1  5x 2  4x 3  7x 4  14 
 4
3
5   x1
 
10   x 2

7   x3
 
8  
 x4

 10 



   20 

 14 




 16 


 10 



   12 

 14 




 16 

 x1 
9 
 10 

  x2 


5 6
  12 
 x3 
 14 
4 7
 


x 

 4
3
4
5 
 10 


  x1 
12 
6
8
10  


x2 
  14 
5
6
7 

x3 



6
7
8  
 16 
x 

 4
 16 
12 14 16 



6
Infinite number of4 solutions
5
2x1  3x 2  4x 3  5x 4  10
 2

4x1  6x 2  8x 3  10x 4  12
4



4x1  5x 2  6x 3  7x 4  14
 4
 5
5x1  6x 2  7x 3  8x 4  16


10x1  12x 2  14x 3  16x 4  16 
  10
No solution
2x1  3x 2  4x 3  5x 4  10
 2

4x1  6x 2  8x 3  10x 4  12
4


4x1  5x 2  6x 3  7x 4  14
 4
 5
5x1  6x 2  7x 3  8x 4  16


10x1  12x 2  14x 3  16x 4  32 
  10
3
4
6
8
5
6
6
12
7
14
Infinite number of solutions
5 
  x1
10  
x2
7 
  x3
8  
x
 4
16 

 10 




 12 
   14 




 16 


 32 


Consistent
Rank(A) = rank(A:B) = n
Consistent
Rank(A) = rank(A:B) < n
Inconsistent
Rank(A) < rank(A:B)
Consistent
Rank(A) = rank(A:B) < n
Inconsistent
Rank(A) < rank(A:B)
Consistent
Rank(A) = rank(A:B) = n
n1KOH  n2Cl2  n3 KClO3  n4 KCl  n5 H 2O
n1  n3  n4
n1  n3  n4  0
n1  3n3  n5
n1  3n3  n5
n1  2n5
n1  2n5
2n2  n3  n4
2n2  n3  n4  0
We have only four
equations but five
unknowns.
The system is
underdetermined.
n1
1
1
1
0
Inverse
0
-0.5
0
-1
n2
0
0
0
2
n3
-1
-3
0
-1
0
1
0
0.5
-0.33333 0.333333
0.333333 0.666667
1

1
1

0

n4
-1
0
0
-1
0
0.5
0
0
 1  1 n1   0 
   
0  3 0  n2   1 
  n5



0 0
0 n3
2
   
2  1  1 n4   0 
0
A
0
1
2
0
N*n5
2
1
0.333333
1.666667
n1
n2
n3
n4
n5
6
3
1
5
3
The missing value is found by dividing the vector through its
smallest values to find the smallest solution for natural numbers.
6KOH  3Cl2  KClO3  5KCl  3H 2O
n1Mga1Sia 2  n2 Na3 H a 4Bra5  n3Sia6 H a7  n4 Na8 H a9  n5 Mga10 Bra11
Equality of
atoms involved
n1a1  n5 a10
n1a2  n3 a6
n2 a3  n4 a8
n2 a4  n4 a9  n3 a7
n2 a5  n5 a11
Including
information on
the valences of
elements
a1  2a2
a4  a3  a5
a7  4 a 6
a8  4(a9  1)
a10  2a11
We have 16 unknows but without
experminetnal information only 11 equations.
Such a system is underdefined.
A system with n unknowns needs at least n
independent and non-contradictory equations
for a unique solution.
a1  a11
If ni and ai are unknowns we have a non-linear situation.
We either determine ni or ai or mixed variables such that no multiplications occur.
n1a1  n5 a10
n1a2  n3 a6
n2 a3  n4 a8
n2 a4  n4 a9  n3 a7
n2 a5  n5 a11
a1  2a2
a4  a3  a5
a7  4 a 6
a8  4(a9  1)
a10  2a11
a1  a11
0
 n1 0 0 0 0

 n1 0 0 0 0  n3
 0 0 n2 0 0
0

0
 0 0 0 n2 0
 0 0 0 0 n2
0

 2 1 0 0 0
0

 0 0 1 1 1 0
 0 0 0 0 0 4

0
0 0 0 0 0
0 0 0 0 0
0

0
1 0 0 0 0
0
0
0
 n5
0  a1   0 

  
0
0
0
0
0  a 2   0 
0
0
 n4
0
0  a3   0 

  
0  n3
0
 n4
0  a 4   0 
0
0
0
0
 n5  a5   0 
0
0
0
0
0  a6    0 

  
0
0
0
0
0  a7   0 
1
0
0
4
0  a8   0 

  
0
1
4
0
0  a9    4 
0
0
0
1
 2  a10  0 

  
0
0
0
0
 1  a11  0 
The matrix is singular because a1, a7, and a10 do
not contain new information
Matrix algebra helps to determine what information is needed
for an unequivocal information.
n1Mga1Sia 2  n2 Na3 H a 4Bra5  n3Sia6 H a7  n4 Na8 H a9  n5 Mga10 Bra11
From the knowledge of the salts we get n1 to n5
n1Mga1Sia 2  n2 Na3 H a 4Bra5  n3Sia6 H a7  n4 Na8 H a9  n5 Mga10 Bra11
Mg2 Si  4Na3 H a 4Bra5  SiHa7  4Na8 H a9  2MgBr2
a4  3a3  a5
a3  a8
4 a 4  a 7  4 a9
4a5  4
a8  1
a9  3
3

 1
 0

 0
 0

 0

1 1
0
0
4
0
0
1
0
0
0
0
a3
a4
a5
a7
a8
a9
Inverse
0  a3   0 
   
0  1 0  a4   0 
 1 0  4  a5   0 
    
0 0
0  a7   1 
 
0 1
0  a8   1 
0 0
1  a9   3 
0
0
We have six variables and six
equations that are not
contradictory and contain
different information.
The matrix is therefore not
singular.
a3
-3
1
0
0
0
0
a4
1
0
4
0
0
0
a5
-1
0
0
1
0
0
a7
0
0
-1
0
0
0
a8
0
-1
0
0
1
0
a9
0
0
-4
0
0
1
0
1
0
4
0
0
1
3
0
12
0
0
0
0
0
-1
0
0
0
1
1
4
0
0
1
3
0
12
1
0
0
0
0
-4
0
1
A
0
0
0
1
1
3
a3
a4
a5
a7
a8
a9
Mg2 Si  4NH 4Br  SiH4  4NH 3  2MgBr2
1
4
1
4
1
3
Linear models in biology
The logistic model of population growth
r 2
N  rN  N  c
K
t
1
2
3
4
N
1
5
15
45
We need four
measurements
r
4  1r  1  c
K
r
10  5r  25  c
K
r
30  15r  225  c
K
1 1 r 
4 1
  


 10    5 15 1 r / K 
 30 15 225 1 c 
  


K denotes the maximum possible density
under resource limitation, the carrying
capacity.
r denotes the intrinsic population growth
rate. If r > 1 the population growths, at r < 1
the population shrinks.
K  1.286 / 0.036  36
Population growth
N  1.286 N 
t
1
2
3
4
5
6
7
8
9
10
1.286 2
N  2.679
36
N
1
4.928571
13.07635
26.46055
38.15409
37.8974
38.00788
37.96091
37.98099
37.97242
N
3.928571
8.147777
13.3842
11.69354
-0.25669
0.110482
-0.04698
0.02008
-0.00856
0.003656
We have an overshot.
In the next time step the population should
decrease below the carrying capacity.
N
K
Overshot
K/2
N (t  1)  N (t )  N (t )
N (t  1)  N  1.286N 
1.286 2
N  2.679
36
Fastest
population
growth
t
The transition matrix
Assume a gene with four different alleles. Each allele can mutate into anther allele.
The mutation probabilities can be measured.
A→A
B→A
C→A
D→A
A→A  0.997 0.001 0.001 0.001


A→B  0.001 0.994 0.001 0.004
A→C  0.001 0.003 0.995 0.004


A→D  0.001 0.002 0.003 0.991
Sum
1
1
1
Initial allele frequencies
 0.4 
 
 0.2 
 0.3 
 
 0.1 
 
1
What are the
frequencies in the
next generation?
Transition matrix
Probability matrix
A(t  1)  0.4 * 0.997  0.2 * 0.001 0.3 * 0.001 0.1* 0.001 0.3994
B(t  1)  0.4 * 0.001 0.2 * 0.994 0.3 * 0.001 0.1* 0.004  0.1999
C (t  1)  0.4 * 0.001 0.2 * 0.003 0.3 * 0.995 0.1* 0.004  0.2999
D(t  1)  0.4 * 0.001 0.2 * 0.002 0.3 * 0.003 0.1* 0.991 0.1008
 A(t  1)   0.997

 
 B(t  1)   0.001
 C (t  1)    0.001

 
 D(t  1)   0.001

 
0.001 0.001
0.994 0.001
0.003 0.995
0.002 0.003
F(t  1)  PF(t )
0.001 A(t ) 


0.004 B(t ) 
0.004 C (t ) 




0.991 D(t ) 
Σ=1
The frequencies at time
t+1 do only depent on
the frequencies at time t
but not on earlier ones.
Markov process
Does the mutation process result in stable allele frequencies?
 A(t  1)   A(t )   0.997

 
 
 B(t  1)   B(t )   0.001
 C (t  1)    C (t )    0.001

 
 
 D(t  1)   D(t )   0.001

 
 
AN  N
AN  N  0
( A  I ) N  0
0.001
0.994
0.003
0.002
0.001
0.001
0.995
0.003
0.001 A(t ) 


0.004 B(t ) 
0.004 C (t ) 




0.991 D(t ) 
AN  N
Stable state vector
Eigenvector of A
Eigenvalue Unit matrix Eigenvector
A
B
C
D
A
B
C
D
0.997
0.001
0.001
0.001
0.001
0.994
0.001
0.004
0.001
0.003
0.995
0.004
0.001
0.002
0.003
0.991
Eigenvectors
0
0 0.842927 0.48866
0.555069 0.780106 -0.18732 0.43811
0.241044
-0.5988 -0.46829 0.65716
-0.79611
-0.1813 -0.18732
0.3707
Eigenvalues
0.988697
0.992303
0.996
1
Every probability
matrix has at least
one eigenvalue = 1.
The largest eigenvalue
defines the stable state
vector
The insulin – glycogen system
At high blood glucose levels insulin stimulates glycogen synthesis and inhibits
glycogen breakdown.
N   fN  g
The change in glycogen concentration N can be modelled
by the sum of constant production g and concentration
dependent breakdown fN.
At equilibrium we have
 fN  g  N  0
f
N 1
 g

  0

 1
D   2
N
N
1
2




The symmetric and square
matrix D that contains
squared values is called the
dispersion matrix
 f 
T
T
   N 1 0  0
1  N 1
 g 
 1 N 2   f 
 2

  0
N

g
1 


The vector {-f,g} is the stationary state vector (the
largest eigenvector) of the dispersion matrix and
gives the equilibrium conditions (stationary point).
 0
 2
 N
The glycogen concentration at equilibrium:
N
N 2   1 0   f 
  1

  0

0   0 1  g 
The value -1 is the eigenvalue of
this system.
N equi
g

f
The equilbrium concentration
does not depend on the initial
concentrations
A matrix with n columns has n
eigenvalues and n eigenvectors.
Some properties of eigenvectors
If  is the diagonal matrix
of eigenvalues:
The eigenvectors of symmetric
matrices are orthogonal
ΛU  UΛ
A( sym m etric) :
AU  UΛ  AUU1  A  UU 1
U' U  0
Eigenvectors do not change after a
matrix is multiplied by a scalar k.
Eigenvalues are also multiplied by k.
The product of all
eigenvalues equals the
determinant of a
matrix.
[ A  I ]u  [kA  kI ]u  0
det A  i 1 i
n
The determinant is zero if
at least one of the
eigenvalues is zero.
In this case the matrix is
singular.
If A is trianagular or diagonal the
eigenvalues of A are the diagonal
entries of A.
A
2
3
3
-1
2
4
3
-6
-5
5
Eigenvalues
2
3
4
5
Page Rank
Google sorts internet pages according to a ranking of websites based on the probablitites to
be directled to this page.
Assume a surfer clicks with probability d to a certain
website A. Having N sites in the world (30 to 50 bilion)
the probability to reach A is d/N.
Assume further we have four site A, B, C, D, with links
to A. Assume further the four sites have cA, cB, cC, and
cD links and kA, kB, kC, and kD links to A.
If the probability to be on one of these sites is pA, pB,
pC, and pD, the probability to reach A from any of the
sites is therefore
dk
dk
dk
p A  pB
B A
cB
 pC
CA
cC
 pD
D A
cD
p A  pB
dkB A
dk
dk
 pC C  A  pD D A
cB
cC
cD
The total probability to reach A is
pA 
Google uses a fixed value of d=0.15.
Needed is the number of links per
website.
1


  dkA B / c A
  dk
AC / c A

  dk
A D / c A

Probability matrix P
dk
dk
dk
d
 pB B A  pC C  A  pD D A
N
cB
cC
cD
pA 
dk
d
dk
dk
 pB B  pC C  pD D
N
cB
cC
cD
pB 
dk
d
dk
dk
 p A A  pC C  pD D
N
cA
cC
cD
pC 
d
dk
dk
dk
 p A A  pB B  pD D
N
cA
cB
cD
pD 
dk
d
dk
dk
 p A A  pB B  pC C
N
cA
cB
cC
 dkB  A / cB
 dkC  A / cC
1
 dkB / cB C
 dkC  B / cC
1
 dkB  D / cB
 dkC  D / cC
 dkD  A / cD  p A 
d 
 
 
 dkD  B / cD  pB  1  d 
  



 dkD C / cD pC
N d
 
 
d 



1
 
 pD 
Rank vector u
Internet pages are ranked according to probability to be reached
A
B
C
D
0
0
0  p A 
 1
 0.15

 


p

0
.
15
1

0
.
15

0
.
075
0
.
15

 B  1 


 0
 0.15
1
 0.075 pC  4  0.15

 


 0





0
0
1  pD 

 0.15
P
A
B
C
D
1
-0.15
0
0
0
1
-0.15
0
0
-0.15
1
0
0
-0.075
-0.075
1
0.0375
0.0375
0.0375
0.0375
1
0
0
0
0.153453 1.023018 0.153453 0.088235
0.023018 0.153453 1.023018 0.088235
0
0
0
1
A
0.0375
B 0.053181
C 0.04829
D
0.0375
P-1
Larry Page
(1973-
Sergej Brin
(1973-
Page Rank as an eigenvector problem
0
0
0  p A 
 1
 0.15

 


1
 0.15  0.075 pB  1  0.15
  0.15

 0
 0.15
1
 0.075 pC  4  0.15

 


 0
 p 
 0.15
0
0
1

 D 


In reality the
constant is
very small
0
0
0  p A 
 1

 
1
 0.15  0.075 pB 
  0.15
0
 0
 0.15
1
 0.075 pC 

 
 0
 p 
0
0
1

 D 
 0
0
0
0  1
 


0
.
15
0

0
.
15

0
.
075
 0


 0
 0.15
0
 0.075  0
 

0
0
0   0
 0
A
B
C
D
0 0 0  p A 
 
1 0 0  p B 
0
0 1 0  pC 
 
0 0 1  pD 
A
B
C
D
0
0
0
0
-0.15
0
-0.15
-0.075
0
-0.15
0
-0.075
0
0
0
0
Eigenvectors
0 0.707107 0.408248
0
0.707107
0 0.408248 0.70711
0.707107 -0.70711
0 -0.7071
0
0
-0.8165
0
The final page rank is given
by the stationary state
vector (the vector of the
largest eigenvalue).
Eigenvalues
-0.15
0
0
0.15
0
0
0
0
Home work and literature
Refresh:
Literature:
• Linear equations
• Inverse
• Stochiometric equations
Mathe-online
Asymptotes:
www.nvcc.edu/home/.../MTH%20163
%20Asymptotes%20Tutorial.pp
http://www.freemathhelp.com/asymp
totes.html
Limits:
Pauls’s online math
http://tutorial.math.lamar.edu/Classe
s/CalcI/limitsIntro.aspx
Sums of series:
http://en.wikipedia.org/wiki/List_of_
mathematical_series
http://en.wikipedia.org/wiki/Series_(
mathematics)
Prepare to the next lecture:
•
•
•
•
Arithmetic, geometric series
Limits of functions
Sums of series
Asymptotes
Download