 Hello, and welcome to the ninth video in the series on latex, the mathematical typesetting system. We're going to continue looking at latex environments with the powerful align environment. So we're going to see how to use the align and its relative the align star environments to typeset a system of equations, a stack of calculations, and an array of stacked calculations. In the last video, we used the equation environment to typeset automatically numbered displayed equations. This is great, but you're probably wondering, what if I had more than one equation to typeset, and they all go together? Here's an example of a very common instance of this. Well, the equation environment isn't built to handle multiple equations all bundled together like this. It only does one equation at a time. Going over to latex, one possible solution is to stack the equations on top of each other using the slash square bracket notation for displayed mode equations. But as you can see, once it's compiled, while the equations are actually displayed, they're not aligned properly. We want the equal signs to line up, and they don't. So this is where the align environment comes in. This is a powerful latex environment, and that it can be used for all sorts of tasks. We're just going to scratch the surface here in this video with three common tasks, starting with this 3x3 system of equations. Before we begin, align is another environment that needs the AMS math package that we met in the equation screencast. So go up to the preamble and type slash use package curly braces AMS math close curly braces. The align environment is used to format multi-line expressions that should be aligned in a certain single place. For example, we'd like that 3x3 linear system to have one equation on each line and lined up along the equal signs. To do this, let's begin by typing slash begin open curly brace align close curly brace. Then we start entering the content starting with the first line. When I get to the symbol I want to use for alignment, which in this case is the equal sign, I'm going to type the ampersand symbol, and then the symbol I want to align, which in this case is the equal sign. The ampersand tells latex that the symbol that follows is to be used for alignment. Now type the rest, and to end this line and start line two, type a double slash. Now we'll move down and type in the second equation using the ampersand again to flag the alignment symbol and end the line with a double slash. And then finally we may make it to the last line, and since this is the last line, we don't end the line with a double slash. Now we close the environment by typing end align. Now when we compile all this, we see that we get the equations all listed out as they should be aligned along the symbols that I flagged with an ampersand. Notice too that the lines of the equations are automatically numbered, much like in the equation environment. This can be handy, but if you don't want the numbers, use the align star environment instead. Once you compile, you can see that the numbers are suppressed. Another place to use the align environment is to create an orderly column of calculations. For example, let's suppose we want to type set the proof of the triangle inequality, which says that the absolute value of a sum of two real numbers is less than or less than or equal to the sum of the absolute values individually. Here's what a shot of this proof looks like from proofwiki.org. And our goal right now is to replicate this proof. Notice that it's a column of calculations and the symbol we use for alignment is not always the equal sign. So let's open up the align star environment because we want to suppress the numbering. Now we're going to type the first line, noting to add the ampersand equals because that's where we're going to align the rows. And then we add a double slash at the end. On the next line, notice that there is no left-hand side. In the align environment, we just simply don't put anything on the left side and just start the line with ampersand equals and then type out the rest of the line as usual. And the third line is the same thing. When we get to the fourth line, we're still not putting anything on the left side, but we're aligning using the less than or equal to symbol, which you'll remember from an earlier screencast is slash leq. Now the fifth line. And finally, the sixth line, and we are done. Let's compile it and see how we did. Finally, we can align multiple equations on the same line. Here's an example from calculus where we're doing integration by parts. Let's suppose I'm computing the integral of x cosine x dx and I want to set u equal to x and then put du equal dx right underneath that. And I also want to have dv equals cosine x dx and then put v equals sine x right above it. So I want to have the u and du expressions aligned along equal signs and the v and the dv expressions aligned along their equal signs, but I don't want to align those two columns with each other. Now the way I can do this is, first of all, begin the align environment, and then type the first line, then the second, and then end the environment. When I compile, I see the finished product is almost right, but I needed some space in between the two columns that I created. Now I can create that space by just putting two more ampersands in here, one between the x and the dv on the first row, and then between the dx and the v on the second row. This creates an aligned space that serves as a kind of separator. And finally, it looks like what I want. There's much more to say about the aligned environment, but these are probably the three simplest and most commonly used situations. Thanks for watching.