Въпроси на преподаването

HOW TO IMPROVE THE FIRST-YEAR STUDENTS MOTIVATION IN LEARNING MATRICES

Отворен достъп

https://doi.org/10.53656/math2022-3-1-how

Резюме. Linear algebra is one of the fundamental courses included in the curriculum of all mathematical, engineering and economic specialties. Students study the subject during the first semester. At this early stage in their education, they cannot realize the connection of the discipline with the specialized subjects. This demotivates the students and they do not make any effort to absorb and assimilate the material. The purpose of this article is to show at least a small part of the applications of Linear algebra in computer science, using only some basic concepts and thus to motivate students for more in-depth understanding of the material in the course. The article takes into account that not all first-year students have a good knowledge of programming. That’s why the software used to illustrate the examples in the article is Matlab. It’s a matrix-based software. Built-in graphics make it easy to visualize and gain insights from data.

Ключови думи: education; linear algebra; teaching; motivation

1. Introduction

Linear algebra is one of the fundamental disciplines included in the computer science curriculum \({ }^{3)}\). Techniques from linear algebra are used also in analytic geometry, engineering, (Angelov & Nikolova 2006) physics and other natural sciences, social sciences, in economics. Some of the disciplines studied by future computer specialists in which Linear Algebra can be found are: graph theory, cryptography, digital image processing, artificial intelligence, machine learning \({ }^{2)}\), computer vision and etc. It is used in all kind of algorithms in cybersecurity, clustering algorithms, in optimization algorithms and it is basically the only kind of math you need in quantum computing \({ }^{1)}\).

Linear algebra is from the first-year courses. Most of the time students avoid getting into linear algebra, because it’s “difficult” or “hard to understand”. Although partly true, linear algebra is a basic programming skill for data scientists and computer engineers(Asabere & Acakpovi 2016). So, a new way of teaching is needed to motivate and encourage students to learn (Caridade 2019).

This article shows only a short list that comprises a small fraction of the applications of basic linear algebra concepts in computer science, and more precisely at Digital image processing (Solomon & Breckon 2011). The idea is to motivate and support students’ interest in mathematics through applications (Silverman & Rosen 2010). Petrov et al. (2015) focused on the importance of practical examples in the teaching of linear algebra and noted that it is essential that such problems and solutions be discussed and explained very well.

Linear algebra in turn is built on two basic elements, the matrix and the vector. The examples in the presentation consider the operations with matrices and are selected with the clear idea that the students are in the first year and are just getting acquainted with the concept of matrix.

2. Digital image processing

Image processing can be defined as the processing of images using mathematical operations. With the introduction of computers, the processing is performed by means of computer graphic algorithms to digital images, which are obtained by a process of digitalization or directly using any digital device. The use of computer to perform image processing on digital images is called digital image processing (Razmjooy & Estrela 2019).

Some of the computer graphics operations that can be easily done by using the linear algebra are: rotation, skewing, scaling, Bezier curves, reflections, dot and cross products, projections, and vector fields. Other more complex operations like filters, require the combination of linear algebra with other mathematical tools.

There are three types of images. They are as following:

– Binary Images

It is the simplest type of image. It takes only two values “black” and “white” or 0 and 1. The binary image consists of a 1-bit image and it takes only 1 binary digit to represent a pixel.

Figure 1. Binary and grayscale image of a squirrel

– Grayscale images

A normal grayscale image contains 8 bits/pixel data, which has 256 different gray levels.

– Colour images

The images are represented as red, green and blue (RGB images). And each color image has 24 bits/pixel means 8 bits for each of the three colors band(RGB).

Color image (RGB image)="158×158Photo by pnglux.com

Figure 2. Color image representation in the RGB color

Matrix operations

Each pixel of a digital image is represented by a numerical value. So every image in a computer is saved in the form of a matrix of numbers. Therefore, digital images can be manipulated using matrices.

– matrix addition

In mathematics, matrix addition is the operation of adding two matrices by adding the corresponding entries together. Two matrices may be added only if they have the same dimension. In the figure below there are two binary images of the same size. Their corresponding matrices are \(A\) and \(B\). The matrices have the same dimension and consist of only two digits: 0 and 1. So, the matrix addition is possible. The new matrix \(C\) has the same dimension and its elements could be 0,1 and 2.

