9/15/2011lecture 2.6 -- matrices1 lecture 2.6: matrices* cs 250, discrete structures, fall 2011...

25
9/15/2011 Lecture 2.6 -- Matrices 1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

Upload: marian-gregory

Post on 31-Dec-2015

221 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 1

Lecture 2.6: Matrices*

CS 250, Discrete Structures, Fall 2011

Nitesh Saxena

Page 2: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 2

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

Page 3: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 3

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

Page 4: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 4

Outline

Matrix Types of Matrices Matrix Operations

Page 5: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 5

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

Page 6: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 6

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

Page 7: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 7

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?

Page 8: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 8

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”

Page 9: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 9

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

Page 10: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 10

Equality of Matrices

Equal Matrices - Work this out

1. If

2. If

Find a, b, c, and d

Find a, b, c, k, m, x, y, and z

Page 11: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 11

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}

Page 12: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 12

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.

Page 13: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 13

Multiplying two Matrices

Matrices Products

Steps before1. 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

Page 14: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 14

Multiplying two Matrices

Matrices Products – Possible outcomes

Page 15: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 15

Multiplying two Matrices

Matrices Products – Work this out

Let

Show that AB is NOT BA (this means that matrix multiplication is not commutative)

Page 16: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 16

Matrix Transpose

Transposition MatrixA matrix which is formed by turning all the rows of a given matrix

intocolumns and vice-versa. The transpose of matrix A is written AT,

and AT = {aji}

Page 17: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 17

Matric Transpose

Transposition Matrix – Work this out

Compute (BA)T :

Compute AT(D + F)

Page 18: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 18

Symmetric Matrix

Symmetrical MatrixA is said to be symmetric if all entries are symmetrical to its main

diagonal. That is, if aij = aji

Page 19: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 19

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

Page 20: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 20

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 bij

Page 21: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 21

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

Page 22: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 22

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:

Page 23: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 23

Boolean Matrices

Page 24: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 24

Boolean Matrices

Work this out

Page 25: 9/15/2011Lecture 2.6 -- Matrices1 Lecture 2.6: Matrices* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena

9/15/2011 Lecture 2.6 -- Matrices 25

Today’s Reading Rosen 2.6