SlideShare a Scribd company logo
THREE LINEAR ALGEBRA APPLICATIONS
11/28/2018, MATH 121 GUEST LECTURE
Three Applications of Linear algebra
Rather than grinding through a laundry list of applications, we focus on three parts,
where linear algebra plays a role. The first is an unsolved problem in complexity
theory of arithmetic, the second is a short overview how data structures and data
storage rely on notions put forward by linear algebra. The third is a spectral problem
in graph theory which is related to networks. The lecture will conclude with a slide
show showing off some applications without going into details.
1. Fast multiplication
1.1. An important unsolved problem in computer science is the question, how fast one
can multiply two integers. The grade-school multiplication of two n-digit numbers uses
about n2
computation steps. Modern computer algebra frame works use more sophis-
ticated methods like the GNU multiple precision arithmetic library. These methods
chose between different methods.
1.2. The Karatsuba method uses the idea that the one can write (a + b)(c + d) =
u+(u+w−v)+w where u = ac, w = bd, v = (b−a)(d−c). Instead of 4 multiplications,
we need only 3. This cuts the O(n2
) complexity to O(nlog2(3)
) = O(n1.5849
) which is
faster. For example, to multiply x = 1234 with y = 5577, build u = 12 ∗ 55 = 660
and w = 34 ∗ 77 = 2618, and v = (33 − 12)(77 − 55) = 22 ∗ 22 = 484, then compute
u ∗ 10000 + v100 + w = 6600000 + (660 + 2618 − 484) ∗ 100 + 2618 = 6882018.
1.3. I learned the following method from a talk of Albrecht Beutelspacher. If
numbers are close to a round number like 1000, there is a neat trick to make the
computation. Assume for example, we have two 3 digit numbers x, y so that the
product of 1000−a and 1000−b is smaller than 1000. Then use (1000−a)(1000−b) =
1000(1000 − a − b) + ab = 1000(x − b) + ab. For example, to compute 991 ∗ 899 build
x − b = 991 − 101 = 890 and ab = 9 ∗ 101 = 909. The result is 890909.
1.4. The fastest multiplication methods are based on linear algebra. Given again two
integers like x = 1234 and y = 5577. If n is the number of digits in x and y, then we
need about n2
operations to get the product. It turns out that there is a faster way
to do that. And this involves linear algebra. The idea is to write the numbers x, y as
functions, then multiply the functions using Fourier theory. How does this work?
Linear Algebra Applications
1.5. If xk and yk are the integer coefficients of x and y so that x = n−1
k=0 xk10k
and
y = n−1
k=0 yk10k
, we look at the functions f(z) = n−1
k=0 xkzk
and g(z) = n
k=0 ykzk
.
We assume n is the number of digits in xy and that xk, yk are zero for k larger than
the number of digits of x or y. Now, if h(z) = f(z)g(z), then h(10) is the product.
The point is that we can compute n data points of h with n log(n) operations and that
we can get from n data points of a polynomial the function back in n log(n) operators.
So, we can compute the product xy in n log(n) operations. How do we achieve this
miracle?
1.6. Given a polynomial f, we can look at the periodic function F(t) = f(e2πit
)/
√
n
and evaluate Xk = F(2πk/n) for k = 0, . . . , (n − 1). This produces a linear map
U : (x0, . . . , xn−1) → (X0, . . . , Xn−1) which is called the discrete Fourier trans-
form. There is a fast Fourier transform implementation which does this in n log(n)
computation steps. If U(y0, . . . , yn−1) = (Y0, . . . , Yn−1) then we have just to compute
Q = U−
1(XY ) and get xy = n
k=0 Qk10k
. Mathematica has the fast Fourier transform
and its inverse implemented. Here is the code:
FastMultiplication [ x , y ]:=Module[{X,Y,U,V, n ,Q} ,
X = Reverse [ IntegerDigits [ x ] ] ; Y = Reverse [ IntegerDigits [ y ] ] ;
n =Length [X]+Length [Y]+1; X=PadRight [X, n ] ; Y=PadRight [Y, n ] ;
U=InverseFourier [X] ; V=InverseFourier [Y] ;
Q=Round[Re[ Fourier [U∗V]∗ Sqrt [ n ] ] ] ;
Sum[Q[ [ k ] ] 10ˆ(k−1), {k , n } ] ] ;
x0 = 11234; y0 = 52342; FastMultiplication [ x0 , y0]==x0∗y0
The procedures Fourier and InverseFourier are implemented already in Mathematica
Here are emulations showing what they do:
X={4 ,2 ,3 ,2 ,1}; n =Length [X] ; InverseFourier [X]
f = Sum[X[ [ k ] ] t ˆ(k−1),{k , n } ] ;
N[ Table [ f /. t −> Exp[−I 2 Pi k/n ] ,{ k ,0 , n−1}]]/ Sqrt [ n ]
N[ ( Table [Exp[ I 2Pi k l /n ] ,{ k ,0 , n−1},{ l ,0 , n−1}]/Sqrt [ n ] ) .X]
Fourier [X]
2. Data structures
2.1. Information is commonly represented in the form of vectors or matrices. This
is sometimes not obvious as data can be complicated. Still, we usually get away with
matrices. For example, if we have names linked to addresses and telephone numbers,
we can make a spread sheet A(i, j), where A(i, 1) is the name and A(i, 2) is the
address and A(i, 3) is the telephone number. In a relational database, information
is stored in tables as matrices containing records as rows and attributes as columns.
2.2. Data can also be stored more geometrically, especially in the form of a graph. A
special case is the hierarchical database in which the graph is a tree, the Khipu knot
encoding used in the Incan empire is an example of a hierarchical database. It is
important to note however that also geometric information like a graph can be stored as
part of a relational data base. A graph with nodes can be encoded with an adjacency
matrix A(i, j) defined as A(i, j) = 1 if i and j are connected and A(i, j) = 0 else.
Figure 1. Khipu from the Inka period. Image Source: Museo Chileno
De Arte Precolombino.
3. Media
3.1. Multimedia like images, sound or movies are stored in vector or matrix form. An
image is an array of pixels, a sound is an array of amplitudes, a movie is given by
an array of pictures and a sound.
3.2. Let us look at a color image A: It is a matrix where each entry A(i, j) contains
three numbers (r, g, b), where r, g, b are red, green and blue color values. Even so this
is a rectangular array of pixels, where each pixel is a vector of numbers, this can be
written as a single vector.
3.3. A sound file consists of two vectors (l, r), where l is the left channel and r is the
right channel. Each entry can be a signed integers from −127 to 128. A movie can be
seen as a vector of pictures. It is a curve in the large space of all pictures.
Figure 2. 6 Frames from the Movie Samsara (2011). Each frame is a
360 x 854 matrix, where each pixel has a Red,Green and Blue value.
Linear Algebra Applications
4. Networks
4.1. A graph G = (V, E) consists of a collection of nodes V which are connected by
edges collected in E. Graphs in which the direction of the edges matter are also called
digraphs. If one says graph, one usually does not specify directions. A graph can be
encoded as a matrix A, the adjacency matrix of A. It is defined as A(i, j) = 1 if i is
connected to j and A(i, j) = 0 else. This matrix is self-adjoint, A = AT
. Therefore,
the eigenvalues of A are real.
4.2. The analogue of the Laplacian in calculus is the matrix L = B − A, where
B = Diag(d1, · · · , dn) is the diagonal matrix containing the vertex degrees of B in
the diagonal. The matrix L always has the eigenvalue 0, with eigenvector [1, 1, · · · , 1].
If the graph is connected, the rest of the eigenvalues are positive. They are the fre-
quencies one can hear, when one hits the graph. The eigenvectors tell something
about the distribution of electrons if the graph represents a molecule. In the case
of circular graphs, we need the same mathematics than for the fast multiplication of
integers. The circle is closed.
Figure 3. Examples of networks.
Oliver Knill, knill@math.harvard.edu, Math 121, Harvard College, 11/27/18

