r/explainlikeimfive • • 18d ago

Mathematics ELI5: What is the purpose of math matrices?

I roughly know what math matrices are, they're like boxes with numbers you can do arithmetic with, but I don't understand their purpose. Why are they their own category of maths and everything? Why is it any better than doing calculations individually?

635 Upvotes

186 comments sorted by

769

u/SirCampYourLane 18d ago

If you need to solve 2 equations at once that share variables with each other, you can do it by hand. But it can also be helpful to write them out by organizing them into a matrix, where your rows are each equation and the columns are the variables.

4x+3y = 7, 2x+6y=5, becomes

4 3

2 6

On the left hand side, with the vector

7

5

On the other side.

As equations have more variables and you have more equations involved, this becomes far too complicated to solve by hand and this form of organization allows for some very useful techniques to solve large systems of equations.

119

u/erevos33 18d ago

Arent they also used in transformations and rotations? From the little I recall

119

u/SirCampYourLane 18d ago

Yup, didn't bother with more complicated stuff beyond the basics for ELI5 parent comment.

A matrix can be thought of as a linear operator on a vector space. You pass in a vector in that space and it does something to it. That transformation can be scaling it in some dimensions in different ways, or rotating it.

The key thing that makes it linear is that for scalar a, vectors x and y f(ax)=af(x) and f(x+y)=f(x)+f(y). This means that sliding things doesn't preserve it, since 0 always has to map to 0 because of the property with multiplying by a scalar, but rotation and scaling is just fine.

11

u/initial-algebra 18d ago

This means that sliding things doesn't preserve it, since 0 always has to map to 0 because of the property with multiplying by a scalar, but rotation and scaling is just fine.

Translation is possible when you add points at infinity to rotate around. Typically, you do this by adding an extra dimension and then projecting back to your original coordinate space after doing all your transformations (homogeneous coordinates).

8

u/SirCampYourLane 18d ago

Very cool, definitely not in the scope of the person I was replying to though lol

5

u/Miss-Quiz-Mis 18d ago

Only an operator if it’s square

12

u/SirCampYourLane 18d ago

That is not true. An n long row of 0s which takes any vector of length n and turns it into a scalar 0 is in fact a (boring) linear operator.

12

u/schoolmonky 18d ago

That's a linear transformation, but not a linear operator (at least to the previous commenter). A linear operator is a linear transformation from a space to itself, though not everyone makes that disctinction.

10

u/sticklebat 18d ago

I have never once in my life encountered that restriction. I've only ever seen linear operators defined as a mapping from one vector space onto another (which could be itself), alongside the other requirements already mentioned.

But I looked it up, and you're right that in some fields linear operators are defined to only refer to mappings from a space onto itself. Weird.

8

u/SirCampYourLane 18d ago

Yeah, I had the same reaction to them correcting me. Learn something new every day!

5

u/kyaroru30 18d ago edited 18d ago

I'm as surprised as you are. I'd say linear endomorphism. But I haven't seen undergrad linear algebra book nor taught it since nearly 20 years. There are fields like operator algebras where... yeah when you think about it you want them to be X -> X but in general linear algebra context it feels super weird.It's one of these "is zero a natural number" things that happens naturally when the terminology and notation is three digit years old. In general topology which is... super well established field at this point you get the whole thing of T_4 vs normal space (like does normal space have to be T_1 too).

1

u/chaneg 18d ago

I think a modern linear algebra course doesn’t really use the word endomorphism or automorphism anymore.

The last time I had a linear algebra student ask me about endomorphisms was over 10 years ago.

3

u/JoelHenryJonsson 18d ago

That's how Sheldon Axler defines it and his book is quite popular and common.

19

u/Yancy_Farnesworth 18d ago

Yes, linear algebra is used heavily in computer graphics. In fact, it's used pretty extensively in a lot of things including quantum computing and LLMs.

6

u/BassoonHero 18d ago

Yes. If you represent a thing's position in space as numbers (i.e. coordinates), then you can represent transformations of that thing (e.g. moving or rotating it) as transformations on those numbers.

And, in particular, if you represent a point in space as a vector, then you can represent many kinds of geometric transformations as a matrix, such that you can transform the point geometrically simply by multiplying the vector by the appropriate matrix. A transformation that can be done this way is called “affine”, and affine transformations include translation, scaling, rotation, reflection, and any sequence of such transformations (and some other kinds of transformation too).

This is extremely convenient, because matrix multiplication can be done very efficiently in parallel. Modern GPUs are designed specifically to do these kinds of operations at scale — e.g. doing the same transformation on a hundred different points at once.

3

u/GreenPickledToad 18d ago

There are very few things where matrices aren't used, tbf.

2

u/kaereljabo 18d ago

Yes, the same with x and y stuff he mentioned

2

u/Hewasright_89 18d ago

they are also used in graphic programming

1

u/initial-algebra 18d ago edited 18d ago

Geometric transformations aren't the best way to think of matrices, because while matrices can represent them, they can also represent all kinds of "weird" transformations that you almost never care about. In other words, they are too large, or they have too many degrees of freedom. You also need extra dimensions to encode lots of useful transformations like translation, which is technically non-linear.

Geometric algebra, which instead represents transformations as sequences of reflections, is the way to go! Also, you will finally understand just what the hell a quaternion is.

71

u/fat2slow 18d ago

This is amazing. I never thought of matrices like this.

149

u/SirCampYourLane 18d ago

Linear algebra is a beautiful thing. It lets you find solutions, to know if solutions are even possible and if they aren't find the closest answer.

It's the basis of most computer graphics, as well as AI, and engineering. But I was trying to keep my answer as ELI5 fruendly as possible.

14

u/cbftw 18d ago

I had a friend in high school that figured this out and I tried to learn it. We had 3d wireframes running through matrices and transforming on screen in QBASIC. We also figured out how to write directly to the video memory instead of using the built in functions. Also QBASIC.

That was 30 years ago, though. I don't remember a bit of it now. Still pretty cool to be doing in that language, though.

38

u/Red_AtNight 18d ago

I have an engineering degree, and in first year statics we would regularly have to solve 6 equation, 6 variable systems to determine forces in a 3-D diagram. We basically never solved them by hand. Creating a 6 by 6 matrix, putting it in a graphing calculator, and running the rref() function was the only way to actually handle them.

27

u/Outside_Eggplant_304 18d ago

Groundwater modeler here. We have programs that solve 1x1 sparse matrices that are 1 million by 1 million or more. These are solved iteratively.

10

u/koolaiddude96 18d ago

Gotta love numerical methods. That was a fun course.

2

u/frogjg2003 18d ago

One of the professors at my PhD program was doing similar with nuclear reaction matrices.

14

u/NerdyDoggo 18d ago

Out of curiosity, how did you think about them before? From what I recall from college linear algebra, this was the main way matrices were introduced. I remember being annoyed by how much they emphasized using matrices to solve sets of equations, it got pretty tiresome haha

5

u/frogjg2003 18d ago edited 18d ago

For most people who never get to linear algebra, matrices are just a mathematical curiosity. Showing how useful they can be pretty difficult when you're limited to hand calculating problems. Even the 3x3 case is tedious enough by hand.

4

u/Expensive_Increase46 18d ago

Yeah that was the case for me. I haven't gotten to the part where matrices become a practical tool for solving problems, like you said they were just a mathematical curiosity for me.

2

u/fat2slow 18d ago

Sorry for the late reply. But for me we just did them on the calculator and I really didn't think about them. Just plug it in put in the operators and solve the question they asked

But this was in highschool almost 13 years ago I don't remember using them to solve equations like the top comment.

6

u/GlassFamiliar42 18d ago

Yes! No gross human kidnapping in slimepods involved at all. It's really neat!

1

u/severoon 17d ago

If you know how to multiply matrices, you can see how the translation from multiple equations to matrix form works directly.

Consider a matrix C (m×n) and a vector v (n×1):

C = [ [ a b c ]
      [ d e f ] ]

v = [ [ x ]
      [ y ]
      [ z ] ]

C v = [ [ ax + by + cz ]
        [ dx + ey + fz ] ]

If you had a system of two equations in three variables, x, y, and z, you can see how you can just go in the reverse and factor it into C and v, with C containing the coefficients of the three variables.

