**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] **

## 41 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

scholaFor 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 KoglerHi, 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.

August 29, 2018 at 3:50 pm

Ayar PacoThanks Joao!!!

September 19, 2008 at 10:30 am

Menuliskan Formulasi Matematika di WordPress.com - Lanjutan « Riset Operasi[…] pemutusan baris (line breaking). Seorang blogger telah menulis empat seri mengenai hal ini di blog-nya, termasuk bagaimana menuliskan formulasi matematika yang terdiri lebih dari satu baris, […]

February 5, 2010 at 2:59 am

saravananthirumuruganathanFantastic post !! Very useful to me . thanks !!

November 26, 2010 at 7:35 pm

PatrickWhen I use the cases code you use for simultaneous equations, the equations all appear on the same line for some reason. What am I missing? By the way I enclosed the code with \[ \], as it would not work otherwise.

November 29, 2010 at 8:24 pm

Joao KoglerHi Patrick,

the supposedly enclosed code is missing. However, I guess that the problem you reported above happened because you forgot the \\ between two consecutive lines containing equations.

Joao

March 18, 2011 at 10:49 pm

LaTeX – Multiline equations, systems and matrices (via Machine Intelligence ?) « The Coherence World[…] WordPressでmultilineでlatexするときの便利なまとめ． Series on Blogging with LaTeX This is the 3rd post in the series. Previous ones: Basics and overview Use of mathematical symbols in formulas and equations 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 co … Read More […]

May 16, 2011 at 7:44 am

sgphi, in “Simultaneous Equations” , the first example, I need to give a text that is common to the 3 equations shown. The text exceeds the length of the line….How to do the same?? Plzzzz help

\be

