Docsity

Assignment 4 Solution - Applied Numerical Computing | EL ENGR 103, Assignments of Electrical and Electronics Engineering

Toggle sidebar
bg1
EE103 Winter 2006
Applied Numerical Computing
J. R. Shinnerl
Instructor: Prof.
HW4 Solution
Exercise 1
(a) Consider a linear combination of vectors in
V,
∑
=
=
m
i
iivu
1
α
then
()
∑∑ ==
==
m
i
ii
m
i
ii vvu
11
βααββ
which is a linear combination of vectors in
V
.
(b) Consider the following
p
vectors each a linear combination of vectors in
V
⎪
⎪
⎪
⎩
⎪
⎪
⎪
⎨
⎧
=
=
∑
∑
=
=
m
i
ipip
m
i
ii
vu
vu
1
1
11
α
α
M
Any combination of the above vectors can be written as
i
m
i
p
j
jij
p
j
m
i
ijij
p
j
jj vvu ∑∑∑∑∑=====⎟
⎟
⎠
⎞
⎜
⎜
⎝
⎛
=
⎟
⎟
⎠
⎞
⎜
⎜
⎝
⎛
=
11111
αβαββ
which is again a linear combination of the vectors in
V
.
(c) In order to show that span(
V
) is a vector subspace of
W
,we need to show
that span(
V
) is a closed set in the sense that any linear combination of the
elements in span(
V
) is a member of span(
V
). This statement was proven in the
previous section.
{
}
m
vvv ,,, 21 L
(d) Let us define the matrix
A
with vectors as its columns:
[
]
m
vvvA L
21
=
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15

Partial preview of the text

Download Assignment 4 Solution - Applied Numerical Computing | EL ENGR 103 and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

EE103 Winter 2006

Applied Numerical Computing

Instructor: Prof. J. R. Shinnerl

HW4 Solution

Exercise 1

(a) Consider a linear combination of vectors inV,

∑

=

m i

u i vi 1

α

then

∑ ∑^ (^ ) = =

= =

m i

i i

m i

u i vi v 1 1

β β α βα

which is a linear combination of vectors inV.

(b) Consider the followingp vectors each a linear combination of vectors inV

⎪

⎪ ⎪ ⎩

⎪ ⎪ ⎪ ⎨

⎧

=

=

∑

∑

=

= m i p pi i

m i i i

u v

u v

1

1 1 1

α

α M

Any combination of the above vectors can be written as

i

m i

p j

j ji

p j

m i

j ji i

p j ∑ j^ u^ j ∑ ∑ v ∑ ∑ v = = = = = ⎟

⎟ ⎠

⎞ ⎜ ⎜ ⎝

⎛ ⎟⎟= ⎠

⎞ ⎜ ⎜ ⎝

⎛

1 1 1 1 1

β β α β α

which is again a linear combination of the vectors inV.

(c) In order to show that span(V) is a vector subspace ofW ,we need to show that span(V) is a closed set in the sense that any linear combination of the elements in span(V) is a member of span(V). This statement was proven in the previous section.

(d) Let us define the matrixA with vectors { v 1 , v 2 ,L, vm } as its columns:

A = [ v 1 v 2 L vm ]

Then the product of matrixA and any vector is ⎥

⎥ ⎥ ⎦

⎤

⎢

⎢ ⎢ ⎣

⎡

x m

x x M

1

∑

=

m i

Ax xi vi 1 Therefore the range(A) is the same as the span(V). As can be seen from above, A is a matrix. The rank of A is the maximum number of independent columns ofA. Therefore the rank ofA is the maximum number of independent vectors inV.

( n × m )

Exercise 2

