Transcript Slajd 1

The book of nature is written in
the language of mathematics
Galileo Galilei
Modelling Biology
Modelling Biology
Basic Applications of Mathematics and
Statistics in the Biological Sciences
Basic Applications of Mathematics and
Statistics in the Biological Sciences
Part I: Mathematics
Script A
Introductory Course for Students of
Modelling Biology
Basic Applications of Mathematics and
Statistics in the Biological Sciences
Biology, Biotechnology and Environmental Protection
Part I: Mathematics
Werner Ulrich
Script B
Part II: Data Analysis and Statistics
Script A
Introductory Course for Students of
Biology, Biotechnology and Environmental Protection
Werner Ulrich
Introductory Course for Students of
Biology, Biotechnology and Environmental Protection
Werner Ulrich
UMK Toruń
2007
UMK Toruń
2007
www.uni.torun.pl/~ulrichw
UMK Torun
2007
Additional sources
http://en.wikipedia.org/wiki/Matrix_(mathematics)
K. Kaw. 2002. Introduction to matrix algebra
http://www.autarkaw.com/books/matrixalgebra/index.html
http://www.ems.bbk.ac.uk/faculty/phdStudents/efthyvoulou/Kaw.pdf
Introduction to matrix algebra and linear models:
http://nitro.biosci.arizona.edu/courses/EEB581-2006/handouts/LinearI.pdf
http://matwww.ee.tut.fi/Kost/MatrixAlgebra-toc.html
Matrix cook book
http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/3274/pdf/imm3274.pdf
Matrix
http://en.wikipedia.org/wiki/Matrix_theory
A first course in linear algebra (free online textbook)
http://linear.ups.edu/download.html
Matrix algebra and regression
http://www.stat.tugraz.at/courses/files/s05.pdf
Mathe online
http://www.matheonline.at/mathint.html
Our program
This compact lecture centres on
matrix algebra and its applications
in biology.
1. Vectors and linear transformations
For each lecture I’ll give the
concepts and key phrases to get
acquainted with.
4. Linear and multiple regression
2. Matrices in biology, data bases, basic operations
3. Solving linear systems
5. Eigenvalues and eigenvectors
6. Markov chains
7. Other applications
Vectors
y
A vector marks a shift of a point at
position P to position Q.
 x 
v 
 y 
y
 0
SS     0
 0
S
Q
P
y
v
P
v
x
P (xP;yP)
Q (xQ;yQ)
Q
 xq  xp 
PQ  
 y  y 
p 
 q
x
 xq  xp 
PQ  
 y  y 
p 
 q
 xp  xq 
QP  
 y  y 
q 
 p
Vectors of the same length and direction are identical.
Vectors are either
denoted with bold type small letters: u, v, w…
or as segment lines with an arrow: PQ
Hermann Günther Graßmann
1809-1877
v
x
PQ  QP
b 
u   
a
y
u
3
i and j are called unit
vectors.
b
a
cosa  ; sin a 
r
r
 r cosa 

u  
 r sin a 
2
r
1
u
a
b 
u     bi  aj
a
Polar coordinates
j
a
i
1
b
2
3
4
x
The length of a vector
r 2  a 2  b2
N-dimensional space
 x1 
 
 x2 
v   x3 
 
 ... 
x 
 n
r  u  a 2  b2
v 
n
x
i 1
2
i
Basic operations
v
a+b+c+d=c+a+b+d=e
y
y
u
 xv 
v 
 yv 
v
yu
d
yv
xv
 xu 
u 
 yu 
xu
yv + yu
d
e
c
xv + xu
e
b
u
b
a
a
c
x
x
 xu   xv   xu  xv 
u v      

y
y
y

y
v 
 u  v  u
Inequation of the triangle
v
u
u+v
u+v = v+u
u+o=u
u+(v+w)=(u+v)+w
u+(-u)=o
Commutative law
 xu 
 xv 
u   ; v   
Zero element
 yu 
 yv 
Associative law
Additive inverse u  v  ( xu  xv ) 2  ( yu  yv ) 2  u  v  ( xu  xv ) 2  ( yu  yv ) 2
Basic operations
y
 xu 
u 
 yu 
u
a-b-c-d=a-(b+c+d)=e
y
Xu + xv
yu - yv
u
xu
yu
v
e
yv
d
d
e
xv
c
v
 xv 
v 
 yv 
a
c
b
a
b
x
x
 xu   xv   xu  xv 
u v      

y
y
y

y
v 
 u  v  u
 xu    xv   xu  xv 
  

u  v  u  ( v)     
y

y
y

y
v
 u  v  u
