Interesting applications of Linear Algebra

Imaji Pietersz
4 min readFeb 21, 2021

--

Hey yolks! haven’t you ever wondering why should you spend hours and hours on your algebra class instead of grabbing some snacks and watching your favorite show? Ah no, because the answer is pretty obvious, how can you ignore if ‘F’ in front of Linear Algebra in your results sheet! So you have to work hard and understand LA. But haven’t you wondering what is the reason for studying Linear algebra which most of you consider so hard?

Today I am here to briefly show you how linear algebra makes your life interesting. So yolks here we go!

Linear algebra is basically studying everything which is required for linear transforms. It can be considered as the core to almost all areas of mathematics. Linear algebra is also acting a major role in most sciences and fields of engineering, because it allows modeling many natural phenomena, and computing efficiently with such models.

By the way we rarely consider linear algebra as a field of data science in general because today’s modern tools are eligible to hide the complex underneath math. Therefore let’s dive into some applications of engineering and data science to understand the beauty of linear algebra hidden there. Put your goggles on. Here we go! I meant dive…

Computer vision

Computer vision is a field of artificial intelligence that trains computers to interpret and understand the visual world. Using digital images from cameras and videos and deep learning models, machines can accurately identify and classify objects — and then react to what they “see.”[1]

In computer vision, linear algebra is used in applications such as image recognition, some image processing techniques including image convolution and image representation as tensors — or as we call them in linear algebra, vectors.

Image convolution

Convolution is a general purpose filter effect for images, mainly Digital Image Processing. Digital Image Processing (DIP) and Linear Algebra (LA) go hand-in-hand. Digital images are made of pixels and each pixel contains numerical values which indicate the color of that region of squire. Basically any image can be represented as a matrix and linear operations such as matrix addition, subtraction, multiplication, et., can be perform on those matrix values, in other words you are applying a filter on your image. Let’s see a very basic example here.

Matrix representation of color images depends on the color system used by the program that is processing the image. Let’s consider RGB scale image which is consist of Red, green and blue, and each color can vary from 0 to 255. A pixel can be represented as a tri-dimensional vector (r, g, b). Different combination of RGB produce different colors.[2] By performing linear operations such as matrix addition, subtraction, multiplication you can apply different filters on to your image.

Natural Language Processing

Natural language processing (NLP) is a branch of artificial intelligence that helps computers understand, interpret and manipulate human language. For an example any grammar editor you have ever used has obtained by NLP.

Word Embedding

Computers are unable to understand human texts. Therefore before performing any processing on text, we need to represent the text numerically.

Word Embedding is a way of representing words as vectors of numbers while maintaining their meaning in the text. These representations are acquired by training various neural networks on a vast volume of text called a corpus. It is a language modeling learning technique. One of the most encountered word embedding technique is called word2vec.

Word2vec is a technique to generate word embedding for better word representation. It does so by capturing a large number of precise syntactic and semantic words relationships. Word2Vev explores word definitions by analyzing the surrounding context. It takes as its input a large corpus of words and produces a vector space, typically of several hundred dimensions, with each unique word in the corpus being assigned a corresponding vector in the space.

Let us now define Word Embedding formally. A Word Embedding format generally tries to map a word using a dictionary to a vector. Let us break this sentence down into finer details to have a clear view.

Sentence- “I have a messy hair”

A dictionary may be the list of all unique words in the sentence.

Dictionary — [“I” , “have” , “a” , “messy” , “hair” ]

A vector representation of a word may be a one-hot encoded vector where 1 stands for the position where the word exists and 0 everywhere else. As an example, the vector representation of “messy” is [0,0,0,1,0] and “hair” is [0,0,0,0,1]. This is just a very simple method to represent a word in the vector form. There are many type of advance ways of word embedding such a as Frequency based Embedding and Prediction based Embedding.[3]Let’s talk about the different types in another post as it is so interesting.

pretty interesting ha? Did you ever notice your favorite filter which makes pretty you amazing and Grammarly which gives you good suggestions of word choice are results of linear algebra? oh well I am sorry but let me reveal this to you. Now it is clear you can’t say no to LA anymore because it is essential for you. Happy learning!

References

[1]Metwalli S. “5 Applications of Linear Algebra In Data Science”, Jul 24,2020, https://towardsdatascience.com/5-applications-of-linear-algebra-in-data-science-81dfc5eb9d4

[2] Nag, H. “Applications of Linear Algebra in Image Filters [Part I]- Operations” , Jun 21, 2020 , https://medium.com/swlh/applications-of-linear-algebra-in-image-filters-part-i-operations-aeb64f236845

[3]NSS, “An Intuitive Understanding of Word Embeddings: From Count Vectors to Word2Vec”, JUNE 4, 2017, https://www.analyticsvidhya.com/blog/2017/06/word-embeddings-count-word2veec/

--

--

Imaji Pietersz
Imaji Pietersz

Written by Imaji Pietersz

I am a CSE undergraduate of UOM, Sri Lanka.

No responses yet