(a) The inverse ofA is defined as a matrix A −^1 such that AA −^1 = A −^1 A = I. (I is the identity matrix defined as

I = ⎡⎣ δ i ij ⎤⎦ , such that δ ij = 1 for i = j and δ ij = 0 for i ≠ j.

(b) In order for both of the above equalities to hold, the matrix A has to be square.

(c) Let assumeB 1 andB 2 are both inverses forA, then B 1 (^) = B I 1 = B 1 (^) ( AB 2 (^) ) = ( B A B 1 ) 2 (^) = ( ) I B 2 = B 2

(d) LetA be represented as A = ⎡⎣ a (^) ij ⎤⎦, then the transpose of matrixA is defined

as AT = ⎡⎣ a (^) ji ⎤⎦. It can be seen that this is equivalent to defining AT such that

x T^ Ay = yTATx holds for column vectors x ∈ Rm and y ∈ Rn.

(e) DefineC = (AB)t^ = Dt^ andE = BtAt. We should show that C andE are the same. Let us introduce the following notation: for matrix A , represents theith

row and represents theith column. Now we have:

a i a^ i Cij = Dji = ajb^ i On the other hand we have:

Exercise 3

(a) LetA be represented as A = [ a 1 a 2 L an ]. For we have

⎥

⎥ ⎥

⎥

⎦

⎤

⎢

⎢ ⎢

⎢

⎣

⎡

x n

x

x x (^) M^2

1

( ) ( ) 1 1

2

1 xa xa Ax x

x

x A x A

n i

i i

n i

i i n

α α α α

α

α α = = = ⎥

⎥ ⎥

⎥

⎦

⎤

⎢

⎢ ⎢

⎢

⎣

⎡ = (^) ∑ ∑ M = =

x y a xa ya xa ya Ax Ay y

y

y

x

x

x Ax y A

n i

i i

n i

i i

n i

i i i i

n i

i i i n n

= + = + = + = + ⎟⎟

⎟ ⎟

⎟

⎠

⎞

⎜⎜

⎜ ⎜

⎜

⎝

⎛

⎥

⎥ ⎥

⎥

⎦

⎤

⎢

⎢ ⎢

⎢

⎣

⎡

⎥

⎥ ⎥

⎥

⎦

⎤

⎢

⎢ ⎢

⎢

⎣

⎡

  • = ∑ ∑ ∑ ∑ = 1 = 1 = 1 = 1

2

1 2

1 ( ) M M ( )

(b) H ( α x )= G ( F ( α x ))= G ( α F ( x ))= α G ( F ( x ))= α H ( x ) H ( x + y )= G ( F ( x + y ))= G ( F ( x )+ F ( y ))= G ( F ( x ))+ G ( F ( y ))= H ( x )+ H ( y ) Therefore,H is also a linear function.

(c) We need to show H ( F −^1 ( G −^1 ( x )))= x and F −^1 ( G −^1 ( Hy ))= y. For the first one: H F ( −^1 ( G −^1 ( ))) x = G F F ( ( −^1 ( G −^1 ( )))) x = G G ( −^1 ( )) x = x

=

For the second part: F −^1 ( G −^1 ( H y ( ))) = F −^1 ( G −^1 ( G F y ( ( )))) = F −^1 ( F y ( )) y which completes the proof. Note that for the proof, no linearity assumption was needed.

(Example ) A = B = 1 2 3 4 3 4 5 6

inv(AB) = inv(B)inv(A) = 9.0000 -4.0000 9.0000 -4. -7.2500 3.2500 -7.2500 3.

Exercise 4

(a) , , then we can easily show that ⎥

⎥ ⎥ ⎦

⎤

⎢

⎢ ⎢ ⎣

⎡

d n

d D L

M O M

L

0

1 0 ⎥

⎥ ⎥ ⎦

⎤

⎢

⎢ ⎢ ⎣

⎡

e n

e E L

M O M

L

0

1 0

ED e d

ed

d e

de DE nn n n

= ⎥

⎥ ⎥ ⎦

⎤

⎢

⎢ ⎢ ⎣

⎡

⎥

⎥ ⎥ ⎦

⎤

⎢

⎢ ⎢ ⎣

⎡

L

M O M

L

L

M O M

L

0

0

0

11 0 1 1

(Example ) A = B = 1 0 0 4 0 0 0 2 0 0 5 0 0 0 3 0 0 6 AB BA 4 0 0 4 0 0 0 10 0 0 10 0 0 0 18 0 0 18

⎥ ⎥ ⎥

⎥

⎦

⎤

⎢ ⎢ ⎢

⎢

⎣

⎡

a m

a A M

1 (b) , ⎥

⎥ ⎥ ⎦

⎤

⎢

⎢ ⎢ ⎣

⎡

d m

d D L

M O M

L

0

1 0 , then

⎥ ⎥ ⎥

⎥

⎦

⎤

⎢ ⎢ ⎢

⎢

⎣

⎡

⎥ ⎥ ⎥

⎥

⎦

⎤

⎢ ⎢ ⎢

⎢

⎣

⎡

× + × + + ×

× + × + + ×

m m m m

m

d a

da

a a d a

d a a a DA M L

M

L (^11)

1 2

1 1 2

0 0

0 0

which completes the proof. (Example ) A = B = 1 1 1 1 0 1 1 1 0 2

B*A 1 1 1 2 2 2

Exercise 6

For simplicity of the notation, we use the same matrices with same dimensions and pivots to explain proof and explain the concepts in the exercise.

⎟⎟

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎠

⎞

⎜⎜

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎝

⎛

× ×

× × × × × ×

× × × × × × ×

× × × × × × × × ×

=

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 *

0 0 0 0 0 0 0 *

0 0 0 *

0 0 *

E

⎟⎟

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎠

⎞

⎜⎜

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎝

⎛

×

× × × ×

× × × ×

× × × × ×

=

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 1

0 0 0 0 0 0 0 1 0

0 0 0 1 0 0

0 0 1 0 0 0

1 0 0 0 0

E

(a) Let’s form a linear combination of the non-zero rows in E and m:

i) Let (^) { a^ r 1^ , a r 2^ , L, a r k } be the nonzero rows in E for k ≤ m.

