Series on Blogging with LaTeX
This is the 3rd post in the series. Previous ones:
Many of the examples shown here were adapted from the Wikipedia article Displaying a formula, which is actually about formulas in Math Markup.
.
Multiline Equations
You can present equations with several lines, using the array statement. Inside its declaration you must :
- Define the number of columns
- Define column alignment
- Define column indentation
- Indicate column separator with & symbol &
Example: {lcr} means: 3 columns with indentations respectively left, center and right
\begin{array}{lcl} z & = & a \\ f(x,y,z) & = & x + y + z \end{array}
\begin{array}{rcr} z & = & a \\ f(x,y,z) & = & x + y + z \end{array}
\begin{array}{rcl} f: R^3 & \to & R \\ (x,y,z) & \to & x + y + z \\ f(x,y,z) & = & x + y + z \end{array}
\begin{array} {lcl} f(x) & = & (a+b)^2 \\ & = & a^2+2ab+b^2 \end{array}
.
Case definitions
Used when a definition have two or more cases. Use the case statement. Notice that the spaces after the instances of if were included inside the mbox declarations.
f(n) = \begin{cases} n/2, & \mbox{if } n\mbox{ is even} \\ 3n+1, & \mbox{if } n\mbox{ is odd} \end{cases}
.
Simultaneous Equations
Here we have a very simple application of the case statement.
\begin{cases} 3x + 5y + z \\ 7x - 2y + 4z \\ -6x + 3y + 2z \end{cases}
.
Matrices
Matrices can be assembled by using the array statement, like in this example:
\left| \begin{array}{cc} x_{11} & x_{12} \\ x_{21} & x_{22} \end{array} \right|
Matrix frames are provided by \left and \right. If you suppress these statements, it will be displayed like:
\begin{array}{cc} A & B \\ C & D \end{array}
However, there is another statement, the matrix declaration, slightly easier to use:
\begin{matrix} x & y \\ z & v \end{matrix}
The frames of the matrix can be displayed in several forms, by just changing the matrix declaration to vmatrix, Vmatrix, bmatrix, Bmatrix or pmatrix, as shown ahead:
\begin{vmatrix} x & y \\ z & v \end{vmatrix}
\begin{Vmatrix} x & y \\ z & v \end{Vmatrix}
\begin{bmatrix} x & y \\ z & v \end{bmatrix}
\begin{Bmatrix} x & y \\ z & v \end{Bmatrix}
\begin{pmatrix} x & y \\ z & v \end{pmatrix}
As a final example, let us construct more complicated matrices and matricial expressions:
\begin{bmatrix} 0 & \cdots & 0 \\ \vdots & \ddots & \vdots \\ 0 & \cdots & 0 \end{bmatrix}
Now, we will show a first matricial expression:
\left[ \begin{array}{c} x_1 \\ x_2 \end{array} \right] = \begin{bmatrix} A & B \\ C & D \end{bmatrix} \times \left[ \begin{array}{c} y_1 \\ y_2 \end{array} \right]
and, here is another example, now using two kinds of vectors:
\begin{bmatrix} xz & xw \\ yz & yw \end{bmatrix} = \left[ \begin{array}{c} x \\ y \end{array} \right] \times \left[ \begin{array}{cc} z & w \end{array} \right]

4 comments
Comments feed for this article
March 22, 2008 at 2:26 am
Latex Resources » LaTeX - Multiline equations, systems and matrices
[...] asymptote: [...]
March 22, 2008 at 1:03 pm
Math Resources Blog » LaTeX - Multiline equations, systems and matrices
[...] steve: [...]
August 14, 2008 at 1:45 pm
schola
For multiline equations the »align« command family is much more convenient. See
http://www.ctan.org/tex-archive/info/math/voss/mathmode/Mathmode.pdf
on page 52 for examples.
Cheers.
August 19, 2008 at 1:35 am
Joao Kogler
Hi, thanks for your suggestion, however it doesn’t seem to work. I’ve gotten an example of page 53 of the document that you have cited and I’ve adapted it to conform to the LaTeX version used in WordPress. However, it didn’t parse.
WordPress uses a particular implementation of LaTeX that is just a subset of AMS LaTeX, with some simplifications. So, it is not expected that all constructions written in AMS LaTeX will work here. The WordPress implementation is more likely the one used in Wikipedia. Although it is just a subset, the WordPress and Wikipedia implementations are very powerful and provide a wide expressiveness for displaying math equations.
See below:
This one can’t parse; (this one follows your suggestion)
$ latex \begin{align} y & = x \\ y & = x^2 + 1 \\ y & = x^3 + x^2 + 1 \end{align} &fg=aa0000&s=2 $
This one works: (is the usual way shown on my posts)
$ latex \begin{array}{rcl} y & = & x \\ y & = & x^2 + 1 \\ y & = & x^3 + x^2 + 1 \end{array} &fg=aa0000&s=2 $
Maybe you would provide some examples, checking by yourself if I am not doing any mistake.