a-b-c=a-(b+c)
a-o=a
a-b≠b-a
Zero element
The S product
y
 4 xu 

4u  
4
y
 u
4yu
 x1   nx1 
  

x
nx
2
2
  

nv  n  x3    nx3  ; n  R
  

 ...   ... 
 x   nx 
 n  n
u
yu
xu
j
i
 a  1   0 
u     a   b   ai  bj
 b   0  1 
4xu
x
Addition, subtraction, and S-product define a
so-called linear vector space.
nu = un
1u=1
0u=0
nku=knu
n(u+v)=nu+nv
(n+k)u=nu+ku
Commutative law
Neutral element
Associative law
Distributive law
Distributive law
A vector space is a commutative group:
1. The commutative and associative laws
hold.
2. A neutral element exists
3. An inverse element exists.
The S product
u  xu / 2 


2  yu / 2 
u/2
u
u  xu  yu
2
2
u
2
2
 xu / 4  yu / 4 
2
u
xu  yu

2
2
2
2
The scalar product
v
y
rv
v
A
a
ru
B
uv  AC(rv cos(uv))  AC * AB
 xu  xv 
uv      xu xv  yu yv
 yu  yv 
xu
y
 cos(u); u  sin(u)
ru
ru
xv
y
 cos(v ); v  sin(v )
rv
rv
a  u v  v  u
u
cos(u v)  cos(v  u)  cos(v ) cos(u)  sin(v ) sin(u)
C
x x
y y
cos(u v)  u v  u v
ru rv ru rv
x xu xv  yu yv  u v  ru rv cos(u v)
The scalar or dot product between two vectors results in a scalar.
uv = vu
u1=u
uo=o
(k+n)u=ku+nu
Commutative law
Neutral element
Zero element
Distributive law
u (vw)≠(uv)w
Associative law doesn’t hold
 u1  v1 
  
 u2  v2 
n




u v  u3 v3  u1v1  u2 v2  u3v3 ...   ui vi
  
i 1
 ...  ... 
  
 un  vn 
The inequality of Cauchy-Schwarz
uv  ru rv  u v
The scalar product of orthogonal vectors
y  m x  b1
y
a
1
x  b2
m
x1
b
x2
y2
uv  u v cos( / 2)  0
y1
y
rv
ru
y2  y1
 m1
x2  x1
xn1  xn 2  ( xn 2  xn1 )


yn 2  yn1
yn 2  yn1
 ( x2  x1 )
1
 m2  
y2  y1
m1
xn1
u
ru
V’
b
x
xn2
yn1
a
yn2
 xu  r
uv    u
 yu  rv
v
 yu  ru

  ( xu xv  yu xv )  0

x
 u  rv
 xv 
 
 yv 
r  xv   yu 

v'  u    
rv  yv    xu 
v' 
ru
rv
The scalar product of orthogonal vectors is zero.
The square of a vector u2
uu  u u cos( 0)  u u  u
ax=k
has an indefinite number of solutions.
Therefore, the division through a vector
is not defined.
2
 a  x 
ax      ax  by  k
 b  y 
k  ax k a
y
  x
b
b b
Examples
What is the angle between the vectors {3,2} and
What is the direction of u that forms with v =
{4;5}?
(12;4} an angle of /3?
uv  ru rv cos(uv)
cos(uv) 
uv
uv
 3  4 
    12  10  9  4 16  25 * cos(uv)
 2  5 
22
 cos(uv)  uv  arccos(0.953)  0.308
533
Are the vectors {3,9} and {-12;4} perpendicular?
 3   12
  36  36  0
uv   
9
4
 

For what z are {6,0,12} and -8,13,z}
perpendicular?
 6   8 
  
uv   0 13   48  0  12z  0
12 z 
  
48
z
4
12
y
u
/3
a
v
rv
x
xv
12


cosa  a  arccos
  0.32
rv
144

16



 0.32  1.37
3
What z makes {6,0,12} and {-8,13,z} parallel?
 6   z 
  
u v   0 13   0  z  16
12  8 
  
 6   z 
  
u v   0   8   0  z  26
1213 
  
 6 13 
  
u v   0   z   0  nd
12  8 
  
 6   8 
  
u v   0   z   0  nd
1213 
  
Linear dependencies
We have k vectors of the same dimension a1 to ak.
A linear combination is then the sum of these vectors of the form
k
u  1a1  2a 2  3a 3  ...  k ak   i ai
i 1
 a1   b1   c1 
     
 a2   b2   c2 
u  3   4   5 
a
b
c
 3  3  3
 a  b  c 
 4  4  4
 7   2  0
     
 2   2  0