Let’s look at an equation. b a 1 1 (^) + b a 2 2 (^) + + b ak k = 0 r r r r L (*)

Each a^ r i^ has a pivot and each element below and above it in E is zero. a i This means that if p-th element of r is a pivot, then p-th elements of other rows are all zeros. Let p 1 be a pivot in a^ r 1. Then, b p 1 1 (^) + b 2 (^) ⋅ 0 + L + bk ⋅ 0 = 0 Because p 1 is 1, b 1 should be zero and the equation (*) is reduced to

b a 2 2 (^) + + b ak k = 0 r r r L (**) Let p 2 be a pivot in a^ r 2. Then, b p 2 2 (^) + b 3 (^) ⋅ 0 L + bk ⋅ 0 = 0

Because p 2 is 1, b 2 should be zero and the equation (**) is reduced to

b a 3 3 (^) + + b ak k = 0 r r r L

b ak k = 0 r r ak Finally, and because r is a nonzero vector, 0 bk =

∴ b a 1 1 (^) + b a 2 2 (^) + + b ak k = 0 ⇔ b 1 (^) = b 2 = = bk = 0 r r r^ r L L

Therefore, the nonzero rows of E are linearly independent. For the given example of E ,

( ) ( ) ( ) ( ) ( ) ( )

1 2 3 4 5

a a a a a

× × × × × +

× × × × +

× × × × +

× +

=

One can easily verify from the above equations that all the coefficients have to be zero, due to the columns with only one non-zero value (the pivot columns).

ii) Let (^) { c^ r 1^ , c r 2^ , L , c r k } be the pivot columns in E.

Then each c^ r i has only one element and all positions are different.

∴ b c 1 + b c 2 2 (^) + + b ck k = 0 ⇔ b 1 (^) = b 2 = = bk = 0 r r r^ r L L

Therefore, the pivot columns of E are linearly independent. For the given example of E ,

1 2 3 4 5

b b b b b

× ⎜^ ⎟^ + × ⎜^ ⎟^ + × ⎜^ ⎟^ + × ⎜^ ⎟^ + × ⎜^ ⎟^ =⎜^ ⎟

All the coefficients have to be zero. So they are linearly independent.

⎥

⎥ ⎥

⎥ ⎥

⎥ ⎥

⎥ ⎥

⎦

⎤

⎢

⎢ ⎢

⎢ ⎢

⎢ ⎢

⎢ ⎢

⎣

⎡

−

=

0 0 0 0 0 1

0 0 0 0 0 1 0

