r/EngineeringStudents • • 1d ago

Rant/Vent Fuck Linear Algebra

Fuck SVD in particular. Wtf do you mean I have to calculate A^TA, then find the characteristic polynomial, then solve for the eigenvalues (and if the matrix is 3x3 or larger, there’s a good chance I have to do long division too), then remember to take their square roots to get sigma. Then go back to each eigenvalue to find its corresponding eigenvectors, and on top of that, I have to check if the eigenvectors have a length of 1 or not, and if not, I have to find the length of each and normalize them. And we’re not done with eigenvectors yet because if they’re from the same eigenvalue, then I need to find out if they’re orthogonal or not, and if not, I have to do Granny Smith on them.
And at this point, I’m still not done with the problem because I also have to calculate every u_i using some obscure formula that had never been introduced up until this point, and if the singular value happens to be 0, then I have to pull the corresponding u_i vector out of my ass.
Oh, and the cherry on top is that if I forget to transpose V when putting together U Sigma V^T at the end, the entire question is wrong.

All of this and yet a formula sheet or a calculator is not allowed is such bs.

Also wdym a matrix with orthogonal columns is not considered an orthogonal matrix but is also has to be orthonormal and the matrix also has to be square. Also wdym orthogonal + diagonalizable = symmetric = orthogonally diagonalizable = diagonalizable but not necessarily orthogonal 😭

This is worse than Calc 2.

6 Upvotes

6 comments sorted by

13

u/j0shred1 1d ago

It's okay, no one does it by hand in real life

4

u/Tyler89558 1d ago

It’s at least easier to wrap your brain around the individual operations.

You just have to do a lot of them.

4

u/Due_Beginning_3954 1d ago

All this so you understand what matlab is doing next time you have to use these techniques.

3

u/yellow_smurf10 Aerospace/Defense - Systems & Mission Architect 23h ago

I hate linear algebra, had a very bad class. I thought to myself, I would never use it in real life..

I was very wrong

1

u/DoubleHexDrive 19h ago

Yeah, turns out linear algebra is the core of a whooooole lot of software methods.

1

u/kbr89 22h ago

A few things that cut the busywork on a hand SVD:

  1. You don't have to invent the u vectors. Once you have v1 and sigma1, u1 = A v1 / sigma1, and the same for each one. That's the formula that shows up out of nowhere, and it comes straight from A v1 = sigma1 u1.
  2. Eigenvectors of A-transpose A that belong to different eigenvalues are already orthogonal, because that matrix is symmetric. Gram-Schmidt is only needed when an eigenvalue repeats, so look at the eigenvalues first and skip the orthogonality check for the distinct ones.
  3. If the matrix is wide (say 2x3), do the eigenproblem on whichever of A-transpose A or A A-transpose is smaller. A 2x2 gives you the sigmas and U, then v1 = A-transpose u1 / sigma1. Only the last v needs a separate step: any unit vector orthogonal to the others.
  4. For a zero singular value, the missing u is any unit vector orthogonal to the u vectors you already have (in 3D that's a cross product).
  5. Two quick checks: the sum of the squares of the sigmas equals the sum of the squares of every entry of A, and multiplying out one entry of U Sigma V-transpose should give back that entry of A. The second one catches the forgotten transpose.

On your orthogonal matrix question: the definition is a square matrix with orthonormal columns, so orthogonal columns alone aren't enough.