& = aˆ2+ab+ba+bˆ2\\

& = aˆ2+2ab+bˆ2

\end{split}

\end{equation}

gives

(a + b)2 = (a + b)(a + b)

= a2 + ab + ba + b2

(VIII.5)

= a2 + 2ab + b2

MATHEMATICS

VIII.4. MISCELLANY

There are more things Mathematics than just equations. Let us look at how LTEX and in

A

particular, the amsmath package deals with them.

Matrices

VIII.4.1.

Matrices are by de¬nition numbers or mathematical expressions arranged in rows and

columns. The amsmath has several environments for producing such arrays. For example

90 TYPESETTING MATHEMATICS

VIII.

The system of equations

x+y’z=1

x’y+z=1

x+y+z=1

can be written in matrix terms as

’1· ¬x· ¬1·

¬1 1

« « «

1 · ¬ y· = ¬1· .

¬ ·¬ · ¬ ·

’1

¬1

¬ ·¬ · ¬ ·

¬ ·¬ · ¬ ·

¬ ·¬ · ¬ ·

1z

1 1 1

’1·

¬1 1

«

¬ ·

Here, the matrix ¬1 1 · is invertible.

’1

¬ ·

¬ ·

¬ ·

1 1 1

is produced by

The system of equations

\begin{align*}

x+y-z & = 1\\

x-y+z & = 1\\

x+y+z & = 1

\end{align*}

can be written in matrix terms as

\begin{equation*}

\begin{pmatrix}

1 & 1 & -1\\

1 & -1 & 1\\

1& 1& 1

\end{pmatrix}

\begin{pmatrix}

x\\

y\\

z

\end{pmatrix}

=

\begin{pmatrix}

1\\

1\\

1

\end{pmatrix}.

\end{equation*}

Here, the matrix

$\begin{pmatrix}

1& 1 & -1\\

1 & -1 & 1\\

1& 1& 1

\end{pmatrix}$

is invertible.

Note that the environment pmatrix can be used within in-text mathematics or in

displayed math. Why the p? There is indeed an environment matrix (without a p) but it

91

MATHEMATICS

VIII.4. MISCELLANY

produces an array without the enclosing parentheses (try it). If you want the array to be

enclosed within square brackets, use bmatrix instead of pmatrix. Thus

a b

Some mathematicians write matrices within parentheses as in while others prefer square

c d

a b

brackets as in

c d

is produced by

Some mathematicians write matrices within parentheses as in

$

\begin{pmatrix}

a & b\\

c&d

\end{pmatrix}

$

while others prefer square brackets as in

$

\begin{bmatrix}

a & b\\

c&d

\end{bmatrix}

$

There is also a vmatrix environment, which is usually used for determinants as in

a b

The determinant is de¬ned by

c d

a b

= ad ’ bc

c d

which is obtained from the input

The determinant

$

\begin{vmatrix}

a & b\\

c&d

\end{vmatrix}

$

is defined by

\begin{equation*}

\begin{vmatrix}

a & b\\

c&d

\end{vmatrix}

=ad -bc

\end{equation*}

There is a variant Vmatrix which encloses the array in double lines. Finally, we have a

Bmatrix environment which produces an array enclosed within braces { }.

92 TYPESETTING MATHEMATICS

VIII.

A row of dots in a matrix can be produced by the command \hdotsfour. it should

be used with an argument specifying the number of columns to be spanned. For example,

to get

A general m — n matrix is of the form

¬ a11 a12 . . . a1n ·

«

¬ 21 a22 . . . a2n ·

¬ ·

¬a ·

¬ ·

¬. . . . . . . . . . . . . . . . . . . .·

¬ ·

¬ ·

¬ ·

¬ ·

am1 am2 . . . amn

we type

A general $m\times n$ matrix is of the form

\begin{equation*}

\begin{pmatrix}

a_{11} & a_{12} & \dots & a_{1n}\\

a_{21} & a_{22} & \dots & a_{2n}\\

\hdotsfor{4}\\

a_{m1} & a_{m2} & \dots & a_{mn}

\end{pmatrix}

\end{equation*}

The command \hdotsfor has also an optional argument to specify the spacing of dots.

Thus in the above example, if we use \hdotsfor[2]{4}, then the space between the dots

is doubled as in

A general m — n matrix is of the form

¬ a11 a12 . . . a1n ·

«

¬ 21 a22 . . . a2n ·

¬ ·

¬a ·

¬ ·

¬. . . . . . . . . . . . . . .·

¬ ·

¬ ·

¬ ·

¬ ·

am1 am2 . . . amn

Dots

VIII.4.2.

In the above example, we used the command \dots to produce a row of three dots. This

can be used in other contexts also. For example,

Consider a finite sequence $X_1,X_2,\dots$, its sum $X_1+X_2+\dots$

and product $X_1X_2\dots$.

gives

Consider a ¬nite sequence X1 , X2 , . . . , its sum X1 + X2 + . . . and product X1 X2 . . . .

Here the dots in all the three contexts are along the “baseline” of the text. Isn™t it better

to typeset this as

Consider a ¬nite sequence X1 , X2 , . . . , its sum X1 + X2 + · · · and product X1 X2 · · · .

