Astrophysics one year ago @empty I'm a noob at chem

1. Empty

Alright so let's learn how to balance a chemical equation with linear algebra! Do you happen to have one that looks difficult or should I just come up with something on my own?

2. Astrophysics

Come up with one, but remember I'm in baby chem! lol

3. Empty

$W \cdot C_6H_{12}O_6 + X \cdot O_2 \rightarrow Y \cdot H_2O+Z \cdot CO_2$ OK hopefully this isn't too crazy. This is the burning of sugar $$C_6H_{12}O_6$$ with oxygen gas $$O_2$$ to make steam $$H_2O$$ and carbon dioxide gas $$CO_2$$ And W, X, Y, and Z are the coefficients we want to use to balance our equation. Everything seem pretty reasonable so far?

4. Empty

I can do an easier one first for an example if this seems too big and confusing.

5. Astrophysics

That's fine, I like combustion :D

6. Empty

So we start out by seeing what all the atoms are in the reaction they will form our basis vectors! We only have Carbon, Hydrogen, and Oxygen, straight forward enough, so here we have our basis vectors: B={C,H,O} That means the vector $\left[ \begin{array}c 6\\ 12\\ 6\\\end{array} \right]$ represents sugar, since we have 6 carbon, 12 oxygen and 6 hydrogen in it. What are the other 3 vectors?

7. Astrophysics

Is that suppose to be 12 hydrogen or oxygen

8. Empty

12 hydrogen. I've just randomly decided the order should be from top to bottom the same as it is listed left to right in my basis {C, H, O} so that means the top is # of carbon, middle is # of hydrogen, and bottom is # of oxygen atoms. So the 12 is for hydrogen. $$C_6H_{12}O_6$$ the subscripts one each letter represent how much of that atom are in the molecule. So for instance $$H_2O$$ means 2 Hydrogen and 1 Oxygen (the 1 is understood if it's not listed).

9. Astrophysics

Ah ok, no I just looked at you said 6 carbon, 12 oxygen, and 6 hydrogen, and was just wondering, if it was an error or that's how it is

10. Astrophysics

So for the second one |dw:1435825543416:dw| don't know how to do linear algebra on LaTeX XD

11. Empty

Where did I say 12 oxygen and 6 hydrogen? haha I want to correct it so it's not confusing

12. Empty
13. Empty

Also, that's correct for the second one :)

14. Astrophysics

|dw:1435825590124:dw| it's no big deal haha

15. Empty

Ahhh ok I see sorry about that haha.

16. Empty

Alright, so go ahead and try that link out, just press 3 and 1 and that'll make your vector to fill in, then copy paste in here the last two vectors. :)

17. Astrophysics

Alright, cool haha $X \[\left[ \begin{array}c 0\\ 0\\ 2\\\end{array} \right]$ -> Y $\left[ \begin{array}c 0\\ 2\\ 1\\\end{array} \right]$ + Z$\left[ \begin{array}c 1\\ 0\\ 2\\\end{array} \right]$ \]

18. Astrophysics

Oh oops, that looks ugly, but I think that's the right idea

19. Empty

Yeah, here I'll help clean it up: $W \left[ \begin{array}c 6\\ 12\\ 6\\\end{array} \right] + X \left[ \begin{array}c 0\\ 0\\ 2\\\end{array} \right]=Y\left[ \begin{array}c 0\\ 2\\ 1\\\end{array} \right]+Z\left[ \begin{array}c 1\\ 0\\ 2\\\end{array} \right]$

20. Astrophysics

|dw:1435825929157:dw| ah yeah

21. Astrophysics

There was a website to do all your latex, and it did not take much time as it had all the presets, I will find it later and share it as well.

22. Astrophysics

Anyways, what's next haha, this seems interesting already

23. Empty

That right arrow is an equal sign, after all this is a chemical equation ;P It just happens to be that chemists prefer to add extra information of directionality to show where the equilibrium lies for a mass aggregate of chemicals. But the total number on the left is equal to the number on the right. Any ideas on how to proceed?

24. Astrophysics

Ah, then in that case, it's just arithmetic, set it = 0?

25. Empty

Yeah, so subtract the two vectors on the right from both sides of the equation to get it equal to zero

26. Astrophysics

|dw:1435826256387:dw|

27. Empty