0 0 0 0 1 0 0

0 0 0 1 0 0 0

0 0 1 0 0 0 0

0 1 0 0 0 0 0

1 0 0 0 0 0 0

k 3

Q

which subtracts ( k 3 * the 3rd^ row) from the 7th^ row. You can verify that QR = I. This means the row replacement is invertible.

(d) The sequence of row replacements and interchanges can be viewed as the product of some invertible operations R = Rk PkRk − 1 Pk − 1 L R 1 P 1. Since all and are invertible, then the matrix is invertible as well. Let us consider a member of the row space of

P i Ri R E , call it u , then by definition u = yt^ E = yt ( RA )=( ytR ) A = xt A which means u belongs to the row space of A as well. Similarly, we can assume that u is in the row space of A , then using the fact that A = R −^1 E u = yt^ A = yt ( R −^1 E )=( ytR −^1 ) E = xt E which means u is in the row space of E , and it completes the proof.

(e) From part (d), the row space of the original matrix A is the same as the row space of row-echelon from of matrix A. From part (a), the non-zero rows of a matrix in row-echelon form are linearly independent.

(f) Let’s assume that E ' is another valid reduced row –echelon form of matrix A which has different pivot positions with E.

Let (^) { a^ r 1^ , a r 2^ , L, a r k } be the nonzero rows in E for k ≤ m and let z^ r i be a row of

E ' which has different pivot position. Let’s look at an equation b a 1 1 (^) + b a 2 2 (^) + + b ak k = zi r r (^) L r r a 1 (^) , a 2 , , au If the pivot position of is^ r^ r^ L r zi r (^) j and have pivot positions smaller

than j (i.e., more left than j ) for u ≤ k , then should be zeros because the pivot is the first nonzero element from the left. So the equation is reduced to

b b 1 , 2 , L, bu

bu (^) + 1 au (^) + 1 + bu (^) + 2 au (^) + 2 + + b ak k = zi r r (^) L r r

Then z^ r i^ has the first element (i.e., the pivot) at position j and each element of a^ r u^ + 1 , a r u^ + 2 , L, a r k at position j is zero because there does not exist same pivot

position as z^ r i^ in (^) { a r 1^ , a r 2^ , L, a r k }.

bu (^) + 1 au (^) + 1 + bu (^) + 2 au (^) + 2 + + b ak k r r (^) L r zi Thus we cannot make equal to^ r by any selection

of bu (^) + 1 , bu (^) + 2 , L , bk. This means that the rows of E cannot span the row space of

E '. I.e., The row spaces of E and E ' are different. Since this contradicts the part(d), the pivot position have to be same.

For the given example,

Lets assume that is another reduced valid

row-echelon form of matrix

E

⎛ ×^ ×^ ×^ ×^ × ⎞

⎜ × × × × ⎟

⎜ × × × × ⎟

′ = ⎜^ × × ⎟

A where the position of the 4th^ pivot is changed from column 8 to column 7. We will show that the range of E ' is different from the range of E. We will contradict the part(d) and show that E ' is not a valid rref( A ). We will try to write the 4th^ row of E ' as a linear combination of the rows in E :

( ) ( ) ( ) ( ) ( ) ( )

1 2 3 4 5

a a a a a

× × × × × +

× × × × +

× × × × +

× +

= × ×

You can verify that from the above set of equations we will have a 1 = a 2 = a 3 = a 5 = 0 For a 4 , no matter what we choose it, we cannot make the 6th^ column in the above equations to hold.

iii) Since the number of unmodified rows inA corresponding to non-zero rows in the row-echelon form ofA are the same, we only need to prove that the unmodified rows in A are linearly independent and that would complete the proof. Let E (^) p be a matrix which has only nonzero rows of E and Ap be a

matrix which has only rows in A corresponding to nonzero rows in E. Then we can find an invertible R p which has only rows and columns in

R corresponding to the index of nonzero rows in E. So E (^) p = R Ap p ⇔ Rp −^1 Ep = Ap.

Thus, ( y RT^ p −^1 ) E (^) p = 0 ⇔ y AT p = 0

