Transcript lecture2.6

Lecture 2.6: Matrices*
CS 250, Discrete Structures, Fall 2011
Nitesh Saxena
9/15/2011
Lecture 2.6 -- Matrices
1
Course Admin

Mid-Term 1 on Thursday, Sep 22



In-class (from 11am-12:15pm)
Will cover everything until the lecture on Sep 15
No lecture on Sep 20



As announced previously, I will be traveling to
Beijing to attend and present a paper at the
Ubicomp 2012 conference
This will not affect our overall topic coverage
This will also give you more time to prepare for
the exam
9/15/2011
Lecture 2.6 -- Matrices
2
Course Admin

HW2 has been posted – due Sep 30



Covers chapter 2 (lectures 2.*)
Start working on it, please. Will be helpful in
preparation of the mid-term
HW1 grading delayed a bit



TA/grader was sick with chicken pox
Trying to finish as soon as possible
HW1 solution has been released
9/15/2011
Lecture 2.6 -- Matrices
3
Outline



Matrix
Types of Matrices
Matrix Operations
9/15/2011
Lecture 2.6 -- Matrices
4
Matrix – what it is?
An array of numbers arranged in m horizontal rows and n vertical columns.
We say that A is a matrix m x n. (Dimension of matrix)
.
A = {aij}, where i = 1, 2, …, m
and j = 1, 2,…, n
9/15/2011
Lecture 2.6 -- Matrices
5
Examples




Grades obtained by a set of students in
different courses can be represented a matrix
Average monthly temperature at a set of
cities can be represented as a matrix
Facebook friend connections for a given set of
users can be represented as a matrix
…
9/15/2011
Lecture 2.6 -- Matrices
6
Types of Matrices
Square Matrix
Number of rows = number of columns
Which one(s)of the following is(are) square matrix(ces)?
Where is the main diagonal?
9/15/2011
Lecture 2.6 -- Matrices
7
Types of Matrices
Diagonal Matrix
“a square matrix in which entries outside the main diagonal area are all
zero, the diagonal entries may or may not be zero”
9/15/2011
Lecture 2.6 -- Matrices
8
Equality of Matrices


Two matrices are said to be equal if the corresponding elements
are equal. Matrix A = B iff aij = bij
Example:
If A and B are equal matrices, find the values of a, b, x and y
9/15/2011
Lecture 2.6 -- Matrices
9
Equality of Matrices
Equal Matrices - Work this out
1.
If
Find a, b, c, and d
2. If
Find a, b, c, k, m, x, y, and z
9/15/2011
Lecture 2.6 -- Matrices
10
Adding two Matrices
Matrices Summation

The sum of the matrices A and B is defined only when A and B
have the same number of rows and the same number of columns
(same dimension). C = A + B is defined as {aij + bij}
9/15/2011
Lecture 2.6 -- Matrices
11
Adding Two Matrices
Matrices Summation – work this out
a) Identify the pair of which matrices between which the summation
process can be executed
b) Compute C + G, A + D, E + H, A + F.
9/15/2011
Lecture 2.6 -- Matrices
12
Multiplying two Matrices
Matrices Products
Steps before
1. Find out if it is possible
to get the products?
1. Find out the result’s
dimension
2. Arrange the numbers in
an easy way to compute –
avoid confusion
9/15/2011
Lecture 2.6 -- Matrices
13
Multiplying two Matrices
Matrices Products – Possible outcomes
9/15/2011
Lecture 2.6 -- Matrices
14
Multiplying two Matrices
Matrices Products – Work this out
Let
Show that AB is NOT BA (this means that
matrix multiplication is not commutative)
9/15/2011
Lecture 2.6 -- Matrices
15
Matrix Transpose
Transposition Matrix
A matrix which is formed by turning all the rows of a given matrix into
columns and vice-versa. The transpose of matrix A is written AT, and
AT = {aji}
9/15/2011
Lecture 2.6 -- Matrices
16
Matric Transpose
Transposition Matrix – Work this out
Compute (BA)T :
Compute AT(D + F)
9/15/2011
Lecture 2.6 -- Matrices
17
Symmetric Matrix
Symmetrical Matrix
A is said to be symmetric if all entries are symmetrical to its main
diagonal. That is, if aij = aji
9/15/2011
Lecture 2.6 -- Matrices
18
Boolean Matrices
Boolean Matrix and Its Operations

Boolean matrix is an m x n matrix where all of its entries are
either 1 or 0 only.

There are three operations on Boolean:

Join by

Meet

Boolean Product
9/15/2011
Lecture 2.6 -- Matrices
19
Boolean Matrices
Boolean Matrix and Its Operations – Join By

Given A = [aij] and B = [bij] are Boolean matrices with the same
dimension, join by A and B, written as A  B, will produce a matrix
C = [cij], where cij = aij
9/15/2011
 bij
Lecture 2.6 -- Matrices
20
Boolean Matrices
Boolean Matrix and Its Operations – Meet

Meet for A and B, both with the same dimension, written as A  B,
will produce matrix D = [dij] where dij = aij  bij
9/15/2011
Lecture 2.6 -- Matrices
21
Boolean Matrices
Boolean Matrix and Its Operations – Boolean Products

If A = [aij] is an m x p Boolean matrix, and B = [bij] is a p x n Boolean
matrix, we can get a Boolean product for A and B written as A ⊙ B,
producing C, where:
9/15/2011
Lecture 2.6 -- Matrices
22
Boolean Matrices
9/15/2011
Lecture 2.6 -- Matrices
23
Boolean Matrices
Work this out
9/15/2011
Lecture 2.6 -- Matrices
24
Today’s Reading

Rosen 2.6
9/15/2011
Lecture 2.6 -- Matrices
25