Professional Documents
Culture Documents
OF
LINEAR ALGEBRA
Group Members
Department- Electrical
L.L Samarathunga 120566H
S.D.M Sandanayaka 120575J
M.G.A.B.N Sandanuwan 120578V
I.K.A Sandeepa 120583G
D.S Saputhanthri 120589F
M.H.M Sazni 120592H
T.M Senarath 120598G
T.S.S Senarathna 120601M
K.M.G.Y Sewwandi 120608P
L.C.J Silva 120618V
Contents
1) Applications in Graph theory
2) Application in Games
3) Balancing chemical equation with aid of Linear Algebra
4) Application to Traffic flow
5) Application in Image Processing and Transformations
6) Weighted Least-Squares-Application of inner product space
7) Application to Genetics
8) Applications to Fibonacci numbers
1. Applications in Graph theory
Graph finite set of points called Vertices {P1,P2, ,Pn}
finite set of ordered pairs called Edges
Used for problem solving in Electrical engineering, computer programming, networking, economics and
communication.
Graph representation is done in matrix form to reduce the complexity
This matrix is referred as adjacency matrix P1
P4
Reducing Complexity
For a simple graph, For a directed graph,
G= G=
The problem is now converted to a numerical form hence theorems of linear algebra are
applicable.
Walks between vertices
To find the number of walks of a specified length
In the position vector the man is standing two units east from the origin and one
unit to the north.
In the velocity vector it says that the plane moves two units west and three units
north.
The direction vector shows us that the gun is pointed to the east side
One of the most popular applications in games is vector addition in physics
integration.
Any physical object in the game will have a vector for velocity, position and
acceleration.
For every frame one has to integrate these vectors meaning adding velocity to the
position and acceleration to the velocity.
For an example lets consider Mario jumping. Mario starts at (0,0) and he moves
upward and right at the same time with a velocity of (1,3).His acceleration is (0,-1)
throughout the jump. Below figure show Marios jump for 7 more frames and
velocities are stated near.
Initially we add his velocity (1,3) to his initial position (0,0) and we get his new position
as (1,3).
Then we add his acceleration to the velocity (0.-1) and get new velocity as (1,2). Like
this we can do this for other frames and get the values.
For vector subtraction, it works as same as the vector addition. Below figure is an
example for vector subtraction in games.
Like this linear algebra can be used in calculating length, distance, dot product , cross
product as well. Examples are in figures.
In advanced way these things can be used in 2D and 3D games design as well.
2D rotations.
3. Balancing chemical equation with aid of Linear Algebra
As an example consider the following chemical equation
NaOH + H2SO4 Na2SO4 +H2O
Assign variables to each of the unknown coefficients. Then the equation can be written
as follows :-
w NaOH + x H2SO4 y Na2SO4 +Z H2O
Following linear equations are obtained, by comparing the numbers of atoms in the
reactants and products.
w=2y w+4x=4y+z w+2x=2z x=y
w -2y =0
w 4x -4y -z =0
Rewrite the linear equations in standard form to get a homogeneous system of
w 2x -2z =0
equations with 4 variables. x -y =0
Perform the Gauss-Jordan elimination method to reduce the matrix.
Balanced equation :-
2 NaOH + 1 H2SO4 1 Na2SO4 + 2 H2O
The system has a free variable (). Therefore the system has
many solution if only where > 100
Lets take = 500. Then,
Their inner product Iout is written to the corresponding middle position (i; j)
of the output image.
Including Translations in coordinate transformations via linear algebra
For instance: rotate an image 300(degrees) around its center (30; 70). To do this we
have to concatenate three elementary operations: translate origin to center, rotate
around this new center, translate back to old origin position.
The concatenated transformation matrix C becomes:
Applied to a pixel position (x; y):
Since this result is already in normalized form, the top 2 positions are the resulting
transformed point (x; y).(Note that under this transformation the rotation center (30; 70) remains
invariant: if (x; y) = (30; 70),)
6. Weighted Least-Squares-Application of inner product space
Let y be a vector of n observations, y1, . . . , yn, and suppose we wish to approximate y
by a vector y that belongs to some specified subspace of Rn
Denote the entries in y by y1, . . . , yn.
Then the sum of the squares for error, or SS(E), in approximating y by y is,
SS(E) = (y1 y1)2 + + (yn yn)2 (1)
This is simply 2, using the standard length in Rn.
Now suppose the measurements that produced the entries in y are not equally
reliable.
Then it becomes appropriate to weight the squared errors in (1) in such a way that
more importance is assigned to the more reliable measurements.
If the weights are denoted by w12, . . . , wn2, then the weighted sum of the squares for
error is,
Weighted SS(E) = w12(y1 y1)2 + + wn2(yn yn)2 (2)
This is the square of the length of y y, where the length is derived from an inner
product namely,
It follows that the weighted SS(E) in (2) is the square of the ordinary length in Rn of W.y W.y,
which we write as 2.
Now suppose the approximating vector y is to be constructed from the columns of a matrix A.
Then we seek an x that makes Ax = y as close to y as possible. However, the measure of
closeness is the weighted error,
There are several types of inheritance; one of particular interest for us is the
autosomal type in which each heritable trait is assumed to be governed by a
single gene. Typically, there are two different forms of genes denoted by A
and
a. Each individual in a population carries a pair of genes; the pairs are
called
the individuals genotype. This gives three possible genotypes for each
inheritable trait: AA, Aa, and aa (aA is genetically the same as Aa).
How genes of parents are passed onto their offspring?
Each individual inhererits one of the genes from one of its parent and
the another gene from its other parent. Since each parent can pass on
only one gene to the offspring, which of the two genes passes on is a
matter of chance.
Lets consider an example of use of Linear Algebra regarding this matter
Example
A common problem in this field is finding the probability of certain genotype after a given number of years. For example, suppose we
want to study the fractions of the three genotypes in the n th generation of cows in terms of the initial genotype fractions. The
Following example is regarding that.
Professor Vetar, at UC Davis, discovers that cows with genotype AA can produce a better quality milk than other
genotypes. Professor Vetar is interested in discovering the fraction of offspring cows with genotype AA. If professor
Vetar choses to cross only genotype AA with other genotypes, what are the probabilities of the offspring being AA, Aa,
or aa ?
First assume, the crossing of AA with AA. This will always gives the genotype AA, therefore the probabilities of an
offspring to be AA, Aa, and aa respectively are equal to 1, 0, and 0.
Second, assume crossing of Aa with AA. The offspring will have half chance to be of genotype AA and half chance the
genotype Aa, therefore the probabilities of AA, Aa, and aa respectively are 1/2, 1/2, and 0.
Third, consider crossing of aa with AA. This will always results in genotype Aa. Therefore, the probabilities of genotypes
AA, Aa, and aa respectively are 0, 1, and 0, respectively.
Example Cont.
The following matrix is the result of the pervious observation:
Assume that the initial population of cows made up of an equal number of each genotype, therefore, the initial
distribution vector is given by,
Suppose someone is interested to see the number of cows with genotype AA, Aa, and aa after 20 generations. One way
to answer this question is to compute which may result in computational error during the matrix multiplication.
Another approach using of diagonalization reduces computation. If the matrix A can be written as product of an
invertible matrix P a diagonal matrix and inverse of P ,that is, then computation will be much simples and
therefore much less computational error. This is mainly because of the following fact:
and
Example Cont.
Not every matrix A is diagonalizable. For A to be diagonalizable it needs to have n linearly independent
eigenvectors. The matrix P is formed by writing these eigenvectors as columns of P. To find eigenvectors
we will first find the eigenvalues.
For the matrix A above the eigenvalues are,
and
Generally we can see Ak=PDkP-1 for any power k. And also Disadiagonalmatrix.
Therefore we can compute Dkasfollows,
Then this things can be applied to find Fibonacci numbers. The general pattern
for the Fibonacci sequence is
fn=fn-1+fn-2
A general expression for fn is not apparent, but can be transform the problem
into a simpler one using matrices. The idea is to compute the vector Vn,
for each n0 rather than fnitself. The relation fn=fn-1+fn-
2 gives
Where Is the
same matrix taken above.
Using the relationship,
and
Also An=PDnP-1
where
andVn=PDnP-1Vo
For all n0, The last vector of the formula for Vn is,
For example, now we can easily compute the 100 th term of the
Fibonacci sequence as follows
References
Application to Graph theory -
http://aix1.uottawa.ca/~jkhoury/graph.htm
Linear Algebra and Gaming -
http://home2.fvcc.edu/~dhicketh/linearalgebra/studentprojects/spring2012/BryanLutgen/Linear %20Algebra%20and%20Gaming.pdf
Balancing Chemical Equations with Linear Algebra -(VIDEO)
https://www.youtube.com/watch?v=yCxDAj87W8M
Applications of systems of linear equations: traffic flow -(VIDEO)
https://www.youtube.com/watch?v=8Kg21jBCm-k
Numerical Linear Algebra, Data Mining and Image Processing
http://www.math.hkbu.edu.hk/~mng/siamala.pdf
On Linear Least-Squares Problems with Diagonally Dominant Weight Matrices
http://epubs.siam.org/doi/abs/10.1137/S0895479895284014
Linear Algebra & Genetics
http://www.math.uci.edu/~brusso/ReedBAMS97.pdf
The Fibonacci Numbers Using Linear Algebra (VIDEO)
https://www.youtube.com/watch?v=L4Rgq8J7ZzA