(Day 48) KAIST's AI503 Mathematics for AI (Matrix Decompositions)

Ivan Ivanov · February 18, 2024

Hello :) Today is Day 48!

A quick summary of today:

Following the book, I read the chapter and took notes on my tablet.

I hope the pics are legible. But the content is:

  • Determinant and Trace
  • Eigenvalues and eigenvectors
  • Cholesky decomposition
  • Eigendecomposition
  • Singular Value Decomposition
  • Exercises

Before the exerises it is mostly the theory. But the real deal was doing the exercises. In particular finding how to do SVD. Firstly I tried to learn how to calculate eigen values and eigenvectors, and then I moved onto SVD. Finding the proper way to solve SVDs… it took me a while. Firstly I followed some medium post, but then it turned out that the person made mistakes which were pointed out in the comments.

SVD formula is A = EVU. Some of the problem came from the fact that I was not sure the exact application of this, but I just wanted to learn how to do it now, because down the line I am sure it will lead to something bigger. They key to understanding it all was this video from an MIT professor.

To do SVD, the steps are: 1) multiply the matrix with its transposed version 2) Do the detrerminant and find the eigen values

image

3) From the eigenvalues you get the Epsilon

image

4) Find the eigenvectors by deducting lambda indetity matrix from the A transposed * A, then normalize and you get V

image

5) Find U by normalizing the product of A and V

image

At first I was not sure how to get the Epsilon, another problem was when doing the eigenvectors, how do I get v1 and v2 (i.e. equalizing the matrix to 0), but I found out that the right result is, by what column vector do I have to multiply the matrix in order to get 0. Another issue was finding U, just how to do it. Many websites that do ‘step-by-step’ tutorial actually skip some steps because they assume the reader knows, but thanks to the MIT video most of these ‘holes’ were fixed. The above is my final exercise, but below are all my notes :)

image image image image image image image image image image image image image image

I am actually still not 100% sure the results I got for SVDs are correct only because I saw comments noting that minuses and the order of values in some matricis matters. I asked in a ML community but I am waiting for a response.

That is all for today!

See you tomorrow :)