20.07.2013 Views

Notes on computational linguistics.pdf - UCLA Department of ...

Notes on computational linguistics.pdf - UCLA Department of ...

Notes on computational linguistics.pdf - UCLA Department of ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Stabler - Lx 185/209 2003<br />

Matrix arithmetic review: An m × n matrix A is an array with m rows and n columns.<br />

Let A(i, j) be the element in row i and column j.<br />

1. We can add the m × n matrices A, B to get the m × n matrix A + B = C in which<br />

C(i,j) = A(i, j) + B(i,j).<br />

2. Matrix additi<strong>on</strong> is associative and commutative:<br />

A + (B + C) = (A + B) + C<br />

A + B = B + A<br />

3. For any n × m matrix M there is an n × m matrix M ′ such that M + M ′ = M ′ + M = M, namelythen × m<br />

matrix M ′ such that every M(i,j) = 0.<br />

4. We can multiply an m × n matrix A and a n × p matrix to get an m × p matrix C in which<br />

C(i,j) = n k=1 A(i, k)B(k, j).<br />

This definiti<strong>on</strong> is sometimes called the “row by column” rule. To find the value <strong>of</strong> C(i,j), youaddthe<br />

products <strong>of</strong> all the elements in row i <strong>of</strong> A and column j <strong>of</strong> B. For example,<br />

<br />

1<br />

2<br />

<br />

4 8<br />

5 2<br />

9<br />

6<br />

<br />

0 (1 · 8) + (4 · 2)<br />

=<br />

0 (2 · 8) + (5 · 2)<br />

(1 · 9) + (4 · 6)<br />

(2 · 9) + (5 · 6)<br />

<br />

(1 · 0) + (4 · 0)<br />

(2 · 2) + (5 · 0)<br />

Here we see that to find C(1, 1) we sum the products <strong>of</strong> all the elements row 1 <strong>of</strong> A times the elements<br />

in column 1 <strong>of</strong> B. – The number <strong>of</strong> elements in the rows <strong>of</strong> A must match the number <strong>of</strong> elements in the<br />

columns <strong>of</strong> B or else AB is not defined.<br />

5. Matrix multiplicati<strong>on</strong> is associative, but not commutative:<br />

A(BC) = (AB)C<br />

<br />

For example, 3 5<br />

<br />

2 2<br />

<br />

= 3 5<br />

4 4<br />

It is interesting to notice that Lambek’s (1958) compositi<strong>on</strong> operator is also associative but not commutative:<br />

(X • Y)• Z) ⇒ X • (Y • Z)<br />

X/Y • Y ⇒ X<br />

Y • X/Y ⇒ X<br />

The c<strong>on</strong>necti<strong>on</strong> between the Lambek calculus and matrix algebra is actually a deep <strong>on</strong>e (Parker, 1995).<br />

6. For any m × m matrix M there is an m × m matrix Im such that TIm = ImT = T ,namelythem × m matrix<br />

Im such that every Im(i, i) = 1andforeveryi= j,Im(i, j) = 0.<br />

7. Exercise:<br />

a. Explain why the claims in 2 are obviously true.<br />

b. Do the calculati<strong>on</strong> to prove that my counterexample to commutativity in 5 is true.<br />

c. Explain why 6 is true.<br />

d. Make sure you can use octave or some other system to do the calculati<strong>on</strong>s <strong>on</strong>ce you know how to do<br />

them by hand:<br />

1% octave<br />

Octave, versi<strong>on</strong> 2.0.12 (i686-pc-linux-gnulibc1).<br />

Copyright (C) 1996, 1997, 1998 John W. Eat<strong>on</strong>.<br />

136

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!