with raised dots for addition and multiplication? The above text is typeset by the input

Consider a finite sequence $X_1,X_2,\dotsc$, its sum $X_1+X_2+\dotsb$

and product $X_1X_2\dotsm$.

93

MATHEMATICS

VIII.4. MISCELLANY

Here \dotsc stands for dots to be used with commas, \dotsb for dots with binary

operations (or relations) and \dotsm for multiplication dots. There is also a \dotsi for

dots with integrals as in

f

···

A1 A2 An

Delimiters

VIII.4.3.

How do we produce something like

ahg ahg

= 0, the matrix

Since is not invertible.

hbf hbf

gfc gfc

Here the ˜small™ in-text matrices are produced by the environment smallmatrix. This

environment does not provide the enclosing delimiters ( ) or ” ” which we must supply

as in

$

\left|\begin{smallmatrix}

a & h & g\\

h & b & f\\

g&f&c

\end{smallmatrix}\right|

=0

$,

the matrix

$

\left(\begin{smallmatrix}

a & h & g\\

h & b & f\\

g&f&c

\end{smallmatrix}\right)

$

is not invertible.

Why the \left|...\right| and \left{...\right? These commands \left and \right

enlarge the delimiter following them to the size of the enclosed material. To see their ef-

fect, try typesetting the above example without these commands. The list of symbols at

the end of the chapter gives a list of delimiters that are available off the shelf.

One interesting point about the \left and \right pair is that, though every \left

should be matched to a \right, the delimiters to which they apply need not match. In par-

ticular we can produce a single large delimiter produced by \left or \right by matching

it with a matching command followed by a period. For example,

ux = v y

Cauchy-Riemann Equations

u y = ’vx

is produced by

94 TYPESETTING MATHEMATICS

VIII.

\begin{equation*}

\left.

\begin{aligned}

u_x & = v_y\\

u_y & = -v_x

\end{aligned}

\right\}

\quad\text{Cauchy-Riemann Equations}

\end{equation*}

There are instances where the delimiters produced by \left and \right are too small

or too large. For example,

\begin{equation*}

(x+y)ˆ2-(x-y)ˆ2=\left((x+y)+(x-y)\right)\left((x+y)-(x-y)\right)=4xy

\end{equation*}

gives

(x + y)2 ’ (x ’ y)2 = (x + y) + (x ’ y) (x + y) ’ (x ’ y) = 4xy

where the parentheses are all of the same size. But it may be better to make the outer

ones a little larger to make the nesting visually apparent, as in

(x + y)2 ’ (x ’ y)2 = (x + y) + (x ’ y) (x + y) ’ (x ’ y) = 4xy

This is produced using the commands \bigl and \bigr before the outer parentheses as

shown below:

\begin{equation*}

(x+y)ˆ2-(x-y)ˆ2=\bigl((x+y)+(x-y)\bigr)\bigl((x+y)-(x-y)\bigr)=4xy

\end{equation*}

Apart from \bigl and \bigr there are \Bigl, \biggl and \Biggl commands (and

their r counterparts) which (in order) produce delimiters of increasing size. (Experiment

with them to get a feel for their sizes.)

As another example, look at

For n-tuples of complex numbers (x1 , x2 , . . . , xn ) and (y1 , y2 , . . . , yn ) of complex numbers

2 «

« «

n n n

¬ · ¬ ·¬ ·

|xk yk |· ¤ ¬ |xk |· ¬ |yk |·

¬ · ¬ ·¬ ·

¬ · ·¬ ·

¬ ¬

¬ · ¬ ·¬ ·

k=1 k=1 k=1

which is produced by

For $n$-tuples of complex numbers $(x_1,x_2,\dotsc,x_n)$ and

$(y_1,y_2,\dotsc,y_n)$ of complex numbers

\begin{equation*}

\left(\sum_{k=1}ˆn|x_ky_k|\right)ˆ2\le

\left(\sum_{k=1}ˆ{n}|x_k|\right)\left(\sum_{k=1}ˆ{n}|y_k|\right)

\end{equation*}

Does not the output below look better?

95

MATHEMATICS

VIII.4. MISCELLANY

For n-tuples of complex numbers (x1 , x2 , . . . , xn ) and (y1 , y2 , . . . , yn ) of complex numbers

n n n

2

|xk yk | ¤ |xk | |yk |

k=1 k=1 k=1

This one is produced by

For $n$-tuples of complex numbers $(x_1,x_2,\dotsc,x_n)$ and

$(y_1,y_2,\dotsc,y_n)$ of complex numbers

\begin{equation*}

\biggl(\sum_{k=1}ˆn|x_ky_k|\biggr)ˆ2\le

\biggl(\sum_{k=1}ˆ{n}|x_k|\biggr)\biggl(\sum_{k=1}ˆ{n}|y_k|\biggr)

\end{equation*}

Here the trouble is that the delimiters produced by \left and \right are a bit too large.

Putting one over another

VIII.4.4.

Look at the following text

From the binomial theorem, it easily follows that if n is an even number, then

n1 n1 n 1

+ =0

1’ ’ ··· ’