lhs=\left\{

\begin{array}{rl}

3x + 5y + z \\

\\

7x- 2y + 4z \\

\\

-6x+3y+2z

\end{array}\right.

\text{Here is the comment that exceeds one line and is required to be inserted appropriately.}

\ee

Jus take a look at the output and u’l understand wat i mean.

Thanks a lottt in advance

May 17, 2011 at 7:34 pm

Joao KoglerSorry, I don’t understand what you want to do. What is the purpose to use a text that exceeds the line length ? Maybe you would like to make a caption to your illustration or explain the facts referring to the equations in your main text. Anyway, I suggest that you try latex to wordpress :

http://lucatrevisan.wordpress.com/latex-to-wordpress/

This would enable you build your text, compile ad debug it before going to wordpress latex.

May 16, 2011 at 7:46 am

sgpoopssss….. “\be” and “\ee” represents, “\begin{equation}” and “\end{equation}” respectively,…..

sgp

June 25, 2011 at 9:40 am

LaTeX – Multiline equations, systems and matrices « Robert's World[…] https://kogler.wordpress.com/2008/03/21/latex-multiline-equations-systems-and-matrices/ […]

August 4, 2011 at 10:45 am

HoriniusFor the “case definition” (syntax = \begin{cases}……), is there any officially defined counter part to display a right bracket “{” on the right?

I mean, I know I could combine matrix and a non-matching right bracket to do the trick, but I would like to know if there’s any way to do it without fiddling and tricks.

August 14, 2011 at 2:36 pm

Joao KoglerSorry, I don’t know.

August 26, 2011 at 3:36 am

Alguns Exemplos de uso do LaTex no Wordpress | Experimentos do Dia a Dia[…] [2] https://kogler.wordpress.com/2008/03/21/latex-multiline-equations-systems-and-matrices/ Like this:LikeBe the first to like this post. […]

August 26, 2011 at 4:27 pm

Alguns Exemplos de uso do LaTex no Wordpress « Zettadata[…] [2] https://kogler.wordpress.com/2008/03/21/latex-multiline-equations-systems-and-matrices/ Share this:TwitterFacebookLike this:LikeBe the first to like this post. Categorias Sem categoria […]

February 15, 2012 at 4:51 am

Useful Links | Mini Physics[…] Online LaTeX equation editor Multi-line Equation LaTeX tutorial LaTeX tutorial for […]

May 6, 2012 at 7:19 pm

zhunxu2011Reblogged this on zhunxu.

August 16, 2012 at 1:42 am

Mark LimI like your matrix in Latex form. Simple . Good work.

August 21, 2012 at 11:20 am

Somnath Dey\begin{array}{*{20}{c}}

What is the meaning of {*{20}{c}} in array definition?

August 22, 2012 at 1:18 am

Peter Mownhttp://numberworld.info/equationSystemSolver is a great online equation system solver

February 14, 2013 at 1:26 pm

Kumar Vishalit not getting parse coming as it is as a simple text can any one please guide me I am very new in Latex please dont mind if it is stupid question

February 14, 2013 at 1:28 pm

Kumar VishalOh my good ness for you its coming whats wrong with my page then I am trying below thing “DOLLAR”latex \begin{bmatrix} xz & xw \\ yz & yw \end{bmatrix}”DOLLAR”

DOLLAR=$ // just because so it didn’t convert to latex

February 14, 2013 at 1:30 pm

Kumar VishalIn preview its not coming but for your page its work do i have to do something like setting or some plugin

March 2, 2013 at 11:12 pm

yawI need a multi line in \lfloor

May 12, 2013 at 1:09 am

Suraj bhattMaths matrics Exacise 3.1 /question 6

Solution

November 17, 2013 at 5:17 am

Latex | Vic's World[…] https://kogler.wordpress.com/2008/03/21/latex-multiline-equations-systems-and-matrices/ […]

March 19, 2014 at 3:24 am

Fractal Interpolation | Connor Johnson[…] This is a blog post I’ve been using since 2008 for reminding myself how to write matrices in . […]

March 21, 2014 at 8:43 am

mathtuition88Reblogged this on Singapore Maths Tuition and commented:

This is how to type LaTeX equations on WordPress blogs!

April 28, 2014 at 3:02 pm

Seyi AjaoThe posts gave me everything I need on multilines matrix. Thanks.

July 20, 2014 at 8:09 am

REDFor the array-type of alignment you don’t usually need to add each small thing from your equation to a different array-cell. I tried it with a multi-line matrix-equation and it works like a charm. Thank you so much for this great post!

November 17, 2014 at 1:50 am

lawhidHow do you do the bra-ket notation?

March 21, 2016 at 2:56 pm

Aruni have used this coding but the column space between the equal symbol is little bit wider, how reduce the space between the two column. Please advice

{\begin{array} {rcl}

{x\mbox{-}{\rm intercept:}} \hspace{.5em} {4x – 5(0)}&=&20\\

x &= &5\\

{y\mbox{-}{\rm intercept:}} \hspace{.5em}{4(0) – 5y}&=&20\\

y&=&-4

\end{array}}

October 17, 2016 at 5:47 pm

boupinelI’d totally forgotten about “cases”. Google brought me here, saving a lot of fussing with \begin{array}. Thanks!

September 19, 2017 at 4:16 pm

LaTeX notes – Robot Can Write[…] LaTeX – Multiline equations, systems and matrices […]

December 13, 2017 at 6:38 pm

collatz ad infinitum | Turing Machine[…] (12/13) 💡 😀 ⭐ ❗ after some more wild/ feverish scratchings last nite, just came up with this neat/ remarkable derivation! (equivalent to prior function with no hadamard operations as desired; the 4th line converts column vectors to diagonal matrices. took awhile to fmt this within rather substantial wordpress math limitations, which allow a lot less than “typical” latex with std packages, found helpful pg on that, multiline aligned eqns in latex without amsmath align [x]) […]

February 14, 2019 at 6:49 pm

LaTex Test – Welcome to the Symbolic Domain[…] This is one of the places where I was able to find some useful instructions for inserting LaTex code into WordPress blog pages: https://kogler.wordpress.com/2008/03/21/latex-multiline-equations-systems-and-matrices/ […]

February 27, 2019 at 6:59 am

Sheng BauDisappointing: adjustment of matrix entries not mentioned.

August 3, 2019 at 7:17 pm

Jebin R. Oliververy much useful……super