More Related Content

PDF
2002 santiago et al
PDF
Lesson 14: Derivatives of Exponential and Logarithmic Functions (Section 021 ...
PDF
Arts revealed in calculus and its extension
PDF
Principal Components Analysis, Calculation and Visualization
PDF
SPDE presentation 2012
PDF
Langrange Interpolation Polynomials
PDF
Ica group 3[1]
PDF
Specific function examples
2002 santiago et al
Lesson 14: Derivatives of Exponential and Logarithmic Functions (Section 021 ...
Arts revealed in calculus and its extension
Principal Components Analysis, Calculation and Visualization
SPDE presentation 2012
Langrange Interpolation Polynomials
Ica group 3[1]
Specific function examples

What's hot (19)

PDF
An algorithm for generating new mandelbrot and julia sets
PDF
Meta-learning and the ELBO
PPTX
A mid point ellipse drawing algorithm on a hexagonal grid
PDF
JC Vectors summary
PPTX
Lecture 9 dim & rank - 4-5 & 4-6
PPT
Chapter 2 Image Processing: Pixel Relation
PDF
Lausanne 2019 #2
PDF
Semi-Supervised Regression using Cluster Ensemble
PDF
Pixel Relationships Examples
PPTX
Basics of pixel neighbor.
PDF
Theory of Relational Calculus and its Formalization
PPTX
Double Integral
PDF
Algebras for programming languages
PPT
Introductory maths analysis chapter 02 official
PDF
A Coq Library for the Theory of Relational Calculus
PDF
Efficient Analysis of high-dimensional data in tensor formats
PDF
8517ijaia06
PDF
QMC: Transition Workshop - Reduced Component-by-Component Constructions of (P...
PPTX
Integration
An algorithm for generating new mandelbrot and julia sets
Meta-learning and the ELBO
A mid point ellipse drawing algorithm on a hexagonal grid
JC Vectors summary
Lecture 9 dim & rank - 4-5 & 4-6
Chapter 2 Image Processing: Pixel Relation
Lausanne 2019 #2
Semi-Supervised Regression using Cluster Ensemble
Pixel Relationships Examples
Basics of pixel neighbor.
Theory of Relational Calculus and its Formalization
Double Integral
Algebras for programming languages
Introductory maths analysis chapter 02 official
A Coq Library for the Theory of Relational Calculus
Efficient Analysis of high-dimensional data in tensor formats
8517ijaia06
QMC: Transition Workshop - Reduced Component-by-Component Constructions of (P...
Integration
Ad

Similar to Lecture50 (20)

PDF
elliptic-curves-modern
PDF
Robust Image Denoising in RKHS via Orthogonal Matching Pursuit
PPTX
5_Exponential_Functicfhfgggdgdgdgdons.pptx
PDF
lemh202 (1).pdfhjsbjsjshsisvsjsbishsisbsisvsus
PDF
Mathematics and Physics And Chemistry with your mind properly and then practice
PDF
Solution set 3
PDF
OPTIMIZATION OF WEIGHT FUNCTION FOR (3+1)D PHONON PROPAGATION IN WEYL FERMION...
PDF
OPTIMIZATION OF WEIGHT FUNCTION FOR (3+1)D PHONON PROPAGATION IN WEYL FERMION...
PDF
Optimization of Weight Function for (3+1)d Phonon Propagation in Weyl Fermion...
PPTX
Parallel algorithm in linear algebra
PPTX
Networking Assignment Help
PDF
Lecture_note2.pdf
PDF
Computer Graphics in Java and Scala - Part 1
PPT
StewartCalc7e_01_01.ppt
PDF
computer graphic and multimedia for the students of MCA
ODP
Seismic data processing introductory lecture
PDF
On an extension of a c algebra
PDF
Lesson 2: A Catalog of Essential Functions (slides)
PDF
Lesson 2: A Catalog of Essential Functions (slides)
elliptic-curves-modern
Robust Image Denoising in RKHS via Orthogonal Matching Pursuit
5_Exponential_Functicfhfgggdgdgdgdons.pptx
lemh202 (1).pdfhjsbjsjshsisvsjsbishsisbsisvsus
Mathematics and Physics And Chemistry with your mind properly and then practice
Solution set 3
OPTIMIZATION OF WEIGHT FUNCTION FOR (3+1)D PHONON PROPAGATION IN WEYL FERMION...
OPTIMIZATION OF WEIGHT FUNCTION FOR (3+1)D PHONON PROPAGATION IN WEYL FERMION...
Optimization of Weight Function for (3+1)d Phonon Propagation in Weyl Fermion...
Parallel algorithm in linear algebra
Networking Assignment Help
Lecture_note2.pdf
Computer Graphics in Java and Scala - Part 1
StewartCalc7e_01_01.ppt
computer graphic and multimedia for the students of MCA
Seismic data processing introductory lecture
On an extension of a c algebra
Lesson 2: A Catalog of Essential Functions (slides)
Lesson 2: A Catalog of Essential Functions (slides)
Ad

Recently uploaded (20)

PPTX
2Systematics of Living Organisms t-.pptx
PPTX
DRUG THERAPY FOR SHOCK gjjjgfhhhhh.pptx.
PPTX
GEN. BIO 1 - CELL TYPES & CELL MODIFICATIONS
PPT
The World of Physical Science, • Labs: Safety Simulation, Measurement Practice
PDF
Formation of Supersonic Turbulence in the Primordial Star-forming Cloud
PPTX
EPIDURAL ANESTHESIA ANATOMY AND PHYSIOLOGY.pptx
PPTX
Cell Membrane: Structure, Composition & Functions
PDF
CAPERS-LRD-z9:AGas-enshroudedLittleRedDotHostingaBroad-lineActive GalacticNuc...
PPTX
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
PPTX
Taita Taveta Laboratory Technician Workshop Presentation.pptx
PDF
Phytochemical Investigation of Miliusa longipes.pdf
PDF
Mastering Bioreactors and Media Sterilization: A Complete Guide to Sterile Fe...
PDF
An interstellar mission to test astrophysical black holes
PPTX
Comparative Structure of Integument in Vertebrates.pptx
PPTX
2. Earth - The Living Planet earth and life
PDF
Biophysics 2.pdffffffffffffffffffffffffff
PPTX
BIOMOLECULES PPT........................
PPTX
2. Earth - The Living Planet Module 2ELS
PPTX
Introduction to Cardiovascular system_structure and functions-1
PDF
bbec55_b34400a7914c42429908233dbd381773.pdf
2Systematics of Living Organisms t-.pptx
DRUG THERAPY FOR SHOCK gjjjgfhhhhh.pptx.
GEN. BIO 1 - CELL TYPES & CELL MODIFICATIONS
The World of Physical Science, • Labs: Safety Simulation, Measurement Practice
Formation of Supersonic Turbulence in the Primordial Star-forming Cloud
EPIDURAL ANESTHESIA ANATOMY AND PHYSIOLOGY.pptx
Cell Membrane: Structure, Composition & Functions
CAPERS-LRD-z9:AGas-enshroudedLittleRedDotHostingaBroad-lineActive GalacticNuc...
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
Taita Taveta Laboratory Technician Workshop Presentation.pptx
Phytochemical Investigation of Miliusa longipes.pdf
Mastering Bioreactors and Media Sterilization: A Complete Guide to Sterile Fe...
An interstellar mission to test astrophysical black holes
Comparative Structure of Integument in Vertebrates.pptx
2. Earth - The Living Planet earth and life
Biophysics 2.pdffffffffffffffffffffffffff
BIOMOLECULES PPT........................
2. Earth - The Living Planet Module 2ELS
Introduction to Cardiovascular system_structure and functions-1
bbec55_b34400a7914c42429908233dbd381773.pdf

Lecture50

  • 1. THREE LINEAR ALGEBRA APPLICATIONS 11/28/2018, MATH 121 GUEST LECTURE Three Applications of Linear algebra Rather than grinding through a laundry list of applications, we focus on three parts, where linear algebra plays a role. The first is an unsolved problem in complexity theory of arithmetic, the second is a short overview how data structures and data storage rely on notions put forward by linear algebra. The third is a spectral problem in graph theory which is related to networks. The lecture will conclude with a slide show showing off some applications without going into details. 1. Fast multiplication 1.1. An important unsolved problem in computer science is the question, how fast one can multiply two integers. The grade-school multiplication of two n-digit numbers uses about n2 computation steps. Modern computer algebra frame works use more sophis- ticated methods like the GNU multiple precision arithmetic library. These methods chose between different methods. 1.2. The Karatsuba method uses the idea that the one can write (a + b)(c + d) = u+(u+w−v)+w where u = ac, w = bd, v = (b−a)(d−c). Instead of 4 multiplications, we need only 3. This cuts the O(n2 ) complexity to O(nlog2(3) ) = O(n1.5849 ) which is faster. For example, to multiply x = 1234 with y = 5577, build u = 12 ∗ 55 = 660 and w = 34 ∗ 77 = 2618, and v = (33 − 12)(77 − 55) = 22 ∗ 22 = 484, then compute u ∗ 10000 + v100 + w = 6600000 + (660 + 2618 − 484) ∗ 100 + 2618 = 6882018. 1.3. I learned the following method from a talk of Albrecht Beutelspacher. If numbers are close to a round number like 1000, there is a neat trick to make the computation. Assume for example, we have two 3 digit numbers x, y so that the product of 1000−a and 1000−b is smaller than 1000. Then use (1000−a)(1000−b) = 1000(1000 − a − b) + ab = 1000(x − b) + ab. For example, to compute 991 ∗ 899 build x − b = 991 − 101 = 890 and ab = 9 ∗ 101 = 909. The result is 890909. 1.4. The fastest multiplication methods are based on linear algebra. Given again two integers like x = 1234 and y = 5577. If n is the number of digits in x and y, then we need about n2 operations to get the product. It turns out that there is a faster way to do that. And this involves linear algebra. The idea is to write the numbers x, y as functions, then multiply the functions using Fourier theory. How does this work?
  • 2. Linear Algebra Applications 1.5. If xk and yk are the integer coefficients of x and y so that x = n−1 k=0 xk10k and y = n−1 k=0 yk10k , we look at the functions f(z) = n−1 k=0 xkzk and g(z) = n k=0 ykzk . We assume n is the number of digits in xy and that xk, yk are zero for k larger than the number of digits of x or y. Now, if h(z) = f(z)g(z), then h(10) is the product. The point is that we can compute n data points of h with n log(n) operations and that we can get from n data points of a polynomial the function back in n log(n) operators. So, we can compute the product xy in n log(n) operations. How do we achieve this miracle? 1.6. Given a polynomial f, we can look at the periodic function F(t) = f(e2πit )/ √ n and evaluate Xk = F(2πk/n) for k = 0, . . . , (n − 1). This produces a linear map U : (x0, . . . , xn−1) → (X0, . . . , Xn−1) which is called the discrete Fourier trans- form. There is a fast Fourier transform implementation which does this in n log(n) computation steps. If U(y0, . . . , yn−1) = (Y0, . . . , Yn−1) then we have just to compute Q = U− 1(XY ) and get xy = n k=0 Qk10k . Mathematica has the fast Fourier transform and its inverse implemented. Here is the code: FastMultiplication [ x , y ]:=Module[{X,Y,U,V, n ,Q} , X = Reverse [ IntegerDigits [ x ] ] ; Y = Reverse [ IntegerDigits [ y ] ] ; n =Length [X]+Length [Y]+1; X=PadRight [X, n ] ; Y=PadRight [Y, n ] ; U=InverseFourier [X] ; V=InverseFourier [Y] ; Q=Round[Re[ Fourier [U∗V]∗ Sqrt [ n ] ] ] ; Sum[Q[ [ k ] ] 10ˆ(k−1), {k , n } ] ] ; x0 = 11234; y0 = 52342; FastMultiplication [ x0 , y0]==x0∗y0 The procedures Fourier and InverseFourier are implemented already in Mathematica Here are emulations showing what they do: X={4 ,2 ,3 ,2 ,1}; n =Length [X] ; InverseFourier [X] f = Sum[X[ [ k ] ] t ˆ(k−1),{k , n } ] ; N[ Table [ f /. t −> Exp[−I 2 Pi k/n ] ,{ k ,0 , n−1}]]/ Sqrt [ n ] N[ ( Table [Exp[ I 2Pi k l /n ] ,{ k ,0 , n−1},{ l ,0 , n−1}]/Sqrt [ n ] ) .X] Fourier [X] 2. Data structures 2.1. Information is commonly represented in the form of vectors or matrices. This is sometimes not obvious as data can be complicated. Still, we usually get away with matrices. For example, if we have names linked to addresses and telephone numbers, we can make a spread sheet A(i, j), where A(i, 1) is the name and A(i, 2) is the address and A(i, 3) is the telephone number. In a relational database, information is stored in tables as matrices containing records as rows and attributes as columns. 2.2. Data can also be stored more geometrically, especially in the form of a graph. A special case is the hierarchical database in which the graph is a tree, the Khipu knot encoding used in the Incan empire is an example of a hierarchical database. It is important to note however that also geometric information like a graph can be stored as part of a relational data base. A graph with nodes can be encoded with an adjacency matrix A(i, j) defined as A(i, j) = 1 if i and j are connected and A(i, j) = 0 else.
  • 3. Figure 1. Khipu from the Inka period. Image Source: Museo Chileno De Arte Precolombino. 3. Media 3.1. Multimedia like images, sound or movies are stored in vector or matrix form. An image is an array of pixels, a sound is an array of amplitudes, a movie is given by an array of pictures and a sound. 3.2. Let us look at a color image A: It is a matrix where each entry A(i, j) contains three numbers (r, g, b), where r, g, b are red, green and blue color values. Even so this is a rectangular array of pixels, where each pixel is a vector of numbers, this can be written as a single vector. 3.3. A sound file consists of two vectors (l, r), where l is the left channel and r is the right channel. Each entry can be a signed integers from −127 to 128. A movie can be seen as a vector of pictures. It is a curve in the large space of all pictures. Figure 2. 6 Frames from the Movie Samsara (2011). Each frame is a 360 x 854 matrix, where each pixel has a Red,Green and Blue value.
  • 4. Linear Algebra Applications 4. Networks 4.1. A graph G = (V, E) consists of a collection of nodes V which are connected by edges collected in E. Graphs in which the direction of the edges matter are also called digraphs. If one says graph, one usually does not specify directions. A graph can be encoded as a matrix A, the adjacency matrix of A. It is defined as A(i, j) = 1 if i is connected to j and A(i, j) = 0 else. This matrix is self-adjoint, A = AT . Therefore, the eigenvalues of A are real. 4.2. The analogue of the Laplacian in calculus is the matrix L = B − A, where B = Diag(d1, · · · , dn) is the diagonal matrix containing the vertex degrees of B in the diagonal. The matrix L always has the eigenvalue 0, with eigenvector [1, 1, · · · , 1]. If the graph is connected, the rest of the eigenvalues are positive. They are the fre- quencies one can hear, when one hits the graph. The eigenvectors tell something about the distribution of electrons if the graph represents a molecule. In the case of circular graphs, we need the same mathematics than for the fast multiplication of integers. The circle is closed. Figure 3. Examples of networks. Oliver Knill, knill@math.harvard.edu, Math 121, Harvard College, 11/27/18