See discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/352180145 Some ApplicAtionS of lineAr AlgebrA in computer Science Presentation · June 2021 CITATION READS 1 2,406 1 author: R. C. Mittal Jaypee Institute of Information Technology 163 PUBLICATIONS 3,790 CITATIONS SEE PROFILE Some of the authors of this publication are also working on these related projects: Solution of Differential Equations using wavelets View project B Splines Based Solutions of Partial Differential Equations View project All content following this page was uploaded by R. C. Mittal on 19 June 2021. The user has requested enhancement of the downloaded file. Some ApplicAtionS of lineAr AlgebrA in computer Science R. C. Mittal Department of Mathematics, Jaypee Institute of Information Technology Sector 62 NOIDA (U. P.) R. C. Mittal Applications of Linear Algebra 1 Page Ranking We start with a question How does the Google search web pages ??? Google searches web pages with the help of “Page Ranking” for the given key word searched for . What is page ranking? According to Wikipedia, page rank is an algorithm used by Google Search to rank web pages in their search engine results. R. C. Mittal Applications of Linear Algebra 2 • PageRank is a way of measuring the importance of website pages. • According to Google PageRank works by counting the number and quality of links to a page to determine a rough estimate of how important the website is. The underlying assumption is that more important websites are likely to receive more links from other websites. Let us discuss a simple example R. C. Mittal Applications of Linear Algebra 3 Suppose there are 5 persons A, B, C , D and E. Some of them know each other and consider friends. Consider the following matrix (1) A= This matrix indicate that A has all other 4 friends and give equal weight to them, B and D each has only one friend. C has 3 friends and E has two friends. R. C. Mittal Applications of Linear Algebra 4 So friend score initially of X is row sum of A. FS(A) = 11/6, FS(B) = 13/12 FS(C) = ¼, FS(D) = ¼ FS(E) = 19/12 Suppose we would like to know who will be our real friend . Initially, you give equal score to each one i.e. [1, 1, 1, 1, 1]. Now we try to iterate it as below vn+1 = A vn ..(2) with v0 = [1, 1, 1, 1, 1]T . This is well known Power method. R. C. Mittal Applications of Linear Algebra 5 It will give dominant eigenvalue and corresponding eigen vector. Now let us replace the friend concept to link in a web page . We form the matrix A as follows • A webpage A is a friend of another webpage B if it has a hyperlink to the webpage B. • Google finds out who’s friends with who by just crawling the web to find out who links to who. • The number of “friends” a webpage has is just the number of links present on the webpage. • The matrix A is created by crawling the web. Once we have it, we find its eigenvector to get an estimate of the PageRanks. R. C. Mittal Applications of Linear Algebra 6 Perron Theorem: Let A = (aij ) be a real positive square matrix. Then we have (1) Let r=ρ(A), then r >0 and suppose it is the largest eigen value. (2)The eigenvalue r has a positive its associated eigenvector. (3) The eigenvalue r is a simple root of the characteristic polynomial of A. R. C. Mittal Applications of Linear Algebra 7 Cipher Code Designing Suppose we have to encode the text “HEMA IS BEAUTIFUL ” (2) We select the linear transformation given by the matrix T= (3) The numerical equivalent of (2) is 8 5 13 1 27 9 19 27 2 5 1 21 20 9 6 21 12 27 (4) R. C. Mittal Applications of Linear Algebra 8 Now we apply transformation (3) on (4) in groups of 3 values, to get 57 54 89 101 127 86 123 131 155 55 51 100 79 68 136 … (5) We convert this to modulo 27, to get 3 0 8 20 19 5 15 23 20 …. (6) So our cipher will be C HTSEOWT ….. (7) If we wish decipher it, we multiply (6) by the inverse of T to get the original message R. C. Mittal Applications of Linear Algebra 9 Principal Component Analysis Today a lot of data is generated daily in different social sites. In fact 90% of today data is generated in the last 3-4 years. This data is to be properly analyzed to gather important and relevant information. PCA is a dimension reduction technique which give most dominant features from the data. These newly extracted features are known as “Principal Components” . R. C. Mittal Applications of Linear Algebra 10 Key Points of PCA • A principal component is a linear combination of the original variables • Principal components are extracted in such a way that the first principal component explains maximum variance in the dataset • Second principal component tries to explain the remaining variance in the dataset and is uncorrelated to the first principal component • Third principal component tries to explain the variance which is not explained by the first two principal components and so on R. C. Mittal Applications of Linear Algebra 11 It may be noted that each additional dimension we add to the PCA technique captures less and less of the variance in the model. The first component is the most important one, followed by the second, then the third, and so on. How to find Principal Components? In order to obtain principal components, we compute the singular values of data. R. C. Mittal Applications of Linear Algebra 12 Suppose A is a real mxn matrix, then singular values of A are nothing but square roots of non-negative eigen values of ATA . Here ATA is a self adjoint matrix. In singular value decomposition of the matrix A, we decompose the matrix A into UDVT , U is a mxm orthonormal matrix, V is a nxn orthonormal matrix and D is a mxn matrix with rxr diagonal matrix containing singular values of A. The matrix V gives us principal directions. R. C. Mittal Applications of Linear Algebra 13 Image Compression We can store an image in a matrix where each entry represents the value of its pixel. For example, a gray scale image (black white image) can be stored in PNG format where a pixel has a value 0 or 1. Suppose we have an image of size 480 x 423 i.e. we have a matrix A of size 480 x 423 having values only 0 or 1. We decompose it in SVD form. Now we retain only first 30 singular values and reconstruct the image. R. C. Mittal Applications of Linear Algebra 14 R. C. Mittal Applications of SVD 15 Qualitatively, we found very little difference in the image. However, in first case we have 480 x 423 = 203040 pixels values while after reduction we have only 30 diagonal values , 480 x 30 values in U and 30 x 423 values in VT . Total values = 30(1 + 480 + 423) = 27120 value. This is roughly 13% of original values. R. C. Mittal Applications of Linear Algebra 16 Face Recognition • Suppose an organization has 1000 employees. The organization has created a data base of face images of the employees with 4 face images at different angles of each employee. So there are 4000 face images in SVD form of employees. Now whenever an employee comes to the organization TV cameras are taking his photos and try to match with stored images i.e. try to match their singular values for face recognition R. C. Mittal Applications of Linear Algebra 17 References 1. G. Strang, Linear Algebra and its Applications, Thomson, Brooks/Cole, 2006 2. R. K. Jain, S.R. K. Iyengar & M. K. Jain, Numerical Methods, New Age International Publishers, New Delhi, 2004 3. M. H. Rafique, Under Standing Eigen-Vectors and Google Page-Rank Algorithm, https://medium.com/@muhammadhassaanrafique/unde r-standing-eigen-vectors-and-google-page-rank-algorithm3ae77c2f92de R. C. Mittal Applications of Linear Algebra 18 View publication stats R. C. Mittal Applications of Linear Algebra 19