What is matrix multiplication and how does it work?

What is matrix multiplication and how does it work?

Matrix multiplication is a fundamental operation in linear algebra, and it has many applications in science, engineering, and business. One way to understand matrix multiplication is as a weighted sum of observations.

Example

Consider a table of students' grades, as shown below.

Student

Final

Middle

Hom work

Attendence

John

90

80

90

100

Mary

80

90

80

90

Peter

70

70

90

80

Kate

80

95

75

100

We can think of this table as a matrix, with each row representing a student and each column representing a grade component. The entries in the matrix are the students' grades.

Now, suppose we want to find the final grade for each student. We can do this by multiplying the matrix by a vector of weights, where figures represent the percentage of each component that contributes to the final grade. For example, if we Define the weights for each component
  • final_weight = 0.5 
  • mid_weight = 0.25 
  • homework_weight = 0.15 
  • attendance_weight = 0.10
We can represent this schema as a vector (0.5, 0.25, 0.15, 0.10), let’s calculate final_grade = (final_grade * final_weight) + (mid_grade * mid_weight) + (homework_grade * homework_weight) + (attendance_grade * attendance_weight)al_grade
Take John's case an an example:

90*0.5+ 80*0.25+90*0.15+100*0.1 = 88.5

What is matrix multiplication and how does it work?


The specific weights assigned to each component will vary depending on the teacher's grading policy and the goals of the course.

Attribute

Scheme1

Scheme1

Scheme1

Final

0.5

0.4

0.3

Middle

0.25

0.3

0.3

Homework

0.15

0.2

0.2

Attendence

0.1

0.1

0.2


When you multiply a matrix and a vector of weights, you get a new matrix with one row for each student. Each row in the new matrix represents the student's final grade under a different grade scheme.

Suppose we want to know which grading scheme will produce the highest class average. We can use matlab to run average calculation. It turns out the third one gives us the best class performance.

What is matrix multiplication and how does it work?



This is just one example of how matrix multiplication can be used to find a weighted sum of observations.

Matrix multiplication is a powerful tool that can be used to solve a variety of problems. For example, it can be used to solve systems of linear equations. By understanding how it works, you can use it to make sense of complex data and to solve problems that would be difficult to solve with other methods.

Another way - linear transformation

Another way to understand matrix multiplication is that a matrix represents a specific linear transformation, and multiplying a vector by a matrix means applying that transformation to the vector. 
Matrix multiplication can be used to represent a variety of space movements, like rotation and scaling. Each column of a matrix represents a coordinate in the space. 
Matrix-vector multiplication is a mathematical operation that takes a matrix and a vector as input, and produces a new vector as output. The new vector represents the result of applying the linear transformation described by the matrix to the original vector. 
You can watch the videos "Essence of Linear Algebra" by 3blue1brown on YouTube. These videos use animation to explain space movement in a clear and concise way.

Reference

Matlab fundamentals
https://www.mathworks.com/learn/training/matlab-fundamentals.html





Post a Comment

Previous Post Next Post