Now we take this equation you found: $W \left[ \begin{array}c 6\\ 12\\ 6\\\end{array} \right] + X \left[ \begin{array}c 0\\ 0\\ 2\\\end{array} \right]+Y\left[ \begin{array}c 0\\ -2\\ -1\\\end{array} \right]+Z\left[ \begin{array}c -1\\ 0\\ -2\\\end{array} \right] = \left[ \begin{array}c 0\\ 0\\ 0\\\end{array} \right]$ And we turn it into a matrix times a vector like this: $\left[ \begin{array}c 6 & 0 & 0 & -1\\12 & 0 & -2 & 0\\6 & 2 & -1 & -2\\\end{array} \right] \left[ \begin{array}c W\\ X\\ Y\\ Z\\\end{array} \right] =\left[ \begin{array}c 0\\ 0\\ 0\\\end{array} \right]$

28. Astrophysics

Ah, nice! Is it sad to say I kind of forgot how to solve such a system of equation using matrices, actually I think I may know...column 1*row, column 2 * row, etc been too long as you can see lol.

29. Empty

Yeah I rarely do this sort of thing much anymore either. I had to play around for a bit to refigure this out haha.

30. Empty

Now we make it an augmented matrix by putting the 0 vector there on the end (it really doesnt matter since it's all 0s it won't change. Now we can start considering putting it into something similar to reduced row echelon form, however we don't have to be so extreme. We just want to make everything nice whole numbers, which thankfully is much simpler since I always hated doing this by hand with fractions. If you see a fraction, then you're doing this wrong! :D

31. Empty

$\left[ \begin{array}c 6 & 0 & 0 & -1\\12 & 0 & -2 & 0\\6 & 2 & -1 & -2\\\end{array} \right]$ So let's pretend this is our augmented matrix (the zero vector column in the last column has been omited cause it's not gonna change when we multiply it by a scalar or add it to itself). Let's reduce this to lowest possible whole numbers. This is simple, for instance let's divide the middle row by 2 to get: $\left[ \begin{array}c 6 & 0 & 0 & -1\\6 & 0 & -1 & 0\\6 & 2 & -1 & -2\\\end{array} \right]$ Now let's subtract the top row from the bottom row to get: $\left[ \begin{array}c 6 & 0 & 0 & -1\\0 & 0 & -1 & 1\\0 & 2 & -1 & -1\\\end{array} \right]$ Subtract the top from the middle sure why not $\left[ \begin{array}c 6 & 0 & 0 & -1\\0 & 0 & -1 & 1\\0 & 2 & -1 & -1\\\end{array} \right]$ Maybe subtract the middle from the bottom to get: $\left[ \begin{array}c 6 & 0 & 0 & -1\\0 & 0 & -1 & 1\\0 & 2 & 0 & -2\\\end{array} \right]$ Divide out that common 2 in the bottom row! $\left[ \begin{array}c 6 & 0 & 0 & -1\\0 & 0 & -1 & 1\\0 & 1 & 0 & -1\\\end{array} \right]$ Hey, we're practically done. Let's carry out this matrix multiplication: $\left[ \begin{array}c 6 & 0 & 0 & -1\\0 & 0 & -1 & 1\\0 & 1 & 0 & -1\\\end{array} \right] \left[ \begin{array}c W\\ X\\ Y\\ Z\\\end{array} \right] =\left[ \begin{array}c 0\\ 0\\ 0\\\end{array} \right]$ This gives us: 6W=Z Y=Z X=Z That's convenient, we can just write this as: 6W=X=Y=Z

32. Empty

Maybe this seems long, but we're actually done now. This is a real fast and easy thing to do in practice since it's pretty much all mechanical and adding whole numbers. Plug all those in, 6W=X=Y=Z to get: $W \cdot C_6H_{12}O_6 + 6W \cdot O_2 \rightarrow 6W \cdot H_2O+6W \cdot CO_2$ divide out the common factor of W: $C_6H_{12}O_6 + 6\cdot O_2 \rightarrow 6 \cdot H_2O+6 \cdot CO_2$ Check it to make sure it's right. In fact if you have a graphing calculator you can go ahead and plug in the matrix to get it into RREF for your homework. Now you might wonder why we had that extra W in there, what's that about do you know?

33. Astrophysics

That's neat but quick question when you want it in RREf, shouldn't it be |dw:1435827574546:dw| just a little thing I remember, but I follow all your steps, this looks great

34. Empty

If I were to do this on my own I'd look at the chemical equation write out my basis {C,H,O} so I could easily reference it so as not to forget, then do the RREF on the matrix immediately until each row has at most 2 things in it.

35. Astrophysics

I just chose 1, doesn't specifically have to be 1

36. Astrophysics

Very cool btw, I didn't even know you could use linear algebra in chemistry this is def worth practicing

37. Empty