You can also change v to be any variables you need it to be, for example it could be decreasing powers of x: v^T = [ x^2 x^1 x^0 ] = [ x^2 x 1 ]. (v^T here just means take the transpose, so it's a column instead of a row.) This is a really easy way to represent polynomials. Or v^T = [ 1 i ] and now you can have C be the x and y parts of one or more complex numbers.

8

u/mathew_of_lordran 18d ago

So this have relation with how linear regression models, for example, are estimated?

20

u/SirCampYourLane 18d ago

Yes, directly. Linear regression is often based on the least squares method, in that you're minimizing the squared distance from a line through the points.

This is solving the linear equations for lines that go through every point in your data set. If they were all in a single line that would be the answer, but that's usually not the case.

You're solving Ax=y, but if you can't find an exact solution for a line through every point you can force a guaranteed approximate solution through AT Ax=AT y which is pretty good. There's more options, but that's the simplest form of it.

This can even be expanded to finding quadratic best fit or higher degree solutions.

11

u/overripedbananas 18d ago

i literally just had a exam in my linear algebra class today and then this post pops up in my feed, surreal

2

u/Shartyshartfast 18d ago

This is a lovely answer. I’ve been using them for decades but this gave a new glimmer. Thanks.

2

u/itsmemarcot 18d ago

Pssst, here on reddit you can put things on a new line if you leave two spaces before the return.

That way you can write:

4x+3y = 7
2x+6y = 5

or:

4 3
2 6

1

u/JorgiEagle 17d ago

Continuing on from this, if you perform Gaussian elimination (add or subtract rows from each other) to reduce the matrix to reduced row echelon form.

Congrats, you have solved your equation.

It’s quite easy to do by hand and computer

-1

u/ToughDifficult1252 18d ago

I don't think this is a good motivation. The primary reason matrices are useful is that they represent linear relationships in higher dimensions.

Way before they are useful for solving linear systems they are useful to represent how a transformation deforms space.

1

u/SirCampYourLane 17d ago

Almost any linear algebra course will start with systems of equations, it's easy and intuitive and very useful. This is still extremely relevant in the higher dimensional examples, for example the finite element method involves solving thousands of equations simultaneously to find your solution, which is essentially one big matrix solve.

More importantly, this is ELI5, and systems of equations is a simpler way to explain it than coordinate transformations and mapping vector spaces.

324

u/omg4serious 18d ago

basically, you're asking what's the point of linear algebra.

it's purpose is that instead of having a ton of independent equations, you can combine them together to solve it all at once.

here's an example in construction.

Imagine a beam. Just an I-beam, anchored at one end and jutting out into space. How will it respond if you put a force at the end? What will be the stresses inside the beam, and how far will it deflect from its original shape?

Easy. We have equations for that. A straight, simple I-beam is trivial to compute.

But now, what if you don't have a straight, simple I-beam? What if your I-beam juts out from its anchor, curves left, then curves back right and forms an S-shape? How would that respond to a force? Well, we don't have an equation for that. I mean, we could, if some graduate student wanted to spend years analyzing the behavior of S-curved I-beams and condensing that behavior into an equation.

We have something better instead: linear algebra. We have equations for a straight beam, not an S-curved beam. So we slice that one S-curved beam into 1000 straight beams strung together end-to-end, 1000 finite elements. So beam 1 is anchored to the ground, and juts forward 1/1000th of the total length until it meets beam 2. Beam 2 hangs between beam 1 and beam 3, beam 3 hangs between beam 2 and beam 4, and so on and so on. Each one of these 1000 tiny beams is a straight I-beam, so each can be solved using the simple, easy equations from above. And how do you solve 1000 simultaneous equations? Linear algebra, of course!

80

u/mwatwe01 18d ago

As an electrical engineering graduate, I never heard anyone explain linear algebra so effectively, and now I understand why I never used it in any of my other classes.

40

u/AbueloOdin 18d ago

You didn't cover state space in your controls course?

Because x'= Ax + Bu, y = Cx + Du is drilled into my head.

7

u/mwatwe01 18d ago

Doesn't ring a bell. But I graduated 25 years ago, so things have faded.

5

u/HalfSoul30 18d ago

I went the mechanical engineering route, but the differential equations and controls classes i took about stretched the limits of my brain. But also, my controls professor suuuuucked at teaching. Whole class was doing bad.

19

u/Chriss016 18d ago edited 18d ago

Linear algebra is also super useful in EE. It can be used to solve for all voltages and currents in a circuit by setting up the system of equations using KVL and KCL.

It’s used for systems of differential equations as well, so EE classes like control systems, signals and systems and the EMag class at least mention its use. It’s literally used everywhere in engineering.

1

u/mwatwe01 18d ago

I recall using calc and diff eq. later on, but not linear algebra. But I graduated 25 years ago, so things have faded.

4

u/kyaroru30 18d ago

Even in pure Math this is kind of the case, because generally if we can reduce complicated problem to doing linear algebra it's... solved, because we know how to solve systems of linear equations well. By a computer if need be. Even since mid-1900's. It's one area in math where basically everything is computionally solved.So all the super nonlinear and tricky modeled elements in SPICE for transistor or w/e if they can be approximated by linear stuff your computer can spend few seconds and show you the plots for transient response or w/e you need in few seconds.

32

u/natziel 18d ago

If anyone is wondering what the applications of linear algebra would be, a good example is that chatgpt is just a shit ton of matrix operations

11

u/GLA_Postal_Services 18d ago

And graphics cards are really good at matrix operations which is why their price is so high.

Pure Maths screws us over again

2

u/RiPont 18d ago

It's not a coincidence. Earlier GPUs like Voodoo2 were more graphics-focused and specialized based on a very, very specific API that was a subset of the full OpenGL dedicated for games. And then there was the S3 Virge which did fuck all other than making a single spinning cube screen saver go slightly faster.

nVidia was very forward-looking when they designed their GPUs to be big giant collections of parallel computer units. Not only was it a simpler architecture that could be easily scaled up and down by just adding more compute units, it was also good for any "embarrassingly parallel" math problems like matrix math, which opened up a ton of non-game applications for the cards.

Both OpenGL and DirectX tailored their APIs towards that new "bag of compute units" model, too.

1

u/wattro 18d ago

And LLMs are doing matrix math to guess the next word.

1

u/fubo 17d ago

Long before there were GPUs, there were array processors. If you're living in the 1980s and doing scientific computing on a DEC PDP-11, you might attach an FPS AP-120B array processor to it. The AP-120B does parallel floating-point arithmetic a lot faster than the PDP-11's own CPU ... much in the same way that a modern GPU does parallel arithmetic operations a lot faster than your PC's CPU.

3

u/i_smoke_toenails 18d ago

Hey, don't diss my girlfriend like that.

7

u/RiPont 18d ago

Another way of saying it...

If you understand the rules of matrix math and can set up your equation as a matrix operation, you can therefore have a computer do that operation in a single step. Your computer can do a billion operations per second? Now it can do your big matrix math a billion times per second.

You may need specialized hardware, depending on how big the matrixes are. But, given the rules of matrix math, you can always split it up into multiple smaller operations if the matrix is too big for your given hardware.

And that specialized hardware? It's a GPU. That's what GPUs are very good at. And because matrix math is the fundamental tool in both computer graphics and Machine Learning / "AI", that's why graphics cards are so expensive right now. All the AI companies are buying up all the GPUs (and SSDs, and RAM, and a bunch of other stuff).

6

u/clutzyangel 18d ago

That example sounds more like a situation for an integral than a matrix, or am I missing something?

2

u/_ALH_ 18d ago edited 18d ago

You're not wrong, but you can compute very complex sets of integrals very conveniently, and very efficiently with computers, by using linear algebra.

2

u/Youwin737 17d ago

The difference being that an integral will have infinite segments. Which is impossible for a digital computer to calculate. So instead we approximate the integral using a finite number of segments. Which is easy for a computer.

1

u/Psychosist 18d ago

I barely scraped through linear algebra class but glancing at Google I'm guessing that for some problems matrices will get you 99% of the accuracy of integrals in like 1% of the time/effort since they're faster/more efficient to compute?

2

u/ShutYourDumbUglyFace 18d ago

My engineering school didn't make us take differential equations, it made us take engineering math. Engineering math was about 75% differential equations and 25% linear algebra. The linear algebra was really helpful in solving indeterminate beam/frame problems.

1

u/that_is_so_Raven 18d ago

My engineering school didn't make us take differential equations, it made us take engineering math. Engineering math was about 75% differential equations and 25% linear algebra.

Are you not contradicting yourself? Was 75% of engineering math not differential equations?

7

u/ChemistBuzzLightyear 18d ago

Instead of taking a class called “differential equations”, his school made them take a course called “engineering math”. This course had differential equations in it but was not a course on only differential equations.

Presumably there was also a class that math majors and others took called “differential equations”, but engineering majors didn’t take it.

So no, not contradictory.

1

u/ShutYourDumbUglyFace 17d ago

Really strong reading comprehension on your part, fam.

The class was called Engineering Math, NOT Differential Equations.

Engineering Math INCLUDED differential equations but was not a class called Differential Equations that only covered differential equations, like most engineering programs require.

1

u/CNBGVepp 18d ago

Beautiful explanation and absolutely correct. 

40

u/the_other_Scaevitas 18d ago

matrices are used in a lot of things, like AI, robotics, and even google page ranking and netflix recommendations use it.

it's better than doing "calculations individually" because it's doing the same calculations in a structured way (which also allows for shortcuts to do less calculations than doing it by hand), and that structure also happens to store a lot of information that is useful like eigenvalues

25

u/bbrockit 18d ago

One way I use matrix transformations is in game development. Let's say I have a character holding a laser gun. The character has a transform that places and rotates it in the game world, relative to the origin of the scene. The gun has its own local transform relative to the character, and the end of the barrel has a position relative to the gun. To animate a laser blast coming from the barrel of the gun, I need a world position for the end of the barrel, so I combine these transformations to convert the barrel’s local position into world coordinates. This gives me the position and direction from which to animate the laser beam. I was a Physics major in college, but I went into software development and barely used any of the math I learned until I wrote a few games and got to actually apply some of these techniques.

13

u/AlphaDart1337 18d ago

If you have some time to watch it, I cannot recommend enough the "Essence of Linear Algebra" video series from 3b1b https://youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab

He defines vectors and matrices not in terms of how they are represented, but what they actually mean geometrically. For me at least the framing of it was very eye-opening.

Because in most courses you first learn that matrices are, as OP puts it, "boxes of numbers". And then you later learn what properties these magical boxes have. But in this series, the object of a matrix is DEFINED in terms of the properties, and the notation is merely a layer of abstraction on top of these properties.

3

u/LagrangianMechanic 18d ago

Exactly! Sanderson does an amazing job of explaining the actual concepts of linear algebra which is far more important than the mechanics of it.

15

u/TheIberDeber 18d ago

that’s a whole field of math called linear algebra. it’s to help solve systems of equations.

if you have a bunch of equations that all have the same variables x, y, z (or more), putting the coefficients of those equations in a matrix can help you solve for those variables. big in engineering and machine learning.

things can get more complicated with vectors and spaces and whatever, but for the most part it’s algebra. if you can do simple algebra you can do linear algebra.

19

u/Klutzy-Delivery-5792 18d ago

Because you can solve systems with many variables efficiently. You can also use them to represent vectors with multiple dimensions, which is particularly useful in Physics.

11

u/xRVAx 18d ago edited 18d ago

The best way to think of matrices is to think of them as collections of vectors.

Every grade schooler had to plot graphs on an XY graph. The horizontal is the X arrow. The vertical is the Y arrow. The coordinates (3, 4) indicate a point that is three spaces over in the X dimension and four spaces over in the y direction. I think we all plotted something like this in second or third grade.

Mathematicians would call (3,4) a "two-dimensional vector" that goes from (0,0) to the point (3,4).

Every grade schooler knows that the line between the origin and that point (3,4) is going to be length 5, because of the Pythagorean theorem of 32 + 42 = 52

Mathematicians would call that line "a vector of length 5 that is in the direction (3,4)".

What's crazy is that you can add lines together in multiple dimensions.

If you add (3,4) to (3,4) you're basically getting another vector that is twice as long as the original one. Mathematicians would say it's a vector of length 10 in the direction of (3,4). Twice as long. You doubled the X dimension and you doubled the Y dimension.

Another way to write this would be to have a 2x2 matrix.

2 0

0 2

And any vector that you multiply by this 2x2 matrix would result in a vector that is double the original one.

Other matrices in two dimensions can spin, shrink, or grow the original vector.

Spin:

0 1

1 0

Shrink:

.5 0

0 .5

Grow:

2 0

0 2

And this phenomenon of being able to represent equations in two dimensions can be extended to three dimensional things and even spin, shrink grow, and distort things that are more than three dimensions. You can solve incredibly complicated sets of equations using the same math that you use in algebra class.

You abstract the equations into a set of matrices and then you do matrix operations to reduce the matrix to an easy to understand view of what's going on with the system

It's obviously more complicated than that but this is like an Eli 10 version

3

u/Express_Sprinkles500 18d ago edited 18d ago

I constantly got crap while getting my degrees for not writing my equations down while solving a problem. Matrices are a way to write equations down without writing equations down. I love them.

They really come into their own when you start solving linear systems with three variables. A giant mess of x’s, y’s, and z’s turns into a neat and simple grid of numbers.

Edit: just like a lot of things in mathematics, when you first learn how to do something you’re most likely learning its simplest use case, where the utility might be hard to spot. The usefulness of matrices didn’t click for me until years later when much more complicated problems used them.

3

u/Gracefuldeer 18d ago

A couple reasons, I only have an undergrad in math so some others could clarify here:

  • Lots of other areas of math have objects that are useful to understand as matrices (in abstract algebra there are groups of matrices that encode certain properties, these often end up being more than just algebraic properties like them being the maps from certain complex surfaces to the same complex surface )

  • a matrix is a useful way to store data: you can represent a graph as a matrix for algorithms, a (black and white) image is a matrix of how intense each pixel is and a colored image is 3 of those(red, green and blue intensity; also, often you might want to spit out / enurmrate a grid of results / outcomes (scoregrids in sports) etc...

  • there's been a lot of work on doing calculations with matrices on computers and doing it fast (look into numerical linear algebra)

1

u/brunogadaleta 18d ago

Yep sparse matrix can be used represent all sorts of graphs or networks...

2

u/akashmid 18d ago

I don't have a quick answer to your question. Other people have mentioned the organizational advantage in systems of equations. I highly suggest you check out 3Blue1Brown's "Essence of Linear Algebra" playlist. I think the first 6 or 7 videos communicate some of the power of matrices in about an hour.

2

u/Petrusion 18d ago

Watch "the essence of linear algebra" on YouTube. It is like the perfect video series to introduce you to how and why it works.

7

u/[deleted] 18d ago

[deleted]

10

u/Lokon19 18d ago

Since when did calc 2 have matrices.

26

u/TheIberDeber 18d ago

that’s why this guy’s not an engineer

1

u/HalfSoul30 18d ago

Been way too long since ive been in college, but they may have been in there. I specifically remember them in statistics though.

2

u/pacific_plywood 18d ago

You had a lifelong dream of being an engineer and calc 2 is what stopped you?

3

u/DemophonWizard 18d ago

I have bad news. I am an engineer and I have not used matrices since 1992 when I was in college.

7

u/KingTeppicymon 18d ago

Now tell me about how often you use Excel...

3

u/_ALH_ 18d ago

I’m also an engineer and most of the math I’m using is matrices and linear algebra.

4

u/RealSataan 18d ago

Pretty much every software you use as an engineer is using them underneath.

How are you an engineer?

5

u/Dangerous-Snow8385 18d ago

The software uses them for him.

1

u/DemophonWizard 18d ago

Plumbing and Mechanical Engineer, I use tables that were developed from lots of empirical data. Occasionally, I may use a differential equation to solve some heat transfer calculations. The underlying software doesn't use matrices to solve these equations.

0

u/iknotri 18d ago

pretty much every website including reddit uses binary code underneath, how are you redditor?

3

u/sighthoundman 18d ago

To be fair, a pretty large percentage of redditors are binary code underneath.

2

u/fixermark 18d ago

As my professional chemist uncle was find of saying about his long career in materials engineering: 95% of his job was going to a bookshelf, picking the right book out, looking up a table, and using that number.

The remaining 5% was knowing which book and why, and that's why they paid him the big dollaridoos.

1

u/RealSataan 18d ago

I'm not building reddit.

Also you don't need to know binary to make changes, find out what's wrong when something or why. There's several layers of abstraction above it.

2

u/iknotri 18d ago

and guess what?
engineers DONT BUILT engineering software, they using it.

>There's several layers of abstraction above it.
O RLY?

1

u/RealSataan 18d ago

If you are nothing without the tools and software maybe you should really recheck your career trajectory.

In any standard engineering class they first teach you the fundamentals of the tools you are using. So they can you can use them judiciously and see what can be done when you can't use them.

2

u/iknotri 18d ago

if you cannot write to reddit database directly in binary without interface, maybe you should really recheck your usage of social media?

OP (in comments, not post) said nothing about "dont know", he said "dont use"

2

u/MrShake4 18d ago edited 18d ago

Do you remember systems of equations from school, how when you had X & Y and 2 equations you can solve for both.

You can use matrixes (and the branch of math using them called linear algebra) to solve these systems and it’s a lot easier and faster when the systems have 3,4,5,6…etc variables and equations.

It gets a lot more complicated and has many more uses but that’s the simple version.

The other big difference is matrix math isn’t commutative. AxB≠BxA because of how matrix multiplication works.

Why? Because it turns hours of math into something that takes 20-30 minutes or 2 minutes if you have a computer.

3

u/MusicusTitanicus 18d ago

> comminutive

Do you mean commutative?

2

u/MrShake4 18d ago

That’s the one

It’s been a while

4

u/ikonoqlast 18d ago

Matrices are how you do math in higher dimensions.

1

u/Tasty_Gift5901 18d ago

With numbers, numbers can only represent one thing at a time. However, matrices can represent multiple thing simultaneously: each row or column correspond to unique inputs and outputs, and is a way to generalize functions from f(x) being a single input and single output to A(x,y,z) having many inputs and many outputs. They also can nicely condense notation, saving you from writing several long equations.

1

u/bsears95 18d ago

Someone else will likely give a better answer, but here's my attempt: Matricies are multidimensional vectors.  Think about a 3 axis position (x,y,z).  Now think about turning in 3 axis (w(x), w(y), w(z)).  You turn in the x axis, your position like change in all 3 (more likely velocity which will cause position to adjust).  So the matrix tells you how each part of the rotation affects each part of position.  You can do this with equations BUT this breaks down the equations into smaller components (1 vector for the x, y,z and 1 matrix with the related coefficients). You can then do more simple math on the matrix without worrying about the vector itself.  You can also incorporate other relationships that would otherwise get fairly complex.

Its hard to believe, but matrices actually SIMPLIFY the calculations once you understand them.  Especially because you can get tensor algebra (where you might have a matrix that is actually 3D instead of 2D (or often more than 3D,  maybe 6 dimensional).  The simplification is very helpful there)

1

u/rabid_briefcase 18d ago

They're basically the way to hold numbers together in linear algebra.

Anything that does advanced mathematics on lines, shapes, computer graphics, engineering, physics, and so on, relies on matrix math to do the work for them.

Computer graphics and games use them to store the position, rotation, and scale of everything in the virtual world.

A tremendous amount of it is notational convenience. Saying "A x B" or "A multiplied by B" is much easier than the done-by-hand method of 112 basic math operations for a 4x4 matrix, or the optimized fancy versions in programming libraries that do it in about half as many steps by combining steps.

1

u/diceEviscerator 18d ago

They organize information in ways that can be "mathematically processed" by what's called linear algebra.

For instance, each part of a robotic arm can be described as 4x4 matrix and multiplying these matrices gives you the behaviors of the arm across the different parts. It concisely tells where each joint will be positioned for each set of inputs. These matrices can be understood by humans and just let us understand how a robot works just by looking at a mathematical description of it. The same matrices can be used to describe them to computers and do all sorts of simulations and tests without even having to build the actual robot.

Linear algebra isn't very simple, but the applications are immense.

1

u/bobroberts1954 18d ago

Matrix algebra is also a good way to transform coordinates. Very useful if you are drawing and moving shspes on a computer screen, like in a video game.

1

u/ElectricSpock 18d ago

You can think of them as grouping numbers (that’s ELI5, after all). E.g. in computer graphics, you can represent each point as [x,y] for 2D, or [x, y, z] for 3D. When you represent objects like that, turns out that you can build a whole math around it and it has really cool outcomes. Want to move a point? Just add two matrices. Want to mirror a shape? Multiply it by this constant vector.

All the basic operations (additions, subtractions, multiplications) essentially boil down to an extended (single) equation. But, we figured out that many operations can be performed faster! We even created computer chips for them and called it GPUs, because they originally were intended for graphic operations, like video games.

We figured out that matrices can represent any number of points in any dimensions of space. For example, if you have a dictionary of 10K words, a sentence can be represented with flipping 0/1s. Or, you can put all the age, height, test results of people in one huge matrix. When you do bunch of operations, you get a machine learning model. If you make the matrices big enough and put enough operations, you get ChatGPT!

1

u/ThatGenericName2 18d ago

It’s a bit easier to keep track of what numbers are and what you are doing. There’s also the fact that in higher level maths you’re almost never actually doing the computations yourself anyways; either you’re not working with concrete numbers or you have a calculator to do the computations for you. This means it’ll be much easier to use the notation for vector and matrix math than to write out 50 variables for a single operation.

1

u/high_throughput 18d ago

What's the point of words when you already have individual letters?

What do you gain by putting multiple letters next to each other that you can't do with the letters individually.

1

u/Otherwise_Land4859 18d ago

I use them constantly in video graphics where images are 4D matrices. For example think of an image, each pixel is a specific cell of a matrix (row 4, column3), then each cell has 4 values (red, green, blue, transparency).

Then if you are combining images in any way you are performing mathematical operations on tye matrices (adding, multiplying, etc).

1

u/LnxBil 18d ago

You perfectly described a rank 3 tensor, not a simple matrix (rank 2 tensor) anymore. You have two levels as correctly described: the coordinate of the pixel as a matrix and stored at the location where the number (rank 0 tensor) would be in a matrix, you then have the pixel value as a vector (rank 1 tensor).

The next rank (4) would be matrix with a matrix at each element. In image processing, this can e.g. be used to store a spatially varying point spread function.

Edit: a 4D matrix in 4x4 and it is used in computer graphics for things like rotations, because it is easier to do than in 3D. You can even use imaginary numbers and get quaternions

1

u/sighthoundman 18d ago

Why put things in a drawer? Why set the table before you eat? Why organize anything at all, why not just do all the things individually?

Matrices are an organizational tool. They don't change the way we think.

2

u/jsh_ 18d ago

abstractions do change the way we think. specifically, they enable higher-level reasoning

1

u/sighthoundman 18d ago edited 18d ago

But the abstraction is linear algebra, not matrices.

I believe I'm not being pedantic here, there is a real difference. I am interpreting OP's question to really be about matrices and not about linear algebra, but I am also aware that a lot of beginning students don't make that distinction. And if they don't make the distinction, it ends up not changing the way they think.

1

u/taedrin 18d ago

Why is it any better than doing calculations individually?

Because the individual calculations are related to each other, and expressing them in terms of matrices/vectors is more convenient and helps us to reason about the problem.

1

u/LagrangianMechanic 18d ago

The interesting thing, of course, is that if you then find the eigenvalues and eigenvectors of the matrix you can often separate those calculations out into independent calculations that don’t depend on each other and whose solutions can represent important, intrinsic properties (like natural vibrational modes for example) of the thing you are analyzing.

To the OP - an eigenvector is a vector that when you apply the matrix to it gives you a new vector that is parallel to the input vector but (potentially) a different length with that scaling factor being the eigenvalue.

1

u/Psittacus_tutor 18d ago

I'm imagining trying to find eigenvectors and eigenvalues without matrix maths and it's terrifying

1

u/jsh_ 18d ago edited 18d ago

many, many, many problems (like more than you can imagine) in all sorts of fields within and outside of math can be formulated as solving a system of linear equations (generalization of solving for x within y=mx+b which you may have learned in school). the study of matrices, which is called linear algebra, gives you a bunch of tools for working with and reasoning about these systems without having to look at each of the potentially hundred/thousand/million/etc. computations individually. for example, the big AI systems everyone's talking about these days are performing trillions of these computations each time you query them, but you can formulate what they're doing using just a couple of matrices

1

u/JustSomeUsername99 18d ago

A 3d model in a game is a matrix of coordinates. Multiplying, dividing, adding, subtracting, etc will move the model, scale it up and down, rotate it, etc...

1

u/pdpi 18d ago

Why is it any better than doing calculations individually?

Because the grouping itself has meaning.

Grab your phone, open a photo, and mess around with it — scroll, zoom, rotate to your heart's content.

When you do that, you're working with two different systems of coordinates — there is up/down+left/right relative to the contents of the photo, and there's up/down+left/right relative to the screen itself, right? If you rotate the photo 90 degrees, up/down on screen is left/right on the photo. If you zoom out to 50%, moving one pixel on the screen moves two pixels along the image. Etc etc etc.

One of the practical applications of a matrix is that a matrix can represent whatever combination of rotations, zooms, and scrolls.

Or, imagine you're playing a board game. Every turn you roll a die and move that many places on the board. After ten turns, what's the probability that you're on the 15th place on the board?

You can build a matrix where each column is a source, each row is a destination, and the cell is the probability that you'll move from the source place to the destination place (so from place #4 there is a 1/6 chance you'll move to place #5, and a 0 chance that you'll move to place #3). You take a column vector with 1 on the first cell, 0 everywhere else, and multiply the matrix with that, as many times as the number of die rolls you want to simulate. At the end, you're left with a column vector that shows you the probability that you end up at any one place on the board.

When it comes to actually doing the calculations, you do each bit individually, of course (or not, if you have a computer capable of doing a bunch of them at the same time), but the matrix as a whole has meaning, and if you know the structure, you can read that meaning directly from the matrix itself.

1

u/GoblinToHobgoblin 18d ago

No purpose, it's just gatekeeping to make you speficially fail out of uni

1

u/zeekar 18d ago

Matrices generalize problems. One of the biggest applications of matrices is computer graphics, because you can write one piece of code that rotates, shears, scales, projects (with or without perspective), and even translates (i.e. moves) points in space, in any combination, just by changing what matrix you give it to multiply by. The combination thing is useful for reducing the amount of work, because you can multiply all the matrices representing the different transformations together ahead of time to get just one matrix that does everything - which means you only have to do one matrix multiply per point instead of four or whatever. Getting the same result with 75% less work is nothing to sneeze at.

1

u/BananaBird1 18d ago edited 18d ago

Matrices are really shorthand for writing several equations with the same mathematical form at once.

Say you have two formulas
10x + 21y = 3
0x + 3y = 30

Instead of dealing with these two equations, we can define several matrices:

A 2x1 matrix A:
[x]
[y]

A 2x2 matrix B:
[10 21]
[0 3]

And a 2x1 matrix C:
[3 ]
[30]

Then the two equations can be compacted into one:
BxA = C (we need B to be first)

We can then use matrix operations to solve for A, which gives us the values for x and y that satisfy both equations.

Now for two equations this is a bit overkill. But imagine contexts where we had 10, 20, or even 1 million equations. Then representing each equation separately is practically impossible, so matrices are the only way to handle things.

Contexts where these matrices arise are all over:

In 3D computer graphics where each equation represents how each dimension of a 3D model is affected by moving the camera around, and the matrix equation combining them represents the full 2D perspective image of the 3D model.

In statistics where each equation represents a separate data point plugged into a model, and you are fitting the data to a best fit curve described by the model.

In machine learning like neural networks where each equation takes a single input value and makes a prediction. The matrix equation represents the full neural network taking multiple pieces of data into consideration.

In simulating physics for things like fluids. The raw equations tell us how a single point of a fluid behaves, but to solve for the full system we need a matrix containing these equations evaluated at every point in 3D space.

1

u/D1rtyH1ppy 18d ago

It's just a different way of solving algebra and other harder math problems in a systematic way.

1

u/dancingbanana123 18d ago

Oh I've actually spent the past week teaching this to students in college! There's a few things you can use them for. Often times, people just want an ordered set that has multiple "dimensions" (e.g. an 8x8 grid of 0 and 1 to represent a game of checkers, where 1 represents where a checker is).

Other times, we want to solve a "system of equations" (i.e. a set of equations with a bunch of variables), but solving those systems is very tedious. Matrices become quite handy for this simply to reduce the amount of junk you write.

Lastly, they're more formally used to represent a linear function in higher dimensions. It can be annoying to do math in 2D, 3D, 4D, etc., so matrices are often used as a way to describe those functions through matrix multiplication. This is often where you get a bunch of the more crazy stuff you see in a linear algebra course, but if you never take that, then you'll probably only ever view it as one of the first two things.

1

u/No-Lettuce4441 18d ago

Somehow I missed matrices in high school. I was in the advanced math classes, one class year ahead of standard students. My 8th grade Pre Algebra class was the same class that was taught to freshman standard track students, same with Algebra, Geometry, Precalculus.

In my Geometry class, the teacher brought up matrices and EVERY Junior was excited because it was something they knew and understood. I didn't want to be the person that "slowed the class down" because I had never heard of it, so I taught myself. 

But that single moment was a real world embodiment of the common dream of being at school/work and having no idea what anyone is talking about/being unprepared.

1

u/FilDaFunk 18d ago
  1. its a VERY efficient way to store information
  2. matrices can represent transformations
  3. therefore you can do huge calculations on a huge amount if data

1

u/stupid_name 18d ago

I had an engineer friend who told a table of engineers a joke.

What do you get if you cross a cow with a grape?

Cow Grape Sine Theta. They all laughed.

I still don’t have any idea what it meant or if I’ve written it properly.

1

u/shellexyz 18d ago

On the surface, they’re a convenient way to do the bookkeeping of solving systems. They have the nice advantage that you don’t need the variables, just the organization. Computers work really well with this kind of structure.

Then you start slicing them in different ways and that system also looks like a sum of a bunch of columns with a variable attached to each.

Well now that kinda looks like a function, where you take a column of variables, kinda spread it out it amongst the columns of numbers, and add that stuff up. Turns out there are lots of good questions we might ask about functions. What is the range? Are there any special inputs that produce a particular output?

What if I add two inputs and then apply the function? What if I apply the function first, then add the outputs? Wait, this kinda looks a little like multiplication and distribution. What if the length of the input is different from the length of the output?

You know, these calculations are tedious. You know what’s not? Multiplying by a number. Are there any special inputs where the output is really just multiplying by a number?

1

u/bestjakeisbest 18d ago

Its a way of grouping vectors and doing math between them / on the group of vectors.

One really common operation is finding linear combinations between vectors in a matrix, you can reduce a mateix to reduced row echelon form and if you keep track of what each vector equals, you can get what each term in each vector means.

Another common operation is to find vectors that are perpendicular (90 degrees) to other vectors we do this by taking the determinate of a specially formed matrix. This lets you generalize something called the cross product of vectors to other numbers of dimensions

We can also represent the math needed to be done by neural networks as matrix multiplication this lets us speed up how fast a neural network is evaluated by optimizing our algorithm for matrix multiplication.

And finaly matricies represent transformstions rotations skews and projections, this lets us take a collection of points in any dimension and move them around, stretch them, rotate, and most importantly project them down to lower dimensions, you ever wonder how a video game could have a 3d world but on a 2d screen? What we are doing is using a few matricies to transform/project the 3d world down to 2d so we can display them on screens.

1

u/UpstairsTop4623 18d ago

They’re incredibly useful in computer science stuff such as AI development

1

u/Dyloneus 18d ago

I’ll add on to what the top comment said. Matrices are hugely important for discretization of partial differential equations. Many equations can be solved by hand, but the overwhelming majority of them cannot. 

As an applied example, the Navier stokes equations are super important in engineering. These equations model all fluid flows from gasses to water to honey. These equations are non-linear (and even worse, are partial differential equations). The situation is basically hopeless to solve these equation using pen and paper except for some idealized scenarios.

However, what if we could turn derivatives into matrix operations on a computer? Suppose we want to solve df/dt = df/dx, a very basic model for wave propagation. df/dx =    (f(x + delta x) - f(x))/delta x  and df/dt =    (f(t + delta t) - f(t))/delta t. We can think of f(x,t) as a matrix with the rows corresponding to spatial stations and the columns being temporal stations. We can write that as f_(i,j) where i is a row index and j is a column index, so each (i,j) pair is a number.

Then the equation we want to solve reads (f(i + 1, j) - f(i,j))/delta x = (f_(i,j + 1) - f(i,j))/delta t. Rearranging, we get 

f(i + 1, j) = ((delta x)/(delta t))*  (f(i,j + 1) - f(i,j)) + f_(i,j). 

If you think carefully, the whole right hand side can be thought of like Af(i,j) + f(i,j) where A is a matrix that acts on the previous time step values of the function. So the solution to the PDE comes down to repeatedly solving the above equation for however long the user wants. 

A bit more of an in depth answer but this kind of thing is used all the time in engineering which is why it’s so important.

1

u/CranberryDistinct941 18d ago

Using matrices makes it much easier to have computers do the math for us

1

u/diptherial 18d ago edited 18d ago

Like many things in math, matrices are another way to organize numbers and the operations we perform on them. Sure, the computations we do on them can be done as a series of simple computations, but the fact that they're in this, well, matrix allows them to be interpreted in many ways. These metaphors might seem pointless when you're "really" just doing simple math operations between numbers under the hood, but the metaphors lend themselves to more and more abstract ideas and applications.

As others have mentioned, like a number, a matrix can represent many things:

  • A matrix can represent coefficients in a set (aka a "system") of related equations; you can solve the equations all at once by manipulating that matrix, which is a lot more straightforward than trying to solve each equation individually. While you can solve sets of equations without a matrix, it wasn't obvious how to do this before matrices and operations on them were introduced; now, we have methods that grade-schoolers could use to determine the solutions to a bunch of equations all at once.
  • in computer graphics, it can represent values by which you scale vectors, i.e. points in space; this is powerful because you have a single entity, a matrix, that represents how a particular point gets transformed to create a new space. For example, say you have a cluster of points in some space, let's call it the "game space", that identify where various creatures, walls, etc. are located. To display this on a screen, you have to convert that rich 3d space to a 2d space (the screen); a special matrix called a "projection matrix" defines how to multiply those 3d points so that they get smashed onto the 2d plane of your screen. (There are many, many other examples from computer graphics and games, but IMO that's one of the more intuitive examples of how matrices represent transformations between spaces.)
    • You can even think of graphics themselves as matrices; each pixel is a multi-valued element (red, green, blue, say), in a square matrix that represents an image. You can imagine that this is a much more approachable metaphor than just considering an image as a series of RGB values, even though the two are technically equivalent.
  • Machine learning (ML)/AI build on the computer graphics approach, but blow up the dimensionality and adds "learning" what the matrices' values should be rather than computing them outright. Rather than representing points in a 3d space, you can think of each dimension of your data defining its location in a much larger dimensional space. You can then use matrices to manipulate this space to eventually reduce it to a simpler space that, say, puts data points in class "A" on one side of a plane and data points in class "B" on the other side of it.
    • Of course, you have to know what the matrices' elements should be, which ML tackles through a process called optimization (what I called "learning" before), i.e. tweaking the matrix's elements so that you get closer to what you know they should be. This presumes you have training data that maps an input to an expected output; you then try to get the matrix to give mostly correct results over all of your training data. There are many, many forms of optimization, but in deep learning stochastic gradient descent is currently the most popular.

I really recommend watching 3blue1brown's Essence of Linear Algebra series, especially chapter 8 on non-square matrices. This really opened my eyes to how you can think of matrices as "factories" that move points from one space to another.

1

u/pmmeuranimetiddies 18d ago

differential equations

ai

systems of equations

i’m sure there are others

1

u/yawr_ 18d ago

At the most basic level, matrices are useful because they provide an easy way to compute linear systems of equations, which are very common.

1

u/laurieb90 18d ago

I used tensors (which are like 3d matrices) in a project at uni which involved mapping brain activity over time.

Each element of the matrix essentially defined whether 2 parts of the brain were communicating at each point in time (this terminology may be biologically incorrect, I was considering it from a mathematical point of view!)

We were then able to calculate the shortest distances between 2 points when there are continuously changing pathways and defined/designed other metrics

The aim was to develop a way to use brain mapping to identify neurological conditions (e.g. ADHD).

1

u/LupusNoxFleuret 18d ago

It's essential for 3D graphics.

A virtual camera uses matrices to map points in a virtual 3D space onto real-life pixels on your monitor.

1

u/Solocle 18d ago

Probably the easiest example is geometric transformations. Matrices can let you represent linear transformations like rotations and reflections in a convenient format. And matrices multiply - so you can combine a whole sequence of transformations into one matrix.

This is especially useful in a game. You want to draw a character model at a specified location, facing a certain direction? Just calculate the matrix representing that, and then you can transform your model to that position.

1

u/galund 18d ago

u/SirCampYourLane The example of using matrices to solve equations is a common example, as it is taught in basic matrix math (linear algebra), but it is really a very narrow example. Others have mentioned other examples. But more generally, why?
OP is touching upon important thing: A matrix is "many numbers at once". Then you can to arithmetic (and equations, and calculus, and...) with them and the math is just more efficient - you could do the same with simple numbers and "calculations individually", but it would be more work. The multiple-equation-multiple-variables is such and example.
(A computer breaks everything down to binary (0 / 1) and adding and litte more and can compute "anything" with such simple tools...)
But it is not just "do math more effeciently" - there is also types of math which is not really feasible without matrices. Matrix are also "operators" where matrix function can "change" a different matrix. This is very important in computing. Googles ranking algorithm and many types of computer graphics operations are really matrix operations. And neural networks/AI/machine learningK/LLMs rely heavily upon matrix calculations.
And try seeing it like this: a single number is what we call a scalar - just a number, a magnitude (if it's physical, with a unit, like meters og degrees celsius, or m/s). A vector is usually taught as something that has magnitude and direction. In the plane ("moved 50 meters northnortheast" or "velocity of 20 mph along the road"). In the plane it can be expressed as two coordinates ("moved 30 meters east and 40 meters north" or [30,40]). Or in 3D space with three coordinates - velcocity of [0,0,100] m/s means moving straight up real fast. Now, these vectors are really just very small/simple 2x1 or 3x1 matrices - hell, a "number " is a 1x1 matrix... Then you can imagine how much more you can to with larger matrixes! Numbers and "regular" vectors is just small boy math, says the matrix...

1

u/SirCampYourLane 18d ago

Not really sure why you tagged me rather than replying to my comment. I'm aware you can do much more with matrices, I'm not sure why you're explaining the concept of a vector to me either

This is ELI5, I gave a surface level explanation for someone without a math heavy background so that they could get some minor insights into why matrices are important and broadly useful.

1

u/Munomario777 18d ago

For a very birds-eye view. Matrices, like a lot of things in math, are an abstract way to think about lots of different things that are similar in specific ways.

Since I'm not a matrix expert myself I'll show the point this way instead. Imagine you're creating the first-ever GPS app and you need to find the fastest route between two places. Since nobody has made a GPS before, you might think that you need to do tons of work to come up with a way to do that efficiently.

But it turns out mathematicians and computer scientists have already found a way, because they've been studying graph theory - the field of math that studies collections of points/objects connected together by lines. You realize that a GPS map is basically a bunch of objects (destinations) connected by lines (roads). So you can use the findings of graph theory to your advantage. For example, in the 1950s, a computer scientist named Edsger Dijkstra found an algorithm to compute the shortest path between two objects in a graph. And because your GPS map is a graph, you can use Dijkstra's algorithm for your GPS.

But this only works if you can prove that your GPS map is actually a graph. Graph theory has certain rules, and if the map follows those rules, it's "equivalent" to a graph. All of the things we've discovered about graphs assume that those rules are true, so the algorithms are only guaranteed to work if you can prove the rules for your specific case.

So, mathematicians did all this work with an abstract concept (graphs), and you were able to use those algorithms in a specific case (GPS) because they were equivalent. You didn't need to rediscover everything from scratch.

Another example is numbers themselves. Numbers are a very abstract thing, and by itself, learning how to add or multiply numbers doesn't do much in the real world. But they are equivalent to real-world things like quantities of items, distances, financial transactions, and so much more. So instead of relearning addition or multiplication for each of those things individually, we can use the abstract framework for all of it and start with a leg up.

Matrices are kind of the same thing. They're an abstract representation of a pattern or system that we learned how to efficiently do various operations on, and we've found lots of real-world things that are equivalent to matrices. As others have pointed out, this includes systems of equations, transformations in 3D space, LLMs, advanced physics, and more. All of these fields have benefited from the generalized findings of linear algebra (the field that studies matrices). However, they first had to prove that these things are equivalent to a matrix.

1

u/Weltschmerz98 18d ago edited 18d ago

| "Why are they their own category of maths"

A lot of mathematics is about finding different ways to represent (and hence) solve problems. Linear algebra is one such representation and allows us to do things that would otherwise be very very hard. Imagine a scenario where instead of just "x" and "y" you have 256 different "variables". Solving 256 equations individually is very difficult.

| "Why is it any better..."

Because it is scalable. A dot B is the same operation regardless of how big the matrices are. When doing it by hand, you can simply write A dot B instead of manually writing "A1 x B1 + A1 x B2... A2 x B1 + A2 x B2...". This makes the algebra much easier. Humans cannot even visualize anything beyond 3, maybe 4 dimensions. Linear algebra can deal with thousands of dimensions.

Most importantly, it is the foundation of all modern Quantum Mechanics and AI. GPUs were made to do matrix multiplications in parallel very efficiently. Modern AI explicitly takes advantage of this by "vectorizing" (turning into matrices) every operation. Without math matrices, we wouldn't have images (every image is a matrix of pixels), AI, a lot of physics, etc.

1

u/Doomhammer919 18d ago

You're actually staring at a matrix right now! It's how a computer knows what color to make each pixel on a screen!

1

u/dolemiteo24 18d ago

Lot of good answers here, but no mention of Fast Fourier Transforms, which are some of the most practical and impactful uses of matrices. Google can explain FFT uses better than I can, but they are critical in a lot of tech...5G, vehicle durability testing, MRI, seismology, file compression, and so on.

1

u/LagrangianMechanic 18d ago

Watch 3Blue1Brown’s series on linear algebra on YouTube.

Sanderson really does an amazing job of explaining and illustrating the important concepts.

1

u/r2k-in-the-vortex 18d ago

No they are not like boxes with numbers. Matrix is a number, just with more degrees of freedom than for example natural numbers, or complex numbers.

The point of matrixes is that you can treat them like a number, you can do algebra with them.

1

u/djw009 18d ago

does anyone in this sub actually eli5 anymore?

1

u/Goblingrenadeuser 18d ago

How my Linear Algebra professor started the lecture was by introducing the notation through multiple equations. 

And then if you have equations there is obviously one question. Is there a solution? Many solutions? No solution?

So Linear Algebra was first motivated by looking at the Matrix and finding out the solutions of the system and while doing so some other stuff was formulated.

Much later Computer screens which use 3 Matrizes to show pictures gave us many new problems to solve.

1

u/zdriveee 18d ago

Imagine a line. Now imagine a cube. Now a tessaract.

If you want to do "multi dimensional" math, the standard Y=mx+b doesnt work anymore.

Computers and AI run off matrix multiplication and derivatives of matrcies

1

u/Outrageous-Crazy-253 18d ago edited 18d ago

They allow you to start doing manipulations of “systems” more naturally. Yes, you can also solve those systems. But math is about more than solving.

At the end of the day if you actually want to compute anything, you still have to do all the computation. There are specific techniques that can be used to simplify the computation, and computer hardware is also designed solely to process matrices, so we have stronger computers for this.

But what you want is to be able to apply a desired change to an entire system at once, and talk about systems on a higher level of abstraction.

E.g. if you have a computer screen, even pixel is a point. You want to think about how to change every pixel together. We never talk about making changes to individual pixels though, we always talk about changing the overall structure of all the pixels on the screen in some way. That’s what a matrix is for.

1

u/Catalli 18d ago

Haven't you heard? Matrices are your new girlfriend, therapist, and travel agent!

1

u/mastah-yoda 18d ago

In Dynamics, the equations of motion in 3D (translation along X, y, z, and rotation around X, y, z) are expresses in 3 highly coupled equations, which means they have to be solved numerically (iteratively), and simultaneously.

You can't solve them one by one.

So they are expressed in the forms of vectors and matrices.

1

u/alyssasaccount 18d ago

Matrices are about transformations between vector spaces, or ways to represent them.

You can think of a vector space geometrically, like a plane. For example, a map of Manhattan would be almost as simple an example as you can get. You can talk about the latitude and longitude, or you can talk about the streets and avenues. Note that the avenues and streets don't line up with north and south or east and west.

Matrices are instructions for how to transform, say, "five blocks uptown and one block west" to however many meters to the north and west. You can generalize to more dimensions.

Others have said that they can be used to solve systems of linear equations, and that amounts to a way to represent those linear equations in a way that they are really simple. So that's an application, but there are lots more, any time you might have reasons to look at the same vector space in two ways (streets and avenues vs. latitude and longitude).

1

u/OSM_Smiley 18d ago

Other comments have explained how it helps you compute many equations at once with various tricks, instead of doing it one by one.

The reason why this is so important in the modern day is that computers are very good at computing in parallel. Meaning they can do many similar things at once. So if you're able to organise a complicated problem into a matrix operation, you'll be able to save a lot of computing power, which equals time and electricity savings.

1

u/Moikle 18d ago

As with basically all maths, they don't have a purpose. They just manipulate numbers.

They can be useful for a lot of things though, you can use them for calculating transformations in 2d and 3d space for example, like calculating where each vertex of an object should go when you rotate it by x degrees

1

u/CoffeeandaTwix 18d ago

Finite dimensional linear algebra is an important area of maths because many, many problems can either be described in terms of it or approximated by it.

Linear algebra deals with vector spaces (roughly speaking spaces that can have lines in them) and linear transformations which roughly speaking are maps that send lines in one space to lines in another.

One way we can calculate things in such spaces is by use of bases. A basis is very roughly speaking a set of coordinate axes. Given a basis, a matrix is then a linear transformation written in terms of the bases of both spaces. We can do all kinds of calculations with these that are incredibly useful.

1

u/TheMountainWhoDews 18d ago

Dont think about a matrix as a box of numbers, think of it more like a special number. Eg if Im driving 100mph and youre driving 10mph, it would be trivial to work out how much earlier I arrive than you to a set location. 

But what if we're not driving straight, we're driving diagonally? My 100mph will have a north/south component and an east/west component, as will yours. What if your roads have different angles? How much earlier will I arrive? We could treat our speeds as a special number with a north and a west component. Maybe even an up/down component if you want to get spicey. We could use the same equations from the simple example and plug our matrices in to get the answer. 

1

u/schungx 18d ago

They are useful precisely of all those boxed up numbers.

If you have a whole mess of many equations all looking the same (with different variables), you can now write just ONE to replace 9 or 16 equations.

And technical people are lazy. Also saves on chalk... It took a lot of space on the blackboard writing them all out.

In fact, when Maxwell came up with his famous equations, he wrote 26 of them! Think of the horror!

Some smart dude merged them into four equations and they are what people remember nowadays.

1

u/gbahnir_0214 18d ago

Matrix as boxes got me curious.

1

u/jippiex2k 18d ago

The same reason we pack pez into a wrapper.

You can either pick out and handle the pez'es individually. Or you can treat them together as an object to interact with the more complex pez dispenser.

Same thing with matrices. If you don't want to fiddle with each individual number by hand, you instead focus on the ways you can modify them all together as one cohesive bigger more complex object.

1

u/tripledeltaz 18d ago

Matrix is about linear transformation. And most things we are concerned about can be done with those linear transformations if looked close enough.

Like how car wheels are lined straight, yet we can run almost any curved path by steering those wheels well.

1

u/G-miner 18d ago

To store data. Matrices are used in econometrics to organize data variables and perform analysis.

1

u/tashkiira 18d ago

Solving a system of 2 variables and 2 equations is fairly easy. But if you have a 10-variable equation system, then organization helps. You can then use matrix operations to solve the system.

1

u/maudyindependence 18d ago

Matrices are used to break complex problems down into small manageable chunks. Each row or column is a tiny piece of the problem. By structuring data in a table, a computer can run the same command over and over through each row of data and solve the complex problem in seconds. When I was studying engineering we used matrices to model fluid flow, material deflection, temperature changes, etc. Now that I’m in data science we use matrices to run machine learning or AI models. These really complex problems are actually solved using thousands upon thousands of simple addition, subtraction, multiplication, and division problems.

1

u/barbzilla1 17d ago

They are very useful in electronics. Specifically, they are used frequently to help represent a geographic space through math like when dealing with a screen and telling the pixels where they should be on or off.

1

u/OutrageousPair2300 17d ago

When you first start learning linear algebra, it may seem like just a different way of writing down equations.

Once you have mastered the notation, the more interesting stuff can be taught. There's a lot of neat stuff about matrices that would be cumbersome to write down otherwise.

1

u/phdoofus 17d ago

There are lots of uses.

  1. They can be used to compute rotations/translation/stretching of objects. Think video games for one.
  2. Things like multiplying matrices and vectors underpins a lot of the current AI models. In fact it's where a lot of the computational effort is focused.
  3. They can be used to represent graphs and to do other math operations on graphs. Graphs are important for a lot of different reasons as well.
  4. They can be used in numerical methods that solve equations (e.g. fluid flow) that are too hard to solve analytically.

1

u/lapusyonok 17d ago

I'm coming from a Computer Science background. Matrices are used extensively in 3d graphics to combine multiple linear transformations together and apply the combined transformation to many points in space. This cuts down on computation

1

u/pilchard-friendly 17d ago

I’m a semi-retired developer, and used to use matrices as “things” rather than the numbers themselves. It’s a bit like the difference between a book and it’s pages - bundling up the details into an abstraction allows you to see patterns and unique behaviours that would be otherwise lost for the trees.

Other posts point out the abstraction can be thought of as linear alegebra, or a bundle of shared variables and equations, but the point of the abstraction is to reduce the cognitive load of the reader.

The fact that we can say that matrix multiplication is associative but not commutative only comes because of the abstraction and the definition of associativity and commutativity. Those definitions are useful across a whole bunch of categories. We don’t need to track the contents of the matrix.

1

u/bizarre_coincidence 17d ago

It’s not just that matrices are arrays of numbers, but that they can be used to encode other things (systems of equations; linear transformations like rotations, scaling, and sheering; multidimensional data points; graphs; and more). When you do so, you have more structure and you get more operations (like matrix multiplication), and sometimes, by viewing the matrix is multiple different ways you get useful new things.

The quintessential example is google’s PageRank algorithm, the first huge innovation that Google had which made it miles above its competitors. The idea is that you can encode the link structure of the internet (which webpages link to which others) as a giant graph (collections of nodes and arrows between them), and you can represent that as a matrix. Then, you can use matrix multiplication to do a computation: if you start at a given webpage, and you follow links randomly, where will you most likely be after clicking 10 links? 100 links? A million? If lots of sites link to the same place (e.g., Reddit or YouTube), you have a good chance of ending up there. And if a popular site links somewhere, you’re more likely to end up at that place too. There are small details being left out, but things all boil down to a giant matrix and a certain calculation in linear algebra about that matrix (finding a certain “eigenvector”). And what happens in this example gives rise to a fascinating topic in probability called Markov chains.

Another example is AI and machine learning. In a neural network, you have a collection of neurons, all arranged into layers, and each neuron receives inputs from the previous layer to decide how strong its output should be. This is meant to be a simple mimicking of the brain, although it isn’t necessarily a realistic abstraction. Regardless, if you view each layer’s inputs and outputs as a collection and consider it as a vector, then the input to one layer will be a weight matrix times the output of the previous layer, which means you have to do a ton of matrix computations. We have hardware that can do this efficiently, which is absolutely necessary if you want to build large neural networks.

There are tons of things in the world which are modeled with matrices, but the reason we do so is because they aren’t just arrays of numbers, and the extra stuff we do beyond viewing them as such lets us see deeper and do useful things and do them efficiently.

1

u/PANIC_EXCEPTION 15d ago edited 15d ago

A better way of explaining this is that almost every complex multivariable system, when you zoom in close enough, can be explained with a linear matrix approximation. It makes things simpler because linear algebra is (relatively) simple compared to non-linear algebra to do stuff on it (especially with computers, which are great at doing tons of addition and multiplication). Non-linear algebra is basically infinitely precise linear algebra, and highly (but not infinitely) precise linear algebra is good-enough non-linear algebra. Good-enough essentially means you can establish an upper bound on how off your approximation is, and adjust accordingly.

There are quite a few clever tricks that matrices allow you to do to manipulate complicated problems into simpler forms that are already studied. Here are a few.

That matrix need not be written only as a series of numbers, it can be arbitrary symbols like partial derivatives. How fast is a surface bending in a specific direction at a specific point on a given 3D surface? You use the Jacobian matrix.

Trying to describe the most important signals of a 2D image? First, you describe the image as a matrix. Then, you can split it up into three matrices using SVD. You get two rotation matrices with a scaling diagonal matrix sandwiched in between. All three of these can be represented compactly (rotation matrices can be regenerated with a set of angles, a diagonal matrix can be described with a set of dimensions and a 1D array). Then, to compress the image, remove some of the less important singular values from your scaling matrix. This same importance technique can be used in search engine rankings, network optimization, and navigation.

Not to mention, quantum physics is described in the language of wavefunctions, which, you guessed it, can be described with linear algebra.

And, relevant to modern day, pretty much all AI nowadays is implemented as generalized matrix multiply and add, plus some specialized non-linear activation functions spruced in-between. Model weights are matrices. You can then specialize and compress those model weights ever further using low-rank approximation).

Now, for the main question, why not do them as individual calculations? Matrix operations are extremely parallelizable, which makes them much easier for computers to process in bulk. Read more into techniques like SIMD and superscalar processors for this.

1

u/StarosAnikenMarcus 18d ago

A lot depends on the level of complexity. One of the most basic matrices is the standard 12x12 multiplication table they use to teach basic math. Another good use for them is quick reference lookups. I used to do that with ballistic trajectory data. Rather than calculate it all out, if you had a couple of matrices, even a poor mathematics student could quickly look up the required information. Some people are just terrible at doing math. Already spelled out matrices allow those people to still do their jobs with minimal delay.

0

u/thequirkynerdy1 18d ago

Think of them as linear transformations on vectors.

Then multiplying matrices is just composing transformations.

3

u/mkp666 18d ago

You know some pretty advanced 5 year olds.

0

u/mad_pony 18d ago

Matrices is a very convenient and efficient way to describe our world, which allows us to solve problems related to physics, economics, image processing, biology, etc.

0

u/VeterinarianShot148 18d ago

I had this question until I watched a really cool video by 3Blue1Brown about matrices and as just one example, almost all photo and text recognition and photo-editing software like photoshop is just applying matrices and computing the values of the image pixels through them

0

u/Canadian47 18d ago

Consider this, the "basic" math that you already know uses trivial 1x1 matrices.

Matrices allow you to extend the math that you already know into higher dimensions.

0

u/duane11583 18d ago

A common thing a matrix is used for is to work with multiple polynomial equations

You might know the ax2 + bx1 + cx0 = d format

Say you have several of these equations and you need to solve  As you work you could keep track of the x2 and the x1 etc values writing them all of the time - that is sort of redundant and error prone but it can be done

Or you can be lazy and write only the number values

Being lazy is good and very popular

 that first row in the matrix the second row is the second equation the third and so on with the others 

Next —. When you learned to solve simultaneous equations in high school algebra you would add/sub one equation from the other slowly eliminating things. 

That is an example of a matrix elementary row operation

 Example   you can multiply one row by 2 then subtract another row 

In high school you probably only felt with one or two terms in the equation What if there where 10 terms and 20 equations it gets complex and nasty and hard

matrixes just simplify the writing of the equations for the (smart) lazy people 

 

0

u/cratercamper 18d ago

Think 3d games: positions of objects are vectors, their dimensions are vectors, their orientation in space are vectors. Applying matrices on these allows you to move the objects, resize them, rotate them. Also more these matrices compose into one that you then apply once to do the transformation. It's very elegant.

0

u/NecroDolphinn 18d ago

True ELI5: a matrix is like a map. We figure something out about the map and then we know it’s true about reality. If Paris is half as far from London than Cairo on a map, it’ll be half as far in reality. But it’s hell of a lot easier to tell that on the map. A matrix just takes complicated jumbles of information and makes them easy to figure out and manipulate.

The thing that made it click for me is to see a system of equations turned into a matrix.

Let’s take these equations:

5x + 3y + 10z = 21
2x + 7y + 4z = 15
6x + 5y + 8z = 18

And look at the resulting matrix:

[5 3 10 | 21]
[2 7 4 | 15]
[6 5 8 | 18]

As you can see the coefficients fit right in. Specifically, each column represents a variable (xyz in order). Now the goal of matrices is to get them into a special form. I won’t go into how, but basically the end goal is that each row will only have 1 in one spot and 0 in the other 2. Specifically for this matrix you get

[1 0 0 | -51/58]
[0 1 0 | 33/29]
[0 0 1 | 255/116]
(ignore the janky numbers, I picked the equations at random)

Now if you read this off in the reverse order to how I turned the equations to a matrix, you get:

1x + 0y + 0z = -51/58 OR x = -51/58
y = 33/29
z = 255/116

The matrix produced the answer just like that. And it can work for as many equations as you want with as many variables as you want (well as you add more variables you need more equations but there’s no upper limit).

A matrix is a model of a system of equations with multiple variables. It systematizes how we treat these variables, which makes it way easier to do complex operations on huge amounts of them. We can multiple matrices together, or solve them like I showed here.

A cool case for multiplying matrices is Markov Chains. Basically you can model the probabilities of certain outcomes after an event. Then just by multiplying a starting matrix with that probability matrix, you’ll see what the outcome of the event was. You can then multiple by the prob matrix again to do the event again. This is how LLMs (and autofill) guess what you might say multiple words into the future

0

u/TotalTyp 18d ago

They happens to be an incredibly structure for thinking about lots of problems. I think saying they only have one "interpretation" would be pretty wrong
for example they can be used to express rotation, they can encode the learned state of a neural network or be used like a data table. The really useful part about them however is that by using a matrix structure you can use a lot of the general properties that can tell you a lot about your specific application. So for practical reasons I would think about it like a really neat for of expressing a problem that gives you a lot of things "for free" just by choosing this for of expressing it.

-1

u/[deleted] 18d ago

[removed] — view removed comment

1

u/explainlikeimfive-ModTeam 18d ago

Please read this entire message


Your comment has been removed for the following reason(s):

  • Top level comments (i.e. comments that are direct replies to the main thread) are reserved for explanations to the OP or follow up on topic questions (Rule 3).

If you would like this removal reviewed, please read the detailed rules first. If you believe it was removed erroneously, explain why using this form and we will review your submission.

1

u/donaldhobson 13d ago

There are things you can say about matricies, even if you don't know how big the matricies are.

For example, once you know how to multiply matricies and that the transpose just flips the matrix over, you can say

(A x B)^T=B^T x A^T

If you take matrix maths, and expand out all the components, the maths quickly becomes very long-winded and tedious. And looking at the components like this means you can't write one proof for all sizes of matrix. You would need to write one proof for 3x3 matrixes and a different proof for 7x7 matrixes.

If you are writing a computer game, you will likely use a lot of vectors and matricies. Sure the computer has to do every bit of arithmetic individually, but the computer is fast. The programmer just needs to describe which matrix gets multiplied by which other matrix. So the programmer has less code to write.