\(c_{i j}=\left\{\begin{array}{l} 0+0=0 \\ 0+1=1+0=1 \\ 1+1=2 \end{array}\right.\) \(\quad\quad\quad\begin{aligned} 0 &- black \\ 1 &- white \end{aligned}\)

Because the data range of the new matrix \(C\) is outside the default display range for binary image, every pixel with value 0 is displayed as black, and every pixel with value 1 and 2 is displayed as white. With other words “only for black

Figure 3. Image addition

– matrix subtraction

Matrix subtraction is the operation of subtracting two matrices of the same dimension by subtracting the corresponding entries. The difference between two matrices (and their corresponding binary images) is shown on the figure below. The values of the elements \(C_{i j}\) in both cases (\(A-B\) and \(B-A\) ) could be only \(-1,0\) and 1.

\[ c_{i j}= \begin{cases}0-1=-1 & \\ 0-0=1-1=0 & 0 \text { - black } \\ 1-0=1 & 1 \text { - white }\end{cases} \]

The value –1 is less than 0, so the corresponding pixel is replaced with the value 0. The images received in both cases are different which shows that the matrix subtraction is not commutative.

Photo byclipart-library.com-=ÙÛаÝ212×238ÙÛÝ212×238ÙÛÝ212×238-=

Figure 4. Image subtraction

One interesting application that could be done using matrix subtraction is to invert the colors of a binary image. For this purpose, a matrix \(A\) with the same dimension as the one corresponding to the binary image (matrix \(B\) ) is created. All the elements of \(A\) must be equal to 1. The difference \(C=A-B\) is considered. The only possible values for the elements of \(C\) are 0 and 1.

\(c_{i j}=\left\{\begin{array}{l} 1-1=0 \\ 1-0=1 \end{array}\right. \quad\quad\quad\begin{aligned}0&- black\\1&- white\end{aligned}\)

All the elements of \(B\) with value of \(0\) will become \(1\) in the obtained matrix \(C\) and all the elements with value of \(1\) at \(B\) will become \(0\) at \(C\). As a result the colors of the picture will be reversed.

DF&)3535B7⋽18DF)3535B7⋽18DF)3535B7⋽18DH****+=-Photo bywww.freepik.com/photos/floral

Figure 5. Invert image colors

Another effect that could be easily made is the indigo effect of an image. Suppose that there is one gray-scale image (fig.6) and it is represented in Matlab with its corresponding matrix \(A=\left(\mathrm{a}_{i j}\right)_{2956 \times 2350}\), where \(a_{i j} \in[0 ; 255]\). Another matrix \(B\) is made of the same dimention as \(A\) where

\(b_{i j}=255-a_{i j}\) for every \(i=1 . .2956 ; j=1 . .2350\)

DF&)3:9;B359⋽DF)Photosbywww.freepik.com/photos/people

Figure 6. Negative effect

In the received image, dark areas become lighter and light areas become darker(fig.6).

– transpose of a matrix

The transpose of a matrix is obtained by changing the rows into columns and columns into rows for a given matrix. Actually the transpose of a matrix is an operator that flips a matrix (image) over its diagonal by switching the row and column indices of a given matrix \(R\) and producing another matrix (fig.7).

=?APhoto by pnglux.com

Figure 7. Flipping an image

– matrix scalar multiplication

Let’s be given a grayscale image with its corresponding matrix \(R\). All the elements in \(R\) are numbers between 0 (black) and 255 (white). In scalar multiplication, each entry in the matrix \(R\) is multiplied by a given scalar. Two cases are shown below on fig. 8.

=?A1୬୮×1୬୮8653Photo by pnglux.com

Figure 8. Darkness and brightness of an image

In the first case the matrix \(R\) is multiplied by 3(number greater than 1). This means that all the elements \(r_{i j}\) will be multiplied by 3. This means that the numbers are getting closer to or exceeding 255(white color). As a result, the image becomes more brighten. All the entries bigger than 255 are substituted with 255.

In the second case the matrix \(R\) is multiplied by 0.5(number between 0 and 1). As a result, the entries have values closer to 0(black) and the image becomes more darken. This shows that multiplication by a constant is used to change the contrast of an image.

– matrix multiplication

Matrix multiplication is an operation that produces a matrix from two matrices. For matrix multiplication, the number of columns in the first matrix must be equal to the number of rows in the second matrix. The resulting matrix, known as the matrix product, has the number of rows of the first and the number of columns of the second matrix. If \(A\) and B are square matrices of the same size, both the products \(A B\) and \(B A\) are defined and of the same size.

The figure below (fig. 9) shows a grayscale image and its corresponding square matrix, denoted with \(R\). Let’s take another matrix \(I_{1}\) of the same dimension, with ones on the antidiagonal and zeros elsewhere. For the matrices \(R\) and \(I_{1}\) both products \(R * I_{1}\) and \(I_{1} * R\) exist and are calculated. From the images corresponding to the two matrices \(R * I_{1}\) and \(I_{1} * R\) it is evident that the operation matrix multiplication is not commutative.

=$00011100100&⋰58×⋰58="⋰58×⋰58Photo by pnglux.com

Figure 9. Flipping an image

At the same time it is shown that by multiplying the given matrix \(R\) with \(I_{1}\) on the left side, it will flip the picture vertical and respectively by multiplying the ma\(\operatorname{trix} R\) with \(I_{1}\) on the right side, it will flip the picture horizontal.

– element by element multiplication

The next figure (fig.10) shows another interesting application (Caridade 2019) – a frame is applied to a given image. It could be done using an element by element multiplication.

Photos by https://pixabay.com/illustrations/grey-ellipse-pattern-wallpaper-757867/