Yeah, I guess I could have adjusted the last two rows by flipping them to get it into closer to RREF: $\left[ \begin{array}c 6 & 0 & 0 & -1\\0 & 1 & 0 & -1\\0 & 0& -1 & 1\\\end{array} \right] \left[ \begin{array}c W\\ X\\ Y\\ Z\\\end{array} \right] =\left[ \begin{array}c 0\\ 0\\ 0\\\end{array} \right]$ We can't do anything about that last column though since it is a rectangular matrix there's no pivots we can use to get rid of it.

38. Empty

Here, try this one, it will be easier I think. (don't cheat!) Hint: use the basis B={H,O} $X \cdot H_2 + Y \cdot O_2 \rightarrow Z \cdot H_2O$

39. Empty

This becomes much more useful of a strategy when you get to more complicated chemical reactions, since you can plug it into a computer and have it solved. It also helps you to expand your concept to see if you truly understand the concept of a vector space as not necessarily being little arrows pointing around.

40. Astrophysics

Haha, alright this is my last one then I will go to bed so here it is |dw:1435827961176:dw|

41. Astrophysics

|dw:1435828070469:dw| Now I'm a bit scared to do the RREF part haha.

42. Empty

There'll only be like one single step to do. You will know you're done when there's only 2 things in each row and all the number in the row have been reduced to their lowest possible common multiple.

43. Astrophysics

Oh wait so it's already done

44. Astrophysics

Or I can multiply by 1/2 I don't think it makes a dif

45. Empty

Yeah, multiply by 1/2 on the first row, that's all there is to do :P

46. Astrophysics

Yeah thought so haha

47. Empty

This example is probably too simple to do by this method that it's sorta like fumbling on itself I think haha.

48. Empty

it's like trying to kill a mouse with a bazooka

49. Astrophysics

Yeah sort off

50. Astrophysics

The first example was really good though

51. Astrophysics

I want to do more of this though, maybe I'll try some on my own and then tag you to check if I'm doing the steps right, or I will know once I balance it without LA haha, anyways are you on tomorrow? I'm a bit sick and it's late so I'm going to head to bed

52. Empty

Alright goodnight, I can definitely check your answers or give you ideas if you tag me

53. Astrophysics

Ok sounds good, I'll talk to you later thanks again for everything haha

54. Empty

Yeah any time

55. Astrophysics

By the way the W in front of sugar, is that there just because it was our original coeff, I didn't catch that?

56. Astrophysics

@Empty

57. Empty

The reason that's there is because we generally set W=1 or divide it out. We can set it equal to any positive integer value if we really wanted to. We have this free variable for a fairly straight forward reason, it's just because this reaction can happen any amount of times really. For instance in the last problem you solved we can write $2H_2+O_2 \rightarrow 2H_2O$ But there's nothing particularly invalid about multiplying everything by 2, the proportions stay the same, which is what matters. $4H_2+2O_2 \rightarrow 4H_2O$ It's just sorta silly to write it this way. There are however some chemists who like a certain kind of way where they have everything in terms of fractions with 1 as the highest number, so they might put: $H_2+\frac{1}{2}O_2 \rightarrow H_2O$ But this isn't the most common thing, although it's really not particularly wrong either.

58. Astrophysics

I figured it was a free variable at first and just wanted to make sure haha, thank you so much, that makes a lot of sense, this method is much more interesting, and fun!! Thanks

59. Astrophysics

It doesn't really bother me either way, if you leave it as fractions or whole numbers, long as you understand how to make it whole numbers, I write it in fractions if I'm being lazy haha. But, if you think about it, it's pretty silly you can't find half a O2 or anything...

60. Empty

Yeah, I find that it's possible to use matrices to solve a real wide range of problems, definitely a worthwhile skill to try to pick up and understand, there is so much to it I don't even know all of linear algebra. Anywhere you have vectors they're important and once you realize that 'linear independence' as a concept is much broader than simply "arrows in space" you can apply this to many other problems like we did here. For example, the amount of hydrogen is completely independent of the amount of oxygen we had, this is basically the essence of linear independence working for us here. Any time you have two or more separate things mixing around together we can think of it as a vector space. To sorta draw it out explicitl what we've done in the case of 2H2+O2=2H2O we can write: |dw:1435829789755:dw|

61. Astrophysics

You have no idea how astonished I am right now

62. Empty

Ask me tomorrow and I'll show you crazy but also very straightforward examples of vector spaces that'll break your noodle lol

63. Astrophysics

Alright, sounds good haha, take care man.

64. Empty

Yeah last year or so I showed @mathslover an example of a vector space that made him stand up out of his chair and gave him a high on math hahaha.