Because the nonzero rows in E are linearly independent, y RT^ p −^1 = 0 ⇔ yT = 0.

I.e., the rows of A p are linearly independent.

Therefore, the rows in A corresponding to nonzero rows in E are also a basis for the row space of A.

(h) Because of interchanges or replacements of rows in A , the elements of basis for range( E ) can have new positions and lose positions in which the elements of basis for range( A ) are located. This makes the ranges of A and E different. (Example)

If , then and.

A

= ⎜^ ⎟

R

= ⎜^ ⎟

E

= ⎜^ ⎟

The basis of column space of A (i.e., basis of range( A )) is.

But the basis of column space of E (i.e., basis of range( E )) is.

Because all basis of range( E ) cannot be made by a linear combination of the basis of range( A ), the basis of range( A ) cannot span range( E ) and vice versa. This means range( E ) ≠ range( A ).

(i)

0 0 * 0 0 0 * 0 0 0 0 0 0 0 * 0 0 0 0 0 0 0 0 0 * 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

E

⎛ ×^ ×^ ×^ ×^ ×^ ×^ ×^ ×^ ×⎞

⎜ × × × × × × ×⎟

⎜ × × × × × ×⎟

= ⎜^ × ×⎟

From ,

we know that the 1^ st , 3rd , 4th , 8th and 10th columns are linearly independent.

If we make a new matrix E^ ˆ which contains the independent columns, then

0 * 0 0 * ˆ (^0 0 0) * , 0 0 0 0 * 0 0 0 0 0 0 0 0 0 0

E

⎛ ×^ ×^ ×^ ×⎞

⎜ × × ×⎟

⎜ × ×⎟

= ⎜^ ×⎟

RE ˆ = A^ ˆ where

A ˆ = (^) ( a 1 (^) a 3 (^) a 4 (^) a 8 (^) a 10 ) , ai : i-th column of A.

Because all columns of E ˆ are linearly independent,.

Eb b

= ⇔ = ⎜^ ⎟

(b) If rank( A ) = n , then the columns of A are linearly independent. Hence, no two linear combinations of the columns of A can be equal unless their corresponding coefficients are (pairwise) equal. I.e., any solution x to Ax = b will be unique, if it exists. More explicitly, suppose Ax = b and Ay = b , then A ( x − y )= b , and by linear independence of the columns of A , x − y = 0 ; Hence, x = y.

Exercise 8

(a) Definition: A “flop” is a “floating-point operation”, typically defined either as (i) one multiplication or addition, or as (ii) one multiplication and one addition: α ⋅ β+ γ. Both forms lead to the same qualitative conclusions. Here I use the latter form ( α ⋅ β+ γ is one flop, not two).

y = A Bx ( ) costs at most about 2 n^2 flops, but ( AB x ) costs up to about n^3^ + n^2

flops, assuming A and B are n × n. For the general case A ∈ R m^ × p , B ∈ R p n × , the orders are pn + pm and , respectively, giving the same conclusion: matrix- matrix multiplication is computationally expensive and should usually be avoided when cheaper alternatives are available.

pmn

(b) Assume A is square, A ∈ R^ n n × , (This assumption is not necessary but will usually be true for this kind of matrix.) The cost of followed by is about