u  3   4   5 
5
2
0
     
   3   0 
     
 7   2
    1 
 2   2  
u  3   4   2 2 
5
2
     3 
   3 
   
Vectors are linearly independent if
u  1a1  2a2  3a3  ... k ak  o
has only one solution of 1=2=3=…=k = 0
Are the vectors {25,64,144}, {5,8,12},
and {1,1,1} linearly independent?
 25   5  1
25  5   0

    

  64     8   1  o  64  8   0
144 12 1
144  12   0

    

144  12   0
39  13  0
13
39  80  0    0    0    0
80  4  0 
4
Are the vectors {1,2,5}, {2,5,7}, and
{6,14,24} linearly independent?
1   2   6 
  2  6  0
     

  2     5   14   o  2  5  14  0
 5   7   24
5  7  24  0
     

2  5  14  0
    0
Vectors are linearly dependent if we can express one of
them as a linear combination of the others.
1   2   6 
     
  2     5    14   o
 5   7   24
     
1   2   6 
     
2 2   2 5   114 
 5   7   24
     
The vector product
The vector or cross product combines two vectors to give a
third vector that is perpendicular to the plane defined by the two
factors .
w
uxv=w
w  u v sin(uv)
v
A  h u  u v sin(uv)
u
The length of the cross product vector equals the area of the
parallelogram made by the two factors.
w
v
h
u
a x b = -b x a
Antisymmetry
|a x b| = |a||b|; if a and b are orthogonal
a x b = o; if ∢ ab = 0 or 
a x (b+c)= a x b + a x c
Distributive law
k(a x b) = ka x b = a x kb
Associative law
axa=o
a x o= o
a x 1= b
null element
no neutral element
The vector product
w
 a   d   (bf  ce) 
    

uxv   b  x e    (cd  af )   w
 c   f   (ae  bd ) 
    

v
h
u
 a  (bf  ce) 
 

u w   b  (cd  af )   abf  ace  bcd  baf  cae  cbd  0
 c  (ae  bd ) 
 

a
d 
 
 
u   b   ai  bj  ck ; v   e   di  ej  fk
c 
f
 
 
uxv   vxu
ixj  k ; ixk   j; jxk  i
uxv  ai  bj  ck xdi  ej  fk  
aiej  aifk  bjdi  bjfk  ckdi  ckej  aiej  aifk  bidj  bjfk  cidk  cjek
uxv  (ae  bd )ij  (af  cd )ik  (bf  ce) jk  (ae  bd )k  (af  cd ) j  (bf  ce)i
 a   d   (bf  ce) 
    

uxv   b  x e    (cd  af )   w
 c   f   (ae  bd ) 
    

What is the volume of a tetraeder?
What is the volume of the tetraeder given
by
A {1,2,3}
B {2,1,4}
C {4,5,1}
D {3,4,6}
D
h C
ABxA
C
B
A
hF
3
( ABxAC)  2 F
V
( ABxAC) AD  ( ABxAC) h
V
( ABxAC) AD
6
 2 1 
3 
 2


 
 
AB  1  2 ; AC   3 ; AD   2 
 4  3
  2
3


 
 
1   3    1
     
ABxAC    1 x 3    5 
1    2   0 
     
  1 2 
  
V   5  2  / 6  8 / 6  4 / 3
 0  3 
  
Application
Berlin
Warsaw
An aeroplane flies from Berlin to Warsaw with
constant speed of 550 kmh-1. Wind blows from
the north with speed 50 kmh-1. In which
direction does the aeroplane fly? What is the
new speed?
 550
0 
; u  

v  
0

50




 550 
  u  v  5502  502  552
u  v  
  50
5502
uu  v   u u  v cosa  cosa 
 0.99637 a  0.085rad  4.879
550* 552
Vectors and geometry
a  b  c  (a  b)2  a2  b2  2ab  c2  a 2  b2  2abcos(ab)  c 2
Cosine law
b
a
If a and b are orthogonal cos(∟ab) = 0:
Law of Pythagoras
c
(a  b)(a  b)  a2  b2  a 2  b2  0
a-b
The vectors a+b and a-b are orthogonal.
b
a+b
a
a
Geometric projections
Reflexion about an
axis
P
Parallel shift
P’
P
x
v
x
x’
x’=x+v
x’
Reflexion about the
origin
v
P’
a 0  a 
   
x'  x  v     
b

2
b
  
   b
Turning about an angle a
Stretching
P’
P’
v
x’=3x
P
u
P
P’
 a
x'   x   
b
a
v
P
vu
u v  u v cos(a )  u 2 cos(a )
uuv
 u cos(a )  v  u cos(a )
uv