ÙÛаÝ97869ÙÛÝ97869ÙÛÝ97869Ù.∗,ℎ;=Ù;=;=Each element ofis multiplied by its corresponding element of.Ù.∗

Figure 10. Random shape of an image

– properties of transpose

The figure below (fig.11) illustrates one of the properties of transpose, called transpose of a product: The transpose of the product of two matrices is equivalent to the product of their transposes in reversed order: \((A B)^{T}=B^{T} A^{T}\). The products

\[ R * I_{1}, \quad\left(R * I_{1}\right)^{T}, \quad R^{T} * I_{1}^{T} \text { and } I_{1}^{T} * R^{T} \]

for the matrices \(R\) and \(I_{1}\) from the previous example are considered. It can be seen that the images corresponding to the products \(\left(\mathrm{R} * I_{1}\right)^{T}\) and \(I_{1}^{T} * R^{T}\) are the same. So when the product of two matrices is transposed the order of the factors reverses.

&6<&6)&66&

Figure 11. Transpose of a product property

– image overflow

Another interesting application of the operations matrix addition and matrix scalar multiplication is the effect of overflowing images. Two images of the same size are needed for this purpose. For illustration of this application the images are grayscale and the image matrices are denoted with \(A\) and \(B\). (fig.12).

=а"2000×3230="2000×3230Photosbywww.freepik.com/photos/

Figure 12. Grayscale images of birds

A new matrix \(M\) is then defined for each real number \(t\) in the range from 0 to 1.

\[ \mathrm{M}(t)=(1-t) A+t B \quad t \in[0,1] \]

The matrix \(\mathrm{M}(0)\) corresponds to the first picture, while \(\mathrm{M}(1)\) corresponds to the second one. For all other values the matrix \(M\) varies from \(A\) to \(B\) (fig.13).

Figure 13. Image overflow

Conclusions

The inability to realize the importance of linear algebra and its applications in technical subjects is one of the reasons for the poor academic performance of students. The typical teaching approach separates linear algebra from other subjects. In recent years, a trend has emerged related to the reduction of the number of hours for mathematical disciplines. In this way, the training becomes too intensive, which in turn contributes to the deterioration of its quality. Therefore, attention should be focused on increasing the motivation of students. It should be considered as a very important factor in the learning process.

The Linear algebra course is taught using the traditional approach with no reference to applications or not very intuitively, such that students struggle to relate it to how it’s used in Computer Science. In order to better motivate students, there is a need for a clearer practical orientation of learning, where the theory is mixed with applications, especially in disciplines with a high level of abstraction, such as linear algebra. This article has allowed students to understand one of the applications of mathematics, linear algebra in particular to computer science.

NOTES

1. Metwalli, S., 2020. 5 Applications of Linear Algebra In Data Science, https:// towardsdatascience.com.

2. Thomas, G., 2018. Mathematics for Machine Learning, Department of Electrical Engineering and Computer Sciences, University of California, Berkeley, 2018, https://gwthomas.github.io/docs/math4ml.pdf.

3. 2013, The Role of Linear Algebra in the Computer Science Curriculum, ACM/ IEEE-CS Computer Science Curricula Joint Task Force, http://www.mit. edu/~kepner/LAinCS.pdf.

REFERENCES

ANGELOV, N., NIKOLOVA, M., 2006, Izpolzvane na Matlab pri obuchenieto na studentite po teoretichna elektrotehnika, Morski nauchen forum - Nikola Vaptsarov Naval Academy, Bulgaria, (3), 155-162, ISSN: 1310-9278

ASABERE, N., ACAKPOVI, A., TORGBY, W., BREW, E. & AMPADU, K., 2016. Towards a Perspective of the Role of Mathematics in Computer Science and Engineering (CSE) Education, International Journal of Computer Science and Telecommunications, 7(1), January 2016, ISSN 2047-3338.

CARIDADE, C. M. R., 2019. Linear Algebra and Image Processing: a new teaching approach. In: 2019 14th Iberian Conference on Information Systems and Technologies (CISTI), IEEE, 1 – 6. Available from: doi. org/10.23919/CISTI.2019.8760909.

PETROV, P., GYUDZHENOV, I. & TUPAROVA, D., 2015. Adapting interactive methods in the teaching of Linear Algebra–results from pilot studies. Procedia-Social and Behavioral Sciences, 191, 142 – 146, ISSN: 1877-0428.

RAZMJOOY, N. & ESTRELA, V., 2019, Applications of Image Processing and Soft Computing Systems In: Agriculture, IGI Globul, ISBN10: 1522580271, Available from: doi.org/10.4018/978-1-52258027-0.

SOLOMON, C. & BRECKON, T., 2011. Fundamentals of digital image processing: a practical approach with examples in Matlab. John Wiley & Sons. ISBN 978 0 470 84473 1.

SILVERMAN, J. & GAIL, L., 2010. Supporting Students’ Interest in Mathematics through Applications from Digital Image Processing. Journal of the Research Center for Educational Technology, 6, 63 – 77.

Година LXV, 2022/3 Архив

стр. 283 - 295 Изтегли PDF