flops ( to build

A = ( I + uvT ) y = Ax 2 n^2 n^2 A , and n^2 to multiply A by x. In contrast, y = x + ( v xT ) u

requires only about flops, for the inner product, and for the vector addition.

(Note: since is scalar,

2 n n n v xT x + (^) ( uvT (^) ) x = x + u v x ( T^ ) = x +( v x uT ) .)

Exercise 9

Well defined if and only if n 11 (^) = m 21 and n 12 (^) = m 22

Consider M (^) ij for, e.g., m 11 (^) < i < m 12 and j < n 11. (This is the (2,1) block of M .)

Recall that M (^) ij is the dot product of the i-th row of M (^) 1 with the j-th column of M 2.

Hence, if (^) ( ˆ(1)^11 ) T ci (^) − m denotes the i − m 11 th row of and similarly for (^) ( 11 , then

ˆ (1) T

C 1 di (^) − m )

( 11 ) (^) ( 11 )

(2) (1) (1) (2) ij ˆ^ i m T^ ,^ ˆ i m^ T j , j

a M c d − − c

⎛ ⎞⎛^ ⎞

Where a^ (2) j is the j-th column of A 2 , and similarly for c (2) j. This expression matches

the corresponding entry in C A 1 2 (^) + D C 1 2. The other cases for i and j are similar.

(Example)

n 11 (^) = m 21 = 3 , n 12 (^) = m 22 = 4 , m 11 (^) = 2 , m 12 (^) = 3 , n 21 (^) = 5 and n 22 (^) = 1.

A1 = B1 = 1 2 3 2 4 6 8 4 5 6 3 5 7 9 C1 = D1 = 9 8 7 5 6 7 8 6 5 4 8 9 1 2 3 2 1 2 3 4 5

M1 = 1 2 3 2 4 6 8 4 5 6 3 5 7 9 9 8 7 5 6 7 8 6 5 4 8 9 1 2 3 2 1 2 3 4 5

Exercise 10

By definition,

( ) 1

k AB (^) ij = (^) ∑ p = aip bpj

For each p ∈ { 1, K, k }, interpret aip as the i-th element of the p-th column of

A , and interpret bpj as j-th element of the p-th row (denoted by b ˆ Tp ) of B :

( ) (^) ( ) ( ) ( ) 1 1 1 1

k k (^) T k (^) T k ij ip^ pj^ p^ i p^ j p^ p^ ij q^ q p p p q (^) ij

AB a b a b a b a b = = = =

= = = = ⎜⎛^ ⎞

∑ ∑ ∑ ∑ ˆ T

Alternatively, since each product is conformable (well defined

dimensionally), the result follows by simple block matrix multiplication, where

the blocks

a bq^ ˆ Tq

Aq of A are the columns of A , and the blocks Bq of B :

( )

1 2 1 2 k 1 1 2 2 k ,

k

B

B

A A A A B A B A B k

B

= ⎜^ ⎟= + + +

L L

M

In this case, each Aq Bq happens to be an “outer product” , but the result

is true for any partitions of

a bk^ ˆ Tk

A and B such that each product Aq Bq is

conformable.

(Example) A = B = 1 2 3 1 2 3 4 5 4 5 6 6 7 8 9 0 11 12 13 14 15

AB A(:,1)B(1,:)+A(:,2)B(2,:)+A(:,3)B(3,:) 46 52 58 64 50 46 52 58 64 50 100 115 130 145 110 100 115 130 145 110

Exercise 11

If x and y are both solutions, then Ax = Ay , so Ax − Ay = A x ( − y ) =0. Thus, if

Ax = b , x − x 0 (^) ∈ null( A ) and therefore x − x 0 = Zw for some w ∈ R^ n^ − r , i.e., x = x 0 + Zw for some w ∈ R n^ − r. On the other hand, if x = x 0 + Zw , then Ax = Ax 0 (^) + AZw = Ax 0 = b.

Exercise 12

To show that an operation f ( ) x is linear in x , you have to prove that f ( ax ) = af ( ) x and f ( x + y ) = f ( ) x + f ( y ). But to show non-linearity, you have to only find one counter-example to one of these two properties.

(a) LINEAR : A weighted average has the form f ( ) x = (^) ∑ (^) iai xi with (^) ∑ i ai = 1.

(b) NON-LINEAR : Consider x = (2,1) and y = ( 2, 0).− (c) LINEAR : The “anti-diagonal” matrix for the operation is 1 if 1 ij 0 otherwise

i j n m

⎧ +^ =^ +

i.e., 0 0 0 1 0 0 1 0 0

M

= ⎜^ ⎟

L

L

M N

L

(d) NON-LINEAR : Consider x = (^) ( −1, − (^1) ) and y =(1,1 ).

Exercise 13

(a) range( A ). Since and ,. In Matlab, it can be verified that for this example, every set of 3 columns from

rank( A ) = 3 range( A ) ⊂ R^3 range( A ) = R^3 A (there are 10 such sets) is linearly independent and therefore a basis for range( A ) = R^3.